/* 千川短视频提示词生成工具 - 样式 */

/* ============================================================
   基础变量与重置
   ============================================================ */

:root {
  --color-bg: #f4efe6;
  --color-surface: #fffaf2;
  --color-card: #fffdf8;
  --color-border: #dfd0bc;
  --color-border-strong: #b99a75;
  --color-text: #211a14;
  --color-text-secondary: #6f5a43;
  --color-text-hint: #9b866c;
  --color-primary: #d85b21;
  --color-primary-hover: #b94716;
  --color-primary-light: #fff1e5;
  --color-success: #2f7d4f;
  --color-warning: #b87825;
  --color-danger: #a33a2d;
  --color-accent: #123c35;
  --color-accent-light: #edf5f1;
  --color-oxblood: #6f2725;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(40, 24, 12, 0.05), 0 8px 22px rgba(80, 47, 19, 0.06);
  --shadow-md: 0 4px 10px rgba(40, 24, 12, 0.08), 0 14px 32px rgba(80, 47, 19, 0.08);
  --shadow-lg: 0 10px 28px rgba(35, 20, 10, 0.14), 0 24px 54px rgba(80, 47, 19, 0.1);
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  --transition: 0.2s ease;
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.78) 0%, rgba(244, 239, 230, 0.96) 42%, #efe5d6 100%),
    repeating-linear-gradient(90deg, rgba(85, 58, 35, 0.018) 0, rgba(85, 58, 35, 0.018) 1px, transparent 1px, transparent 18px);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================================
   布局
   ============================================================ */

.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 24px 44px;
}

.page-header {
  position: relative;
  text-align: left;
  padding: 22px 0 20px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(185, 154, 117, 0.38);
}

.page-header h1 {
  font-size: 1.9rem;
  font-weight: 650;
  color: var(--color-text);
  letter-spacing: 0;
  line-height: 1.2;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.page-header .subtitle {
  margin-top: 7px;
  color: var(--color-text-secondary);
  font-size: 0.92rem;
}

.main-layout {
  display: grid;
  grid-template-columns: 300px minmax(420px, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

/* ============================================================
   卡片
   ============================================================ */

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 11px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #fffaf2 0%, #f8efe2 100%);
}

.card-header h2 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0;
}

.card-body {
  padding: 16px;
}

.card-badges {
  display: flex;
  gap: 6px;
}

.result-card-header {
  gap: 12px;
  flex-wrap: wrap;
}

.result-status-line {
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-left: auto;
  min-width: 0;
}

.result-status-line .progress-text {
  margin-top: 0;
  text-align: center;
}

.result-status-line .generation-steps {
  justify-content: flex-end;
  gap: 4px;
  margin-top: 0;
}

.result-status-line .step-dot {
  display: none;
}

.result-status-line .step-item,
.result-status-line .progress-text {
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: nowrap;
}

.result-status-line .step-item .step-icon {
  width: auto;
  min-width: 10px;
}

.result-status-line .step-item.step-active,
.result-status-line .progress-text.status-running {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
}

.result-status-line .step-item.step-done,
.result-status-line .progress-text.status-model {
  border-color: var(--color-success);
  background: rgba(58, 143, 99, 0.12);
  color: var(--color-success);
}

.result-status-line .progress-text.status-local {
  border-color: var(--color-warning);
  background: #fff7e7;
  color: var(--color-warning);
}

.result-status-line .step-item.step-fail,
.result-status-line .progress-text.status-fail {
  border-color: var(--color-danger);
  background: rgba(193, 65, 65, 0.1);
  color: var(--color-danger);
}

/* ============================================================
   表单
   ============================================================ */

.form-group {
  margin-bottom: 13px;
}

.form-group label {
  display: block;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  margin-bottom: 5px;
}

.form-group label .required {
  color: var(--color-danger);
}

.form-group label .hint {
  font-weight: 400;
  color: var(--color-text-hint);
  font-size: 0.75rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.88rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(216, 91, 33, 0.14);
}

.form-group textarea.script-input {
  min-height: 200px;
  resize: vertical;
  line-height: 1.65;
}

.product-photo-field input[type="file"] {
  padding: 7px 8px;
}

.product-photo-preview {
  margin-top: 7px;
  padding: 8px 9px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 248, 0.78);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  line-height: 1.55;
}

.product-photo-preview-title {
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 3px;
}

.product-photo-preview-item {
  overflow-wrap: anywhere;
}

.product-photo-preview .muted {
  color: var(--color-text-hint);
}

.product-photo-field .btn-sm {
  margin-top: 7px;
}

.main-image-log-text {
  min-height: 150px;
  max-height: 260px;
  overflow: auto;
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.video-breakdown-grid {
  display: grid;
  grid-template-columns: minmax(260px, var(--video-input-width, 520px)) auto;
  align-items: end;
  gap: 0 14px;
  justify-content: start;
}

.video-download-group {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.video-download-group .btn-save-config,
#analyzeVideoBtn {
  min-width: 82px;
  min-height: 37px;
  padding: 7px 16px;
  white-space: nowrap;
}

#analyzeVideoBtn {
  align-self: end;
}

.video-analysis-report {
  margin-top: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  overflow: hidden;
}

.video-analysis-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(223, 208, 188, 0.72);
  background: var(--color-primary-light);
}

.video-analysis-report-header strong {
  color: var(--color-text);
  font-size: 0.86rem;
}

.video-analysis-report .analysis-report-input {
  width: 100%;
  min-height: 300px;
  max-height: 520px;
  margin: 0;
  padding: 12px;
  border: 0;
  outline: none;
  resize: vertical;
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.script-actions {
  align-items: end;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.video-analysis-file-group {
  flex: 0 1 var(--video-input-width, 520px);
  margin-bottom: 0;
}

.main-image-grid,
.visual-style-grid {
  display: grid;
  grid-template-columns: minmax(260px, 520px) auto auto;
  align-items: end;
  gap: 8px 14px;
}

.main-image-grid .form-group,
.visual-style-grid .form-group {
  margin-bottom: 0;
}

.main-image-report .analysis-report-input {
  min-height: 220px;
}

.main-image-set-intro,
.main-image-set-plan {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.main-image-set-plan ol {
  margin: 8px 0 0 18px;
}

.main-image-prompt {
  display: block;
  width: 100%;
  min-height: 220px;
  margin-top: 10px;
  margin-bottom: 12px;
  resize: vertical;
}

.main-image-result {
  margin-top: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  overflow: hidden;
}

.main-image-result-list {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 720px);
  justify-content: start;
  gap: 12px;
  padding: 12px;
}

.main-image-nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.main-image-nav-item {
  width: 100%;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.main-image-nav-item strong,
.main-image-nav-item span {
  display: block;
  overflow-wrap: anywhere;
}

.main-image-nav-item strong {
  font-size: 13px;
  line-height: 1.35;
}

.main-image-nav-item span {
  margin-top: 3px;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.main-image-nav-item.active {
  border-color: var(--color-primary);
  background: #fff8ef;
  box-shadow: 0 0 0 3px rgba(216, 91, 33, 0.12);
}

.main-image-nav-item.is-success {
  border-color: rgba(34, 139, 95, 0.48);
}

.main-image-nav-item.is-failed {
  border-color: rgba(190, 54, 54, 0.58);
}

.main-image-shared-card {
  min-height: 100%;
  max-width: 720px;
}

.main-image-result-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-image-result-card.is-running {
  border-color: rgba(246, 104, 31, 0.72);
}

.main-image-result-card.is-ready {
  border-color: rgba(38, 118, 96, 0.45);
}

.main-image-result-card.is-success {
  border-color: rgba(34, 139, 95, 0.68);
}

.main-image-result-card.is-failed {
  border-color: rgba(190, 54, 54, 0.72);
}

.main-image-result-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border-bottom: 1px solid var(--color-border);
}

.main-image-result-meta strong {
  color: var(--color-text);
}

.main-image-result-meta span {
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.main-image-result-meta .main-image-channel {
  color: var(--color-text-hint);
  word-break: break-word;
}

.main-image-result-meta.main-image-shared-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: start;
}

.main-image-selected-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.main-image-text-control {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-self: start;
}

.main-image-text-control label {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.main-image-text-control select {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 7px 8px;
  font-size: 12px;
}

.main-image-result-card img {
  display: block;
  width: 100%;
  max-height: 520px;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fffdf8;
}

.main-image-card-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 420px;
  padding: 14px;
  background: #fffdf8;
  color: var(--color-text-secondary);
  text-align: center;
  font-size: 13px;
}

.main-image-card-placeholder strong {
  color: var(--color-text);
}

.main-image-card-placeholder span {
  line-height: 1.45;
}

.main-image-analysis-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.main-image-analysis-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.main-image-status-pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.2;
}

.main-image-status-pill.is-running {
  border-color: rgba(246, 104, 31, 0.52);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.main-image-status-pill.is-ready {
  border-color: rgba(38, 118, 96, 0.36);
  color: #176b4b;
  background: #f1fbf5;
}

.main-image-status-pill.is-success {
  border-color: rgba(34, 139, 95, 0.4);
  color: #176b4b;
  background: #eefaf4;
}

.main-image-status-pill.is-failed {
  border-color: rgba(190, 54, 54, 0.42);
  color: #b32626;
  background: #fff1ee;
}

.main-image-status-pill.is-partial {
  border-color: rgba(184, 122, 25, 0.45);
  color: #9a6414;
  background: #fff7df;
}

.main-image-status-pill.is-fallback {
  border-color: rgba(184, 122, 25, 0.45);
  color: #9a6414;
  background: #fff7df;
}

.main-image-progress-bar {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(185, 154, 117, 0.22);
}

.main-image-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7a2b, #d94e11);
  transition: width 0.25s ease;
}

.main-image-card-progress {
  padding: 9px 10px 0;
}

.main-image-card-progress p,
.main-image-analysis-progress p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.main-image-item-controls {
  padding: 10px;
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.main-image-item-controls label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.main-image-item-controls textarea {
  min-height: 58px;
  resize: vertical;
}

.main-image-item-controls textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 7px 8px;
  font-size: 12px;
}

.main-image-result-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--color-border);
}

.main-image-actions {
  padding: 10px;
  border-top: 1px solid var(--color-border);
}

.report-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.topic-link-group {
  grid-column: span 2;
}

.topic-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.topic-link-row input {
  width: 100%;
}

.report-history-picker {
  margin-top: 8px;
  max-height: none;
  overflow: visible;
}

.report-history-title {
  padding: 8px 10px 6px;
  color: var(--color-text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(223, 208, 188, 0.72);
}

.report-history-more {
  padding: 7px 10px;
  color: var(--color-text-hint);
  font-size: 0.76rem;
  line-height: 1.5;
}

.btn-secondary {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.btn-secondary:hover {
  background: var(--color-accent);
  color: #fff;
}

.script-document-picker {
  margin-top: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  max-height: 180px;
  overflow: auto;
}

.script-doc-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid rgba(223, 208, 188, 0.72);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}

.script-doc-item:last-child {
  border-bottom: 0;
}

.script-doc-item:hover {
  background: var(--color-primary-light);
}

.script-doc-item small {
  color: var(--color-text-hint);
  white-space: nowrap;
}

.script-document-picker.report-history-picker {
  max-height: none;
  overflow: visible;
}

.current-script-document {
  margin-top: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  overflow: hidden;
}

.current-script-document-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(223, 208, 188, 0.72);
  background: var(--color-primary-light);
}

.current-script-document-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-script-document pre {
  max-height: 260px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.generation-config-card .form-group {
  margin-bottom: 12px;
}

.generation-config-card .config-section + .config-section {
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
  margin-top: 2px;
}

.sidebar-left .generation-config-card .config-grid {
  grid-template-columns: 1fr;
}

.sidebar-left .generation-config-card .config-inline-row {
  flex-direction: column;
  gap: 0;
}

.template-workflow {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

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

.template-select-group {
  flex: 0 0 180px;
  margin-bottom: 0;
  min-width: 0;
}

.template-select-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.template-generate-row .btn-generate {
  flex: 0 0 auto;
  min-width: 132px;
  padding: 9px 18px;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.inline-generation-status {
  flex: 1 1 360px;
  margin-left: 0;
  justify-content: flex-start;
}

.template-key-points {
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  line-height: 1.45;
  min-width: 0;
}

.template-key-points strong {
  color: var(--color-text);
  font-size: 0.82rem;
}

.template-key-points span {
  min-width: 0;
}

.config-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.config-inline-row {
  gap: 12px;
  margin-bottom: 0;
}

/* 保存配置 */
.btn-save-config {
  padding: 7px 16px;
  font-size: 0.82rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
}

.btn-save-config:hover {
  background: var(--color-primary);
  color: #fff;
}

.save-hint {
  font-size: 0.78rem;
  color: var(--color-success);
  margin-left: 8px;
  align-self: center;
}
.toggle-group {
  display: flex;
  align-items: center;
}

.toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 6px;
}

.toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--color-text);
  user-select: none;
}

/* ============================================================
   风格选择 - 列表式布局
   ============================================================ */

.style-list-label {
  font-size: 0.78rem;
  color: var(--color-text-hint);
  margin-bottom: 10px;
  padding-left: 2px;
}

.style-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 8px;
  max-height: none;
  overflow: visible;
  margin-bottom: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  /* 滚动条美化 */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.style-list::-webkit-scrollbar {
  width: 6px;
}

.style-list::-webkit-scrollbar-track {
  background: transparent;
}

.style-list::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 3px;
}

.style-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.style-list-item:last-child {
  border-bottom: 1px solid var(--color-border);
}

.style-list-item:hover {
  background: #fff4e8;
  border-color: var(--color-border-strong);
}

.style-list-item.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.style-list-item-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.style-list-item.selected .style-list-item-radio {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.style-list-item.selected .style-list-item-radio::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.style-list-item-info {
  flex: 1;
  min-width: 0;
}

.style-list-item-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-list-item.selected .style-list-item-label {
  color: var(--color-primary);
}

.style-list-item-title {
  font-size: 0.73rem;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.style-list-item-persona {
  font-size: 0.68rem;
  color: var(--color-text-hint);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 1px;
}

.style-list-item-best {
  font-size: 0.75rem;
  color: var(--color-primary);
  font-weight: 500;
}

.style-summary {
  padding: 12px;
  background: var(--color-accent-light);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(18, 60, 53, 0.18);
}

.summary-header {
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.summary-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.style-detail-card {
  display: grid;
  gap: 8px;
}

.style-detail-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(18, 60, 53, 0.18);
}

.style-detail-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.style-detail-label {
  color: var(--color-accent);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.55;
}

.style-detail-value {
  color: var(--color-text-secondary);
  font-size: 0.84rem;
  line-height: 1.62;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  background: #fffaf2;
  color: var(--color-accent);
  border: 1px solid rgba(18, 60, 53, 0.14);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   生成按钮
   ============================================================ */

.btn-generate {
  min-width: 220px;
  padding: 13px 48px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #e46b2b 0%, var(--color-primary) 100%);
  border: 1px solid #a93d13;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
}

.btn-generate:hover {
  background: linear-gradient(180deg, #d85b21 0%, var(--color-primary-hover) 100%);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-generate:active {
  transform: translateY(0);
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.progress-text {
  margin-top: 8px;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  text-align: center;
}

.model-usage-info {
  margin-top: 6px;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
  opacity: 0.9;
}

/* 电商首页 Banner 生成 */
.banner-studio-card {
  border: 0;
  background: #f8f5ef;
  box-shadow: none;
}

.banner-studio-card > .card-body {
  padding: 0;
}

.banner-studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(184, 134, 69, 0.2);
  background: rgba(255, 253, 248, 0.94);
}

.banner-studio-brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: #3a2a1d;
}

.banner-studio-brand strong {
  font-size: 0.98rem;
  letter-spacing: 0;
}

.banner-studio-brand span {
  font-size: 0.72rem;
  color: rgba(58, 42, 29, 0.62);
}

.banner-export-btn {
  min-height: 30px;
  padding: 0 18px;
  border: 1px solid #a87b42;
  border-radius: 2px;
  background: #a87b42;
  color: #fffaf2;
  font-weight: 700;
  cursor: pointer;
}

.banner-tool-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 0;
  align-items: start;
  min-height: 720px;
}

.banner-editor-panel {
  position: sticky;
  top: 12px;
  align-self: start;
  min-height: calc(100vh - 92px);
  padding: 12px 14px 18px;
  border: 0;
  border-right: 1px solid rgba(184, 134, 69, 0.22);
  border-radius: 0;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: none;
}

.banner-editor-section + .banner-editor-section {
  margin-top: 14px;
}

.banner-editor-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: rgba(58, 42, 29, 0.72);
  font-size: 0.78rem;
  font-weight: 600;
}

.banner-editor-section h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(184, 134, 69, 0.28);
}

