:root {
  --bg: #0f0f14;
  --bg-card: #1a1a24;
  --bg-hover: #22222f;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --text-muted: #8888a0;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-brand-link {
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  transition: opacity 0.2s;
}
.nav-brand-link:hover {
  opacity: 0.92;
}
.nav-brand-link:focus-visible {
  outline: 2px solid var(--primary, #6c8cff);
  outline-offset: 2px;
}

.logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem;
}

.version { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }

.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: var(--bg-hover);
}

.container { max-width: 1280px; margin: 0 auto; padding: 2rem; }

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.page-header p { color: var(--text-muted); }

.demo-banner {
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  font-size: 0.85rem;
  color: #a5b4fc;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; margin-bottom: 1.25rem; color: var(--text); }

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}
textarea { resize: vertical; min-height: 80px; }

.char-count { float: right; font-size: 0.75rem; }

.mode-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.mode-tab {
  padding: 0.5rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.mode-tab.active, .mode-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(99,102,241,0.1);
}
.mode-hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.upload-area:hover { border-color: var(--primary); }
.upload-hint { display: block; margin-top: 0.5rem; color: var(--success); font-size: 0.85rem; }

.btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; align-items: center; }

.progress-panel { min-height: 300px; }
.progress-panel.empty { display: flex; align-items: center; justify-content: center; }
.empty-state { text-align: center; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }

.progress-bar-wrap {
  background: var(--bg);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
  margin: 1rem 0;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a855f7);
  border-radius: 8px;
  transition: width 0.3s;
}
.progress-info { font-size: 0.85rem; color: var(--text-muted); }
.progress-stage { font-size: 1rem; font-weight: 600; margin-top: 0.5rem; }
.task-id-label { font-family: monospace; font-size: 0.8rem; color: var(--text-muted); margin-top: 1rem; }

.preview-panel { margin-top: 1rem; }
.preview-panel video { width: 100%; border-radius: 8px; margin-bottom: 1rem; object-fit: contain; }
.preview-panel img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.stat-value { display: block; font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }
.stat-card.processing .stat-value { color: var(--info); }
.stat-card.completed .stat-value { color: var(--success); }
.stat-card.queued .stat-value { color: var(--warning); }

.toolbar { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; }

.table-wrap { overflow-x: auto; }
.table-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.task-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.task-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.th-select,
.td-select {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}

.th-select input,
.td-select input {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--primary);
}

.th-actions {
  min-width: 280px;
}

.th-actions-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-clear-select {
  display: none;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}

.btn-clear-select.is-visible {
  display: inline-block;
}

.btn-batch-idle,
.btn:disabled.btn-primary,
#batch-download-btn:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  opacity: 1;
  cursor: not-allowed;
  pointer-events: none;
}

#batch-download-btn:disabled:hover,
.btn-batch-idle:hover {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.th-actions-head .btn-primary:not(:disabled) {
  cursor: pointer;
  pointer-events: auto;
}

.task-table td { padding: 0.75rem; border-bottom: 1px solid var(--border); }
.task-table tr:hover td { background: var(--bg-hover); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-queued { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-processing { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-completed { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-failed { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-cancelled { background: rgba(136,136,160,0.15); color: var(--text-muted); }

.mini-progress {
  width: 80px; height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}
.mini-progress-bar { height: 100%; background: var(--primary); }

.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; }
.pagination button {
  padding: 0.4rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.pagination button.active { background: var(--primary); border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center; justify-content: center;
}
.modal.open { display: flex; }
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%; max-width: 600px;
  max-height: 85vh; overflow-y: auto;
}
.modal-content.modal-wide { max-width: 820px; }
.detail-preview {
  margin-bottom: 1.25rem;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0a0f;
  border: 1px solid var(--border);
  padding: 0.75rem;
  text-align: center;
}
.detail-preview-media {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.detail-preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: min(480px, 62vh);
  overflow: hidden;
}
.detail-preview video {
  max-width: 100%;
  max-height: min(420px, 58vh);
  width: 100%;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
  background: #000;
  object-fit: contain;
}
.detail-preview img {
  max-width: 100%;
  max-height: min(480px, 62vh);
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
  background: #000;
  object-fit: contain;
}
.detail-preview-meta {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.detail-preview-meta-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}
.detail-preview-meta-row .label {
  width: 72px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.detail-preview-meta-row span:last-child {
  flex: 1;
  word-break: break-all;
}
.modal-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
}
.detail-info { margin: 0; }
.detail-preview-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: center;
}
.dashboard-tabs { margin-top: 1rem; }

.label-hint {
  font-size: 0.8rem;
  font-weight: normal;
  color: var(--text-muted);
  margin-left: 0.35rem;
}
.ref-image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 100px;
  transition: border-color 0.15s;
}
.ref-image-gallery.drag-over { border-color: var(--primary); background: rgba(99, 102, 241, 0.06); }
.ref-image-item {
  position: relative;
  width: 88px;
  height: 110px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.ref-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ref-image-badge {
  position: absolute;
  left: 4px;
  top: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.ref-image-remove {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.ref-image-add {
  width: 88px;
  height: 110px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.ref-image-add:hover { border-color: var(--primary); color: var(--primary); }
.ref-add-icon { font-size: 1.75rem; line-height: 1; }
.ref-add-text { font-size: 0.75rem; }
.ref-image-tip { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }
.ref-image-tip.warn { color: var(--warning); }
.prompt-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.prompt-label-row label { margin-bottom: 0; }
.btn-at-mention {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-at-mention:hover { border-color: var(--primary); color: var(--primary); }
.prompt-editor-wrap { position: relative; }
.at-mention-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
}
.at-mention-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}
.at-mention-item:hover { background: rgba(99, 102, 241, 0.12); }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.modal-body { padding: 1.5rem; }
.detail-row { display: flex; margin-bottom: 0.75rem; }
.detail-row dt { width: 100px; color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; }
.detail-row dd { flex: 1; font-size: 0.85rem; word-break: break-all; }

.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .settings-layout { grid-template-columns: 1fr; } }
.settings-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.settings-tab {
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
}
.settings-tab.active, .settings-tab:hover { background: var(--bg-card); color: var(--text); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-panel-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5; }
.settings-panel .field-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; line-height: 1.4; }
.settings-model-picker { position: relative; max-width: 420px; }
.settings-model-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
}
.settings-model-trigger:hover,
.settings-model-trigger.open { border-color: #6366f1; }
.settings-model-name { flex: 1; font-weight: 500; }
.settings-model-arrow { color: var(--text-muted); font-size: 0.75rem; }
.settings-model-menu {
  position: absolute;
  z-index: 200;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 320px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.settings-model-menu-header {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.settings-model-menu-body {
  max-height: 280px;
  overflow-y: auto;
  padding: 0.35rem;
}
.settings-model-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 0.85rem;
}
.settings-model-item:hover { background: var(--bg-elevated); }
.settings-model-item.active {
  background: rgba(99, 102, 241, 0.15);
  outline: 1px solid rgba(99, 102, 241, 0.35);
}
.settings-model-item.unavailable { opacity: 0.55; }
.settings-model-item-name { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.settings-model-item-desc {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.settings-model-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  white-space: nowrap;
}
.settings-model-check { color: #818cf8; font-size: 0.85rem; min-width: 1rem; text-align: center; }
.settings-model-empty { padding: 1rem; font-size: 0.85rem; color: var(--text-muted); text-align: center; }
.about-list dt { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.75rem; }
.about-list dd { font-size: 0.95rem; }
.storage-stats {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.save-msg { font-size: 0.85rem; color: var(--success); margin-left: 0.5rem; }

/* ── 模型选择器（参考主流 AI 平台交互） ── */
.model-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s;
}
.model-picker-trigger:hover { border-color: var(--primary); }

.model-picker-trigger-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem; flex-shrink: 0;
}

.model-picker-trigger-text { flex: 1; min-width: 0; }
.model-picker-trigger-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-picker-trigger-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-picker-trigger-arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.model-picker-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.model-picker-overlay.open { display: flex; }

.model-picker-panel {
  background: #2a2a32;
  border: 1px solid #3a3a48;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}

.model-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem 0.5rem;
}
.model-picker-title { font-size: 1rem; font-weight: 600; }
.model-picker-close {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}
.model-picker-close:hover { color: var(--text); }

.model-picker-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem 0.75rem;
}
.model-picker-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}
.model-picker-tab.active {
  background: #3a3a48;
  color: var(--text);
}
.model-picker-tab.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.model-picker-search {
  margin: 0 0.75rem 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  width: calc(100% - 1.5rem);
}

.model-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.75rem;
  min-height: 200px;
  max-height: 480px;
}

.model-picker-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border: 2px solid transparent;
}
.model-picker-item:hover { background: rgba(255,255,255,0.04); }
.model-picker-item.selected {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.4);
}
.model-picker-item.unavailable {
  opacity: 0.45;
  cursor: not-allowed;
}

.model-picker-item-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #3a3a48;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
  color: #c4b5fd;
}
.model-picker-item.featured .model-picker-item-icon {
  background: linear-gradient(135deg, rgba(236,72,153,0.25), rgba(99,102,241,0.25));
  color: #f472b6;
}

