/* Shared Shuakan palette. Loaded last so legacy pages inherit one visual language. */
:root {
  --ui-shell: #0f1115;
  --ui-shell-soft: #13161c;
  --ui-panel: #171a21;
  --ui-panel-raised: #1d212a;
  --ui-line-dark: rgba(255, 255, 255, .09);
  --ui-line-dark-strong: rgba(255, 255, 255, .15);
  --ui-text-dark: #f2efe7;
  --ui-text-dark-soft: #aaa59c;
  --ui-text-dark-dim: #77746e;

  --ui-canvas: #f4f1eb;
  --ui-paper: #fffdf9;
  --ui-paper-soft: #ede8df;
  --ui-line-light: rgba(49, 42, 31, .11);
  --ui-text-light: #201d18;
  --ui-text-light-soft: #6f695f;
  --ui-text-light-dim: #90897d;

  --ui-accent: #c9a95d;
  --ui-accent-hover: #d7b86c;
  --ui-accent-strong: #9a7628;
  --ui-accent-soft: rgba(201, 169, 93, .14);
  --ui-success: #64c98c;
  --ui-danger: #df7169;
  --ui-warning: #d9ad56;

  --ds-color-workspace: var(--ui-canvas);
  --ds-color-surface: var(--ui-paper);
  --ds-color-surface-secondary: var(--ui-paper-soft);
  --ds-color-surface-elevated: var(--ui-paper);
  --ds-color-text-primary: var(--ui-text-light);
  --ds-color-text-secondary: var(--ui-text-light-soft);
  --ds-color-text-tertiary: var(--ui-text-light-dim);
  --ds-color-accent: var(--ui-accent);
  --ds-color-accent-hover: var(--ui-accent-hover);
  --ds-color-accent-pressed: var(--ui-accent-strong);
  --ds-color-accent-tint: var(--ui-accent-soft);
  --ds-color-accent-border: rgba(201, 169, 93, .34);

  --bg: var(--ui-shell);
  --bg-2: var(--ui-panel);
  --bg-3: var(--ui-panel-raised);
  --surface: var(--ui-panel);
  --surface-2: var(--ui-shell-soft);
  --surface-3: var(--ui-panel-raised);
  --line: var(--ui-line-dark);
  --line-strong: var(--ui-line-dark-strong);
  --text: var(--ui-text-dark);
  --text-dim: var(--ui-text-dark-soft);
  --muted: var(--ui-text-dark-soft);
  --dim: var(--ui-text-dark-dim);
  --gold: var(--ui-accent);
  --gold-soft: var(--ui-accent-hover);
  --gold-2: #e7ca7a;
  --violet: var(--ui-accent);
  --green: var(--ui-success);
  --red: var(--ui-danger);
}

/* Public presentation stays light, but uses the same warm neutrals and gold. */
.product-home {
  --ph-canvas: var(--ui-canvas);
  --ph-paper: var(--ui-paper);
  --ph-soft: var(--ui-paper-soft);
  --ph-line: var(--ui-line-light);
  --ph-ink: var(--ui-text-light);
  --ph-muted: var(--ui-text-light-soft);
  background: var(--ui-canvas);
}

.app.product-home-shell,
.app.product-home-shell .view[data-page="home"] { background: var(--ui-canvas); }

/* Logged-in application pages share the creator's charcoal surfaces. */
.app:not(.product-home-shell) {
  --ds-color-workspace: var(--ui-shell);
  --ds-color-surface: var(--ui-panel);
  --ds-color-surface-secondary: var(--ui-shell-soft);
  --ds-color-surface-elevated: var(--ui-panel-raised);
  --ds-color-text-primary: var(--ui-text-dark);
  --ds-color-text-secondary: var(--ui-text-dark-soft);
  --ds-color-text-tertiary: var(--ui-text-dark-dim);
  --ds-color-text-disabled: #5e5c58;
  --ds-color-separator: var(--ui-line-dark);
  --ds-color-border-control: var(--ui-line-dark-strong);
  --ds-color-border-card: var(--ui-line-dark);
  --ds-color-border-strong: rgba(201, 169, 93, .36);
  --ds-color-hover-neutral: rgba(255, 255, 255, .045);
  --ds-color-pressed-neutral: rgba(255, 255, 255, .075);
  color: var(--ui-text-dark);
  background: var(--ui-shell);
}