.banner-editor-panel .form-group {
  margin-bottom: 8px;
}

.banner-editor-panel label {
  font-size: 0.72rem;
  color: rgba(58, 42, 29, 0.68);
}

.banner-editor-panel input[type="text"],
.banner-editor-panel input[type="file"] {
  min-height: 30px;
  border-radius: 2px;
  font-size: 0.78rem;
}

.banner-bg-picker {
  display: flex;
  gap: 8px;
}

.banner-bg-option {
  display: grid;
  gap: 4px;
  align-items: center;
  justify-items: center;
  width: 58px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.banner-bg-option input {
  display: none;
}

.banner-bg-option:has(input:checked) {
  background: transparent;
}

.banner-bg-thumb {
  display: block;
  width: 54px;
  height: 36px;
  border-radius: 2px;
  border: 1px solid rgba(185, 154, 117, 0.5);
  overflow: hidden;
}

.banner-bg-option:has(input:checked) .banner-bg-thumb {
  outline: 2px solid #a87b42;
  outline-offset: 2px;
}

.banner-bg-option span:last-child {
  font-size: 0.68rem;
  color: rgba(58, 42, 29, 0.7);
}

.banner-bg-thumb-v1 {
  background: url("assets/banner-scene-1.png?v=20260814") center / cover no-repeat;
}

.banner-bg-thumb-v2 {
  background: url("assets/banner-scene-2.png?v=20260814") center / cover no-repeat;
}

.banner-bg-thumb-v3 {
  background: url("assets/banner-scene-3.png?v=20260814") center / cover no-repeat;
}

.banner-color-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 0;
}

.banner-color-row label {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(184, 134, 69, 0.24);
  background: #fffaf2;
}

.banner-color-row input[type="color"] {
  order: -1;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
}

.banner-product-editor {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 6px 8px;
  padding: 8px;
  border: 1px solid rgba(185, 154, 117, 0.34);
  border-radius: 2px;
  background: rgba(255, 250, 242, 0.62);
}

.banner-product-editor + .banner-product-editor {
  margin-top: 8px;
}

.banner-product-editor label {
  grid-row: span 2;
  display: grid;
  place-items: center;
  gap: 3px;
  width: 38px;
  min-height: 52px;
  border: 1px dashed rgba(184, 134, 69, 0.45);
  color: #a87b42;
  cursor: pointer;
}

.banner-product-editor label span {
  font-size: 1rem;
}

.banner-product-editor label input {
  display: none;
}

.banner-product-editor input[type="text"] {
  min-height: 28px;
}

.banner-editor-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.banner-preview-panel {
  min-width: 0;
  padding: 26px 30px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.banner-preview-header {
  display: none;
}

.banner-stage-frame {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 1px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #efe5d6;
  box-shadow: 0 18px 58px rgba(70, 49, 28, 0.15);
}

.banner-stage {
  --banner-scale: 0.5;
  --banner-accent: #b88645;
  --banner-ink: #3a2416;
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform: scale(var(--banner-scale));
  transform-origin: left top;
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--banner-ink);
}

.banner-stage-background {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 28% 38%, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0) 30%),
    linear-gradient(90deg, rgba(112, 70, 38, 0.08) 0 45%, rgba(255, 252, 244, 0.25) 45% 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0 76%, rgba(80, 45, 20, 0.08) 76% 100%);
}

.banner-bg-v1 {
  background: linear-gradient(90deg, #d4b38d 0%, #ead8bd 35%, #f7ecd8 67%, #d1a16d 100%);
}

.banner-bg-v1 .banner-stage-background {
  background: url("assets/banner-scene-1.png?v=20260814") center / cover no-repeat;
}

.banner-bg-v2 {
  background: linear-gradient(90deg, #9b6234 0%, #c8945b 34%, #f1dcc0 65%, #7e4e2f 100%);
}

.banner-bg-v2 .banner-stage-background {
  background: url("assets/banner-scene-2.png?v=20260814") center / cover no-repeat;
}

.banner-bg-v3 {
  background: linear-gradient(90deg, #aaa397 0%, #d7d2c8 36%, #f2eee7 68%, #887f72 100%);
}

.banner-bg-v3 .banner-stage-background {
  background: url("assets/banner-scene-3.png?v=20260814") center / cover no-repeat;
}

.banner-bg-v1 .banner-stage-background::before,
.banner-bg-v2 .banner-stage-background::before,
.banner-bg-v3 .banner-stage-background::before {
  content: "";
  position: absolute;
  left: 250px;
  top: 0;
  width: 650px;
  height: 1080px;
  background: repeating-linear-gradient(90deg, rgba(98, 62, 34, 0.12) 0 20px, rgba(255,255,255,0.28) 20px 52px, rgba(98, 62, 34, 0.08) 52px 84px);
}

.banner-stage-background::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 220px;
  height: 100%;
  background:
    linear-gradient(90deg, rgba(109, 66, 34, 0.08), rgba(72, 43, 24, 0.22)),
    repeating-linear-gradient(180deg, transparent 0 190px, rgba(255,255,255,0.16) 190px 194px);
}

.banner-bg-v1 .banner-stage-background::before,
.banner-bg-v1 .banner-stage-background::after,
.banner-bg-v2 .banner-stage-background::before,
.banner-bg-v2 .banner-stage-background::after,
.banner-bg-v3 .banner-stage-background::before,
.banner-bg-v3 .banner-stage-background::after {
  display: none;
}

.banner-stage-model {
  display: none;
  position: absolute;
  left: 380px;
  top: 132px;
  width: 290px;
  height: 790px;
  border-radius: 150px 150px 80px 80px;
  background:
    radial-gradient(ellipse at 50% 52px, rgba(37, 29, 24, 0.95) 0 86px, transparent 87px),
    radial-gradient(ellipse at 50% 126px, rgba(236,188,156,0.92) 0 76px, transparent 77px),
    linear-gradient(110deg, rgba(240, 231, 213, 0.96), rgba(255,255,246,0.97) 48%, rgba(220, 207, 184, 0.92));
  box-shadow: 0 28px 80px rgba(84, 52, 27, 0.18);
}

.banner-stage-model::after {
  content: "";
  position: absolute;
  left: 86px;
  top: 220px;
  width: 118px;
  height: 300px;
  border-left: 4px solid rgba(95, 60, 34, 0.16);
  border-right: 4px solid rgba(95, 60, 34, 0.12);
  transform: skewX(-7deg);
}

.banner-stage-text {
  position: absolute;
  left: 1160px;
  top: 248px;
  width: 610px;
}

.banner-stage-subtitle {
  margin-bottom: 36px;
  color: var(--banner-accent);
  font-family: "Times New Roman", "Noto Serif CJK SC", serif;
  font-size: 21px;
  letter-spacing: 10px;
  text-transform: uppercase;
}

.banner-stage-title {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  font-size: 88px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 10px;
}

.banner-stage-slogan {
  margin-top: 42px;
  font-size: 32px;
  line-height: 1.35;
}

.banner-stage-divider {
  width: 144px;
  height: 4px;
  margin: 44px 0 48px;
  background: linear-gradient(90deg, var(--banner-accent) 0 60px, transparent 60px 84px, var(--banner-accent) 84px 144px);
}

.banner-stage-points {
  display: grid;
  gap: 26px;
  font-size: 24px;
  line-height: 1.5;
}

.banner-stage-point {
  display: flex;
  align-items: center;
  gap: 14px;
}

.banner-stage-point span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--banner-accent);
  flex: 0 0 auto;
}

.banner-stage-cta {
  width: 264px;
  height: 76px;
  margin-top: 34px;
  border: 2px solid var(--banner-accent);
  border-radius: 0;
  background: rgba(255,250,242,0.1);
  color: var(--banner-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 14px 32px rgba(92, 55, 20, 0.18);
}

.banner-stage-products {
  position: absolute;
  left: 1010px;
  top: 810px;
  display: flex;
  gap: 25px;
}

.banner-stage-product {
  width: 240px;
  height: 180px;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: #f7f3ee;
  box-shadow: 0 12px 28px rgba(54, 34, 20, 0.14);
}

.banner-stage-product-image {
  width: 204px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(58, 36, 22, 0.46);
  font-size: 18px;
}

.banner-stage-product-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.banner-stage-product strong,
.banner-stage-product em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banner-stage-product strong {
  margin-top: 12px;
  font-size: 20px;
}

.banner-stage-product em {
  margin-top: 2px;
  color: var(--banner-accent);
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  font-size: 22px;
  font-style: normal;
  font-weight: 700;
}

.banner-render-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 250, 242, 0.72);
  color: var(--color-text);
  font-weight: 700;
}

.banner-stage-caption {
  margin: 8px 0 0;
  color: rgba(58, 42, 29, 0.36);
  font-size: 0.72rem;
  text-align: center;
}

@media (max-width: 1040px) {
  .banner-tool-shell {
    grid-template-columns: 1fr;
  }
}

/* 生成步骤条 */
.generation-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--color-text-hint);
  flex-wrap: wrap;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.3s;
}

.step-item.step-done { color: var(--color-success); }
.step-item.step-active { color: var(--color-primary); font-weight: 700; }
.step-item.step-fail { color: var(--color-danger); }

.step-item .step-icon {
  display: inline-block;
  width: 16px;
  text-align: center;
}

.step-dot {
  color: var(--color-border);
}

/* 生成步骤条 */
.generation-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--color-text-hint);
  flex-wrap: wrap;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.3s;
}

.step-item.step-done { color: var(--color-success); }
.step-item.step-active { color: var(--color-primary); font-weight: 600; }
.step-item.step-fail { color: var(--color-danger); }

.step-item .step-icon {
  display: inline-block;
  width: 16px;
  text-align: center;
}

.step-dot {
  color: var(--color-border);
}

/* ============================================================
   生成结果
   ============================================================ */

.badge {
  display: inline-block;
  padding: 4px 9px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.badge-success {
  background: #edf5f1;
  color: var(--color-success);
  border-color: rgba(47, 125, 79, 0.18);
}

.badge-fail {
  background: #fff0ec;
  color: var(--color-danger);
  border-color: rgba(163, 58, 45, 0.18);
}

.badge-model {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(216, 91, 33, 0.22);
}

.badge-local {
  background: #fff7e7;
  color: var(--color-warning);
  border-color: rgba(184, 120, 37, 0.22);
}

.model-error {
  padding: 10px 14px;
  background: #fff7e7;
  border: 1px solid #e8c68f;
  border-radius: var(--radius-sm);
  color: var(--color-warning);
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.model-error-title {
  font-weight: 700;
  color: var(--color-warning);
}

.model-error-detail {
  margin-top: 4px;
  color: var(--color-text-secondary);
  word-break: break-word;
}

.model-error-checks {
  margin: 6px 0 0 18px;
  color: var(--color-text-muted);
}

.model-error-checks li {
  margin: 2px 0;
}

.model-status-details {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, var(--color-accent) 28%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-card) 78%, var(--color-accent-light) 22%);
  color: var(--color-text-secondary);
  font-size: 0.78rem;
}

.model-status-title {
  margin-bottom: 6px;
  color: var(--color-text);
  font-weight: 700;
}

.model-status-row {
  display: grid;
  grid-template-columns: 72px 82px minmax(160px, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 5px 0;
  border-top: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent 28%);
}

.model-status-row:first-of-type {
  border-top: 0;
}

.model-status-row strong {
  color: var(--color-text);
}

.model-status-row span {
  font-weight: 700;
}

.model-status-ok span {
  color: var(--color-success);
}

.model-status-warn span {
  color: var(--color-warning);
}

.model-status-fail span {
  color: var(--color-danger);
}

.model-status-row small {
  color: var(--color-text-muted);
}

.model-status-row em,
.model-status-summary {
  grid-column: 1 / -1;
  color: var(--color-text-muted);
  font-style: normal;
  line-height: 1.5;
  word-break: break-word;
}

.prompt-version-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

.prompt-header .prompt-version-tabs {
  flex: 0 1 auto;
  margin: 0;
}

.prompt-version-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  width: auto;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
}

.prompt-header .prompt-version-tab {
  flex: 0 0 auto;
}

.prompt-version-tab:hover,
.prompt-version-tab.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.prompt-version-tab strong {
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
}

/* 拆解摘要 */
.breakdown {
  background: #fffaf2;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  padding: 10px 14px;
}

.breakdown summary {
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.breakdown-content {
  margin-top: 10px;
  font-size: 0.82rem;
}

.bd-item {
  margin-bottom: 6px;
  line-height: 1.5;
}

.bd-script-analysis {
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(185, 154, 117, 0.56);
}

.bd-script-flow,
.bd-nine-dims {
  margin-top: 8px;
}

.bd-script-flow span {
  display: block;
  margin-top: 4px;
  color: var(--color-text-secondary);
}

.bd-dim {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 4px 10px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(185, 154, 117, 0.42);
}

.bd-dim:last-child {
  border-bottom: none;
}

.bd-dim-label {
  grid-row: span 2;
  font-weight: 700;
  color: var(--color-primary);
}

.bd-dim-evidence {
  color: var(--color-text);
}

.bd-dim-suggestion {
  color: var(--color-text-hint);
}

.bd-shots {
  margin-top: 8px;
}

.bd-shot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(185, 154, 117, 0.56);
  font-size: 0.8rem;
}

.bd-shot:last-child {
  border-bottom: none;
}

.bd-shot-seq {
  font-weight: 700;
  color: var(--color-primary);
}

.bd-shot-role {
  font-weight: 600;
  color: var(--color-text);
}

.bd-shot-task {
  color: var(--color-text-secondary);
}

.bd-shot-camera {
  display: block;
  width: 100%;
  color: var(--color-text-hint);
  font-size: 0.78rem;
}

/* 提示词输出 */
.prompt-section {
  margin-top: 4px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary) 28%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-card) 88%, var(--color-primary-light) 12%);
}