.model-picker-item-body { flex: 1; min-width: 0; }
.model-picker-item-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.model-picker-item.featured .model-picker-item-name { color: #f472b6; }
.model-picker-item-tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(34,197,94,0.2);
  color: #4ade80;
  font-weight: 500;
}
.model-picker-item-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.model-picker-item-lock {
  font-size: 0.7rem;
  color: var(--warning);
  margin-top: 0.2rem;
}

.model-picker-footer {
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid #3a3a48;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.model-picker-settings-link {
  color: #a5b4fc;
  text-decoration: none;
  font-size: 0.8rem;
}
.model-picker-settings-link:hover { text-decoration: underline; }

/* —— 模型管理页 —— */
.model-mgmt-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.model-mgmt-tabs[hidden] {
  display: none !important;
}
.model-mgmt-tab {
  padding: 0.45rem 1rem;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
}
.model-mgmt-tab:hover { color: var(--text); border-color: var(--accent, #6c8cff); }
.model-mgmt-tab.active {
  background: rgba(108, 140, 255, 0.15);
  border-color: var(--accent, #6c8cff);
  color: var(--text);
  font-weight: 600;
}
#gen-provider-tabs {
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}
.model-mgmt-subtab {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}
.model-mgmt-subtab:hover { color: var(--text); border-color: var(--accent, #6c8cff); }
.model-mgmt-subtab.active {
  background: rgba(108, 140, 255, 0.12);
  border-color: var(--accent, #6c8cff);
  color: var(--text);
}

.model-mgmt-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.model-mgmt-stats .stat-item { text-align: center; min-width: 72px; }
.model-mgmt-stats .stat-num {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}
.model-mgmt-stats .stat-label { font-size: 0.75rem; color: var(--text-muted); }

.model-mgmt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1rem;
}
.model-mgmt-search {
  flex: 1;
  min-width: 180px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.model-mgmt-toolbar select {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }

.model-mgmt-table-wrap { padding: 0; overflow-x: auto; }
.model-mgmt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.model-mgmt-table th,
.model-mgmt-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.model-mgmt-table th { color: var(--text-muted); font-weight: 500; background: rgba(0,0,0,0.15); }
.model-mgmt-table tr.row-disabled { opacity: 0.55; }
.model-mgmt-name { font-weight: 600; }
.model-mgmt-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }
.model-slug { font-size: 0.75rem; color: #a5b4fc; }
.empty-cell { text-align: center; padding: 2rem; color: var(--text-muted); }
.model-mgmt-actions { white-space: nowrap; }
.btn-link {
  background: none;
  border: none;
  color: #a5b4fc;
  cursor: pointer;
  padding: 0 0.35rem;
  font-size: 0.85rem;
}
.btn-link.danger { color: #f87171; }
.btn-link:hover { text-decoration: underline; }

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.model-mgmt-hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.model-edit-panel { max-width: 520px; width: 95%; }
.model-edit-form { padding: 0 1rem 1rem; }
.model-edit-form .field-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.mode-checkboxes { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; }
.mode-checkboxes label { font-size: 0.88rem; cursor: pointer; }

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.status-dot::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: 0.4rem;
}
.status-dot.online::before { background: var(--success); }
.status-dot.offline::before { background: var(--danger); }

.action-btns { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* ===== 统一创作页 ===== */
.create-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.create-hero {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.create-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.media-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(168,85,247,0.2));
  border: 1px solid rgba(99,102,241,0.45);
  color: #c4b5fd;
  padding: 0.15rem 0.65rem;
  border-radius: 8px;
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
  vertical-align: baseline;
}

.media-switch-arrow { font-size: 0.75em; opacity: 0.8; }

.media-switch-wrap {
  position: relative;
  display: inline-block;
  vertical-align: baseline;
}

.media-switch-menu {
  /* 实际坐标由 create.js positionMediaMenu 设置；此处仅作 fallback */
  min-width: 168px;
  z-index: 250;
}

.media-switch-wrap > .media-switch-menu.compose-dropdown {
  position: fixed;
  transform: translateX(-50%);
}

.compose-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1rem 1.25rem 0.85rem;
  box-shadow: var(--shadow);
}

.compose-inner {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.compose-ref-zone {
  flex-shrink: 0;
  max-width: 520px;
}

.compose-ref-zone:has(.compose-ref-row.is-expanded) {
  max-width: min(520px, 100%);
}

.compose-ref-zone.drag-over .compose-ref-add {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-hover);
}

.compose-ref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: visible;
}

.compose-ref-stack-wrap {
  position: relative;
  height: 96px;
  flex-shrink: 0;
  width: var(--stack-w-collapsed, 0);
  transition: width 0.28s ease;
  transition-delay: 0.05s;
  z-index: 1;
  overflow: visible;
}

.compose-ref-stack-wrap.has-items {
  width: var(--stack-w-collapsed);
}

.compose-ref-row.is-expanded .compose-ref-stack-wrap.has-items {
  width: var(--stack-w-expanded, var(--stack-w-collapsed)) !important;
  z-index: 30;
  transition-delay: 0s;
  max-width: min(var(--stack-w-expanded), 400px);
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
}

.compose-ref-stack {
  position: relative;
  height: 100%;
  min-width: var(--stack-w-expanded, 0);
}

.compose-ref-card {
  position: absolute;
  width: 68px;
  height: 88px;
  left: var(--cx, 0);
  top: var(--cy, 0);
  transform: rotate(var(--cr, 0deg));
  z-index: var(--zi, 1);
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  background: #1a1a24;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transform-origin: center bottom;
  transition:
    left 0.28s ease,
    top 0.28s ease,
    transform 0.28s ease,
    box-shadow 0.2s ease,
    z-index 0s;
  transition-delay: 0s;
}

.compose-ref-row:not(.is-expanded) .compose-ref-card {
  transition-delay: 0.08s;
}

.compose-ref-row.is-expanded .compose-ref-card {
  left: var(--ex, var(--cx));
  top: var(--ey, var(--cy));
  transform: rotate(var(--er, 0deg));
  z-index: calc(10 + var(--zi, 1));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.compose-ref-row.is-expanded .compose-ref-card:hover {
  z-index: 50;
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.35);
}

.compose-ref-row.can-expand:not(.is-expanded) .compose-ref-card:not(:last-child) {
  pointer-events: none;
}

.compose-ref-card img,
.compose-ref-video-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.compose-ref-video-bg {
  width: 100%;
  height: 100%;
  position: relative;
  background: linear-gradient(145deg, #1e293b, #0f172a);
}

.compose-ref-video-bg video {
  opacity: 0.85;
}

.compose-ref-video-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.compose-ref-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 0.62rem;
  background: rgba(0, 0, 0, 0.72);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  color: #fff;
  z-index: 2;
}

.compose-ref-duration {
  position: absolute;
  left: 4px;
  top: 4px;
  font-size: 0.62rem;
  background: rgba(0, 0, 0, 0.72);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  color: #fff;
  z-index: 2;
  font-variant-numeric: tabular-nums;
}

.compose-ref-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.compose-ref-row.is-expanded .compose-ref-remove,
.compose-ref-card:hover .compose-ref-remove {
  opacity: 1;
}

.compose-ref-overflow {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  z-index: 2;
}

.compose-ref-add {
  width: 52px;
  height: 88px;
  flex-shrink: 0;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s;
}

.compose-ref-add:hover {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.1);
  color: #c4b5fd;
  transform: translateY(-1px);
}

.compose-ref-add-plus {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 300;
}

.compose-ref-add-text {
  font-size: 0.62rem;
  line-height: 1.3;
  text-align: center;
  max-width: 2.5em;
}

.compose-ref-tip {
  font-size: 0.68rem;
  margin-top: 0.4rem;
  color: var(--text-muted);
  line-height: 1.35;
  max-width: 160px;
}

.compose-ref-tip.warn {
  color: var(--warning);
}

.compose-editor {
  flex: 1;
  min-width: 0;
  position: relative;
  cursor: text;
}

.compose-input-cursor {
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 2px;
  height: 1.15em;
  border-radius: 1px;
  background: #38e8ff;
  box-shadow: 0 0 8px rgba(56, 232, 255, 0.75);
  pointer-events: none;
  z-index: 1;
}

.compose-editor:not(.is-focused):not(.has-text) .compose-input-cursor {
  animation: compose-cursor-blink 1.05s step-end infinite;
}

.compose-editor.is-focused .compose-input-cursor,
.compose-editor.has-text .compose-input-cursor {
  display: none;
}

@keyframes compose-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.compose-prompt {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1rem;
  resize: none;
  outline: none;
  line-height: 1.5;
  min-height: 72px;
  padding-left: 12px;
}

.compose-prompt::placeholder { color: var(--text-muted); }

.compose-video-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.video-upload-hint { font-size: 0.8rem; color: var(--text-muted); }

.compose-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  position: relative;
}

.toolbar-pill {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.toolbar-pill.compose-llm.is-unavailable {
  opacity: 0.65;
  border-color: rgba(245, 158, 11, 0.45);
}

.toolbar-pill.compose-llm .llm-label {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-pill.compose-cost-estimate {
  cursor: default;
  color: #a8d4a0;
  border-color: rgba(168, 212, 160, 0.35);
  background: rgba(168, 212, 160, 0.08);
  font-variant-numeric: tabular-nums;
}
.toolbar-pill.compose-cost-estimate::after {
  content: none;
}
.toolbar-pill.compose-cost-estimate.cost-free {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--bg-hover);
}

.toolbar-pill::after {
  content: '▾';
  font-size: 0.65rem;
  opacity: 0.55;
  margin-left: 0.1rem;
}

.toolbar-pill.btn-at-mention::after,
.compose-submit::after,
.compose-video-add::after {
  content: none;
}

.toolbar-pill:hover,
.toolbar-pill.pill-open {
  background: #2a2a3a;
  border-color: rgba(99, 102, 241, 0.35);
}

.toolbar-pill.pill-open {
  color: #c4b5fd;
}

.compose-submit {
  margin-left: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
}

.compose-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.compose-dropdown {
  position: fixed;
  background: #23232e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 6px;
  min-width: 128px;
  z-index: 200;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}

.compose-dropdown[hidden] { display: none !important; }

.compose-dropdown-dropup {
  z-index: 350;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}

.compose-bar-dock .toolbar-pill.pill-open::after {
  content: '▴';
}

.compose-dropdown-header {
  padding: 0.55rem 0.75rem 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin: -2px -2px 4px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #23232e;
}

.compose-dropdown-body {
  flex: 0 0 auto;
  min-height: 0;
}

.compose-dropdown-simple {
  padding: 6px;
}

.compose-dropdown-model {
  width: 320px;
  padding: 0;
}

.compose-dropdown-model .compose-dropdown-body {
  padding: 4px 6px 6px;
}

.compose-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.compose-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.compose-dropdown-item.active {
  background: rgba(99, 102, 241, 0.12);
}

.dropdown-item-label {
  flex: 1;
  min-width: 0;
}

.dropdown-item-check {
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  color: #fff;
  font-size: 0.8rem;
  opacity: 0;
}

.compose-dropdown-item.active .dropdown-item-check {
  opacity: 1;
}

.model-dropdown-item {
  align-items: flex-start;
  padding: 0.65rem 0.7rem;
}

.model-dropdown-item.unavailable {
  opacity: 0.45;
}

.model-dropdown-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.model-dropdown-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.model-dropdown-name {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
}

.model-dropdown-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dropdown-empty {
  padding: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.toolbar-pill.compose-style::after {
  content: ' ▾';
}

.compose-dropdown-footer {
  padding: 0.45rem 0.65rem 0.35rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.4;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 4px;
  flex-shrink: 0;
}

.media-switch.pill-open {
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.media-switch.media-switch-smart {
  background: linear-gradient(135deg, rgba(45,212,191,0.22), rgba(99,102,241,0.18));
  border-color: rgba(45,212,191,0.55);
  color: #5eead4;
}

.compose-smart-mode .compose-manual-only,
.compose-smart-mode .btn-at-mention {
  display: none !important;
}

.compose-smart-mode .compose-toolbar {
  justify-content: flex-end;
  gap: 0.5rem;
}

.compose-smart-mode .compose-toolbar .compose-optimize-btn {
  margin-right: auto;
}

.compose-smart-prefs::after,
.compose-optimize::after,
.compose-submit::after {
  content: none;
}

.compose-smart-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(12px);
  z-index: 400;
  max-width: min(92vw, 520px);
  padding: 0.65rem 1.1rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(45, 212, 191, 0.35);
  color: #e2e8f0;
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.compose-smart-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.compose-smart-hint {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0.85rem 0;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(51, 65, 85, 0.6);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.compose-smart-hint--ready {
  color: #5eead4;
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.08);
}

.compose-submit.is-plan-ready {
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.45), 0 0 18px rgba(45, 212, 191, 0.25);
}

.compose-submit.is-plan-ready:not(:disabled):hover {
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.6), 0 0 22px rgba(45, 212, 191, 0.35);
}

.compose-smart-prefs {
  gap: 0.2rem;
  border-color: rgba(45, 212, 191, 0.45);
  color: #5eead4;
}

.compose-smart-prefs-arrow {
  font-size: 0.72em;
  opacity: 0.85;
}

.compose-smart-prefs-panel {
  position: fixed;
  z-index: 300;
  width: min(92vw, 380px);
  padding: 0.85rem 1rem 1rem;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  display: none;
}

.compose-smart-prefs-panel.is-open {
  display: block;
}

.smart-prefs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.smart-prefs-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.smart-prefs-auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  user-select: none;
}

.smart-prefs-auto-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.smart-prefs-switch {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  transition: background 0.2s;
}

.smart-prefs-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.smart-prefs-auto-toggle input:checked + .smart-prefs-switch {
  background: rgba(45, 212, 191, 0.55);
  border-color: rgba(45, 212, 191, 0.65);
}

.smart-prefs-auto-toggle input:checked + .smart-prefs-switch::after {
  transform: translateX(16px);
}

.smart-prefs-section {
  margin-bottom: 0.85rem;
}

.smart-prefs-section-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.smart-prefs-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.smart-prefs-seg-btn {
  padding: 0.45rem 0.35rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.smart-prefs-seg-btn.active {
  border-color: rgba(45, 212, 191, 0.55);
  color: #5eead4;
  background: rgba(45, 212, 191, 0.1);
}

.smart-prefs-aspect-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.smart-prefs-aspect-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 52px;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.smart-prefs-aspect-btn.active {
  border-color: rgba(45, 212, 191, 0.45);
  color: #5eead4;
  background: rgba(45, 212, 191, 0.08);
}

.smart-prefs-aspect-icon {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.85;
}

.smart-prefs-aspect-tall { transform: scaleX(0.72); }
.smart-prefs-aspect-square { font-size: 0.95rem; }
.smart-prefs-aspect-smart { color: #5eead4; }

.smart-prefs-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  align-items: end;
}

.smart-prefs-select {
  width: 100%;
  padding: 0.42rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text);
  font-size: 0.82rem;
}

.smart-prefs-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 34px;
}

