/* 5130 shared warm palette. Color-only: never filter product media or change layout.
 * Inspired by Pantone Relaxed Elegance: Cannoli Cream, Cream Tan, Safari,
 * Chanterelle, Mocha Mousse and Chocolate Martini. These are screen-adapted
 * UI colors, not certified Pantone-to-HEX conversions. Deep mocha controls
 * preserve readable contrast; the lighter neutrals belong to surfaces.
 */
:root, body {
  color-scheme: light;
  --warm-bg: #eae2d7 !important;
  --warm-paper: #fcfaf5 !important;
  --warm-surface: #f7f2eb !important;
  --warm-soft: #e9ded3 !important;
  --warm-ink: #40332f !important;
  --warm-muted: #6c5e56 !important;
  --warm-accent: #80665a !important;
  --warm-accent-dark: #655048 !important;
  --warm-line: rgba(112, 91, 79, .22) !important;
  --warm-shadow: 0 12px 32px rgba(80, 63, 54, .08) !important;
  --warm-gradient: linear-gradient(145deg, #f2eee7 0%, #eae2d7 55%, #e3d8cf 100%) !important;
  --warm-panel-gradient: linear-gradient(135deg, #fcfaf5 0%, #f7f2eb 100%) !important;
  --warm-button-gradient: linear-gradient(135deg, #80665a 0%, #655048 100%) !important;
  --bg: var(--warm-bg) !important;
  --panel: var(--warm-paper) !important;
  --paper: var(--warm-paper) !important;
  --paper-2: var(--warm-soft) !important;
  --ivory: var(--warm-bg) !important;
  --ink: var(--warm-ink) !important;
  --muted: var(--warm-muted) !important;
  --line: var(--warm-line) !important;
  --line-dark: #c5b5a8 !important;
  --accent: var(--warm-accent) !important;
  --accent-dark: var(--warm-accent-dark) !important;
  --brand: var(--warm-accent) !important;
  --green: var(--warm-accent) !important;
  --green-dark: var(--warm-accent-dark) !important;
  --mint: var(--warm-soft) !important;
  --forest: var(--warm-accent-dark) !important;
  --forest-2: var(--warm-accent) !important;
  --forest-3: var(--warm-soft) !important;
  --beige-accent: var(--warm-accent) !important;
  --beige-accent-dark: var(--warm-accent-dark) !important;
  --beige-ink: var(--warm-ink) !important;
  --beige-bg: var(--warm-bg) !important;
  --beige-paper: var(--warm-paper) !important;
  --vs2-ink: var(--warm-ink) !important;
  --vs2-muted: var(--warm-muted) !important;
  --vs2-accent: var(--warm-accent) !important;
  --vs2-accent-soft: var(--warm-soft) !important;
  --vs2-border: var(--warm-line) !important;
  --vs2-line: var(--warm-line) !important;
  --vs2-glass: var(--warm-surface) !important;
  --vs2-glass-strong: var(--warm-paper) !important;
  --vs2-shadow: var(--warm-shadow) !important;
  --single-chat-ink: var(--warm-ink) !important;
  --single-chat-muted: var(--warm-muted) !important;
  --single-chat-accent: var(--warm-accent) !important;
  --single-chat-accent-soft: var(--warm-soft) !important;
  --single-chat-line: var(--warm-line) !important;
  --single-chat-surface: var(--warm-surface) !important;
  --edit-ink: var(--warm-ink) !important;
  --edit-muted: var(--warm-muted) !important;
  --edit-line: var(--warm-line) !important;
  --edit-glass: var(--warm-surface) !important;
  --edit-jade: var(--warm-accent) !important;
  --video-accent: var(--warm-accent) !important;
  --video-ink: var(--warm-ink) !important;
  --video-line: var(--warm-line) !important;
  --uj-bg: var(--warm-bg) !important;
  --uj-rail: var(--warm-soft) !important;
  --uj-surface: var(--warm-paper) !important;
  --uj-line: var(--warm-line) !important;
  --uj-ink: var(--warm-ink) !important;
  --uj-muted: var(--warm-muted) !important;
  --uj-accent: var(--warm-accent) !important;
  --uj-accent-dark: var(--warm-accent-dark) !important;
  --uj-soft: var(--warm-soft) !important;
}
html, body { background: var(--warm-gradient) !important; color: var(--warm-ink) !important; }
body:not(.login-page)::before { background-image: radial-gradient(circle at 14% 16%, rgba(223,211,197,.55), transparent 34%), radial-gradient(circle at 83% 20%, rgba(239,229,214,.45), transparent 32%), radial-gradient(circle at 62% 88%, rgba(190,172,159,.3), transparent 36%) !important; }
body::after { background: linear-gradient(180deg, rgba(252,250,245,.28), rgba(228,219,210,.35)) !important; }
/* Preserve the existing homepage artwork; bring the surrounding surfaces into its palette. */
body :is(.topbar,.module-nav,.workspace-nav,.video-nav,.edit-topbar,.single-chat-workspace-head,.single-chat-pane-head,.studio-panel-head,.app-header) {
  background: var(--warm-panel-gradient) !important;
  color: var(--warm-ink) !important;
  border-color: var(--warm-line) !important;
}
body :is(.glass,.panel,.module-heading,.single-chat-shell,.single-chat-workspace,.single-chat-product-context,.edit-chat-shell,.edit-pane,.edit-conversation,.video-materials,.assistant-action-card,.studio-panel,.mypage-card,.library-head,.filters,.prompt-lab-panel,.prompt-lab-auto-research,.buyer-step-card) {
  background: var(--warm-panel-gradient) !important;
  border-color: var(--warm-line) !important;
  box-shadow: var(--warm-shadow) !important;
}
body :is(.single-chat-tasks,.single-chat-unified-rail,.edit-history-pane,.project-sidebar,.sidebar-action-bar,.single-chat-mode-switch,.edit-mode-switch,#videoCatalogTags) {
  background: linear-gradient(150deg, #efe8dd, #e6dcce) !important;
  border-color: var(--warm-line) !important;
}
body :is(.single-chat-product-copy,.single-chat-task-copy,.single-chat-result-section,.edit-chat-context-copy,.video-chat-header,.video-catalog-heading,.workspace-task-copy) { color: var(--warm-ink) !important; }
body :is(.account-menu-button,.account-menu-button:hover,.user-badge) {
  background: var(--warm-panel-gradient) !important;
  color: var(--warm-ink) !important;
  border-color: var(--warm-line) !important;
}
body :is(h1,h2,h3,h4,h5,h6,.video-brand,.brand-block h1,.brand-block h1::after) { color: var(--warm-ink) !important; }
body .brand-block h1::after { background: var(--warm-soft) !important; }
body .module-tab.active { box-shadow: 0 5px 14px rgba(80,63,54,.16) !important; }
body :is(.muted,.muted-note,.single-chat-task-copy small,.single-chat-product-copy span,.visual-history-meta,.video-save-status,.video-task-toolbar,.video-nav p,.edit-history-meta,.edit-conversation-heading p,.video-catalog-item small) { color: var(--warm-muted) !important; }
body :is(.product-card,.preset-list-item,.result-card,.style-card,.scene-card,.custom-style-card,.single-chat-task-row,.visual-history-image-card,.edit-history-item,.edit-message.assistant,.assistant-message:not(.user),.video-catalog-item,.workspace-task-card,.workspace-style-card,.buyer-result-card,.combo2-card) {
  background: var(--warm-paper) !important;
  color: var(--warm-ink) !important;
  border-color: var(--warm-line) !important;
}
body :is(.single-chat-composer,.single-chat-composer-tools,.assistant-input-row,.edit-composer,.single-chat-output-head,.visual-history-dialog-head,.visual-history-footer) { background: var(--warm-surface) !important; border-color: var(--warm-line) !important; }
body :is(.visual-history-dialog,.single-chat-product-dialog,.single-chat-combo-pool-dialog,.single-chat-free-dialog,.prompt-dialog,.modal-dialog,.batch-task-dialog,#videoCatalogDialog,#videoHistoryDialog,.edit-source-dialog) { background: var(--warm-paper) !important; color: var(--warm-ink) !important; border-color: var(--warm-line) !important; }
body dialog::backdrop { background: rgba(64,51,47,.4) !important; }
body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),select,textarea) {
  background: var(--warm-paper) !important;
  color: var(--warm-ink) !important;
  border-color: var(--warm-line) !important;
}
body :is(input,select,textarea):focus { border-color: var(--warm-accent) !important; box-shadow: 0 0 0 3px rgba(128,102,90,.13) !important; }
body :is(input[type="checkbox"],input[type="radio"],input[type="range"],progress) { accent-color: var(--warm-accent); }
body :is(.ghost,.secondary,.section-action,.video-button,.edit-icon-button,.edit-quick-prompts button,.single-chat-icon-button,.visual-history-toolbar button,.visual-history-more,.single-chat-head-actions button,.single-chat-head-actions a,.single-chat-view-prompt,.single-chat-regen-image,.single-chat-dislike,.video-nav-action,.video-catalog-search button) {
  background: var(--warm-panel-gradient) !important;
  color: var(--warm-accent-dark) !important;
  border-color: var(--warm-line) !important;
}
body :is(.module-tab,.video-nav a,.video-module-nav a,.mstyle-tag,.chips button) { color: var(--warm-muted) !important; }
body :is(.primary,.module-tab.active,.single-chat-mode-switch button.active,.single-chat-template-host .custom-style-source-tabs button.primary,.visual-history-tabs button.active,.edit-mode-switch button.active,.chips button.active,.mstyle-tag.active,.edit-message-result-download,.render-button,.compile-button,.studio-primary,.unified-video-prepare,#assistantSendBtn,#editSendBtn) {
  background: var(--warm-button-gradient) !important;
  color: #fffdf9 !important;
  border-color: var(--warm-accent-dark) !important;
}
body :is(.primary,.edit-message-result-download,.render-button,.compile-button,.unified-video-prepare,#assistantSendBtn,#editSendBtn):hover { background: linear-gradient(135deg, #72594e, #59443d) !important; color: #fffdf9 !important; }
body :is(.module-tab.vs2-home-tab,.video-nav a[aria-current],.video-module-nav a.active,.chat-video-tier.selected,.video-catalog-item:has(:checked),.single-chat-template-host .style-card.active,.workflow-steps button.active,.tier-picker button.active,.platform-picker button.active) {
  background: var(--warm-soft) !important;
  color: var(--warm-accent-dark) !important;
  border-color: var(--warm-accent) !important;
  box-shadow: 0 0 0 1px rgba(128,102,90,.18) !important;
}
body :is(.edit-message.user,.single-chat-workspace .assistant-message.user) { background: var(--warm-button-gradient) !important; color: #fffdf9 !important; }
body[data-page="video-chat"] .assistant-message.user { background: var(--warm-soft) !important; color: var(--warm-ink) !important; border-color: var(--warm-line) !important; }
body :is(.single-chat-task-thumb,.workspace-task-placeholder,.workspace-style-cover,.single-chat-product-preview,.single-chat-mode-switch,.edit-status-badge,.status-pill,.workspace-task-status) { background: var(--warm-soft) !important; color: var(--warm-accent-dark) !important; }
body :is(.edit-assistant-mark,.edit-progress-bar i,.single-chat-progress-bar i,.runtime-progress i,.scene-progress i,.video-progress i) { background: var(--warm-button-gradient) !important; }
body :is(.single-chat-template-host .style-card-grid,.single-chat-task-list,.workspace-task-grid,.workspace-style-row) { scrollbar-color: #ad9788 #e9ded3; }
body :is(.single-chat-template-host .style-card-grid,.single-chat-task-list)::-webkit-scrollbar-track { background: #e9ded3 !important; }
body :is(.single-chat-template-host .style-card-grid,.single-chat-task-list)::-webkit-scrollbar-thumb { background: #ad9788 !important; border-color: #e9ded3 !important; }
/* Professional style cards must keep their selected state above the shared card theme. */
body .style-selection-summary {
  margin: 10px 0 12px;
  color: var(--warm-accent-dark, #654f46);
  font-size: 14px;
  font-weight: 600;
}
body.single-chat-mode .style-selection-summary { display: none; }
body .style-pick-panel .style-card { position: relative; }
body .style-pick-panel .style-card:hover,
body .style-pick-panel .style-card:focus-visible {
  border-color: var(--warm-accent, #80665a) !important;
}
body .style-pick-panel .style-card:focus-visible {
  outline: 2px solid var(--warm-accent, #80665a);
  outline-offset: 3px;
}
body .style-pick-panel .style-card.active {
  border-color: var(--warm-accent, #80665a) !important;
  box-shadow: 0 0 0 3px rgba(128,102,90,.32) !important;
}
body .style-pick-panel .style-card.active .sc-cap {
  background: var(--warm-soft, #ebe1d7);
  color: var(--warm-accent-dark, #654f46);
  font-weight: 800;
}
body .style-pick-panel .style-card.active::after {
  content: "✓ 已选择";
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--warm-accent-dark, #654f46);
  color: #fffdf9;
  box-shadow: 0 2px 8px rgba(64,51,47,.18);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  pointer-events: none;
}
/* Status colors stay semantic. Never flatten errors, warnings or destructive actions. */
body :is(.danger-button,.visual-history-error,.error-box,.error-message) { color: #a3392d !important; }
body :is(button,a,input,select,textarea,summary):focus-visible { outline-color: var(--warm-accent-dark) !important; }
/* More-specific legacy controls use literal green values instead of theme tokens. */
body.single-chat-mode .single-chat-save-style,
body.single-chat-mode .single-chat-save-style:hover {
  background: var(--warm-panel-gradient) !important;
  color: var(--warm-accent-dark) !important;
  border-color: var(--warm-line) !important;
}
body.single-chat-mode .single-chat-workspace #assistantSendBtn,
body.main-edit-agent-page #editSendBtn {
  background: var(--warm-button-gradient) !important;
  color: #fffdf9 !important;
  border-color: var(--warm-accent-dark) !important;
}
body.single-chat-mode .single-chat-workspace .assistant-input-row,
body.single-chat-mode .single-chat-quick-prompts {
  background: var(--warm-surface) !important;
}
body.single-chat-mode .single-chat-workspace #assistantInput { background: var(--warm-paper) !important; }
body[data-page="video-chat"] button:not(.primary):not(.selected):not(.active):not(.danger-button):not(.unified-video-prepare):not(#assistantSendBtn) {
  background: var(--warm-panel-gradient) !important;
  color: var(--warm-accent-dark) !important;
  border-color: var(--warm-line) !important;
}
body[data-page="video-chat"] #videoCatalogTags button[aria-pressed="true"],
body[data-page="video-chat"] #videoCatalogSelectedTags button {
  background: var(--warm-soft) !important;
  color: var(--warm-accent-dark) !important;
  border-color: var(--warm-accent) !important;
}

/* Readable foreground/background pairs, including labels nested in controls.
 * Never recolor image pixels or remove semantic failure/danger indicators. */
body :is(.ghost,.secondary,.font-hint,.admin-link,.logout-button,.account-dropdown,
         .single-chat-head-actions a,.single-chat-head-actions button,
         .single-chat-save-style,.visual-history-footer .ghost,.module-tab:not(.active)) {
  color: var(--warm-accent-dark) !important;
}
body :is(.ghost,.secondary,.single-chat-save-style,.module-tab,.video-button) :is(span,small,strong),
body .topbar .font-hint :is(span,small) { color: inherit !important; }
body :is(.status-pill,.badge,.prompt-lab-gate-badge):not(.error):not(.failed):not(.danger) {
  background: var(--warm-soft) !important;
  color: var(--warm-accent-dark) !important;
}
body :is(.section-title,.module-heading,.single-chat-pane-head,.single-chat-product-copy,
         .edit-conversation-heading,.video-catalog-heading) :is(p,small,label,span) {
  color: var(--warm-muted) !important;
}
body :is(.single-chat-template-host,.visual-history-panel,.prompt-lab-panel,.edit-pane) :is(input,textarea)::placeholder {
  color: var(--warm-muted) !important;
  opacity: 1;
}
body :is(.primary,.module-tab.active,.visual-history-tabs button.active,
         .single-chat-mode-switch button.active,.single-chat-template-host button.primary) {
  background: var(--warm-button-gradient) !important;
  color: #fffdf9 !important;
}
body .workspace-feature::after {
  background: linear-gradient(135deg, rgba(252,250,245,.76), rgba(247,242,235,.84)) !important;
}
body .workspace-feature :is(strong,p) {
  color: var(--warm-ink) !important;
  text-shadow: none !important;
}
body .chat-video-final-download {
  background: var(--warm-button-gradient) !important;
  color: #fffdf9 !important;
}


/* Shared 2.0 page frame: every workspace uses the same responsive gutters.
   Scope to outer shells; dialogs, image sizes and inner tools retain their layout. */
:root {
  --vs2-page-gutter: 16px;
  --vs2-page-width: calc(100% - var(--vs2-page-gutter) - var(--vs2-page-gutter));
}
body > :is(.topbar, .module-nav, .workspace-nav, .workspace-main,
           .edit-chat-shell, .edit-agent-layout, .scene-library-main,
           .trophy-page, .layout),
body.prompt-studio.website > .shell {
  box-sizing: border-box !important;
  width: var(--vs2-page-width) !important;
  max-width: none !important;
  min-width: 0;
  margin-left: auto !important;
  margin-right: auto !important;
}
body > :is(.topbar, .workspace-nav) {
  min-height: 66px !important;
  margin-top: 16px !important;
  margin-bottom: 10px !important;
  padding: 11px 16px !important;
  border: 1px solid var(--warm-line) !important;
  border-radius: 20px !important;
  flex-shrink: 0;
}
body > .module-nav {
  margin-top: 0 !important;
  margin-bottom: 16px !important;
  padding: 7px !important;
  border: 1px solid var(--warm-line) !important;
  border-radius: 16px !important;
  flex-shrink: 0;
}
body > :is(.workspace-main, .scene-library-main, .trophy-page, .layout) {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
/* The professional editor has a toolbar and canvas instead of a <main>. */
body > :is(.toolbar#toolbar, .main-area) {
  box-sizing: border-box;
  width: var(--vs2-page-width);
  max-width: none;
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
}
/* The 2.0 video page keeps its sidebar; the main column uses all remaining space. */
body[data-page="video-chat"] > .video-chat-main {
  max-width: none;
  padding-left: var(--vs2-page-gutter);
  padding-right: var(--vs2-page-gutter);
}
@media (max-width: 760px) {
  :root { --vs2-page-gutter: 8px; }
  body > :is(.topbar, .workspace-nav) {
    margin-top: 8px !important;
    margin-bottom: 6px !important;
    border-radius: 16px !important;
  }
  body > .module-nav {
    margin-bottom: 10px !important;
    border-radius: 14px !important;
  }
}

/* The chat layout moves cards out of .style-pick-panel. Keep the selected
 * state above ID-bearing generic button rules as well as professional cards. */
body.single-chat-mode #singleChatTemplateHost .style-card { position: relative; }
body.single-chat-mode #singleChatTemplateHost .style-card.active {
  border-color: var(--warm-accent, #80665a) !important;
  box-shadow: 0 0 0 3px rgba(128,102,90,.32) !important;
}
body.single-chat-mode #singleChatTemplateHost .style-card.active .sc-cap {
  background: var(--warm-soft, #ebe1d7) !important;
  color: var(--warm-accent-dark, #654f46) !important;
  font-weight: 800;
}
body.single-chat-mode #singleChatTemplateHost .style-card.active::after {
  content: "✓ 已选择";
  position: absolute;top: 6px;right: 6px;z-index: 2;
  padding: 4px 7px;border-radius: 999px;
  background: var(--warm-accent-dark, #654f46);color: #fffdf9;
  font-size: 11px;font-weight: 800;line-height: 1.3;pointer-events: none;
}