.prompt-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  margin-bottom: 8px;
}

.btn-copy {
  padding: 5px 9px;
  font-size: 0.78rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-copy:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.prompt-output {
  background: #211a14;
  color: #fff6e8;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid #3c2d20;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
}

/* ============================================================
   知识库面板
   ============================================================ */

.kb-detail {
  margin-bottom: 6px;
}

.kb-detail summary {
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 4px 0;
}

.kb-text {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.kb-text p {
  margin-bottom: 4px;
}

.kb-logic-text ol {
  margin: 6px 0 0 18px;
  padding: 0;
}

.kb-logic-text li {
  margin-bottom: 5px;
  padding-left: 2px;
}

.kb-template-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(223, 208, 188, 0.74);
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  font-size: 0.77rem;
}

.kb-template-item:last-child {
  border-bottom: none;
}

.kb-template-desc {
  color: var(--color-text-secondary);
}

.kb-template-applicable {
  color: var(--color-text-hint);
  font-size: 0.72rem;
  display: block;
  width: 100%;
}

/* ============================================================
   历史记录
   ============================================================ */

.history-list {
  max-height: 500px;
  overflow-y: auto;
}

.empty-hint {
  color: var(--color-text-hint);
  text-align: center;
  padding: 16px 0;
  font-size: 0.82rem;
}

.history-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(223, 208, 188, 0.74);
  font-size: 0.82rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.history-label {
  font-weight: 600;
  color: var(--color-text);
}

.history-badges {
  font-size: 0.75rem;
}

.history-item-meta {
  color: var(--color-text-hint);
  font-size: 0.72rem;
  margin-bottom: 6px;
}

.history-item-preview {
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-item-actions {
  display: flex;
  gap: 6px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.72rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-copy-sm:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-delete-sm:hover {
  background: #fff0ec;
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* ============================================================
   响应式
   ============================================================ */

@media (min-width: 1280px) {
  .main-image-result-list {
    grid-template-columns: minmax(200px, 240px) minmax(0, 720px);
  }
}

@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 260px 1fr 260px;
    gap: 12px;
  }

  body.user-console .module-nav-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .main-image-result-list {
    grid-template-columns: minmax(180px, 220px) minmax(0, 680px);
  }
}

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

  .video-breakdown-grid {
    grid-template-columns: 1fr;
  }

  .main-image-grid,
  .visual-style-grid {
    grid-template-columns: 1fr;
  }

  .main-image-result-list {
    grid-template-columns: 1fr;
  }

  .style-list {
    max-height: none;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  .style-list-item {
    padding: 8px 10px;
    gap: 8px;
  }

  .app-container {
    padding: 10px 12px 24px;
  }
}

@media (max-width: 480px) {
  .main-image-result-list {
    grid-template-columns: 1fr;
  }

  .style-list {
    max-height: none;
    grid-template-columns: 1fr;
  }

  .style-list-item {
    padding: 8px 10px;
    gap: 8px;
  }

  .form-row {
    flex-direction: column;
    gap: 8px;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }

  .config-actions {
    align-items: flex-start;
  }

  .topic-link-group {
    grid-column: auto;
  }

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

  .topic-history-columns {
    grid-template-columns: 1fr;
  }

  .topic-history-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topic-history-actions {
    width: 100%;
    justify-content: space-between;
  }

  .btn-generate {
    padding: 10px 32px;
    font-size: 0.95rem;
  }

  .template-generate-row {
    align-items: center;
  }

  .template-select-row {
    flex-direction: column;
  }

  .template-select-group {
    flex-basis: auto;
    width: 100%;
  }

  .template-generate-row .btn-generate {
    width: auto;
  }

  .inline-generation-status {
    flex-basis: 100%;
  }
}

/* 暗色模式 */
.dark-mode {
  --color-bg: #17110d;
  --color-surface: #241a13;
  --color-card: #1f1712;
  --color-border: #4a3728;
  --color-border-strong: #7f5d3e;
  --color-text: #fff6e8;
  --color-text-secondary: #d8c3a7;
  --color-text-hint: #9e8567;
  --color-primary-light: #3a2418;
  --color-accent-light: #142621;
}

.dark-mode {
  background:
    linear-gradient(180deg, #17110d 0%, #21160f 100%),
    repeating-linear-gradient(90deg, rgba(255, 246, 232, 0.025) 0, rgba(255, 246, 232, 0.025) 1px, transparent 1px, transparent 18px);
}

.dark-mode .card-header { background: linear-gradient(180deg, #271b12 0%, #1f1712 100%); }

.dark-mode .prompt-output {
  background: #0f0b08;
  color: #fff6e8;
  border: 1px solid #4a3728;
}

.dark-mode .style-list,
.dark-mode .style-summary,
.dark-mode .breakdown,
.dark-mode .model-error { background: #241a13; }

.dark-mode .style-list-item:hover { background: #2b1d13; }
.dark-mode .style-list-item.selected { background: linear-gradient(90deg, #3a2418 0%, #241a13 100%); }
.dark-mode .tag { background: #1c1410; color: #d8c3a7; border-color: #4a3728; }

/* 暗色模式切换按钮 */
.theme-toggle {
  position: fixed; top: 12px; right: 12px; z-index: 100;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

/* 知识库面板增强 */
.kb-full-content {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: var(--font-mono);
}

.kb-full-content::-webkit-scrollbar { width: 4px; }
.kb-full-content::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
/* 配置分隔线 */
.config-divider {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  padding: 10px 0 6px;
  margin: 8px 0 12px;
  border-top: 1px solid var(--color-border);
}

.form-group.half {
  flex: 1;
  min-width: 0;
}

/* 操作按钮组 */
.prompt-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 0;
  flex: 0 0 auto;
}

/* 修改按钮 */
.btn-edit {
  padding: 5px 9px;
  font-size: 0.78rem;
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-sm);
  background: #fff7e7;
  color: var(--color-warning);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-edit:hover {
  background: var(--color-warning);
  color: #fff;
  border-color: var(--color-warning);
}

.btn-edit.active {
  background: var(--color-warning);
  color: #fff;
  border-color: var(--color-warning);
}

/* 生成视频按钮 */
.btn-generate-video {
  min-width: 132px;
  padding: 9px 18px;
  font-size: 0.88rem;
  border: 1px solid #a93d13;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #e46b2b 0%, var(--color-primary) 100%);
  color: #fff;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 700;
  box-shadow: none;
}

#resultCard .prompt-header .prompt-version-tab,
#resultCard .prompt-header .btn-copy,
#resultCard .prompt-header .btn-edit,
#resultCard .prompt-header .btn-generate-video {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: nowrap;
}

#resultCard .prompt-header .prompt-version-tab {
  width: 68px;
}

#resultCard .prompt-header .btn-copy,
#resultCard .prompt-header .btn-edit {
  width: 44px;
}

.btn-generate-video:hover {
  background: linear-gradient(180deg, #d85b21 0%, var(--color-primary-hover) 100%);
  color: #fff;
  border-color: #a93d13;
  transform: translateY(-1px);
}

.btn-generate-video:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* 提示词编辑框 */
.prompt-editor {
  display: none;
  width: 100%;
  min-height: 200px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  background: #211a14;
  color: #fff6e8;
  resize: vertical;
  outline: none;
}

.prompt-editor:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(216, 91, 33, 0.14);
}

/* 视频生成状态 */
.video-gen-status {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.5;
}

.video-gen-status.waiting {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.video-gen-status.loading {
  background: var(--color-primary-light);
  border: 1px solid rgba(216, 91, 33, 0.22);
  color: var(--color-primary);
}

.video-gen-status.success {
  background: #edf5f1;
  border: 1px solid rgba(47, 125, 79, 0.18);
  color: var(--color-success);
}

.video-gen-status.warning {
  background: #fff7df;
  border: 1px solid rgba(184, 122, 25, 0.2);
  color: var(--color-warning);
}

.video-gen-status.error {
  background: #fff0ec;
  border: 1px solid rgba(163, 58, 45, 0.18);
  color: var(--color-danger);
}

/* 暗色模式兼容 */
.dark-mode .btn-edit { background: #332412; color: #e4b46d; border-color: #7f5d3e; }
.dark-mode .btn-edit:hover,
.dark-mode .btn-edit.active { background: #7f5d3e; color: #fff6e8; border-color: #7f5d3e; }
.dark-mode .btn-generate-video { background: #142621; color: #bed9ce; border-color: #31564b; }
.dark-mode .btn-generate-video:hover { background: #31564b; color: #fff; border-color: #31564b; }
.dark-mode .prompt-editor { background: #0f0b08; border-color: #7f5d3e; }
.dark-mode .video-gen-status.loading { background: #3a2418; border-color: #7f5d3e; color: #f0a36d; }
.dark-mode .video-gen-status.success { background: #142621; border-color: #31564b; color: #8ed2a9; }
.dark-mode .video-gen-status.warning { background: #302614; border-color: #6b5328; color: #e8c57b; }
.dark-mode .video-gen-status.error { background: #321b17; border-color: #6f2725; color: #ef8b7c; }
/* ============================================================
   视频结果
   ============================================================ */
.video-result {
  margin-top: 14px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary) 28%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-card) 88%, var(--color-primary-light) 12%);
}

.video-result-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.video-result-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: 100%;
}

.video-result-actions .video-gen-status {
  flex: 1 1 140px;
  min-height: 32px;
  margin-top: 0;
  padding: 6px 10px;
  font-size: 0.78rem;
  line-height: 1.35;
  display: flex;
  align-items: center;
  min-width: 0;
}

.video-player {
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius-md);
  background: #000;
  display: block;
  max-height: 480px;
}

.btn-copy-video-url,
.btn-download-video,
.btn-open-folder {
  padding: 4px 10px;
  font-size: 0.72rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-copy-video-url:hover { background: var(--color-primary-light); border-color: var(--color-primary); }
.btn-download-video:hover { background: #edf5f1; border-color: var(--color-success); color: var(--color-success); }
.btn-open-folder:hover { background: var(--color-accent-light); border-color: var(--color-accent); color: var(--color-accent); }

/* 暗色模式视频结果 */
.dark-mode .btn-copy-video-url:hover { background: #3a2418; }
.dark-mode .btn-download-video:hover { background: #142621; color: #8ed2a9; border-color: #31564b; }
.dark-mode .btn-open-folder:hover { background: #142621; color: #bed9ce; border-color: #31564b; }

/* ============================================================
   字体与字号优化
   ============================================================ */

:root {
  --font-sans: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Segoe UI", Arial, sans-serif;
  --font-readable: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Segoe UI", Arial, sans-serif;
}

html {
  font-size: 16px;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.68;
  letter-spacing: 0;
  overflow-x: hidden;
}

.app-container,
.main-layout,
.sidebar-left,
.content-main,
.sidebar-right,
.card,
.card-body {
  min-width: 0;
  max-width: 100%;
}

.page-header h1 {
  font-size: 1.78rem;
  font-weight: 700;
  line-height: 1.24;
}

.page-header .subtitle {
  font-size: 0.95rem;
  line-height: 1.55;
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.form-group label,
.config-divider {
  font-size: 0.84rem;
  line-height: 1.45;
}

.form-group label .hint {
  font-size: 0.8rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  min-height: 38px;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  line-height: 1.45;
}

.toggle-label {
  font-size: 0.9rem;
  line-height: 1.45;
}

button,
.btn-save-config,
.btn-copy,
.btn-edit,
.btn-generate-video,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.35;
}

.btn-generate {
  font-size: 1.08rem;
  line-height: 1.35;
}

.style-list-label,
.progress-text,
.generation-steps,
.model-error,
.video-gen-status,
.empty-hint {
  font-size: 0.88rem;
  line-height: 1.55;
}

.style-list-item-label {
  font-size: 0.94rem;
  line-height: 1.38;
}

.style-list-item-title {
  font-size: 0.84rem;
  line-height: 1.45;
}

.style-list-item-persona,
.style-list-item-best {
  font-size: 0.8rem;
  line-height: 1.45;
}

.summary-header,
.history-label,
.video-result-header strong,
.prompt-header strong {
  font-size: 0.95rem;
  line-height: 1.45;
}

.tag,
.badge,
.history-badges,
.history-item-meta,
.kb-template-applicable {
  font-size: 0.8rem;
  line-height: 1.35;
}

.prompt-output,
.prompt-editor,
.kb-full-content {
  font-family: var(--font-readable);
  font-size: 0.94rem;
  line-height: 1.78;
}

.kb-detail summary {
  font-size: 0.92rem;
  line-height: 1.45;
}

.kb-text,
.kb-template-item,
.history-item {
  font-size: 0.88rem;
  line-height: 1.62;
}

.video-usage-info {
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: #f8f4ed;
  border: 1px solid rgba(223, 208, 188, 0.8);
  color: var(--color-text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.video-history-section {
  margin-top: 16px;
  border-top: 1px solid rgba(223, 208, 188, 0.74);
  padding-top: 14px;
}

.video-history-usage {
  margin: 5px 0 6px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.video-history-error {
  margin: 5px 0 8px;
  color: #a6412f;
  font-size: 0.78rem;
  line-height: 1.45;
  word-break: break-word;
}

/* ============================================================
   视觉优化：工作台配色与暗色适配
   ============================================================ */

:root {
  --color-bg: #eef3f2;
  --color-surface: #ffffff;
  --color-card: #ffffff;
  --color-border: #d7e0dc;
  --color-border-strong: #9ab0aa;
  --color-text: #17211f;
  --color-text-secondary: #4d625d;
  --color-text-hint: #7f918c;
  --color-text-muted: #6f827d;
  --color-primary: #e35d25;
  --color-primary-hover: #bf4717;
  --color-primary-light: #fff0e8;
  --color-success: #18835b;
  --color-warning: #b7791f;
  --color-danger: #b33a2e;
  --color-accent: #126a5b;
  --color-accent-light: #e8f5f1;
  --shadow-sm: 0 1px 2px rgba(16, 31, 28, 0.05), 0 10px 28px rgba(33, 57, 52, 0.08);
  --shadow-md: 0 6px 14px rgba(16, 31, 28, 0.08), 0 18px 44px rgba(33, 57, 52, 0.1);
  --shadow-lg: 0 12px 32px rgba(16, 31, 28, 0.13), 0 28px 62px rgba(33, 57, 52, 0.12);
}

body {
  background:
    linear-gradient(180deg, #f7faf8 0%, #eef3f2 44%, #e5ece9 100%),
    linear-gradient(90deg, rgba(18, 106, 91, 0.045) 0 1px, transparent 1px 24px);
}

.page-header {
  border-bottom-color: rgba(154, 176, 170, 0.48);
}

.page-header h1 {
  color: #102521;
}

.page-header .subtitle {
  max-width: 760px;
  color: var(--color-text-secondary);
}

.card {
  border-color: rgba(154, 176, 170, 0.58);
  background: rgba(255, 255, 255, 0.96);
}

.card-header {
  background: linear-gradient(180deg, #ffffff 0%, #f2f7f5 100%);
  border-bottom-color: rgba(154, 176, 170, 0.42);
}

.card-header h2 {
  color: #142b27;
}

.form-group label {
  color: #425a55;
}

.form-group input,
.form-group select,
.form-group textarea,
.script-document-picker,
.current-script-document,
.btn-copy,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder {
  background: #fbfdfc;
  border-color: var(--color-border);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.prompt-editor:focus {
  background: #ffffff;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(18, 106, 91, 0.14);
}

.btn-save-config,
.btn-copy,
.btn-edit,
.btn-generate-video,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder {
  border-radius: 6px;
}

.btn-save-config {
  background: var(--color-primary-light);
  border-color: rgba(227, 93, 37, 0.42);
  color: var(--color-primary);
}

.btn-save-config:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary,
.btn-generate-video {
  background: var(--color-accent-light);
  border-color: rgba(18, 106, 91, 0.38);
  color: var(--color-accent);
}

.btn-secondary:hover,
.btn-generate-video:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.style-list-item {
  background: #fbfdfc;
  border-color: var(--color-border);
}

.style-list-item:hover {
  background: #eef8f5;
  border-color: rgba(18, 106, 91, 0.38);
}

.style-list-item.selected {
  background: linear-gradient(180deg, #fff6f0 0%, #fff0e8 100%);
  border-color: rgba(227, 93, 37, 0.7);
}

.style-list-item.selected .style-list-item-label {
  color: var(--color-primary);
}

.style-summary {
  background: linear-gradient(180deg, #eff8f5 0%, #e8f5f1 100%);
  border-color: rgba(18, 106, 91, 0.22);
}

.style-detail-row {
  border-bottom-color: rgba(18, 106, 91, 0.18);
}

.style-detail-label {
  color: var(--color-accent);
}

.btn-generate {
  background: linear-gradient(180deg, #ec7440 0%, var(--color-primary) 100%);
  border-color: #b83f13;
  border-radius: 8px;
}

.btn-generate:hover {
  background: linear-gradient(180deg, #e35d25 0%, var(--color-primary-hover) 100%);
}

.badge-success,
.video-gen-status.success {
  background: #e8f6ef;
  border-color: rgba(24, 131, 91, 0.22);
}

.badge-fail,
.video-gen-status.error {
  background: #fff0ed;
  border-color: rgba(179, 58, 46, 0.22);
}

.badge-model,
.video-gen-status.loading {
  background: var(--color-primary-light);
  border-color: rgba(227, 93, 37, 0.24);
}

.badge-local,
.model-error {
  background: #fff7e8;
  border-color: rgba(183, 121, 31, 0.24);
}

.breakdown,
.video-usage-info {
  background: #fbfdfc;
  border-color: var(--color-border);
}

.prompt-output,
.prompt-editor {
  background: #13211f;
  border-color: #28413c;
  color: #f4fbf8;
}

.history-list {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 6px;
}

.history-item {
  border-bottom-color: rgba(154, 176, 170, 0.36);
}

.video-history-usage {
  color: var(--color-text-muted);
}

.raw-response-detail {
  margin-top: 8px;
  font-size: 0.78rem;
}

.raw-response-detail summary {
  color: var(--color-accent);
  cursor: pointer;
  font-weight: 700;
}

.raw-response-detail pre {
  margin-top: 6px;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  border-radius: 6px;
  background: #13211f;
  color: #f4fbf8;
  font-family: var(--font-readable);
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.theme-toggle {
  border-radius: 8px;
}

.dark-mode {
  --color-bg: #101818;
  --color-surface: #172221;
  --color-card: #15201f;
  --color-border: #2b403d;
  --color-border-strong: #49635f;
  --color-text: #eef8f5;
  --color-text-secondary: #bfd1cc;
  --color-text-hint: #8da39d;
  --color-text-muted: #9fb4ae;
  --color-primary: #f07a45;
  --color-primary-hover: #ff9364;
  --color-primary-light: #34231c;
  --color-success: #6ed0a4;
  --color-warning: #e7b66d;
  --color-danger: #ef8d7e;
  --color-accent: #7ed9c8;
  --color-accent-light: #17302d;
}

.dark-mode {
  background:
    linear-gradient(180deg, #0e1717 0%, #101818 48%, #0d1414 100%),
    linear-gradient(90deg, rgba(126, 217, 200, 0.035) 0 1px, transparent 1px 24px);
}

.dark-mode .page-header {
  border-bottom-color: rgba(73, 99, 95, 0.55);
}

.dark-mode .page-header h1,
.dark-mode .card-header h2 {
  color: #f2fbf8;
}

.dark-mode .card {
  background: rgba(21, 32, 31, 0.98);
  border-color: rgba(73, 99, 95, 0.72);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22), 0 14px 38px rgba(0, 0, 0, 0.24);
}

.dark-mode .card-header {
  background: linear-gradient(180deg, #1a2927 0%, #15201f 100%);
  border-bottom-color: rgba(73, 99, 95, 0.72);
}

.dark-mode .form-group label {
  color: #bfd1cc;
}

.dark-mode .form-group input,
.dark-mode .form-group select,
.dark-mode .form-group textarea,
.dark-mode .script-document-picker,
.dark-mode .current-script-document,
.dark-mode .btn-copy,
.dark-mode .btn-sm,
.dark-mode .btn-copy-video-url,
.dark-mode .btn-download-video,
.dark-mode .btn-open-folder,
.dark-mode .theme-toggle {
  background: #172221;
  border-color: #2b403d;
  color: var(--color-text);
}

.dark-mode .form-group input:focus,
.dark-mode .form-group select:focus,
.dark-mode .form-group textarea:focus,
.dark-mode .prompt-editor:focus {
  background: #1b2b29;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(126, 217, 200, 0.16);
}

.dark-mode .btn-save-config {
  background: #34231c;
  border-color: rgba(240, 122, 69, 0.42);
  color: #ffb08a;
}

.dark-mode .btn-save-config:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #18100d;
}

.dark-mode .btn-secondary,
.dark-mode .btn-generate-video {
  background: #17302d;
  border-color: rgba(126, 217, 200, 0.35);
  color: #9ce6d8;
}

.dark-mode .btn-secondary:hover,
.dark-mode .btn-generate-video:hover {
  background: #24534d;
  border-color: #7ed9c8;
  color: #f2fbf8;
}

.dark-mode .style-list,
.dark-mode .style-summary,
.dark-mode .breakdown,
.dark-mode .model-error,
.dark-mode .video-usage-info {
  background: #172221;
}

.dark-mode .style-list-item {
  background: #172221;
  border-color: #2b403d;
}

.dark-mode .style-list-item:hover {
  background: #1d302d;
  border-color: rgba(126, 217, 200, 0.34);
}

.dark-mode .style-list-item.selected {
  background: linear-gradient(180deg, #33231c 0%, #241f1a 100%);
  border-color: rgba(240, 122, 69, 0.72);
}

.dark-mode .style-summary {
  background: linear-gradient(180deg, #17302d 0%, #152826 100%);
  border-color: rgba(126, 217, 200, 0.2);
}

.dark-mode .style-detail-row,
.dark-mode .history-item {
  border-bottom-color: rgba(73, 99, 95, 0.58);
}

.dark-mode .prompt-output,
.dark-mode .prompt-editor,
.dark-mode .raw-response-detail pre {
  background: #0b1212;
  border-color: #2b403d;
  color: #eef8f5;
}

.dark-mode .badge-success,
.dark-mode .video-gen-status.success {
  background: #17302d;
  border-color: rgba(110, 208, 164, 0.28);
  color: var(--color-success);
}

.dark-mode .badge-fail,
.dark-mode .video-gen-status.error {
  background: #321f1c;
  border-color: rgba(239, 141, 126, 0.28);
  color: var(--color-danger);
}

.dark-mode .badge-model,
.dark-mode .video-gen-status.loading {
  background: #34231c;
  border-color: rgba(240, 122, 69, 0.28);
  color: #ffb08a;
}

.dark-mode .badge-local,
.dark-mode .model-error {
  background: #302719;
  border-color: rgba(231, 182, 109, 0.28);
  color: var(--color-warning);
}

.dark-mode .raw-response-detail summary {
  color: var(--color-accent);
}

/* 暗色模式亮度修正：降低压黑感，提升详情区可读性 */
.dark-mode {
  --color-bg: #172322;
  --color-surface: #223330;
  --color-card: #1f2d2b;
  --color-border: #3a5650;
  --color-border-strong: #5f7c75;
  --color-text: #f5fbf8;
  --color-text-secondary: #d5e4df;
  --color-text-hint: #adc2bc;
  --color-text-muted: #c0d2cc;
  --color-primary-light: #463027;
  --color-accent-light: #24413c;
}

.dark-mode {
  background:
    linear-gradient(180deg, #1b2a28 0%, #172322 52%, #15201f 100%),
    linear-gradient(90deg, rgba(126, 217, 200, 0.045) 0 1px, transparent 1px 24px);
}

.dark-mode .card {
  background: #1f2d2b;
  border-color: rgba(95, 124, 117, 0.78);
}

.dark-mode .card-header {
  background: linear-gradient(180deg, #263936 0%, #1f2d2b 100%);
}

.dark-mode .form-group input,
.dark-mode .form-group select,
.dark-mode .form-group textarea,
.dark-mode .script-document-picker,
.dark-mode .current-script-document,
.dark-mode .btn-copy,
.dark-mode .btn-sm,
.dark-mode .btn-copy-video-url,
.dark-mode .btn-download-video,
.dark-mode .btn-open-folder,
.dark-mode .theme-toggle {
  background: #263936;
  border-color: #3a5650;
}

.dark-mode .style-summary {
  background: linear-gradient(180deg, #294943 0%, #24413c 100%);
  border-color: rgba(126, 217, 200, 0.32);
}

.dark-mode .style-detail-label {
  color: #8ff0df;
}

.dark-mode .style-detail-value {
  color: #edf7f4;
}

.dark-mode .style-detail-row {
  border-bottom-color: rgba(143, 240, 223, 0.22);
}

.dark-mode .style-list-item {
  background: #263936;
  border-color: #3a5650;
}

.dark-mode .style-list-item:hover {
  background: #2d4742;
}

.dark-mode .history-item-meta,
.dark-mode .video-history-usage,
.dark-mode .kb-template-applicable {
  color: #c0d2cc;
}

@media (max-width: 900px) {
  html {
    font-size: 15.5px;
  }

  .page-header h1 {
    font-size: 1.52rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .btn-generate {
    font-size: 1rem;
  }
}

/* ============================================================
   Hermes-inspired final theme
   ============================================================ */

:root {
  --color-bg: #f6efe3;
  --color-surface: #fffaf2;
  --color-card: #fffdf8;
  --color-border: #dec8a8;
  --color-border-strong: #a87945;
  --color-text: #241810;
  --color-text-secondary: #60452c;
  --color-text-hint: #92775b;
  --color-text-muted: #806a52;
  --color-primary: #f26a21;
  --color-primary-hover: #c94d12;
  --color-primary-light: #fff0df;
  --color-success: #2d7551;
  --color-warning: #a66b1f;
  --color-danger: #a43b2e;
  --color-accent: #183f35;
  --color-accent-light: #edf4ee;
  --shadow-sm: 0 1px 2px rgba(61, 38, 18, 0.06), 0 10px 28px rgba(98, 62, 24, 0.08);
  --shadow-md: 0 6px 14px rgba(61, 38, 18, 0.1), 0 18px 44px rgba(98, 62, 24, 0.12);
  --shadow-lg: 0 12px 32px rgba(61, 38, 18, 0.16), 0 28px 62px rgba(98, 62, 24, 0.16);
}

body {
  background:
    linear-gradient(180deg, #fff8ed 0%, #f6efe3 46%, #eadcc8 100%),
    linear-gradient(90deg, rgba(168, 121, 69, 0.045) 0 1px, transparent 1px 24px);
}

.page-header {
  border-bottom-color: rgba(168, 121, 69, 0.4);
}

.page-header h1,
.card-header h2 {
  color: #241810;
}

.page-header .subtitle,
.form-group label,
.style-list-label,
.kb-detail summary,
.breakdown summary {
  color: var(--color-text-secondary);
}

.card {
  background: rgba(255, 253, 248, 0.98);
  border-color: rgba(168, 121, 69, 0.42);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: linear-gradient(180deg, #fffaf2 0%, #f3e5d1 100%);
  border-bottom-color: rgba(168, 121, 69, 0.34);
}

.form-group input,
.form-group select,
.form-group textarea,
.script-document-picker,
.current-script-document,
.btn-copy,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder,
.theme-toggle {
  background: #fffaf2;
  border-color: var(--color-border);
  color: var(--color-text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.prompt-editor:focus {
  background: #fffdf8;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(242, 106, 33, 0.16);
}

.btn-save-config {
  background: var(--color-primary-light);
  border-color: rgba(242, 106, 33, 0.48);
  color: #b54710;
}

.btn-save-config:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fffaf2;
}

.btn-secondary,
.btn-generate-video {
  background: var(--color-accent-light);
  border-color: rgba(24, 63, 53, 0.35);
  color: var(--color-accent);
}

.btn-secondary:hover,
.btn-generate-video:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fffaf2;
}

.style-list-item {
  background: #fffaf2;
  border-color: rgba(168, 121, 69, 0.34);
}

.style-list-item:hover {
  background: #fff4e5;
  border-color: rgba(242, 106, 33, 0.48);
}

.style-list-item.selected {
  background: linear-gradient(180deg, #fff3e5 0%, #ffe6cc 100%);
  border-color: var(--color-primary);
}

.style-list-item.selected .style-list-item-label {
  color: #c94d12;
}

.style-summary {
  background: linear-gradient(180deg, #f3f7ef 0%, #edf4ee 100%);
  border-color: rgba(24, 63, 53, 0.2);
}

.style-detail-row {
  border-bottom-color: rgba(24, 63, 53, 0.18);
}

.style-detail-label {
  color: var(--color-accent);
}

.style-detail-value {
  color: var(--color-text-secondary);
}

.btn-generate {
  background: linear-gradient(180deg, #ff813a 0%, var(--color-primary) 100%);
  border-color: #b84612;
  color: #fffaf2;
  box-shadow: 0 8px 20px rgba(201, 77, 18, 0.24), 0 20px 48px rgba(98, 62, 24, 0.14);
}

.btn-generate:hover {
  background: linear-gradient(180deg, #f26a21 0%, var(--color-primary-hover) 100%);
}

.badge-model,
.video-gen-status.loading {
  background: var(--color-primary-light);
  border-color: rgba(242, 106, 33, 0.28);
  color: #b54710;
}

.badge-success,
.video-gen-status.success {
  background: #edf4ee;
  border-color: rgba(45, 117, 81, 0.2);
  color: var(--color-success);
}

.badge-local,
.model-error {
  background: #fff6e7;
  border-color: rgba(166, 107, 31, 0.22);
  color: var(--color-warning);
}

.breakdown,
.video-usage-info {
  background: #fffaf2;
  border-color: rgba(168, 121, 69, 0.38);
}

.prompt-output,
.prompt-editor,
.raw-response-detail pre {
  background: #21160f;
  border-color: #5c3a1d;
  color: #fff8ed;
}

.history-item {
  border-bottom-color: rgba(168, 121, 69, 0.28);
}

.raw-response-detail summary {
  color: var(--color-accent);
}

.dark-mode {
  --color-bg: #241a13;
  --color-surface: #34261c;
  --color-card: #2d2118;
  --color-border: #6a4c31;
  --color-border-strong: #a87945;
  --color-text: #fff8ed;
  --color-text-secondary: #ead4bb;
  --color-text-hint: #c9ad8e;
  --color-text-muted: #d8bea1;
  --color-primary: #ff813a;
  --color-primary-hover: #ff9a61;
  --color-primary-light: #4a2d1c;
  --color-success: #8ac89f;
  --color-warning: #e6b36e;
  --color-danger: #ef9888;
  --color-accent: #b7d6c5;
  --color-accent-light: #26392f;
}

.dark-mode {
  background:
    linear-gradient(180deg, #2d2118 0%, #241a13 54%, #1d140f 100%),
    linear-gradient(90deg, rgba(255, 129, 58, 0.04) 0 1px, transparent 1px 24px);
}

.dark-mode .page-header {
  border-bottom-color: rgba(168, 121, 69, 0.42);
}

.dark-mode .page-header h1,
.dark-mode .card-header h2 {
  color: #fff8ed;
}

.dark-mode .card {
  background: #2d2118;
  border-color: rgba(168, 121, 69, 0.62);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22), 0 14px 38px rgba(0, 0, 0, 0.22);
}

.dark-mode .card-header {
  background: linear-gradient(180deg, #3a2a1d 0%, #2d2118 100%);
  border-bottom-color: rgba(168, 121, 69, 0.52);
}

.dark-mode .form-group label,
.dark-mode .page-header .subtitle,
.dark-mode .style-list-label,
.dark-mode .kb-detail summary,
.dark-mode .breakdown summary {
  color: var(--color-text-secondary);
}

.dark-mode .form-group input,
.dark-mode .form-group select,
.dark-mode .form-group textarea,
.dark-mode .script-document-picker,
.dark-mode .current-script-document,
.dark-mode .btn-copy,
.dark-mode .btn-sm,
.dark-mode .btn-copy-video-url,
.dark-mode .btn-download-video,
.dark-mode .btn-open-folder,
.dark-mode .theme-toggle {
  background: #34261c;
  border-color: #6a4c31;
  color: var(--color-text);
}

.dark-mode .form-group input:focus,
.dark-mode .form-group select:focus,
.dark-mode .form-group textarea:focus,
.dark-mode .prompt-editor:focus {
  background: #3d2b1f;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 129, 58, 0.18);
}

.dark-mode .btn-save-config {
  background: #4a2d1c;
  border-color: rgba(255, 129, 58, 0.5);
  color: #ffc09a;
}

.dark-mode .btn-save-config:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #20130c;
}

.dark-mode .btn-secondary,
.dark-mode .btn-generate-video {
  background: #26392f;
  border-color: rgba(183, 214, 197, 0.35);
  color: #d4eadf;
}

.dark-mode .btn-secondary:hover,
.dark-mode .btn-generate-video:hover {
  background: #385647;
  border-color: #b7d6c5;
  color: #fff8ed;
}

.dark-mode .style-list,
.dark-mode .style-summary,
.dark-mode .breakdown,
.dark-mode .model-error,
.dark-mode .video-usage-info {
  background: #34261c;
}

.dark-mode .style-list-item {
  background: #34261c;
  border-color: #6a4c31;
}

.dark-mode .style-list-item:hover {
  background: #412d1e;
  border-color: rgba(255, 129, 58, 0.5);
}

.dark-mode .style-list-item.selected {
  background: linear-gradient(180deg, #4d2f1d 0%, #3a281b 100%);
  border-color: rgba(255, 129, 58, 0.8);
}

.dark-mode .style-list-item.selected .style-list-item-label {
  color: #ffb487;
}

.dark-mode .style-summary {
  background: linear-gradient(180deg, #344638 0%, #26392f 100%);
  border-color: rgba(183, 214, 197, 0.28);
}

.dark-mode .style-detail-label {
  color: #d4eadf;
}

.dark-mode .style-detail-value {
  color: #fff8ed;
}

.dark-mode .style-detail-row,
.dark-mode .history-item {
  border-bottom-color: rgba(183, 214, 197, 0.18);
}

.dark-mode .history-item-meta,
.dark-mode .video-history-usage,
.dark-mode .kb-template-applicable {
  color: var(--color-text-muted);
}

.dark-mode .prompt-output,
.dark-mode .prompt-editor,
.dark-mode .raw-response-detail pre {
  background: #160f0b;
  border-color: #6a4c31;
  color: #fff8ed;
}

.dark-mode .badge-model,
.dark-mode .video-gen-status.loading {
  background: #4a2d1c;
  border-color: rgba(255, 129, 58, 0.36);
  color: #ffc09a;
}

.dark-mode .badge-success,
.dark-mode .video-gen-status.success {
  background: #26392f;
  border-color: rgba(138, 200, 159, 0.28);
  color: var(--color-success);
}

.dark-mode .badge-local,
.dark-mode .model-error {
  background: #40301f;
  border-color: rgba(230, 179, 110, 0.3);
  color: var(--color-warning);
}

.dark-mode .model-error-detail,
.dark-mode .model-error-checks {
  color: var(--color-text-muted);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea,
body.dark-mode textarea.script-input,
body.dark-mode .prompt-editor {
  background-color: #34261c;
  border-color: #6a4c31;
  color: #fff8ed;
}

body.dark-mode .form-group input::placeholder,
body.dark-mode .form-group textarea::placeholder {
  color: #c9ad8e;
}

textarea.prompt-editor,
body.dark-mode textarea.prompt-editor {
  background: #211a14;
  background-color: #211a14;
  color: #fff6e8;
  caret-color: #fff6e8;
  border-color: #7f5d3e;
}

textarea.prompt-editor:focus,
body.dark-mode textarea.prompt-editor:focus {
  background: #211a14;
  background-color: #211a14;
  color: #fff6e8;
  border-color: var(--color-primary);
}

textarea.prompt-editor::selection {
  background: rgba(255, 180, 135, 0.35);
  color: #fff;
}

#generateVideo.btn-generate-video,
body.dark-mode #generateVideo.btn-generate-video {
  min-width: 132px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
  background: linear-gradient(180deg, #e46b2b 0%, var(--color-primary) 100%);
  border: 1px solid #a93d13;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

#generateVideo.btn-generate-video:hover,
body.dark-mode #generateVideo.btn-generate-video:hover {
  color: #fff;
  background: linear-gradient(180deg, #d85b21 0%, var(--color-primary-hover) 100%);
  border-color: #a93d13;
  transform: translateY(-1px);
}

#generateVideo.btn-generate-video:disabled,
body.dark-mode #generateVideo.btn-generate-video:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#videoResult {
  display: none !important;
}

/* ============================================================
   Theme schemes and recent workflow polish
   ============================================================ */

body.theme-maillard {
  --color-bg: #f6efe3;
  --color-surface: #fffaf2;
  --color-card: #fffdf8;
  --color-border: #dec8a8;
  --color-border-strong: #a87945;
  --color-text: #241810;
  --color-text-secondary: #60452c;
  --color-text-hint: #92775b;
  --color-text-muted: #806a52;
  --color-primary: #f26a21;
  --color-primary-hover: #c94d12;
  --color-primary-light: #fff0df;
  --color-success: #2d7551;
  --color-warning: #a66b1f;
  --color-danger: #a43b2e;
  --color-accent: #183f35;
  --color-accent-light: #edf4ee;
  --theme-page-start: #fff7ec;
  --theme-page-mid: #f6efe3;
  --theme-page-end: #ead9bf;
  --theme-card-header-start: #fffaf2;
  --theme-card-header-end: #f6ead8;
  --theme-primary-top: #ff813a;
}

body.theme-morandi {
  --color-bg: #eef1ed;
  --color-surface: #fbfbf6;
  --color-card: #fffef9;
  --color-border: #cfd8d0;
  --color-border-strong: #94a59b;
  --color-text: #26312d;
  --color-text-secondary: #5a6a64;
  --color-text-hint: #83918a;
  --color-text-muted: #76847e;
  --color-primary: #8d7565;
  --color-primary-hover: #6f5a4c;
  --color-primary-light: #f1ebe5;
  --color-success: #5b8973;
  --color-warning: #a68453;
  --color-danger: #a8645d;
  --color-accent: #6f8790;
  --color-accent-light: #e8eef0;
  --theme-page-start: #f9faf5;
  --theme-page-mid: #eef1ed;
  --theme-page-end: #dde5df;
  --theme-card-header-start: #fbfbf6;
  --theme-card-header-end: #edf2ed;
  --theme-primary-top: #a18676;
}

body.theme-macaron {
  --color-bg: #f8f0f4;
  --color-surface: #fffafd;
  --color-card: #ffffff;
  --color-border: #ead6e2;
  --color-border-strong: #caa8bb;
  --color-text: #2a2530;
  --color-text-secondary: #6d5d71;
  --color-text-hint: #9b8497;
  --color-text-muted: #887588;
  --color-primary: #e6799e;
  --color-primary-hover: #c65a80;
  --color-primary-light: #fff0f6;
  --color-success: #66a98e;
  --color-warning: #c79b4a;
  --color-danger: #c85d68;
  --color-accent: #6e8fd6;
  --color-accent-light: #eef3ff;
  --theme-page-start: #fff7fb;
  --theme-page-mid: #f8f0f4;
  --theme-page-end: #eaf2ff;
  --theme-card-header-start: #fffafd;
  --theme-card-header-end: #f7edf7;
  --theme-primary-top: #ff93b8;
}

body.theme-dopamine {
  --color-bg: #fff5e6;
  --color-surface: #fffefa;
  --color-card: #ffffff;
  --color-border: #f2c8aa;
  --color-border-strong: #ef7f47;
  --color-text: #201624;
  --color-text-secondary: #624d68;
  --color-text-hint: #8f7697;
  --color-text-muted: #7d687f;
  --color-primary: #ff4f7b;
  --color-primary-hover: #d93663;
  --color-primary-light: #ffeaf0;
  --color-success: #00a878;
  --color-warning: #ff9f1c;
  --color-danger: #e43d30;
  --color-accent: #1f72ff;
  --color-accent-light: #eaf2ff;
  --theme-page-start: #fff7d8;
  --theme-page-mid: #fff0ee;
  --theme-page-end: #e8f2ff;
  --theme-card-header-start: #fffefa;
  --theme-card-header-end: #fff0c8;
  --theme-primary-top: #ff7aa0;
}

body.dark-mode.theme-maillard,
body.dark-mode.theme-morandi,
body.dark-mode.theme-macaron,
body.dark-mode.theme-dopamine {
  --color-bg: #1f1714;
  --color-surface: #2d241f;
  --color-card: #281f1b;
  --color-border: #5b473d;
  --color-border-strong: #9d7561;
  --color-text: #fff8f0;
  --color-text-secondary: #ead7c8;
  --color-text-hint: #c5ab99;
  --color-text-muted: #d5bfae;
  --color-primary-light: #44291f;
  --color-accent-light: #243336;
  --theme-page-start: #221817;
  --theme-page-mid: #1b1616;
  --theme-page-end: #161313;
  --theme-card-header-start: #30231d;
  --theme-card-header-end: #261d19;
}

body.dark-mode.theme-morandi {
  --color-primary: #bba494;
  --color-primary-hover: #d1b9a7;
  --color-accent: #9db5bc;
  --color-success: #92c2a9;
  --color-warning: #d8bb83;
  --color-danger: #d38b84;
}

body.dark-mode.theme-macaron {
  --color-primary: #ff9abd;
  --color-primary-hover: #ffb3cb;
  --color-accent: #9fb8ff;
  --color-success: #8bd4bb;
  --color-warning: #e8c57b;
  --color-danger: #ef8d98;
}

body.dark-mode.theme-dopamine {
  --color-primary: #ff6f98;
  --color-primary-hover: #ff8bad;
  --color-accent: #75a7ff;
  --color-success: #5de0b8;
  --color-warning: #ffc457;
  --color-danger: #ff8177;
}

body {
  background:
    linear-gradient(180deg, var(--theme-page-start, #fff7ec) 0%, var(--theme-page-mid, #f6efe3) 48%, var(--theme-page-end, #ead9bf) 100%),
    repeating-linear-gradient(90deg, rgba(85, 58, 35, 0.018) 0, rgba(85, 58, 35, 0.018) 1px, transparent 1px, transparent 18px);
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
}

.page-title-block {
  min-width: 0;
}

.page-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.theme-scheme-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.theme-select {
  height: 34px;
  min-width: 104px;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  color: var(--color-text);
  font-size: 0.82rem;
  outline: none;
}

.theme-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent);
}

.card-header {
  background: linear-gradient(180deg, var(--theme-card-header-start, #fffaf2) 0%, var(--theme-card-header-end, #f6ead8) 100%);
}

.video-breakdown-grid,
.template-select-row,
.template-generate-row,
.video-result-actions,
.script-actions,
.report-actions {
  row-gap: 10px;
}

.video-breakdown-grid,
.script-actions {
  --video-input-width: 520px;
}

.video-download-group,
.video-analysis-file-group {
  align-self: end;
}

.video-analysis-file-group input[type="file"] {
  width: 100%;
  max-width: none;
}

.video-analysis-report,
.template-key-points,
.video-result,
.history-item {
  border-color: color-mix(in srgb, var(--color-border) 82%, var(--color-primary) 18%);
}

.video-analysis-report-header,
.current-script-document-header {
  background: linear-gradient(180deg, var(--color-primary-light), color-mix(in srgb, var(--color-primary-light) 62%, var(--color-card) 38%));
}

.btn-save-config,
.btn-generate,
#generateVideo.btn-generate-video,
body.dark-mode #generateVideo.btn-generate-video {
  background: linear-gradient(180deg, var(--theme-primary-top, #ff813a) 0%, var(--color-primary) 100%);
  border-color: color-mix(in srgb, var(--color-primary) 76%, #23150d 24%);
  color: #fff;
}

.btn-save-config:hover,
.btn-generate:hover,
#generateVideo.btn-generate-video:hover,
body.dark-mode #generateVideo.btn-generate-video:hover {
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  border-color: var(--color-primary-hover);
  color: #fff;
}

.btn-secondary,
.btn-copy,
.btn-edit,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder {
  background: var(--color-accent-light);
  border-color: color-mix(in srgb, var(--color-accent) 28%, var(--color-border) 72%);
  color: var(--color-accent);
}

.btn-secondary:hover,
.btn-copy:hover,
.btn-edit:hover,
.btn-sm:hover,
.btn-copy-video-url:hover,
.btn-download-video:hover,
.btn-open-folder:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.history-item {
  background: color-mix(in srgb, var(--color-card) 86%, var(--color-primary-light) 14%);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  margin-bottom: 8px;
}

.history-item:last-child {
  margin-bottom: 0;
}

.template-workflow {
  background: color-mix(in srgb, var(--color-card) 72%, var(--color-primary-light) 28%);
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, var(--color-primary) 28%);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.prompt-output {
  border-color: color-mix(in srgb, var(--color-border) 76%, var(--color-primary) 24%);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea,
body.dark-mode textarea.script-input,
body.dark-mode .prompt-editor,
body.dark-mode .theme-select {
  background-color: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

body.dark-mode textarea.prompt-editor,
body.dark-mode .prompt-output {
  background: #1c1614;
  background-color: #1c1614;
  color: var(--color-text);
  border-color: var(--color-border);
}

@media (max-width: 900px) {
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-tools {
    width: 100%;
  }
}

/* ============================================================
   Restore original fixed palette
   ============================================================ */

body:not(.dark-mode) {
  --color-bg: #f6efe3;
  --color-surface: #fffaf2;
  --color-card: #fffdf8;
  --color-border: #dec8a8;
  --color-border-strong: #a87945;
  --color-text: #241810;
  --color-text-secondary: #60452c;
  --color-text-hint: #92775b;
  --color-text-muted: #806a52;
  --color-primary: #f26a21;
  --color-primary-hover: #c94d12;
  --color-primary-light: #fff0df;
  --color-success: #2d7551;
  --color-warning: #a66b1f;
  --color-danger: #a43b2e;
  --color-accent: #183f35;
  --color-accent-light: #edf4ee;
  --theme-page-start: #fff7ec;
  --theme-page-mid: #f6efe3;
  --theme-page-end: #ead9bf;
  --theme-card-header-start: #fffaf2;
  --theme-card-header-end: #f6ead8;
  --theme-primary-top: #ff813a;
}

body.dark-mode {
  --color-bg: #241a13;
  --color-surface: #34261c;
  --color-card: #2d2118;
  --color-border: #6a4c31;
  --color-border-strong: #a87945;
  --color-text: #fff8ed;
  --color-text-secondary: #ead4bb;
  --color-text-hint: #c9ad8e;
  --color-text-muted: #d8bea1;
  --color-primary: #ff813a;
  --color-primary-hover: #ff9a61;
  --color-primary-light: #4a2d1c;
  --color-success: #8ac89f;
  --color-warning: #e6b36e;
  --color-danger: #ef9888;
  --color-accent: #b7d6c5;
  --color-accent-light: #26392f;
  --theme-page-start: #241a13;
  --theme-page-mid: #211812;
  --theme-page-end: #1c140f;
  --theme-card-header-start: #34261c;
  --theme-card-header-end: #2d2118;
  --theme-primary-top: #ff813a;
}

.page-header {
  display: block;
}

.card-header {
  background: linear-gradient(180deg, var(--theme-card-header-start) 0%, var(--theme-card-header-end) 100%);
}

.btn-save-config,
.btn-generate,
#generateVideo.btn-generate-video,
body.dark-mode #generateVideo.btn-generate-video {
  background: linear-gradient(180deg, var(--theme-primary-top) 0%, var(--color-primary) 100%);
  border-color: #a93d13;
  color: #fff;
}

.btn-save-config:hover,
.btn-generate:hover,
#generateVideo.btn-generate-video:hover,
body.dark-mode #generateVideo.btn-generate-video:hover {
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  border-color: var(--color-primary-hover);
  color: #fff;
}

.btn-secondary,
.btn-copy,
.btn-edit,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder {
  background: var(--color-accent-light);
  border-color: rgba(24, 63, 53, 0.35);
  color: var(--color-accent);
}

.btn-secondary:hover,
.btn-copy:hover,
.btn-edit:hover,
.btn-sm:hover,
.btn-copy-video-url:hover,
.btn-download-video:hover,
.btn-open-folder:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fffaf2;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 247, 236, 0.78), rgba(47, 32, 20, 0.5)),
    rgba(18, 14, 10, 0.46);
  backdrop-filter: blur(12px);
}

.auth-card {
  width: min(420px, 100%);
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-card);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-card-header {
  display: flex;
  align-items: center;
  padding: 18px 20px 15px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, var(--theme-card-header-start) 0%, var(--theme-card-header-end) 100%);
}

.auth-card h2 {
  margin: 0;
  color: var(--color-text);
  font-size: 21px;
  line-height: 1.25;
}

.auth-card p {
  margin: 0;
  padding: 16px 20px 2px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.auth-field {
  padding: 0 20px;
  margin-top: 12px;
}

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

.auth-field input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.auth-field input:focus {
  border-color: var(--color-primary);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(242, 106, 33, 0.14);
}

.auth-password-control {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.auth-password-control input {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.auth-password-control input:focus {
  position: relative;
  z-index: 1;
}

.auth-password-toggle {
  flex: 0 0 58px;
  min-height: 38px;
  border: 1px solid var(--color-border);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.auth-password-toggle:hover {
  background: var(--color-accent);
  color: #fffaf2;
}

.auth-submit {
  width: calc(100% - 40px);
  min-height: 40px;
  margin: 16px 20px 0;
  border-radius: var(--radius-sm);
}

.auth-message {
  min-height: 34px;
  padding: 10px 20px 16px;
  color: var(--color-danger);
  font-size: 13px;
  line-height: 1.45;
}

input.server-managed {
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.account-current-user {
  margin-bottom: 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.account-login-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.account-login-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
}

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

.account-login-item strong {
  display: block;
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.account-module-field {
  grid-column: 2 / -1;
}

.account-module-options,
.account-module-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.2;
}

.checkbox-inline input {
  width: auto;
  margin: 0;
}

.account-module-row {
  margin-top: 8px;
}

.account-module-static {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
  color: var(--color-text-muted);
  font-size: 12px;
}

.accounts-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}

.account-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.account-meta strong {
  color: var(--color-text);
  font-size: 14px;
}

.account-meta span {
  color: var(--color-text-muted);
  font-size: 12px;
}

.account-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.user-session-bar {
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.access-logs-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.access-log-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(222, 200, 168, 0.76);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.access-log-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.access-log-main strong {
  color: var(--color-text);
  font-size: 13px;
}

.access-log-main span,
.access-log-detail {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.access-log-status {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.access-log-status.success {
  border-color: rgba(45, 117, 81, 0.28);
  background: rgba(45, 117, 81, 0.1);
  color: var(--color-success);
}

.access-log-status.failed {
  border-color: rgba(164, 59, 46, 0.25);
  background: rgba(164, 59, 46, 0.1);
  color: var(--color-danger);
}

.access-log-status.warning {
  border-color: rgba(166, 107, 31, 0.28);
  background: rgba(166, 107, 31, 0.1);
  color: var(--color-warning);
}

body.admin-console .main-layout {
  grid-template-columns: minmax(320px, 760px);
  justify-content: center;
}

body.admin-console .sidebar-left {
  width: 100%;
}

body.user-console .main-layout {
  grid-template-columns: 280px minmax(0, 960px);
  justify-content: center;
}

body.user-console #toolSidebarRight,
body.admin-console #generationHistoryCard {
  display: none;
}

body.user-console #modelConfigCard,
body.user-console #accountManagementCard,
body.user-console #accessLogCard,
body.user-console #modelCallLogCard,
body.user-console #rulesKnowledgeCard {
  display: none;
}

body.dark-mode .auth-overlay {
  background:
    linear-gradient(180deg, rgba(36, 26, 19, 0.82), rgba(18, 13, 9, 0.7)),
    rgba(0, 0, 0, 0.38);
}

body.dark-mode .auth-field input {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

body.dark-mode .auth-field input:focus {
  background: #3d2b1f;
  border-color: var(--color-primary);
}

body.dark-mode .auth-password-toggle {
  background: var(--color-accent-light);
  border-color: var(--color-border);
  color: var(--color-accent);
}

body.dark-mode .auth-password-toggle:hover {
  background: var(--color-accent);
  color: #20130c;
}

.module-nav-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}

body.user-console .module-nav-panel {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  justify-content: center;
  gap: 12px;
}

.module-nav-item {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.92);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.module-nav-item:hover {
  border-color: var(--color-border-strong);
  background: #fffaf2;
  transform: translateY(-1px);
}

.module-nav-item.active {
  border-color: var(--color-primary);
  background: linear-gradient(180deg, #fff7eb 0%, #fffdf8 100%);
  box-shadow: 0 10px 24px rgba(173, 92, 24, 0.12);
}

.module-nav-title {
  font-size: 16px;
  font-weight: 750;
  line-height: 1.25;
}

.module-nav-desc {
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.module-nav-item.active .module-nav-title {
  color: var(--color-primary);
}

.workbench-module {
  min-width: 0;
}

.sixty-second-workbench {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sixty-second-brief-panel .analysis-report-input {
  min-height: 160px;
}

.sixty-second-output-panel {
  margin-top: 2px;
}

.sixty-second-output-panel .prompt-output {
  min-height: 360px;
  max-height: 620px;
}

body.module-main-image .main-layout {
  grid-template-columns: 280px minmax(0, 960px);
  justify-content: center;
}

body.module-main-image #toolSidebarRight {
  display: none;
}

body.dark-mode .module-nav-item {
  background: rgba(54, 39, 29, 0.92);
}

body.dark-mode .module-nav-item:hover {
  background: rgba(63, 45, 33, 0.96);
}

body.dark-mode .module-nav-item.active {
  background: linear-gradient(180deg, rgba(94, 55, 29, 0.92) 0%, rgba(54, 39, 29, 0.96) 100%);
}

@media (max-width: 900px) {
  body.user-console .module-nav-panel,
  .module-nav-panel {
    grid-template-columns: 1fr;
  }

  .module-nav-item {
    min-height: 68px;
  }
}

/* ============================================================
   UI polish layer - 2026-08-01
   ============================================================ */

:root {
  --color-bg: #f5f1ea;
  --color-surface: #fffaf3;
  --color-card: #fffefd;
  --color-border: #d8c9b6;
  --color-border-strong: #ad8f69;
  --color-text: #1e221f;
  --color-text-secondary: #5d5348;
  --color-text-hint: #8b7a68;
  --color-primary: #e15b22;
  --color-primary-hover: #bd4617;
  --color-primary-light: #fff0e4;
  --color-accent: #155e52;
  --color-accent-light: #eef7f3;
  --color-success: #27764d;
  --color-warning: #aa6b18;
  --color-danger: #b23b2f;
  --shadow-sm: 0 1px 2px rgba(27, 20, 13, 0.04), 0 8px 20px rgba(84, 61, 36, 0.06);
  --shadow-md: 0 8px 24px rgba(36, 25, 14, 0.08);
  --shadow-lg: 0 20px 60px rgba(28, 22, 16, 0.18);
}

body {
  background:
    radial-gradient(circle at 16% -10%, rgba(225, 91, 34, 0.1), transparent 32%),
    linear-gradient(180deg, #fffaf3 0%, #f5f1ea 42%, #ece2d4 100%);
  color: var(--color-text);
}

.app-container {
  max-width: 1440px;
  padding: 24px 28px 48px;
}

.page-header {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 16px 0 18px;
  border-bottom: 1px solid rgba(173, 143, 105, 0.34);
}

.page-title-row {
  width: 100%;
  justify-content: flex-start;
}

.page-header h1 {
  font-size: 1.72rem;
  font-weight: 760;
}

.user-session-bar {
  margin-left: auto;
  padding: 4px 0;
}

.module-nav-panel {
  max-width: 1280px;
  margin: 16px auto 22px;
  gap: 14px;
}

.module-nav-item {
  min-height: 70px;
  padding: 14px 18px;
  border-color: rgba(216, 201, 182, 0.92);
  background: rgba(255, 254, 253, 0.9);
  box-shadow: var(--shadow-sm);
}

.module-nav-item:hover {
  background: #ffffff;
  box-shadow: var(--shadow-md);
}

.module-nav-item.active {
  border-color: var(--color-primary);
  background: linear-gradient(180deg, #fff8ef 0%, #ffffff 100%);
  box-shadow: 0 10px 26px rgba(225, 91, 34, 0.12);
}

.module-nav-title {
  font-size: 0.98rem;
  font-weight: 780;
}

.module-nav-desc {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

.main-layout,
body.user-console .main-layout,
body.module-main-image .main-layout {
  grid-template-columns: 280px minmax(0, 980px);
  gap: 18px;
  justify-content: center;
}

body.admin-console .main-layout {
  grid-template-columns: minmax(360px, 860px);
}

.card {
  border-color: rgba(216, 201, 182, 0.94);
  background: rgba(255, 254, 253, 0.96);
  box-shadow: var(--shadow-sm);
}

.card-header {
  min-height: 48px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #fffaf3 0%, #f5ecdf 100%);
}

.card-header h2 {
  font-size: 0.94rem;
  font-weight: 780;
}

.card-body {
  padding: 16px 18px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label,
.auth-field label {
  color: #4f453a;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.form-group input,
.form-group select,
.form-group textarea,
.auth-field input {
  min-height: 38px;
  border-color: rgba(216, 201, 182, 0.98);
  background: #fffbf5;
}

.form-group textarea {
  line-height: 1.55;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover,
.auth-field input:hover {
  border-color: var(--color-border-strong);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.auth-field input:focus {
  border-color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(225, 91, 34, 0.13);
}

button,
.btn-save-config,
.btn-generate,
.btn-copy,
.btn-edit,
.btn-generate-video,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder {
  min-height: 34px;
  border-radius: var(--radius-sm);
  font-weight: 720;
}

.btn-save-config,
.btn-generate,
#generateVideo.btn-generate-video,
body.dark-mode #generateVideo.btn-generate-video {
  background: linear-gradient(180deg, #ff7535 0%, var(--color-primary) 100%);
  border-color: var(--color-primary);
  color: #ffffff;
}

.btn-save-config:hover,
.btn-generate:hover,
#generateVideo.btn-generate-video:hover,
body.dark-mode #generateVideo.btn-generate-video:hover {
  background: linear-gradient(180deg, #f06428 0%, var(--color-primary-hover) 100%);
  border-color: var(--color-primary-hover);
}

.btn-secondary,
.btn-copy,
.btn-edit,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder,
.btn-generate-video {
  background: var(--color-accent-light);
  border-color: #9bb9ae;
  color: var(--color-accent);
}

.btn-secondary:hover,
.btn-copy:hover,
.btn-edit:hover,
.btn-sm:hover,
.btn-copy-video-url:hover,
.btn-download-video:hover,
.btn-open-folder:hover,
.btn-generate-video:hover {
  background: #dff0e9;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.theme-toggle {
  top: 18px;
  right: 20px;
  border-color: rgba(216, 201, 182, 0.9);
  background: rgba(255, 254, 253, 0.94);
  box-shadow: var(--shadow-sm);
}

.auth-overlay {
  background:
    linear-gradient(180deg, rgba(245, 241, 234, 0.72), rgba(56, 47, 39, 0.48)),
    rgba(20, 16, 12, 0.18);
  backdrop-filter: blur(8px);
}

.auth-card {
  width: min(420px, calc(100vw - 32px));
  border-color: rgba(216, 201, 182, 0.95);
  box-shadow: var(--shadow-lg);
}

.auth-card-header {
  min-height: 58px;
  padding: 18px 20px 14px;
}

.auth-card h2 {
  font-size: 1.18rem;
}

.auth-card p {
  padding: 16px 20px 2px;
}

.auth-submit {
  min-height: 42px;
}

.auth-message {
  min-height: 28px;
  padding: 9px 20px 6px;
}

.auth-contact {
  padding: 0 20px 18px;
  color: var(--color-text-hint);
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
}

.auth-contact a {
  color: var(--color-accent);
  font-weight: 700;
  text-decoration: none;
}

.auth-contact a:hover {
  text-decoration: underline;
}

.toolbox-landing {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 72px);
  padding: 28px 0;
}

.toolbox-home-shell {
  width: min(980px, 100%);
  margin: 0 auto;
}

.toolbox-home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(209, 184, 151, 0.82);
}

.toolbox-brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.toolbox-brand-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(216, 201, 182, 0.96);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 243, 0.92);
  box-shadow: var(--shadow-sm);
  font-size: 1.55rem;
}

.toolbox-home-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid rgba(125, 166, 153, 0.72);
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: 0.82rem;
  font-weight: 720;
}

.toolbox-kicker {
  color: var(--color-primary);
  font-size: 0.86rem;
  font-weight: 760;
  line-height: 1.2;
}

.toolbox-home-header h1 {
  margin-top: 5px;
  color: var(--color-text);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 820;
  line-height: 1.12;
}

.toolbox-home-panel {
  border: 1px solid rgba(209, 184, 151, 0.86);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.78);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.toolbox-home-copy {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(216, 201, 182, 0.82);
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.92) 0%, rgba(255, 252, 247, 0.74) 100%);
}

.toolbox-home-copy h2 {
  color: var(--color-text);
  font-size: 1.28rem;
  font-weight: 820;
  line-height: 1.25;
}

.toolbox-home-copy p {
  max-width: 38em;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
  text-align: right;
}

.toolbox-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
  padding: 22px;
}

.toolbox-entry-card {
  appearance: none;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon title"
    "icon desc"
    "icon action";
  column-gap: 14px;
  row-gap: 6px;
  min-height: 146px;
  padding: 22px;
  border: 1px solid rgba(216, 201, 182, 0.96);
  border-radius: var(--radius-lg);
  background: rgba(255, 254, 253, 0.94);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.toolbox-entry-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  background: #fffdf9;
  box-shadow: var(--shadow-md);
}

.toolbox-entry-card:focus-visible {
  outline: 2px solid rgba(245, 99, 35, 0.38);
  outline-offset: 2px;
}

.toolbox-entry-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(216, 201, 182, 0.95);
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  font-size: 1.45rem;
}

.toolbox-entry-title {
  grid-area: title;
  align-self: end;
  font-size: 1.18rem;
  font-weight: 820;
  line-height: 1.25;
}

.toolbox-entry-desc {
  grid-area: desc;
  max-width: 34em;
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  line-height: 1.55;
}

.toolbox-entry-action {
  grid-area: action;
  align-self: end;
  width: max-content;
  margin-top: 8px;
  padding: 4px 10px;
  border: 1px solid rgba(125, 166, 153, 0.65);
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: 0.82rem;
  font-weight: 720;
}

.toolbox-home-footer {
  display: flex;
  justify-content: center;
  padding: 16px 12px 0;
  color: var(--color-text-hint);
  font-size: 0.78rem;
  line-height: 1.5;
}

.toolbox-home-footer span {
  padding: 3px 8px;
}

.live-dashboard-placeholder .card-body {
  background: var(--color-card);
  color: var(--color-text);
}

.live-dashboard-placeholder .topic-workbench {
  gap: 14px;
}

.live-dashboard-hero {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(216, 201, 182, 0.95);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fffaf2 0%, #fff5ea 100%);
}

.live-dashboard-hero p {
  max-width: 920px;
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.7;
  font-size: 0.9rem;
}

.live-dashboard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.live-dashboard-steps span {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(125, 166, 153, 0.62);
  border-radius: var(--radius-sm);
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.live-dashboard-steps span:not(:last-child)::after {
  content: ">";
  position: absolute;
  right: -13px;
  color: var(--color-text-hint);
  font-size: 0.78rem;
}

.live-dashboard-output-map {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.live-dashboard-output-map span {
  color: var(--color-text-hint);
  font-size: 0.82rem;
}

.live-dashboard-output-map strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(243, 111, 45, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(255, 247, 237, 0.84);
  color: var(--color-primary);
  font-size: 0.82rem;
  font-weight: 750;
}

.live-dashboard-upload-panel,
.live-dashboard-data-panel,
.live-dashboard-principles {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 242, 0.76);
  box-shadow: var(--shadow-sm);
}

.live-dashboard-upload-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
  align-items: start;
}

.live-dashboard-upload-panel label,
.live-dashboard-data-panel label,
.live-dashboard-choice-group strong {
  color: var(--color-text);
}

.live-dashboard-upload-panel .hint,
.live-dashboard-data-title span,
.live-dashboard-file-count {
  color: var(--color-text-hint);
}

.live-dashboard-upload-panel input[type="file"] {
  width: 100%;
  min-height: 42px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}

.live-dashboard-file-count {
  display: inline-flex;
  margin-top: 8px;
  font-size: 0.82rem;
}

.live-dashboard-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.live-dashboard-choice-group {
  display: grid;
  gap: 8px;
}

.live-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.live-choice-pill {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  color: var(--color-text-secondary);
  font-weight: 650;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.live-choice-pill.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.live-dashboard-data-panel {
  padding: 16px;
}

.live-dashboard-data-title {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(216, 201, 182, 0.78);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 248, 0.74);
}

.live-data-section {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(216, 201, 182, 0.74);
}

.live-data-section h3 {
  margin: 0;
  color: var(--color-primary);
  font-size: 0.95rem;
}

.live-data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
}

.live-data-grid .form-group {
  margin: 0;
}

.live-dashboard-data-panel input[type="text"],
.live-dashboard-data-panel textarea {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.live-dashboard-data-panel input::placeholder,
.live-dashboard-data-panel textarea::placeholder {
  color: var(--color-text-hint);
}

.live-dashboard-check {
  margin-top: 4px;
  color: var(--color-text-secondary);
}

.live-dashboard-form-links {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 14px;
}

.live-dashboard-principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.live-dashboard-principles div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(216, 201, 182, 0.8);
  border-radius: var(--radius-sm);
  background: var(--color-card);
}

.live-dashboard-principles strong {
  color: var(--color-text);
}

.live-dashboard-principles span {
  color: var(--color-text-secondary);
  line-height: 1.6;
  font-size: 0.82rem;
}

.live-dashboard-action-row {
  flex-wrap: wrap;
}

.live-dashboard-action-row #liveDashboardStatus {
  margin-left: auto;
  min-width: 168px;
  justify-content: center;
}

.live-dashboard-primary {
  min-width: 220px;
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: none;
}

.live-dashboard-placeholder .video-analysis-report,
.live-dashboard-placeholder .topic-history-panel {
  background: var(--color-card);
  color: var(--color-text);
}

@media (max-width: 1100px) {
  .live-dashboard-upload-panel,
  .live-data-grid,
  .live-dashboard-principles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .live-dashboard-upload-panel,
  .live-data-grid,
  .live-dashboard-principles {
    grid-template-columns: 1fr;
  }

  .live-dashboard-action-row #liveDashboardStatus {
    width: 100%;
    margin-left: 0;
  }
}

.topic-analysis-placeholder {
  width: min(1180px, 100%);
  margin: 0 auto 18px;
}

.topic-workbench {
  display: grid;
  gap: 14px;
}

.topic-workbench > .report-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topic-workbench > .report-actions #topicAnalysisStatus {
  margin-left: auto;
  min-width: 168px;
  justify-content: center;
  align-self: center;
}

.topic-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.topic-text-input {
  min-height: 130px;
}

.topic-report-input {
  min-height: 260px;
}

.topic-output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.topic-generated-output {
  min-height: 220px;
}

.topic-output-panel {
  margin-top: 0;
}

.topic-history-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-card) 92%, var(--color-primary-light) 8%);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.topic-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-card) 82%, var(--color-primary-light) 18%);
}

.topic-history-heading {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.topic-history-heading strong {
  font-size: 1rem;
  color: var(--color-text);
}

.topic-history-heading span {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.topic-history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topic-history-count,
.topic-history-column h3 span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--color-border) 78%, var(--color-primary) 22%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-card) 84%, var(--color-primary-light) 16%);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 650;
}

.topic-history-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}

.topic-history-column {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.topic-history-column h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text);
}

.topic-history-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.topic-history-list-standalone {
  max-height: 180px;
  padding: 12px;
}

.topic-history-item {
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--color-border) 84%, var(--color-primary) 16%);
  border-radius: var(--radius-sm);
  background: rgba(255, 251, 245, 0.84);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.topic-history-item:hover {
  border-color: color-mix(in srgb, var(--color-primary) 42%, var(--color-border) 58%);
  box-shadow: 0 8px 20px rgba(80, 47, 19, 0.08);
  transform: translateY(-1px);
}

.topic-history-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.topic-history-title-text {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.topic-history-title-text strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.topic-history-type {
  flex-shrink: 0;
  padding: 2px 6px;
  border: 1px solid rgba(125, 166, 153, 0.52);
  border-radius: 999px;
  background: rgba(235, 246, 241, 0.88);
  color: var(--color-primary-dark);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
}

.topic-history-type-generation {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border) 55%);
  background: color-mix(in srgb, var(--color-primary-light) 72%, var(--color-card) 28%);
}

.topic-history-item-title .btn-sm {
  min-height: 28px;
  padding: 3px 9px;
}

.topic-history-item-meta {
  margin-bottom: 5px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.topic-history-item p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-history-empty {
  min-height: 118px;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px dashed color-mix(in srgb, var(--color-border) 82%, var(--color-primary) 18%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-card) 88%, var(--color-surface) 12%);
}

.dark-mode .topic-history-panel {
  background: rgba(21, 32, 31, 0.98);
  border-color: rgba(73, 99, 95, 0.72);
}

.dark-mode .topic-history-header {
  background: linear-gradient(180deg, #1a2927 0%, #15201f 100%);
  border-bottom-color: rgba(73, 99, 95, 0.72);
}

.dark-mode .topic-history-heading span,
.dark-mode .topic-history-item-meta {
  color: var(--color-text-muted);
}

.dark-mode .topic-history-count,
.dark-mode .topic-history-column h3 span {
  background: rgba(23, 48, 45, 0.86);
  border-color: rgba(126, 217, 200, 0.28);
  color: #b7d6c5;
}

.dark-mode .topic-history-item,
.dark-mode .topic-history-empty {
  background: #172221;
  border-color: rgba(73, 99, 95, 0.68);
}

.dark-mode .topic-history-type {
  background: rgba(23, 48, 45, 0.86);
  border-color: rgba(126, 217, 200, 0.38);
  color: #9ce6d8;
}

.dark-mode .topic-history-type-generation {
  background: #34261c;
  border-color: rgba(240, 122, 69, 0.36);
  color: #ffb08a;
}

.empty-state-panel {
  display: grid;
  place-items: center;
  min-height: 260px;
  gap: 8px;
  border: 1px dashed rgba(173, 143, 105, 0.55);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 243, 0.72);
  color: var(--color-text-secondary);
  text-align: center;
}

.empty-state-panel strong {
  color: var(--color-text);
  font-size: 1.2rem;
}

.empty-state-panel span {
  max-width: 36em;
  font-size: 0.88rem;
}

.main-image-generation-board {
  gap: 12px;
}

.main-image-nav-item,
.history-item,
.script-doc-item,
.access-log-row {
  background: rgba(255, 251, 245, 0.82);
}

.main-image-shared-card {
  min-height: 520px;
}

.prompt-textarea,
#videoAnalysisReport,
#visualStyleResult,
.main-image-log-text {
  background: #fffbf5;
}

body.dark-mode {
  --color-bg: #191d1b;
  --color-surface: #202724;
  --color-card: #242a27;
  --color-border: #45514a;
  --color-border-strong: #6e8479;
  --color-text: #f4efe6;
  --color-text-secondary: #c9beb0;
  --color-text-hint: #a99c8d;
  --color-primary-light: #3a2418;
  --color-accent-light: #18332e;
  background:
    radial-gradient(circle at 18% -12%, rgba(225, 91, 34, 0.12), transparent 34%),
    linear-gradient(180deg, #181b19 0%, #151817 100%);
}

body.dark-mode .card,
body.dark-mode .module-nav-item,
body.dark-mode .auth-card {
  background: rgba(36, 42, 39, 0.96);
  border-color: var(--color-border);
}

body.dark-mode .card-header,
body.dark-mode .auth-card-header {
  background: linear-gradient(180deg, #2b332f 0%, #242a27 100%);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea,
body.dark-mode .auth-field input,
body.dark-mode .prompt-textarea,
body.dark-mode #videoAnalysisReport,
body.dark-mode #visualStyleResult,
body.dark-mode .main-image-log-text {
  background: #1f2522;
}

body.dark-mode .auth-contact a {
  color: #9dd1c2;
}

body.dark-mode .toolbox-kicker,
body.dark-mode .toolbox-entry-card,
body.dark-mode .toolbox-home-panel,
body.dark-mode .toolbox-brand-icon,
body.dark-mode .empty-state-panel {
  background: rgba(36, 42, 39, 0.92);
  border-color: var(--color-border);
}

body.dark-mode .toolbox-home-header {
  border-color: var(--color-border);
}

body.dark-mode .toolbox-home-copy {
  background: linear-gradient(180deg, #2b332f 0%, #242a27 100%);
  border-color: var(--color-border);
}

body.dark-mode .toolbox-home-pill,
body.dark-mode .toolbox-entry-action {
  background: rgba(38, 71, 62, 0.62);
  border-color: var(--color-border);
  color: #b8dfd3;
}

body.dark-mode .toolbox-entry-card:hover {
  background: rgba(43, 51, 47, 0.98);
}

body.dark-mode .toolbox-entry-icon {
  background: var(--color-primary-light);
  border-color: var(--color-border);
}

@media (max-width: 1100px) {
  .app-container {
    padding: 18px 16px 40px;
  }

  .main-layout,
  body.user-console .main-layout,
  body.module-main-image .main-layout {
    grid-template-columns: 1fr;
    max-width: 980px;
    margin: 0 auto;
  }

  .sidebar-left {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 720px) {
  .page-header {
    align-items: flex-start;
  }

  .page-header h1 {
    font-size: 1.38rem;
  }

  .user-session-bar {
    margin-left: 0;
  }

  .sidebar-left {
    grid-template-columns: 1fr;
  }

  .card-body {
    padding: 14px;
  }

  .toolbox-entry-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .toolbox-entry-card {
    min-height: 132px;
    padding: 20px;
  }

  .toolbox-home-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbox-home-copy {
    display: block;
    padding: 18px;
  }

  .toolbox-home-copy p {
    margin-top: 8px;
    text-align: left;
  }
}

/* ==========================================================
   功能测试专区 · 创意提示词生成
   ========================================================== */

.creative-prompt-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

body.module-creative-prompt .main-layout {
  grid-template-columns: 280px minmax(0, 960px);
  justify-content: center;
}

body.module-creative-prompt .creative-prompt-placeholder {
  display: block;
}

body.module-creative-prompt .creative-prompt-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

body.module-creative-prompt .creative-prompt-grid .creative-form-col:first-child {
  display: none;
}

body.module-creative-prompt .creative-form-col {
  padding: 0;
  border: 0;
  background: transparent;
}

body.module-creative-prompt .creative-col-title {
  display: none;
}

.creative-form-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.creative-col-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.creative-form-col .form-group {
  margin-bottom: 0;
}

.creative-form-col .form-group input {
  width: 100%;
}

.creative-input {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.7;
}

body.module-creative-prompt .creative-input {
  min-height: 250px;
}

body.module-creative-prompt .creative-archive-actions {
  margin-top: 8px;
  align-items: center;
  gap: 10px;
}

body.module-creative-prompt .creative-history-picker {
  margin-top: 8px;
}

.creative-generate-heading {
  margin-top: 18px;
  padding: 10px 0 8px;
  color: var(--color-text);
  font-size: 0.88rem;
  font-weight: 700;
}

body.module-creative-prompt .creative-generate-heading {
  margin: 20px -16px 0;
  padding: 11px 16px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, var(--theme-card-header-start) 0%, var(--theme-card-header-end) 100%);
}

.creative-prompt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

body.module-creative-prompt .creative-prompt-toolbar {
  align-items: center;
  margin-top: 10px;
  border-color: color-mix(in srgb, var(--color-primary) 52%, var(--color-border) 48%);
}

body.module-creative-prompt .creative-template-workflow {
  gap: 10px;
  margin: 14px 0 10px;
  padding: 10px;
  border-color: color-mix(in srgb, var(--color-primary) 58%, var(--color-border) 42%);
  background: color-mix(in srgb, var(--color-card) 74%, var(--color-primary-light) 26%);
}

body.module-creative-prompt .creative-template-workflow .template-select-row {
  align-items: stretch;
}

body.module-creative-prompt .creative-template-workflow .template-select-group {
  flex-basis: 130px;
}

body.module-creative-prompt .creative-template-workflow .btn-generate {
  min-width: 96px;
  padding: 7px 14px;
  font-size: 0.78rem;
}

body.module-creative-prompt .creative-template-workflow .inline-generation-status {
  flex: 1 1 360px;
}

body.module-creative-prompt .prompt-section {
  margin-top: 10px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 58%, var(--color-border) 42%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-card) 78%, var(--color-primary-light) 22%);
}

body.module-creative-prompt .prompt-header {
  margin-bottom: 8px;
}

body.module-creative-prompt .prompt-header .prompt-version-tab,
body.module-creative-prompt .prompt-header .btn-copy,
body.module-creative-prompt .prompt-header .btn-edit {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: nowrap;
}

body.module-creative-prompt .prompt-header .prompt-version-tab {
  width: 68px;
}

body.module-creative-prompt .prompt-header .btn-copy,
body.module-creative-prompt .prompt-header .btn-edit {
  width: 44px;
}

body.module-creative-prompt .prompt-output,
body.module-creative-prompt .prompt-editor {
  min-height: 76px;
  border-radius: var(--radius-sm);
}

.creative-prompt-toolbar .creative-template-group {
  min-width: 220px;
  margin-bottom: 0;
}

.creative-prompt-toolbar .creative-template-group select {
  width: 100%;
}

.creative-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
}

.creative-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.creative-prompt-placeholder .prompt-section {
  margin-top: 16px;
}

.creative-prompt-placeholder .prompt-output {
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
}

body.dark-mode .creative-form-col,
body.dark-mode .creative-prompt-toolbar {
  background: var(--color-card);
  border-color: var(--color-border);
}

body.dark-mode.module-creative-prompt .creative-form-col {
  background: transparent;
  border-color: transparent;
}

@media (max-width: 960px) {
  .creative-prompt-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .creative-input {
    min-height: 260px;
  }

  .model-status-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

/* ==========================================================
   Overall workbench UI refresh - 2026-09-10
   ========================================================== */

:root {
  --color-bg: #f4f3ef;
  --color-surface: #fbfaf6;
  --color-card: #ffffff;
  --color-border: #d8d3ca;
  --color-border-strong: #afa397;
  --color-text: #1d241f;
  --color-text-secondary: #5b615a;
  --color-text-hint: #8a8177;
  --color-primary: #e65f2a;
  --color-primary-hover: #c84a19;
  --color-primary-light: #fff0e7;
  --color-accent: #11675f;
  --color-accent-light: #edf7f4;
  --color-success: #24764f;
  --color-warning: #a86517;
  --color-danger: #b43c32;
  --shadow-sm: 0 1px 2px rgba(20, 24, 21, 0.04), 0 8px 24px rgba(58, 49, 38, 0.06);
  --shadow-md: 0 8px 24px rgba(34, 31, 27, 0.09);
  --shadow-lg: 0 18px 54px rgba(29, 26, 22, 0.16);
}

html {
  scroll-behavior: smooth;
}

body {
  background: linear-gradient(180deg, #f9f8f4 0%, #f3f1eb 48%, #ebe8df 100%);
  color: var(--color-text);
  font-size: 14px;
}

.app-container {
  max-width: 1480px;
  padding: 18px 24px 40px;
}

.workspace-shell {
  min-width: 0;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 62px;
  margin: -18px -24px 0;
  padding: 12px 24px;
  background: rgba(249, 248, 244, 0.92);
  border-bottom: 1px solid rgba(216, 211, 202, 0.9);
  backdrop-filter: blur(14px);
}

.page-header h1 {
  font-size: 1.45rem;
  font-weight: 780;
}

.user-session-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 6px;
  border: 1px solid rgba(216, 211, 202, 0.9);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
}

#userSessionText {
  padding: 0 6px;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}

.theme-toggle {
  position: fixed;
  top: 72px;
  right: 18px;
  z-index: 40;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
}

.module-nav-panel,
body.user-console .module-nav-panel {
  position: sticky;
  top: 62px;
  z-index: 24;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 10px;
  max-width: none;
  margin: 0 -4px 18px;
  padding: 12px 4px;
  background: rgba(244, 243, 239, 0.88);
  backdrop-filter: blur(12px);
}

.module-nav-item {
  position: relative;
  min-height: 62px;
  padding: 12px 14px;
  border: 1px solid rgba(216, 211, 202, 0.96);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.module-nav-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
}

.module-nav-item:hover {
  border-color: rgba(175, 163, 151, 0.95);
  background: #ffffff;
  box-shadow: var(--shadow-md);
}

.module-nav-item.active {
  border-color: color-mix(in srgb, var(--color-primary) 72%, var(--color-border) 28%);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(230, 95, 42, 0.13);
}

.module-nav-item.active::before {
  background: var(--color-primary);
}

.module-nav-title {
  font-size: 0.95rem;
  line-height: 1.25;
}

.module-nav-desc {
  max-width: 32em;
  margin-top: 5px;
  color: var(--color-text-secondary);
  font-size: 0.76rem;
  line-height: 1.35;
}

.main-layout,
body.user-console .main-layout,
body.module-main-image .main-layout,
body.module-creative-prompt .main-layout {
  grid-template-columns: 268px minmax(0, 1030px);
  gap: 16px;
  justify-content: center;
  align-items: start;
}

body.admin-console .main-layout {
  grid-template-columns: minmax(360px, 940px);
}

.sidebar-left,
.content-main,
.sidebar-right,
#toolMain {
  min-width: 0;
}

.sidebar-left {
  position: sticky;
  top: 154px;
  max-height: calc(100vh - 170px);
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.card {
  margin-bottom: 16px;
  border: 1px solid rgba(216, 211, 202, 0.94);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.card-header {
  min-height: 42px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(216, 211, 202, 0.86);
  background: linear-gradient(180deg, #ffffff 0%, #f8f5ef 100%);
}

.card-header h2 {
  font-size: 0.88rem;
  font-weight: 780;
  line-height: 1.25;
}

.card-body {
  padding: 14px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label,
.auth-field label {
  margin-bottom: 5px;
  color: var(--color-text-secondary);
  font-size: 0.76rem;
  line-height: 1.25;
}

.form-group input,
.form-group select,
.form-group textarea,
.auth-field input,
textarea.script-input,
.analysis-report-input,
.prompt-editor,
.prompt-textarea {
  border-radius: 6px;
  border-color: rgba(204, 197, 188, 0.98);
  background: #fffdfa;
  color: var(--color-text);
}

.form-group input,
.form-group select,
.auth-field input {
  min-height: 36px;
}

.form-group textarea,
textarea.script-input,
.analysis-report-input,
.prompt-editor,
.prompt-textarea {
  line-height: 1.6;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.auth-field input:focus,
textarea.script-input:focus,
.analysis-report-input:focus,
.prompt-editor:focus,
.prompt-textarea:focus {
  border-color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(230, 95, 42, 0.13);
}

button,
.btn-save-config,
.btn-generate,
.btn-copy,
.btn-edit,
.btn-generate-video,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder {
  min-height: 32px;
  border-radius: 6px;
  font-weight: 740;
  line-height: 1.2;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
}

.btn-save-config,
.btn-generate,
#generateVideo.btn-generate-video,
body.dark-mode #generateVideo.btn-generate-video {
  background: linear-gradient(180deg, #ff7840 0%, var(--color-primary) 100%);
  border-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(230, 95, 42, 0.18);
}

.btn-save-config:hover,
.btn-generate:hover,
#generateVideo.btn-generate-video:hover,
body.dark-mode #generateVideo.btn-generate-video:hover {
  background: linear-gradient(180deg, #ef6530 0%, var(--color-primary-hover) 100%);
  border-color: var(--color-primary-hover);
  box-shadow: 0 8px 20px rgba(200, 74, 25, 0.22);
}

.btn-secondary,
.btn-copy,
.btn-edit,
.btn-sm,
.btn-copy-video-url,
.btn-download-video,
.btn-open-folder,
.btn-generate-video {
  background: var(--color-accent-light);
  border-color: #a3c1bc;
  color: var(--color-accent);
  box-shadow: none;
}

.btn-secondary:hover,
.btn-copy:hover,
.btn-edit:hover,
.btn-sm:hover,
.btn-copy-video-url:hover,
.btn-download-video:hover,
.btn-open-folder:hover,
.btn-generate-video:hover {
  background: #dff0ec;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.template-workflow,
body.module-creative-prompt .creative-template-workflow {
  padding: 12px;
  border: 1px solid rgba(230, 95, 42, 0.42);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fffaf6 0%, #ffffff 100%);
}

.template-select-row,
body.module-creative-prompt .creative-template-workflow .template-select-row {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.template-select-group {
  margin-bottom: 0;
}

.template-key-points,
.creative-template-key-points {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(230, 95, 42, 0.28);
  border-radius: 6px;
  background: #fffdf9;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.template-generate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.result-status-line {
  flex: 1 1 auto;
  gap: 6px;
}

.result-status-line .generation-steps {
  gap: 5px;
}

.result-status-line .step-item,
.result-status-line .progress-text {
  min-height: 26px;
  border-radius: 6px;
  background: #fbfaf6;
  font-size: 0.75rem;
}

.prompt-section,
body.module-creative-prompt .prompt-section {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(230, 95, 42, 0.42);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fffaf6 0%, #ffffff 100%);
}

.prompt-header {
  gap: 8px;
  margin-bottom: 10px;
}

.prompt-version-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prompt-version-tab {
  min-height: 30px;
  border-radius: 6px;
  background: #fffdf9;
}

.prompt-version-tab.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary-hover);
}

.prompt-output,
body.module-creative-prompt .prompt-output,
.prompt-editor,
body.module-creative-prompt .prompt-editor {
  min-height: 160px;
  border-radius: 6px;
  border-color: #2a1f19;
  background: #19110c;
  color: #fff9ef;
  font-size: 0.88rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.prompt-output {
  padding: 14px 16px;
}

.model-status-details {
  margin: 10px 0 0;
  border-radius: var(--radius-md);
  background: #fbfaf6;
}

.model-status-row {
  align-items: center;
  min-height: 34px;
}

.video-analysis-report,
.script-document-picker,
.topic-history-panel,
.history-item,
.main-image-shared-card {
  border-radius: var(--radius-md);
}

.analysis-report-input,
#videoAnalysisReport {
  min-height: 240px;
}

.report-actions,
.script-actions,
.creative-archive-actions,
.form-row {
  gap: 8px;
}

.history-item,
.topic-history-item,
.script-doc-item {
  border-color: rgba(216, 211, 202, 0.82);
  background: #fffdf9;
}

.history-item:hover,
.topic-history-item:hover,
.script-doc-item:hover {
  border-color: rgba(230, 95, 42, 0.42);
  background: #ffffff;
}

.toolbox-home-shell {
  max-width: 1040px;
}

.toolbox-home-header,
.toolbox-home-panel {
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.toolbox-entry-card {
  border-radius: var(--radius-md);
  background: #ffffff;
}

.toolbox-entry-card:hover {
  border-color: var(--color-primary);
}

body.module-creative-prompt .creative-input {
  min-height: 230px;
}

body.module-creative-prompt .creative-generate-heading {
  margin: 18px -14px 0;
  padding: 10px 14px;
}

body.dark-mode {
  --color-bg: #1d211f;
  --color-surface: #242a27;
  --color-card: #272d2a;
  --color-border: #3b433f;
  --color-border-strong: #53605a;
  --color-text: #f3f0e8;
  --color-text-secondary: #c9c1b7;
  --color-text-hint: #9f968d;
  --color-primary-light: rgba(230, 95, 42, 0.16);
  --color-accent-light: rgba(70, 139, 128, 0.18);
  background: linear-gradient(180deg, #1f2321 0%, #191d1b 100%);
}

body.dark-mode .page-header,
body.dark-mode .module-nav-panel {
  background: rgba(29, 33, 31, 0.9);
}

body.dark-mode .user-session-bar,
body.dark-mode .card,
body.dark-mode .module-nav-item,
body.dark-mode .toolbox-home-header,
body.dark-mode .toolbox-home-panel,
body.dark-mode .toolbox-entry-card {
  background: rgba(39, 45, 42, 0.94);
}

body.dark-mode .card-header {
  background: linear-gradient(180deg, #303733 0%, #272d2a 100%);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea,
body.dark-mode .auth-field input,
body.dark-mode textarea.script-input,
body.dark-mode .analysis-report-input,
body.dark-mode .prompt-editor,
body.dark-mode .prompt-textarea,
body.dark-mode .template-key-points,
body.dark-mode .creative-template-key-points,
body.dark-mode .model-status-details,
body.dark-mode .history-item,
body.dark-mode .topic-history-item,
body.dark-mode .script-doc-item {
  background: #202521;
  border-color: var(--color-border);
  color: var(--color-text);
}

body.dark-mode .prompt-output,
body.dark-mode .prompt-editor {
  background: #100c09;
  border-color: #3e3129;
  color: #fff6e9;
}

@media (max-width: 1100px) {
  .page-header,
  .module-nav-panel,
  body.user-console .module-nav-panel {
    position: static;
  }

  .main-layout,
  body.user-console .main-layout,
  body.module-main-image .main-layout,
  body.module-creative-prompt .main-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar-left {
    position: static;
    max-height: none;
    padding-right: 0;
  }
}

@media (max-width: 720px) {
  .app-container {
    padding: 12px;
  }

  .page-header {
    margin: -12px -12px 0;
    padding: 10px 12px;
  }

  .page-title-row,
  .user-session-bar,
  .template-generate-row {
    align-items: stretch;
  }

  .page-title-row,
  .user-session-bar,
  .template-generate-row,
  .report-actions,
  .script-actions,
  .creative-archive-actions {
    flex-direction: column;
  }

  .module-nav-panel,
  body.user-console .module-nav-panel {
    grid-template-columns: minmax(0, 1fr);
    margin: 0 0 12px;
    padding: 10px 0;
  }

  .template-select-row,
  body.module-creative-prompt .creative-template-workflow .template-select-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-status-line {
    justify-content: flex-start;
    width: 100%;
  }

  .theme-toggle {
    top: auto;
    right: 12px;
    bottom: 12px;
  }
}