.smart-prefs-check-field {
  display: flex;
  align-items: flex-end;
}

.recent-section { margin-top: 3rem; }

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.recent-header h2 { font-size: 1.1rem; }

.recent-more {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.recent-more:hover { color: var(--primary-hover); }

.recent-cards {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.recent-card {
  flex: 0 0 180px;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.recent-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99,102,241,0.4);
}

.recent-card-thumb {
  aspect-ratio: 1;
  background: var(--bg-hover);
  position: relative;
  overflow: hidden;
}

.recent-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-card-thumb.generating img { filter: blur(8px); opacity: 0.6; }

.recent-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 2rem;
}

.recent-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.65);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
}

.recent-card-body { padding: 0.65rem 0.75rem; }

.recent-card-title {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-card-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.recent-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== 生成过程页 Studio ===== */
.studio-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 60px);
}

.studio-sidebar {
  grid-column: 1;
  grid-row: 1;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-back {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.sidebar-back:hover { color: var(--primary-hover); }

.sidebar-title { font-weight: 600; }

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.sidebar-item {
  display: flex;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 0.65rem;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 0.25rem;
}

.sidebar-item:hover { background: var(--bg-hover); }
.sidebar-item.active { background: rgba(99,102,241,0.15); }

.sidebar-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-hover);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-item-icon img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-item-text { min-width: 0; }

.sidebar-item-title {
  display: block;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sidebar-empty { padding: 1rem; color: var(--text-muted); font-size: 0.85rem; }

.studio-main {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 1.5rem 2rem;
  /* 为固定输入框预留空间：距底 42px + 展开态最大高度 */
  padding-bottom: calc(42px + 300px);
}

.studio-thread {
  overflow: visible;
  padding-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.studio-message-footer {
  margin-top: 0.35rem;
}

.studio-message-footer .studio-message-prompt {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.studio-message-footer .studio-message-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.studio-dock {
  position: fixed;
  bottom: 42px;
  left: 260px;
  right: 0;
  z-index: 30;
  background: none;
  pointer-events: none;
  padding: 0 2rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: auto;
  min-height: 0;
  max-height: none;
}

.studio-dock .compose-bar {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  pointer-events: auto;
}

.studio-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.studio-head-info {
  max-width: 720px;
  width: 100%;
}

.studio-head-info .studio-message-prompt {
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.studio-head-info .studio-message-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.studio-date { color: var(--text-muted); font-size: 0.9rem; }

.studio-message {
  max-width: 720px;
  margin: 0;
}

.studio-preview-interactive {
  position: relative;
}

.studio-preview-hit {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 16px;
  overflow: hidden;
}

.studio-preview-hit .studio-output {
  pointer-events: none;
}

.studio-preview-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease, background 0.18s ease;
}

.studio-preview-interactive:hover .studio-preview-btn,
.studio-preview-btn:focus-visible {
  opacity: 1;
}

.studio-preview-btn:hover {
  background: rgba(99, 102, 241, 0.75);
  border-color: rgba(255, 255, 255, 0.28);
}

.studio-preview-btn-icon {
  font-size: 1rem;
  line-height: 1;
}

.studio-preview-modal-content {
  max-width: min(960px, 94vw);
}

.studio-preview-modal-body {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.studio-preview-full {
  max-width: 100%;
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  display: block;
  border-radius: 12px;
  object-fit: contain;
}

video.studio-preview-full {
  width: 100%;
  background: #0a0a0f;
}

.studio-message-media {
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: flex-start;
}

.studio-message-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.studio-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.studio-action-btn:hover {
  background: #2a2a3a;
  border-color: rgba(99, 102, 241, 0.35);
}

.studio-action-primary {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.45);
  color: #c4b5fd;
}

.studio-action-icon {
  font-size: 0.9rem;
  opacity: 0.85;
}

.studio-preview-wrap {
  width: 100%;
  max-width: 280px;
  aspect-ratio: var(--studio-ar, 1);
  max-height: min(420px, 42vh);
}

.studio-preview-wrap.studio-ar-landscape {
  max-width: min(360px, 88%);
  max-height: min(220px, 32vh);
}

.studio-preview-wrap.studio-ar-portrait {
  max-width: min(220px, 62%);
  max-height: min(420px, 48vh);
}

.studio-preview-wrap.studio-ar-square {
  max-width: min(260px, 72%);
  max-height: min(260px, 38vh);
}

.studio-output {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  object-fit: contain;
}

img.studio-output,
video.studio-output {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
}

.studio-output-pending {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.studio-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, var(--bg-hover) 25%, #2a2a3a 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.studio-progress-badge {
  position: relative;
  z-index: 1;
  background: rgba(0,0,0,0.55);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.studio-output-error {
  padding: 1.25rem;
  color: var(--warning);
  border: 1px dashed var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.studio-error-wrap {
  max-width: min(520px, 92%);
  aspect-ratio: auto;
  max-height: none;
  height: auto;
}

.studio-error-wrap .studio-output-error {
  max-width: none;
}

.studio-error-panel {
  text-align: center;
  padding: 0.25rem 0.5rem;
}

.studio-error-title {
  color: #fbbf24;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  line-height: 1.4;
}

.studio-error-tip {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0;
}

.studio-error-detail {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  font-size: 0.78rem;
  line-height: 1.5;
  word-break: break-word;
  text-align: left;
}

.studio-loading { color: var(--text-muted); text-align: center; padding: 3rem; }

/* —— Studio 底部 Dock：预留固定槽位，输入栏自身收起/展开缩放 —— */
.compose-bar-dock {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.28s ease,
    box-shadow 0.28s ease;
}

.compose-bar-dock:not(.is-expanded) {
  height: 60px;
  max-height: 60px;
  padding: 0 1rem;
  border-radius: 28px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  justify-content: center;
}

.compose-bar-dock.is-expanded {
  height: auto;
  max-height: 280px;
  padding: 0.85rem 1rem 0.75rem;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  justify-content: stretch;
}

.compose-bar-dock .compose-dock-body {
  flex: 1;
  min-height: 0;
  transition: opacity 0.22s ease;
}

.compose-bar-dock:not(.is-expanded) .compose-dock-body {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  opacity: 1;
}

.compose-bar-dock.is-expanded .compose-dock-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 1;
}

.compose-bar-dock:not(.is-expanded) .compose-inner {
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
}

.compose-bar-dock.is-expanded .compose-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: flex-start;
}

.compose-bar-dock:not(.is-expanded) .compose-ref-zone {
  max-width: none;
}

.compose-bar-dock:not(.is-expanded) .compose-ref-row {
  gap: 6px;
}

.compose-bar-dock:not(.is-expanded) .compose-ref-stack-wrap {
  height: 44px;
}

.compose-bar-dock:not(.is-expanded) .compose-ref-stack-wrap.has-items {
  width: var(--stack-w-collapsed) !important;
}

.compose-bar-dock:not(.is-expanded) .compose-ref-card {
  width: 36px;
  height: 44px;
  border-width: 1.5px;
}

.compose-bar-dock:not(.is-expanded) .compose-ref-add {
  width: 36px;
  height: 44px;
  border-radius: 10px;
}

.compose-bar-dock:not(.is-expanded) .compose-ref-add-text,
.compose-bar-dock:not(.is-expanded) .compose-ref-tip {
  display: none !important;
}

.compose-bar-dock:not(.is-expanded) .compose-ref-add-plus {
  font-size: 1.1rem;
}

.compose-bar-dock:not(.is-expanded) .compose-editor {
  min-width: 0;
}

.compose-bar-dock:not(.is-expanded) .compose-prompt {
  min-height: 28px;
  height: 28px;
  max-height: 28px;
  line-height: 28px;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  white-space: nowrap;
  resize: none;
  cursor: text;
}

.compose-bar-dock:not(.is-expanded) .compose-input-cursor {
  display: none;
}

.compose-bar-dock:not(.is-expanded) .compose-toolbar {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border-top: none;
  gap: 0;
}

.compose-bar-dock:not(.is-expanded) .compose-toolbar > :not(.compose-submit) {
  display: none !important;
}

.compose-bar-dock:not(.is-expanded) .compose-submit {
  margin-left: 0;
  width: 36px;
  height: 36px;
  font-size: 1.05rem;
}

.compose-bar-dock.is-expanded .compose-prompt {
  /* 3 行完整可见（含 textarea 内边距余量） */
  min-height: calc(1.5em * 3 + 4px);
  height: calc(1.5em * 3 + 4px);
  max-height: calc(1.5em * 3 + 4px);
  white-space: pre-wrap;
  overflow-y: hidden;
  resize: none;
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}

.compose-bar-dock.is-expanded .compose-prompt.compose-prompt-scrollable {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(160, 160, 176, 0.55) transparent;
}

.compose-bar-dock.is-expanded .compose-prompt.compose-prompt-scrollable::-webkit-scrollbar {
  width: 4px;
}

.compose-bar-dock.is-expanded .compose-prompt.compose-prompt-scrollable::-webkit-scrollbar-track {
  background: transparent;
}

.compose-bar-dock.is-expanded .compose-prompt.compose-prompt-scrollable::-webkit-scrollbar-thumb {
  background: rgba(160, 160, 176, 0.45);
  border-radius: 4px;
}

.compose-bar-dock.is-expanded .compose-prompt.compose-prompt-scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(180, 180, 196, 0.65);
}

.compose-bar-dock .compose-prompt {
  transition: min-height 0.28s ease, max-height 0.28s ease;
}

.compose-bar-dock.is-expanded .compose-ref-stack-wrap {
  height: 96px;
}

.compose-bar-dock.is-expanded .compose-ref-card {
  width: 68px;
  height: 88px;
  border-width: 2px;
}

.compose-bar-dock.is-expanded .compose-ref-add {
  width: 44px;
  height: 96px;
}

.compose-bar-dock.is-expanded .compose-ref-add-text {
  display: block;
  font-size: 0.58rem;
}

.compose-bar-dock.is-expanded .compose-ref-tip {
  display: block;
  font-size: 0.62rem;
  margin-top: 0.25rem;
}

.compose-bar-dock.is-expanded .compose-toolbar {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  flex: 0 0 auto;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  position: relative;
  z-index: 1;
}

.compose-bar-dock.is-expanded .compose-ref-row {
  gap: 10px;
}

.compose-bar-dock.is-expanded .compose-submit {
  width: 40px;
  height: 40px;
}

@media (max-width: 900px) {
  .studio-layout { grid-template-columns: 1fr; }
  .studio-sidebar { display: none; }
  .studio-main { grid-column: 1; }
  .studio-dock { left: 0; padding: 0 1rem; }
  .create-inner { flex-direction: column; }
}

/* ── Agent Pills (创作页) ── */
.agent-pills {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1.25rem auto 0;
  max-width: 720px;
}

.agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  transition: background 0.2s, border-color 0.2s;
}

.agent-pill:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
}

.agent-pill-muted { opacity: 0.85; }

.agent-pill-icon { font-size: 1rem; line-height: 1; }

/* ── UGC 仓库（左右布局） ── */
.ugc-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.ugc-header-stats {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding-bottom: 0.25rem;
}

.ugc-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: stretch;
  height: calc(100vh - 168px);
  min-height: 420px;
}