.app:not(.product-home-shell) > .content,
.app:not(.product-home-shell) .view,
.app:not(.product-home-shell) .view[data-page="workspace"],
.app:not(.product-home-shell) .view[data-page="generate"],
.app:not(.product-home-shell) .view[data-page="assets"],
.app:not(.product-home-shell) .view[data-page="jobs"],
.app:not(.product-home-shell) .view[data-page="prompts"],
.app:not(.product-home-shell) .view[data-page="chat"],
.app:not(.product-home-shell) .view[data-page="providers"],
.app:not(.product-home-shell) .view[data-page="platform"],
.app:not(.product-home-shell) .view[data-page="billing"],
.app:not(.product-home-shell) .view:has(.wk-library) {
  --bg: var(--ui-shell);
  --bg-2: var(--ui-panel);
  --bg-3: var(--ui-panel-raised);
  --line: var(--ui-line-dark);
  --text: var(--ui-text-dark);
  --text-dim: var(--ui-text-dark-soft);
  color: var(--ui-text-dark);
  background: var(--ui-shell);
}

html[data-theme="dark"] .app:not(.product-home-shell) .sidebar {
  color: var(--ui-text-dark);
  border-color: var(--ui-line-dark);
  background: rgba(15, 17, 21, .98);
}

html[data-theme="dark"] .app:not(.product-home-shell) .logo,
html[data-theme="dark"] .app:not(.product-home-shell) .topbar {
  color: var(--ui-text-dark);
  border-color: var(--ui-line-dark);
  background: rgba(15, 17, 21, .94);
}