/* hidden 会被 display:grid 覆盖，必须显式隐藏面板 */
#ugc-materials-panel[hidden],
#ugc-products-panel[hidden] {
  display: none !important;
}

.ugc-products-panel {
  display: block;
  height: calc(100vh - 168px);
  min-height: 420px;
}

.ugc-products-panel .ugc-grid-scroll {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}

.product-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.product-create-tile {
  border: 2px dashed rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.06);
  cursor: pointer;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  transition: border-color 0.15s, background 0.15s;
}

.product-create-tile:hover {
  border-color: rgba(245, 158, 11, 0.75);
  background: rgba(245, 158, 11, 0.12);
}

.product-create-tile-inner {
  text-align: center;
  color: var(--text-muted);
}

.product-create-tile-icon {
  display: block;
  font-size: 2rem;
  color: #fbbf24;
  margin-bottom: 0.35rem;
}

.ugc-sidebar {
  padding: 0;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ugc-sidebar-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.ugc-sidebar-head h2 {
  font-size: 0.95rem;
  margin: 0;
}

.ugc-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.ugc-tree-node {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem 0.35rem 0;
  border-radius: 8px;
  margin: 0 0.35rem;
}

.ugc-tree-node:hover { background: var(--bg-hover); }

.ugc-tree-node.active {
  background: rgba(139, 92, 246, 0.15);
  box-shadow: inset 2px 0 0 var(--primary);
}

.ugc-tree-toggle {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.ugc-tree-toggle.collapsed { transform: rotate(-90deg); }

.ugc-tree-spacer { width: 22px; flex-shrink: 0; }

.ugc-tree-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  padding: 0.2rem 0;
  font-size: 0.85rem;
  min-width: 0;
}

.ugc-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ugc-tree-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.ugc-tree-count-rollup {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
}

.ugc-tree-actions {
  display: none;
  gap: 0.1rem;
  flex-shrink: 0;
}

.ugc-tree-node:hover .ugc-tree-actions { display: flex; }

.ugc-icon-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1;
}

.ugc-icon-btn:hover { background: rgba(139, 92, 246, 0.25); color: #fff; }

.ugc-icon-danger:hover { background: rgba(239, 68, 68, 0.3); }

.ugc-main {
  padding: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ugc-main-head {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  z-index: 1;
}

.ugc-main-title h2 {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
}

.ugc-panel-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.ugc-main-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.ugc-main-toolbar .search-input { min-width: 180px; max-width: 240px; }

.ugc-upload-status {
  font-size: 0.8rem;
  color: var(--primary-hover);
  white-space: nowrap;
}

.ugc-grid-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
}

.ugc-grid-scroll.is-uploading {
  opacity: 0.7;
  pointer-events: none;
}

.ugc-grid-placeholder {
  grid-column: 1 / -1;
}

.ugc-container-hint {
  grid-column: 1 / -1;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.06);
  margin-bottom: 0.25rem;
}

.ugc-container-hint p {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

.ugc-container-hint-sub {
  color: var(--text-muted);
  font-size: 0.82rem !important;
}

.ugc-container-hint .btn {
  margin-top: 0.35rem;
}

.ugc-upload-tile {
  border: 1.5px dashed rgba(139, 92, 246, 0.35);
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.04);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  min-height: 0;
}

.ugc-upload-tile:hover {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.08);
}

.ugc-upload-tile.is-dragover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.14);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.ugc-upload-tile.is-uploading {
  opacity: 0.55;
  pointer-events: none;
}

.ugc-upload-tile-inner {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem;
  text-align: center;
}

.ugc-upload-tile-icon {
  font-size: 1.75rem;
  line-height: 1;
  color: var(--primary-hover);
  font-weight: 300;
}

.ugc-upload-tile-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e8e8f0;
}

.ugc-upload-tile-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.ugc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}

.ugc-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.ugc-card:hover { border-color: rgba(139, 92, 246, 0.35); }

.ugc-card-thumb {
  position: relative;
  aspect-ratio: 1;
  background: #0a0a12;
  cursor: pointer;
}

.ugc-card-thumb img,
.ugc-card-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ugc-card-type {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 0.65rem;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.ugc-card-body { padding: 0.55rem 0.6rem 0.65rem; }

.ugc-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.ugc-card-actions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.ugc-card-actions .btn-sm { padding: 0.2rem 0.45rem; font-size: 0.72rem; }

.ugc-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.ugc-detail-media {
  border-radius: 10px;
  overflow: hidden;
  background: #0a0a12;
  max-height: 420px;
}

.ugc-detail-media img,
.ugc-detail-media video {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

@media (max-width: 900px) {
  .ugc-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .ugc-sidebar { max-height: 240px; height: auto; }
  .ugc-main { height: calc(100vh - 320px); min-height: 360px; }
  .ugc-detail { grid-template-columns: 1fr; }
}

/* legacy ugc-toolbar removed */
.ugc-toolbar { display: none; }

/* ── Agent 工作台 ── */
.agent-page { max-width: 1280px; margin: 0 auto; }

.agent-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.agent-back {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.agent-back:hover { color: var(--primary-hover); }

.agent-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.35rem; }

.agent-workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: start;
}

.agent-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.agent-panel h3 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.agent-asset-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.agent-asset-tabs button {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.agent-asset-tabs button.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
  color: #e8e8f0;
}

.agent-asset-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 0.65rem;
}

.agent-asset-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.agent-asset-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}

.agent-asset-item.picked {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.agent-pick-mark {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--primary);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-asset-hint { font-size: 0.75rem; color: var(--text-muted); }

.agent-selected { font-size: 0.8rem; margin-top: 0.5rem; color: var(--text-muted); }

.agent-panel-main { display: flex; flex-direction: column; gap: 1rem; }

.agent-config-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.agent-config-row label { font-size: 0.82rem; color: var(--text-muted); }

.agent-num { max-width: 120px; }

.agent-config-check label { font-size: 0.82rem; cursor: pointer; }

.agent-config-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; }

.agent-plan-summary { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 0.75rem; }

.plan-summary-stale {
  color: #fbbf24 !important;
  font-weight: 500;
}

.agent-plan-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.agent-plan-item summary { cursor: pointer; font-weight: 600; }

.agent-plan-item p { margin: 0.45rem 0 0; color: var(--text-muted); line-height: 1.45; }

.agent-camp-progress { margin: 0.5rem 0; }