html[data-theme="dark"] .app:not(.product-home-shell) .nav a { color: var(--ui-text-dark-soft); }
html[data-theme="dark"] .app:not(.product-home-shell) .nav a:hover { color: var(--ui-text-dark); background: rgba(255, 255, 255, .045); }
html[data-theme="dark"] .app:not(.product-home-shell) .nav a.active { color: #e7ca7a; background: var(--ui-accent-soft); }

.app:not(.product-home-shell) .home-continue-card,
.app:not(.product-home-shell) .home-quick-link,
.app:not(.product-home-shell) .home-project-card,
.app:not(.product-home-shell) .home-jobs-card { background: var(--ui-panel); border-color: var(--ui-line-dark); }
.app:not(.product-home-shell) .home-workspace .home-header h1,
.app:not(.product-home-shell) .home-workspace .home-section-heading h2,
.app:not(.product-home-shell) .home-workspace .home-continue-card h2,
.app:not(.product-home-shell) .home-workspace strong,
.app:not(.product-home-shell) .wk-page-head h1,
.app:not(.product-home-shell) .wk-page strong,
.app:not(.product-home-shell) .wk-section-title h3,
.app:not(.product-home-shell) .permission-denied h2 { color: var(--ui-text-dark); }
.app:not(.product-home-shell) .home-workspace .home-header p,
.app:not(.product-home-shell) .home-workspace .home-section-heading p,
.app:not(.product-home-shell) .home-workspace small,
.app:not(.product-home-shell) .home-section-label,
.app:not(.product-home-shell) .wk-page-head p,
.app:not(.product-home-shell) .wk-page small,
.app:not(.product-home-shell) .wk-page .muted { color: var(--ui-text-dark-soft); }
.app:not(.product-home-shell) .home-resources nav > a { background: var(--ui-shell-soft); }
.app:not(.product-home-shell) .home-resources nav > a:hover,
.app:not(.product-home-shell) .home-quick-link:hover { background: var(--ui-panel-raised); border-color: rgba(201, 169, 93, .28); }

.app:not(.product-home-shell) .view .cover,
.app:not(.product-home-shell) .view > .card,
.app:not(.product-home-shell) .view table,
.app:not(.product-home-shell) .platform-panel,
.app:not(.product-home-shell) .platform-account-card {
  color: var(--ui-text-dark);
  border-color: var(--ui-line-dark);
  background: var(--ui-panel);
}

.app:not(.product-home-shell) .view input,
.app:not(.product-home-shell) .view select,
.app:not(.product-home-shell) .view textarea {
  color: var(--ui-text-dark);
  border-color: var(--ui-line-dark-strong);
  background: var(--ui-shell-soft);
}

.app:not(.product-home-shell) .view input:focus,
.app:not(.product-home-shell) .view select:focus,
.app:not(.product-home-shell) .view textarea:focus { border-color: rgba(201, 169, 93, .62); }

.btn-electric,
.btn-electric:hover {
  color: #1a1308;
  border-color: var(--ui-accent);
  background: linear-gradient(135deg, var(--ui-accent-hover), var(--ui-accent));
  box-shadow: 0 4px 16px rgba(201, 169, 93, .2);
}

.script-select:hover,
.script-select:focus {
  border-color: rgba(201, 169, 93, .62) !important;
  box-shadow: 0 0 0 3px rgba(201, 169, 93, .13) !important;
}

.pill.fb { color: var(--ui-text-dark-soft); border-color: var(--ui-line-dark-strong); background: rgba(255, 255, 255, .055); }

/* Creator V2 adopts the same charcoal surfaces and the same single accent. */
.v2-shell {
  background:
    radial-gradient(circle at 12% -10%, rgba(201, 169, 93, .09), transparent 30%),
    radial-gradient(circle at 92% 5%, rgba(201, 169, 93, .045), transparent 28%),
    var(--ui-shell);
}

.v2-shell .topbar { background: rgba(15, 17, 21, .9); }
.badge.child,
.xuanya-section-title small,
.mother-reference span { color: #e7ca7a; }
.badge.child,
.xuanya-detail-thumb.is-active,
.xuanya-variant.is-active { border-color: rgba(201, 169, 93, .34); }
.badge.child,
.xuanya-variant.is-active { background: rgba(201, 169, 93, .1); }
.xuanya-detail-thumb.is-active { box-shadow: 0 0 0 2px rgba(201, 169, 93, .14); }

.el2-block.frame { color: #c7c4bc; border-color: #4a4d53; background: #292d34; }
.login-aurora-blue { background: radial-gradient(circle, rgba(201,169,93,.2), rgba(91,75,42,.06) 55%, transparent 74%); }

/* One global, remembered light/dark control shared by the public shell and Creator. */
.theme-toggle {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 82px;
  height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--ui-line-dark-strong);
  border-radius: 999px;
  color: var(--ui-text-dark-soft);
  background: var(--ui-panel-raised);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .15);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
}
.theme-toggle:hover { color: #e7ca7a; border-color: rgba(201, 169, 93, .42); }
.theme-toggle:active { transform: translate(-50%, -50%) scale(.96); }
.theme-toggle-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="dark"] .theme-toggle-icon-sun,
html[data-theme="dark"] .theme-toggle-label-light,
html[data-theme="light"] .theme-toggle-icon-moon,
html[data-theme="light"] .theme-toggle-label-dark { display: none; }
.product-theme-toggle,
.creator-theme-toggle { position: static; left: auto; top: auto; transform: none; }
.product-theme-toggle:active,
.creator-theme-toggle:active { transform: scale(.96); }
.product-theme-toggle { min-width: 76px; height: 38px; color: var(--ph-muted); border-color: var(--ph-line); background: color-mix(in srgb, var(--ph-paper) 82%, transparent); box-shadow: none; }
.creator-theme-toggle { flex: 0 0 auto; }

/* Public presentation follows the global choice instead of forcing a light page. */
html[data-theme="dark"] .product-home {
  --ph-canvas: var(--ui-shell);
  --ph-paper: var(--ui-panel);
  --ph-soft: var(--ui-shell-soft);
  --ph-line: var(--ui-line-dark);
  --ph-ink: var(--ui-text-dark);
  --ph-muted: var(--ui-text-dark-soft);
  color: var(--ui-text-dark);
  background: var(--ui-shell);
}
html[data-theme="dark"] .app.product-home-shell,
html[data-theme="dark"] .app.product-home-shell .view[data-page="home"] { background: var(--ui-shell); }
html[data-theme="dark"] .product-global-header { background: color-mix(in srgb, var(--ui-shell) 88%, transparent); }
html[data-theme="dark"] .product-window,
html[data-theme="dark"] .product-visual-badge { box-shadow: 0 24px 65px rgba(0, 0, 0, .32); }

/* Workspace light mode reuses the same warm paper palette. */
html[data-theme="light"] body { color: var(--ui-text-light); background: var(--ui-canvas); }
html[data-theme="light"] .app:not(.product-home-shell) {
  --ds-color-workspace: var(--ui-canvas);
  --ds-color-surface: var(--ui-paper);
  --ds-color-surface-secondary: var(--ui-paper-soft);
  --ds-color-surface-elevated: var(--ui-paper);
  --ds-color-text-primary: var(--ui-text-light);
  --ds-color-text-secondary: var(--ui-text-light-soft);
  --ds-color-text-tertiary: var(--ui-text-light-dim);
  --ds-color-text-disabled: #b0a99d;
  --ds-color-separator: var(--ui-line-light);
  --ds-color-border-control: rgba(49, 42, 31, .16);
  --ds-color-border-card: var(--ui-line-light);
  --ds-color-border-strong: rgba(154, 118, 40, .34);
  --ds-color-hover-neutral: rgba(49, 42, 31, .045);
  --ds-color-pressed-neutral: rgba(49, 42, 31, .075);
  color: var(--ui-text-light);
  background: var(--ui-canvas);
}
html[data-theme="light"] .app:not(.product-home-shell) > .content,
html[data-theme="light"] .app:not(.product-home-shell) .view,
html[data-theme="light"] .app:not(.product-home-shell) .view[data-page="workspace"],
html[data-theme="light"] .app:not(.product-home-shell) .view:has(.wk-library) {
  --bg: var(--ui-canvas);
  --bg-2: var(--ui-paper);
  --bg-3: var(--ui-paper-soft);
  --line: var(--ui-line-light);
  --text: var(--ui-text-light);
  --text-dim: var(--ui-text-light-soft);
  color: var(--ui-text-light);
  background: var(--ui-canvas);
}
html[data-theme="light"] .app:not(.product-home-shell) .sidebar,
html[data-theme="light"] .app:not(.product-home-shell) .logo,
html[data-theme="light"] .app:not(.product-home-shell) .topbar {
  color: var(--ui-text-light);
  border-color: var(--ui-line-light);
  background: rgba(255, 253, 249, .94);
}
html[data-theme="light"] .app:not(.product-home-shell) .nav a { color: var(--ui-text-light-soft); }
html[data-theme="light"] .app:not(.product-home-shell) .nav a:hover { color: var(--ui-text-light); background: rgba(49, 42, 31, .045); }
html[data-theme="light"] .app:not(.product-home-shell) .nav a.active { color: var(--ui-accent-strong); background: var(--ui-accent-soft); }
html[data-theme="light"] .app:not(.product-home-shell) .home-continue-card,
html[data-theme="light"] .app:not(.product-home-shell) .home-quick-link,
html[data-theme="light"] .app:not(.product-home-shell) .home-project-card,
html[data-theme="light"] .app:not(.product-home-shell) .home-jobs-card,
html[data-theme="light"] .app:not(.product-home-shell) .view .cover,
html[data-theme="light"] .app:not(.product-home-shell) .view > .card,
html[data-theme="light"] .app:not(.product-home-shell) .view table,
html[data-theme="light"] .app:not(.product-home-shell) .platform-panel,
html[data-theme="light"] .app:not(.product-home-shell) .platform-account-card { color: var(--ui-text-light); border-color: var(--ui-line-light); background: var(--ui-paper); }
html[data-theme="light"] .app:not(.product-home-shell) .home-workspace .home-header h1,
html[data-theme="light"] .app:not(.product-home-shell) .home-workspace .home-section-heading h2,
html[data-theme="light"] .app:not(.product-home-shell) .home-workspace .home-continue-card h2,
html[data-theme="light"] .app:not(.product-home-shell) .home-workspace strong,
html[data-theme="light"] .app:not(.product-home-shell) .wk-page-head h1,
html[data-theme="light"] .app:not(.product-home-shell) .wk-page strong,
html[data-theme="light"] .app:not(.product-home-shell) .wk-section-title h3 { color: var(--ui-text-light); }
html[data-theme="light"] .app:not(.product-home-shell) .home-workspace .home-header p,
html[data-theme="light"] .app:not(.product-home-shell) .home-workspace .home-section-heading p,
html[data-theme="light"] .app:not(.product-home-shell) .home-workspace small,
html[data-theme="light"] .app:not(.product-home-shell) .home-section-label,
html[data-theme="light"] .app:not(.product-home-shell) .wk-page-head p,
html[data-theme="light"] .app:not(.product-home-shell) .wk-page small,
html[data-theme="light"] .app:not(.product-home-shell) .wk-page .muted { color: var(--ui-text-light-soft); }
html[data-theme="light"] .app:not(.product-home-shell) .home-resources nav > a { background: var(--ui-paper-soft); }
html[data-theme="light"] .app:not(.product-home-shell) .view input,
html[data-theme="light"] .app:not(.product-home-shell) .view select,
html[data-theme="light"] .app:not(.product-home-shell) .view textarea { color: var(--ui-text-light); border-color: rgba(49, 42, 31, .16); background: var(--ui-paper); }
html[data-theme="light"] .app:not(.product-home-shell) .theme-toggle { color: var(--ui-text-light-soft); border-color: var(--ui-line-light); background: var(--ui-paper-soft); box-shadow: none; }

/* Creator V2 consumes the same stored theme and semantic colors. */
html[data-theme="light"] {
  --bg: var(--ui-canvas);
  --bg-2: var(--ui-paper);
  --bg-3: var(--ui-paper-soft);
  --surface: var(--ui-paper);
  --surface-2: var(--ui-paper-soft);
  --surface-3: #e4ded3;
  --line: var(--ui-line-light);
  --line-strong: rgba(49, 42, 31, .17);
  --text: var(--ui-text-light);
  --text-dim: var(--ui-text-light-soft);
  --muted: var(--ui-text-light-soft);
  --dim: var(--ui-text-light-dim);
}
html[data-theme="light"] .v2-shell {
  --creator-text-strong: var(--ui-text-light);
  --creator-text-body: #4f4a42;
  --creator-text-soft: var(--ui-text-light-soft);
  color: var(--ui-text-light);
  background: var(--ui-canvas);
}
html[data-theme="light"] .v2-shell .topbar { background: rgba(255, 253, 249, .92); }
html[data-theme="light"] .v2-shell .stage-nav { background: rgba(244, 241, 235, .88); }
html[data-theme="light"] .v2-shell .stage-tab:hover,
html[data-theme="light"] .v2-shell .btn.ghost { background: rgba(49, 42, 31, .045); }
html[data-theme="light"] .v2-shell .stage-tab b { background: rgba(49, 42, 31, .06); }
html[data-theme="light"] .v2-shell .theme-toggle { color: var(--ui-text-light-soft); border-color: var(--ui-line-light); background: var(--ui-paper-soft); box-shadow: none; }
html[data-theme="light"] .el2-block.frame { color: #5f5a52; border-color: #c9c1b5; background: #e7e1d7; }

@media (forced-colors: active) {
  .btn-electric { forced-color-adjust: auto; }
}