.agent-pipeline-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.agent-pipeline-item.failed { border-color: rgba(239, 68, 68, 0.4); }

.agent-pipeline-steps { color: var(--text-muted); margin: 0.35rem 0; }

.agent-pipeline-steps .completed { color: var(--success); }

.agent-pipeline-steps .failed { color: var(--danger); }

.agent-pipeline-link { font-size: 0.8rem; color: var(--primary-hover); }

.agent-pipeline-err { color: var(--danger); font-size: 0.78rem; margin-top: 0.35rem; }

.agent-empty { color: var(--text-muted); font-size: 0.85rem; }

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.form-row label { font-size: 0.85rem; color: var(--text-muted); }

@media (max-width: 900px) {
  .agent-workspace { grid-template-columns: 1fr; }
}

/* ── UGC 模式切换 ── */
.ugc-mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ugc-mode-tab {
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
}

.ugc-mode-tab.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde68a;
}

.ugc-products-panel .ugc-products-main { width: 100%; }

.product-import-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.product-file-label { cursor: pointer; margin: 0; }

.product-image-count {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.product-edit-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 0.75rem;
  min-height: 120px;
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
}

.product-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.product-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.product-gallery-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 2rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.product-gallery-empty-icon { font-size: 1.75rem; opacity: 0.5; }
.product-gallery-empty p { margin: 0; font-size: 0.9rem; color: var(--text); }
.product-gallery-empty span { font-size: 0.78rem; }

.product-media-card {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.product-media-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.product-media-card.is-cover {
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.product-media-card.is-pending {
  opacity: 0.88;
  border-style: dashed;
}

.product-media-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.25);
  cursor: zoom-in;
  overflow: hidden;
}

.product-media-thumb.is-pending-thumb { cursor: default; }

.product-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.product-media-thumb:hover img { transform: scale(1.04); }

.product-media-zoom {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.product-media-thumb:hover .product-media-zoom { opacity: 1; }

.product-media-tag {
  position: absolute;
  font-size: 0.62rem;
  line-height: 1.2;
  padding: 0.12rem 0.38rem;
  border-radius: 4px;
  font-weight: 600;
  pointer-events: none;
}

.product-media-tag.tag-type {
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}

.product-media-tag.tag-cover {
  top: 6px;
  right: 6px;
  background: rgba(245, 158, 11, 0.92);
  color: #111;
}

.product-media-tag.tag-pending {
  top: 6px;
  right: 6px;
  background: rgba(99, 102, 241, 0.85);
  color: #fff;
}

.product-media-footer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.45rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.product-media-type {
  flex: 1;
  min-width: 0;
  padding: 0.22rem 0.35rem;
  font-size: 0.72rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.product-media-tools {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.product-media-tool {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.product-media-tool:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.product-media-tool.is-active {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.45);
  cursor: default;
}

.product-media-tool-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
}

.product-preview-modal .product-preview-content {
  max-width: min(920px, 92vw);
}

.product-preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: min(78vh, 720px);
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 0 0 10px 10px;
}

.product-preview-body img {
  max-width: 100%;
  max-height: min(76vh, 700px);
  object-fit: contain;
  border-radius: 6px;
}

.product-readiness {
  margin: 0.65rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.product-readiness-tip {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
  line-height: 1.4;
}

#product-ref-tip[hidden] { display: none !important; }

.product-no-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  font-size: 0.85rem;
  font-weight: 600;
}

.agent-no-cover { aspect-ratio: 1; border-radius: 6px; }

.product-parse-note {
  font-size: 0.82rem;
  color: #fbbf24;
  margin: 0;
}

.product-card-thumb { cursor: default; }

/* ── Agent 画布工作区（版心与 UGC 仓库一致：1280px container） ── */
.agent-canvas-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.agent-canvas-header {
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.agent-canvas-header.page-header {
  margin-bottom: 0.75rem;
}

.agent-canvas-title-block {
  min-width: 0;
}

.agent-canvas-page h1 {
  font-size: 1.75rem;
  margin: 0 0 0.25rem;
  line-height: 1.25;
}

.agent-canvas-page .agent-subtitle {
  font-size: 0.9rem;
  margin: 0;
  color: var(--text-muted);
}

.agent-canvas-page .agent-back {
  display: inline-block;
  font-size: 0.85rem;
  white-space: nowrap;
  margin-bottom: 0.35rem;
}

.agent-workspace-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: auto 1fr;
  gap: 1rem;
  align-items: stretch;
  width: 100%;
  height: calc(100vh - 168px);
  min-height: 420px;
}

.agent-layout-full {
  grid-column: 1 / -1;
  width: 100%;
  box-sizing: border-box;
}

.agent-category-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.65rem 0.45rem;
  min-height: 0;
  height: 100%;
  z-index: 20;
}

.agent-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  padding: 0 0.15rem;
}

.agent-category-head strong {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.agent-category-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -0.2rem;
  padding: 0 0.1rem;
}

.agent-category-tree .ugc-tree-node {
  padding-right: 0;
}

.agent-category-tree .ugc-tree-label {
  padding: 0.35rem 0.25rem;
  min-width: 0;
}

.agent-category-tree .ugc-tree-name {
  font-size: 0.76rem;
}

.agent-category-tree .ugc-tree-count {
  font-size: 0.62rem;
  min-width: 1rem;
}

.agent-product-rail-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.48rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.agent-product-rail-btn:hover,
.agent-product-rail-btn.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.35);
  color: #e8e8f0;
}

.category-rail {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.category-rail-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: 100%;
  padding: 0.48rem 0.5rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.category-rail-btn:hover,
.category-rail-btn.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.35);
  color: #e8e8f0;
}

.category-rail-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
}

.category-rail-label {
  flex: 1;
  font-size: 0.78rem;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  letter-spacing: 0;
  line-height: 1.2;
}

.category-rail-count {
  font-size: 0.62rem;
  min-width: 1.15rem;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.25);
  color: #bfdbfe;
  flex-shrink: 0;
  text-align: center;
}

.category-popover {
  position: fixed;
  z-index: 100;
  width: 280px;
  max-height: min(420px, 70vh);
  overflow: hidden;
  display: none;
  flex-direction: column;
  background: rgba(14, 14, 22, 0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.category-popover.is-open {
  display: flex;
}

.category-popover[hidden] {
  display: none !important;
}

.category-popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.category-popover-head strong { font-size: 0.88rem; }

.category-popover-tip {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.category-popover-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.category-popover-foot {
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem;
  border-top: 1px solid var(--border);
}

.category-popover-foot a { color: var(--text-muted); }

.agent-category-panel .agent-selected {
  margin-top: auto;
  padding: 0.45rem 0.25rem 0.15rem;
  font-size: 0.66rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.agent-canvas-main {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.agent-canvas-empty {
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 0;
}

.agent-canvas-empty[hidden] {
  display: none !important;
}

.agent-plan-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 280px;
  padding: 2rem;
  color: var(--text-muted);
  text-align: center;
}
.agent-plan-loading p { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.plan-summary-loading { color: #c4b5fd; }
.plan-summary-error { color: #f87171; cursor: help; }
.plan-summary-enhancing::after {
  content: '';
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-left: 0.4rem;
  vertical-align: -0.1rem;
  border: 2px solid rgba(196, 181, 253, 0.35);
  border-top-color: #c4b5fd;
  border-radius: 50%;
  animation: agent-plan-spin 0.8s linear infinite;
}
.agent-plan-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: agent-plan-spin 0.8s linear infinite;
}
@keyframes agent-plan-spin { to { transform: rotate(360deg); } }

.agent-toolbar.card {
  padding: 0.65rem 1rem;
  flex-shrink: 0;
  margin: 0;
}

.agent-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.agent-toolbar-row label { font-size: 0.78rem; color: var(--text-muted); }

.voice-item-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
}

.voice-picker-wrap {
  position: relative;
  min-width: 168px;
}

.voice-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-width: 168px;
  cursor: pointer;
  text-align: left;
}

.voice-picker-arrow { opacity: 0.6; font-size: 0.7rem; }

.voice-picker-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 120;
  min-width: 280px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface-elevated, #1e1e24);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  padding: 0.35rem 0;
}

.voice-picker-group-label {
  padding: 0.35rem 0.75rem 0.2rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.voice-picker-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
}

.voice-picker-item:hover,
.voice-picker-item.is-active {
  background: rgba(167, 139, 250, 0.12);
}

.voice-picker-item-label { flex: 1; }

.voice-picker-play {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
}

.voice-picker-play:hover { background: rgba(167, 139, 250, 0.2); }
.voice-picker-play.is-loading { opacity: 0.5; pointer-events: none; }

.voice-picker-delete {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  border: none;
  border-radius: 4px;
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.voice-picker-delete:hover { background: rgba(248, 113, 113, 0.28); }

#voice-clone-modal label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

#voice-clone-modal .search-input { width: 100%; margin-bottom: 0.25rem; }

.voice-match-hint {
  font-size: 0.75rem;
  color: #fbbf24;
  max-width: 220px;
  line-height: 1.3;
}

.voice-match-hint.is-error { color: #f87171; }

.ugc-gender-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  font-size: 0.65rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.agent-camp-name {
  display: inline-block;
  max-width: min(320px, 42vw);
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-input-name {
  width: min(180px, 28vw);
}

.agent-toolbar-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.agent-toolbar .agent-plan-summary {
  margin: 0.3rem 0 0;
  margin-bottom: 0;
  font-size: 0.76rem;
  line-height: 1.35;
}

.category-asset-item {
  position: relative;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  overflow: visible;
  text-align: left;
}

.category-asset-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #0a0a12;
  border-radius: 8px;
  overflow: hidden;
}

.category-asset-media img,
.category-asset-item .product-no-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.category-asset-item .product-no-cover {
  aspect-ratio: auto;
}

.category-asset-zoom {
  position: absolute;
  bottom: 4px;
  right: 4px;
  z-index: 3;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.58rem;
  line-height: 1.35;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  cursor: zoom-in;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.category-asset-zoom:hover {
  background: rgba(59, 130, 246, 0.85);
}

.category-asset-item .category-asset-name {
  display: block;
  font-size: 0.65rem;
  padding: 0.25rem 0.15rem 0;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-asset-item.picked {
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.category-asset-item .agent-pick-mark {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.agent-product-hint {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.agent-product-warn {
  display: block;
  font-size: 0.65rem;
  color: #f59e0b;
}

.agent-canvas-section {
  padding: 0.45rem 0.65rem 0.5rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.agent-canvas-section[hidden] {
  display: none !important;
}

.canvas-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-shrink: 0;
}

.canvas-section-head .canvas-item-tabs {
  margin-bottom: 0;
  flex: 1;
}

.canvas-run-progress {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  min-width: 0;
}

.canvas-run-progress[hidden] {
  display: none !important;
}

.canvas-camp-progress {
  width: 88px;
  margin: 0;
  flex-shrink: 0;
}

.canvas-run-progress-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvas-tab-running {
  border-color: rgba(59, 130, 246, 0.55) !important;
  color: #93c5fd !important;
}

.canvas-tab-done {
  border-color: rgba(34, 197, 94, 0.45) !important;
  color: #86efac !important;
}

.canvas-tab-failed {
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #fca5a5 !important;
}

.canvas-viewport-running {
  outline: 1px solid rgba(59, 130, 246, 0.25);
}

.canvas-node-status {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  font-size: 0.58rem;
  line-height: 1.2;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

.canvas-node-step,
.canvas-node-mid {
  position: absolute;
}

.canvas-node-status-running {
  background: rgba(59, 130, 246, 0.9);
  color: #fff;
}

.canvas-node-status-completed {
  background: rgba(34, 197, 94, 0.88);
  color: #fff;
}

.canvas-node-status-failed {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

.canvas-node-step-running .canvas-node-body,
.canvas-node-output-running .canvas-node-body {
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.canvas-node-step-completed .canvas-node-body,
.canvas-node-output-completed .canvas-node-body {
  border-color: rgba(34, 197, 94, 0.55);
}

.canvas-node-step-failed .canvas-node-body,
.canvas-node-output-failed .canvas-node-body {
  border-color: rgba(239, 68, 68, 0.55);
}

.canvas-node-error {
  font-size: 0.58rem;
  line-height: 1.25;
  color: #fca5a5;
  margin-top: 0.2rem;
  max-width: 96px;
  word-break: break-all;
}

.canvas-node-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: rgba(59, 130, 246, 0.08);
}

.canvas-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: canvas-spin 0.75s linear infinite;
}

@keyframes canvas-spin {
  to { transform: rotate(360deg); }
}

.canvas-node-failed {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #f87171;
  font-size: 1.1rem;
  background: rgba(239, 68, 68, 0.08);
}

.canvas-output-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

.canvas-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
  background: rgba(0, 0, 0, 0.22);
}

.contact-point:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.canvas-viewport {
  position: relative;
  flex: 1;
  min-height: 320px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(15, 15, 25, 0.6) 0%, rgba(10, 10, 18, 0.9) 100%);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.canvas-stage {
  position: relative;
  min-width: 1150px;
  min-height: 600px;
}

.canvas-edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.canvas-edges-temp {
  z-index: 3;
}

.canvas-edge {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 2;
}

.canvas-edge-active {
  stroke: rgba(139, 92, 246, 0.85);
}

.canvas-edge-fixed {
  stroke: rgba(255, 255, 255, 0.45);
  stroke-dasharray: 4 3;
}

.canvas-edge-toggle {
  pointer-events: stroke;
  cursor: context-menu;
}

.canvas-edge-toggle:hover {
  stroke: rgba(245, 158, 11, 0.9);
  stroke-width: 2.5;
}

.canvas-edge-temp {
  stroke: rgba(59, 130, 246, 0.75);
  stroke-dasharray: 6 4;
}

.canvas-nodes {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.canvas-node {
  position: absolute;
  width: 96px;
  text-align: center;
  user-select: none;
}

.canvas-node.is-dragging {
  z-index: 10;
  opacity: 0.92;
}

.canvas-node-head {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  cursor: grab;
  padding: 0.15rem 0.2rem;
  border-radius: 6px;
}

.canvas-node-head:active {
  cursor: grabbing;
}

.canvas-node-body {
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg);
  aspect-ratio: 1;
  position: relative;
}

.canvas-node-body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.canvas-node-sub {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.25;
  max-height: 2.5em;
  overflow: hidden;
}

.port {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(15, 15, 25, 0.95);
  z-index: 5;
}

.port-out {
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  cursor: crosshair;
  background: rgba(59, 130, 246, 0.85);
}

.port-in {
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(168, 85, 247, 0.85);
}

.port-out:hover,
.port-in:hover {
  transform: translateY(-50%) scale(1.15);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.canvas-node-input .canvas-node-body {
  border-color: rgba(59, 130, 246, 0.45);
  position: relative;
}

.canvas-node-product .canvas-node-body {
  position: relative;
}

.canvas-node.is-selected .canvas-node-body {
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.9);
}

.canvas-node.is-preview-target .canvas-node-body {
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.75);
  opacity: 0.92;
}

.canvas-node.is-preview-candidate .canvas-node-body {
  outline: 2px dashed rgba(59, 130, 246, 0.55);
  outline-offset: 2px;
}

.contact-point {
  display: none;
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 8;
  padding: 0;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.45);
}

.canvas-node.is-selected .contact-point {
  display: flex;
}

.contact-point-out {
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
}

.contact-point-in {
  left: -12px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
}

.contact-point:hover {
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.28);
}

.contact-point-in:hover {
  transform: translateY(-50%) rotate(180deg) scale(1.08);
}

.canvas-node.is-selected .port-out {
  opacity: 0.35;
}

.canvas-viewport {
  position: relative;
}

.canvas-contact-menu {
  position: absolute;
  z-index: 30;
  width: 240px;
  max-height: min(420px, 55vh);
  overflow: hidden;
  display: none;
  flex-direction: column;
  background: rgba(14, 14, 22, 0.98);
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}

.canvas-contact-menu.is-open {
  display: flex;
}

.canvas-contact-menu[hidden] {
  display: none !important;
}

.canvas-contact-menu-head {
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  color: #e8e8f0;
}

.canvas-contact-menu-body {
  overflow-y: auto;
  padding: 0.45rem;
}

.canvas-contact-section-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin: 0.35rem 0.25rem 0.3rem;
}

.canvas-contact-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.35rem 0.4rem;
  margin-bottom: 0.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  font-size: 0.72rem;
}

.canvas-contact-option img,
.canvas-contact-option .contact-opt-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

.canvas-contact-option .contact-opt-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.canvas-contact-option span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-contact-option.is-active {
  border-color: rgba(59, 130, 246, 0.65);
  background: rgba(59, 130, 246, 0.12);
  color: #e8e8f0;
}

.canvas-contact-option:hover {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.1);
  color: #e8e8f0;
}

.canvas-contact-option-step {
  justify-content: center;
  font-weight: 500;
}

.canvas-edge-preview {
  stroke: rgba(245, 158, 11, 0.55);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  fill: none;
}

.canvas-node.is-linked .canvas-node-body {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.85);
}

.canvas-node.is-linked .canvas-node-head {
  color: #93c5fd;
}

.canvas-node-type-label {
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  font-size: 0.58rem;
  padding: 0.1rem 0.25rem;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.75);
  border-radius: 8px 8px 0 0;
  text-align: left;
}
.canvas-node-product .canvas-node-body { border-color: rgba(245, 158, 11, 0.65); }
.canvas-node-mid .canvas-node-body { border-color: rgba(139, 92, 246, 0.5); border-style: dashed; }
.canvas-node-output .canvas-node-body { border-color: rgba(34, 197, 94, 0.55); }

.canvas-node-step {
  width: 118px;
}

.canvas-node-step .canvas-node-body {
  aspect-ratio: auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem;
  border-color: rgba(168, 85, 247, 0.6);
  background: rgba(139, 92, 246, 0.12);
  cursor: default;
}

.canvas-step-preview {
  display: block;
  font-size: 0.62rem;
  font-style: normal;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.35;
  text-align: left;
}

.canvas-node-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

.canvas-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-top: 0.65rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.canvas-legend-compact {
  margin-top: 0.35rem;
  flex-shrink: 0;
  font-size: 0.68rem;
  gap: 0.5rem 0.75rem;
}

.canvas-hint-inline {
  margin-left: auto;
  opacity: 0.85;
}

.canvas-sync-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.canvas-sync-status.is-saving { color: #fbbf24; }
.canvas-sync-status.is-error { color: var(--danger); }

.step-prompt-modal-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.agent-llm-cost {
  font-size: 0.78rem;
  color: #a8d4a0;
  border: 1px solid rgba(168, 212, 160, 0.35);
  background: rgba(168, 212, 160, 0.08);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.canvas-item-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.canvas-tab {
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.canvas-tab.active {
  background: rgba(139, 92, 246, 0.32);
  border-color: rgba(167, 139, 250, 0.85);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.canvas-tab.active.canvas-tab-running {
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(96, 165, 250, 0.85);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #dbeafe;
}

.canvas-tab.active.canvas-tab-done {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(74, 222, 128, 0.75);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #dcfce7;
}

.canvas-tab.active.canvas-tab-failed {
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(248, 113, 113, 0.85);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #fecaca;
}

#camp-item-status-badge .badge {
  min-width: 5.5rem;
  text-align: center;
}

.legend-item::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.legend-input::before { background: rgba(59, 130, 246, 0.7); }
.legend-step::before { background: rgba(168, 85, 247, 0.7); }
.legend-output::before { background: rgba(34, 197, 94, 0.7); }

.agent-prompt-dock { padding: 0.85rem 1rem; }

.prompt-dock-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.prompt-dock-tabs button {
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.prompt-dock-tabs button.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.canvas-prompt-input {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.prompt-dock-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.prompt-dock-meta { font-size: 0.75rem; color: var(--text-muted); }

@media (max-width: 960px) {
  .agent-canvas-page {
    height: auto;
    min-height: 0;
  }
  .agent-workspace-body { grid-template-columns: 188px 1fr; }
  .category-rail-label { font-size: 0.72rem; }
  .canvas-viewport { min-height: 280px; }
  .canvas-hint-inline { margin-left: 0; width: 100%; }
  .category-popover { width: 200px; }
  .agent-toolbar-actions { margin-left: 0; width: 100%; }
  .agent-canvas-header { flex-wrap: wrap; }
}

/* ── 商品详情（UGC） ── */
.product-detail { display: flex; flex-direction: column; gap: 1rem; }

.product-detail-head { display: flex; flex-direction: column; gap: 0.35rem; }

.product-name-input {
  font-size: 1.15rem;
  font-weight: 600;
  border: none;
  background: transparent;
  padding-left: 0;
}

.product-detail-tip {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.product-section-head h4 {
  margin: 0;
  font-size: 0.95rem;
}

.product-section-sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.product-textarea { min-height: 64px; line-height: 1.45; }

.product-detail-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.product-save-hint { font-size: 0.8rem; color: var(--text-muted); }

.product-upload-type {
  min-width: 7.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}

.product-readiness-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.product-readiness-fill { height: 100%; border-radius: 999px; transition: width 0.3s; }
.product-readiness-high { background: linear-gradient(90deg, #22c55e, #4ade80); }
.product-readiness-medium { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.product-readiness-low { background: linear-gradient(90deg, #ef4444, #f87171); }

.product-readiness-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.product-readiness-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.product-ref-chip {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.product-ref-chip.ok { color: #4ade80; border-color: rgba(74, 222, 128, 0.35); }
.product-ref-chip.miss { color: var(--text-muted); }

.product-ready-badge {
  font-size: 0.68rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-weight: 600;
}

.product-ready-badge.ready-high { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.product-ready-badge.ready-mid { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.product-ready-badge.ready-low { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.product-card-ready {
  position: absolute;
  top: 4px;
  right: 4px;
}

.product-pending-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 1rem 0.5rem;
  display: block;
  word-break: break-all;
  text-align: center;
}

.product-ready-mini {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 0.58rem;
  padding: 0.08rem 0.3rem;
  border-radius: 4px;
  font-weight: 600;
}

.product-ready-mini-high { background: rgba(34, 197, 94, 0.85); color: #111; }
.product-ready-mini-medium { background: rgba(245, 158, 11, 0.85); color: #111; }
.product-ready-mini-low { background: rgba(239, 68, 68, 0.85); color: #fff; }

.ugc-card-product .ugc-card-product-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(245, 158, 11, 0.85);
  color: #1a1a1a;
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-weight: 600;
}

.ugc-card-meta-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0.35rem;
  line-height: 1.3;
}

.step-prompt-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.step-prompt-ref-badge {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.45);
  color: var(--text-secondary);
  user-select: none;
}

.step-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.step-settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.step-settings-grid select {
  width: 100%;
}

.step-prompt-body-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.canvas-output-previewable {
  cursor: zoom-in;
}

.canvas-input-previewable {
  cursor: zoom-in;
}

.canvas-output-previewable,
.canvas-output-link-btn {
  border: none;
  background: none;
  padding: 0;
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
}

.canvas-output-previewable img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.canvas-node-body .canvas-preview-hint {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.65);
  pointer-events: none;
}

.canvas-node-mid .canvas-node-body {
  position: relative;
}

.canvas-history-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  border: none;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.62rem;
  line-height: 1.3;
  cursor: pointer;
  color: #e0e7ff;
  background: rgba(59, 130, 246, 0.82);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.canvas-history-badge:hover {
  background: rgba(37, 99, 235, 0.95);
}

.canvas-item-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.canvas-item-actions[hidden] {
  display: none !important;
}

.agent-history-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.agent-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(62vh, 520px);
  overflow-y: auto;
}

.agent-history-card {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.agent-history-card.is-active {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.08);
}

.agent-history-card.is-final {
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35);
}

.agent-history-thumb {
  width: 96px;
  height: 96px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.agent-history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-history-thumb .canvas-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

.agent-history-thumb-wrap {
  position: relative;
}

.agent-history-meta {
  min-width: 0;
}

.agent-history-meta strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.agent-history-meta p {
  margin: 0.15rem 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.agent-history-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.agent-history-badge-tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.agent-history-badge-tag.tag-active {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

.agent-history-badge-tag.tag-final {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
}

.agent-history-actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex-shrink: 0;
}

.agent-history-actions .btn {
  white-space: nowrap;
}

.agent-history-footer {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.agent-history-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.agent-history-compare-col {
  min-width: 0;
}

.agent-history-compare-col h4 {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
}

.agent-history-compare-media {
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 9/16;
  max-height: 420px;
}

.agent-history-compare-media img,
.agent-history-compare-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.agent-history-compare-meta {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.agent-history-compare-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
}

@media (max-width: 720px) {
  .agent-history-card {
    grid-template-columns: 72px 1fr;
  }
  .agent-history-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .agent-history-compare-grid {
    grid-template-columns: 1fr;
  }
}

