/* 由 scripts/gen_palettes.py 生成；只负责品牌层，不覆盖文字与业务语义色。 */
[data-pick-palette="skylight"] {
  --sw: radial-gradient(circle,#ffffff 0 54%,transparent 56%),linear-gradient(135deg,#0078c0,#20a060);
}
:root[data-theme="light"][data-palette="skylight"],
body.ex-ai-mode[data-ai-theme="light"][data-ai-palette="skylight"] {
  --brand-fill: #0078a8;
  --brand-rgb: 0,120,168;
  --brand-ink: #075b80;
  --brand-on: #fff;
  --brand-soft: #e6f2fa;
  --brand-peer: #147d60;
  --brand-peer-rgb: 20,125,96;
  --brand-chart: #0078a8;
  --brand-c3: #526c85;
  --brand-c4: #147d60;
  --brand-bg: #f3f6fb;
  --brand-sidebar: #eef5f7;
  --surface-soft: #e8eef7;
  --surface-glow: #0078c0;
  --surface-peer: #20a060;
  --surface-mist: rgba(0,120,192,.10);
  --surface-mist-peer: rgba(32,160,96,.07);
  --surface-sticky: rgba(247,251,253,.98);
  --brand-hover: color-mix(in srgb,#0078a8 86%,black);
  --brand-grad: linear-gradient(120deg,var(--brand-fill),var(--brand-peer));
  --brand-mist: rgba(0,120,168,.14);
  --brand-mist-peer: rgba(20,125,96,.10);
}
:root[data-theme="dark"][data-palette="skylight"],
body.ex-ai-mode[data-ai-theme="dark"][data-ai-palette="skylight"] {
  --brand-fill: #0078a8;
  --brand-rgb: 0,120,168;
  --brand-ink: #075b80;
  --brand-on: #0d172b;
  --brand-soft: #e6f2fa;
  --brand-peer: #147d60;
  --brand-peer-rgb: 20,125,96;
  --brand-chart: #075b80;
  --brand-c3: #526c85;
  --brand-c4: #147d60;
  --brand-bg: #f3f6fb;
  --brand-sidebar: #f3f6fb;
  --surface-soft: #e8eef7;
  --surface-glow: #0078c0;
  --surface-peer: #20a060;
  --surface-mist: rgba(0,120,192,.12);
  --surface-mist-peer: rgba(32,160,96,.06);
  --surface-sticky: rgba(247,251,253,.98);
  --brand-hover: color-mix(in srgb,#0078a8 86%,black);
  --brand-grad: linear-gradient(120deg,var(--brand-fill),var(--brand-peer));
  --brand-mist: rgba(0,120,168,.19);
  --brand-mist-peer: rgba(20,125,96,.08);
}
[data-pick-palette="powerflow"] {
  --sw: linear-gradient(135deg,#0078c0,#20a060);
}
:root[data-theme="light"][data-palette="powerflow"],
body.ex-ai-mode[data-ai-theme="light"][data-ai-palette="powerflow"] {
  --brand-fill: #147d60;
  --brand-rgb: 20,125,96;
  --brand-ink: #12684f;
  --brand-on: #fff;
  --brand-soft: #e6f2fa;
  --brand-peer: #20a060;
  --brand-peer-rgb: 32,160,96;
  --brand-chart: #147d60;
  --brand-c3: #526c85;
  --brand-c4: #70899c;
  --brand-bg: #eef5f2;
  --brand-sidebar: #0c2134;
  --surface-soft: #e7f1ec;
  --surface-glow: #0a84d0;
  --surface-peer: #20a060;
  --surface-mist: rgba(10,132,208,.10);
  --surface-mist-peer: rgba(32,160,96,.07);
  --surface-sticky: rgba(247,251,253,.98);
  --brand-hover: color-mix(in srgb,#147d60 86%,black);
  --brand-grad: linear-gradient(120deg,var(--brand-fill),var(--brand-peer));
  --brand-mist: rgba(20,125,96,.14);
  --brand-mist-peer: rgba(32,160,96,.10);
}
:root[data-theme="dark"][data-palette="powerflow"],
body.ex-ai-mode[data-ai-theme="dark"][data-ai-palette="powerflow"] {
  --brand-fill: #0078c0;
  --brand-rgb: 0,120,192;
  --brand-ink: #6fd3ee;
  --brand-on: #fff;
  --brand-soft: #0f3b55;
  --brand-peer: #2cc283;
  --brand-peer-rgb: 44,194,131;
  --brand-chart: #6fd3ee;
  --brand-c3: #92aabd;
  --brand-c4: #c0d2df;
  --brand-bg: #06273b;
  --brand-sidebar: #06273b;
  --surface-soft: #0c3748;
  --surface-glow: #0a84d0;
  --surface-peer: #20a060;
  --surface-mist: rgba(10,132,208,.12);
  --surface-mist-peer: rgba(32,160,96,.06);
  --surface-sticky: rgba(247,251,253,.98);
  --brand-hover: color-mix(in srgb,#0078c0 86%,black);
  --brand-grad: linear-gradient(120deg,var(--brand-fill),var(--brand-peer));
  --brand-mist: rgba(0,120,192,.19);
  --brand-mist-peer: rgba(44,194,131,.08);
}
[data-pick-palette="ocean"] {
  --sw: linear-gradient(135deg,#2563eb,#2863eb 50%,#3b82f6);
}
:root[data-theme="light"][data-palette="ocean"],
body.ex-ai-mode[data-ai-theme="light"][data-ai-palette="ocean"] {
  --brand-fill: #2563eb;
  --brand-rgb: 37,99,235;
  --brand-ink: #1d4fd8;
  --brand-on: #fff;
  --brand-soft: #eaf1ff;
  --brand-peer: #5281ca;
  --brand-peer-rgb: 82,129,202;
  --brand-chart: #2563eb;
  --brand-c3: #537ca5;
  --brand-c4: #00857e;
  --brand-bg: #eef3fa;
  --brand-sidebar: #102445;
  --surface-soft: #e8eef8;
  --surface-glow: #5385d0;
  --surface-peer: #668db5;
  --surface-mist: rgba(83,133,208,.10);
  --surface-mist-peer: rgba(102,141,181,.07);
  --surface-sticky: rgba(248,250,255,.98);
  --brand-hover: color-mix(in srgb,#2563eb 86%,black);
  --brand-grad: linear-gradient(120deg,var(--brand-fill),var(--brand-peer));
  --brand-mist: rgba(37,99,235,.14);
  --brand-mist-peer: rgba(82,129,202,.10);
}
:root[data-theme="dark"][data-palette="ocean"],
body.ex-ai-mode[data-ai-theme="dark"][data-ai-palette="ocean"] {
  --brand-fill: #2563eb;
  --brand-rgb: 37,99,235;
  --brand-ink: #8db3ff;
  --brand-on: #fff;
  --brand-soft: #1a2a4d;
  --brand-peer: #739bd8;
  --brand-peer-rgb: 115,155,216;
  --brand-chart: #8db3ff;
  --brand-c3: #a1bdd8;
  --brand-c4: #62cfcc;
  --brand-bg: #141a23;
  --brand-sidebar: #141a23;
  --surface-soft: #1d2531;
  --surface-glow: #5385d0;
  --surface-peer: #668db5;
  --surface-mist: rgba(83,133,208,.12);
  --surface-mist-peer: rgba(102,141,181,.06);
  --surface-sticky: rgba(248,250,255,.98);
  --brand-hover: color-mix(in srgb,#2563eb 86%,black);
  --brand-grad: linear-gradient(120deg,var(--brand-fill),var(--brand-peer));
  --brand-mist: rgba(37,99,235,.19);
  --brand-mist-peer: rgba(115,155,216,.08);
}

/* 明确在每个作用域解析别名，AI 外观不继承经典模式已计算好的品牌值。 */
:root[data-skin][data-theme][data-palette], body.ex-ai-mode[data-ai-palette][data-ai-theme] {
  --tx-inv: var(--brand-on); --px-on-brand: var(--brand-on);
  --pri: var(--brand-fill); --pri-rgb: var(--brand-rgb); --pri-tx: var(--brand-ink); --pri-soft: var(--brand-soft);
  --acc: var(--brand-peer); --acc-rgb: var(--brand-peer-rgb); --grad: var(--brand-grad);
  --c1: var(--brand-chart); --c2: var(--brand-peer); --c3: var(--brand-c3); --c4: var(--brand-c4);
  --px-brand: var(--brand-fill); --px-brand-rgb: var(--brand-rgb); --px-brand-soft: var(--brand-soft);
  --bg: var(--brand-bg); --sb-active: var(--brand-fill);
  --mesh1: var(--surface-mist); --mesh2: var(--surface-mist-peer); --mesh3: var(--surface-mist); --mesh4: var(--surface-mist-peer);
  --mesh-base: linear-gradient(165deg,var(--brand-bg),var(--surface-soft));
  --aur1: var(--surface-glow); --aur2: var(--surface-peer); --aur3: var(--surface-glow);
  --haze: var(--surface-mist-peer); --spot1: var(--surface-mist); --spot2: var(--surface-mist-peer);
}
body.ex-ai-mode[data-ai-palette][data-ai-theme] {
  --x-brand: var(--brand-fill); --x-brand2: var(--brand-peer); --x-brand-ink: var(--brand-ink); --x-brand-soft: var(--brand-soft);
  --x-bg: var(--brand-bg); --x-step-peer: var(--brand-peer);
  --x-grad-start: var(--brand-fill); --x-grad-middle: color-mix(in srgb,var(--brand-fill),var(--brand-peer)); --x-grad-end: var(--brand-peer);
  --ai-accent-rgb: var(--brand-rgb); --ai-action-hover: var(--brand-hover);
  --ai-badge-line: color-mix(in srgb,var(--brand-fill) 24%,var(--x-line));
  --ai-glow-1: var(--brand-rgb); --ai-glow-2: var(--brand-peer-rgb); --ai-glow-3: var(--brand-rgb);
  --ai-violet-wash: var(--brand-mist-peer); --ai-cyan-wash: var(--brand-mist); --ai-agent-wash: var(--brand-mist);
  background-color: var(--brand-bg);
}
body.ex-ai-mode[data-ai-skin=glass] {
  background-image: radial-gradient(ellipse at 5% 0%,var(--surface-mist),transparent 60%),radial-gradient(ellipse at 95% 85%,var(--surface-mist-peer),transparent 55%);
}
body.ex-ai-mode[data-ai-skin=classic] { background-image: none; }
body:not(.ex-ai-mode) .sidebar { background: var(--brand-sidebar); }
body:not(.ex-ai-mode) .avatar, body.ex-ai-mode .avatar { background: var(--brand-fill); }
body.ex-ai-mode .sidebar .brand-mark { background: var(--brand-grad); }
body.ex-ai-mode .cx-btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
body.ex-ai-mode .co-stage.on .co-node { outline: 2px solid var(--brand-ink); outline-offset: 3px; }
body.ex-ai-mode .fa-banner[data-stage-art] {
  --fa-ink: var(--brand-chart); --fa-peer: var(--brand-peer);
  --fa-tint: color-mix(in srgb,var(--brand-fill) 16%,var(--x-panel));
}

/* Flux 品牌框架：所有规则显式限定 powerflow，其他调色盘不继承。 */
:root[data-palette="powerflow"][data-theme], body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme] {
  --flux-blue: var(--brand-fill); --flux-green: var(--brand-peer);
  --flux-sidebar: linear-gradient(180deg,#003f67 0%,#064b57 52%,#0b523c 100%);
  --brand-grad: linear-gradient(120deg,#0078c0 0%,#087c89 55%,#0f8257 100%);
  --flux-grad-bright: linear-gradient(90deg,#1e9be8 0%,#22c3c0 52%,#2fd08c 100%);
  --flux-card: #fff;
}
:root[data-palette="powerflow"][data-theme="dark"], body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme="dark"] {
  --flux-card: #0b3447;
  /* 品牌底：左上品牌蓝、右下品牌绿两团柔光，压在深蓝→青→绿的斜向渐变上。 */
  --flux-wall: radial-gradient(ellipse 70% 56% at 0% 0%,rgba(0,132,214,.36),transparent 64%),
    radial-gradient(ellipse 78% 64% at 100% 100%,rgba(32,176,104,.36),transparent 66%),
    linear-gradient(140deg,#05243c 0%,#06323f 46%,#073d35 100%);
}
:root[data-palette="powerflow"] body:not(.ex-ai-mode), body.ex-ai-mode[data-ai-palette="powerflow"] { --leading-title: 1.6; --seam: 8px; --gap: 12px; }
:root[data-palette="powerflow"][data-skin="classic"] body:not(.ex-ai-mode) { background: #eef4f5; }
:root[data-palette="powerflow"][data-skin="classic"][data-theme="dark"] body:not(.ex-ai-mode) { background: var(--flux-wall) fixed var(--brand-bg); }
:root[data-palette="powerflow"][data-skin="glass"] body:not(.ex-ai-mode) .backdrop { background: var(--flux-wall) var(--brand-bg); }
:root[data-palette="powerflow"][data-skin="glass"] body:not(.ex-ai-mode) .backdrop::before,
:root[data-palette="powerflow"][data-skin="glass"] body:not(.ex-ai-mode) .backdrop::after,
:root[data-palette="powerflow"][data-skin="glass"] body:not(.ex-ai-mode) .backdrop :is(i,b) { display: none; }
:root[data-palette="powerflow"][data-skin][data-theme] body:not(.ex-ai-mode) :is(.card,.kpi,.kpi.hero) {
  background: var(--flux-card); backdrop-filter: none; -webkit-backdrop-filter: none;
}
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-skin="glass"] { background: var(--flux-wall) fixed var(--brand-bg); }
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme] {
  --x-panel: var(--flux-card); --ai-panel: var(--flux-card); --cx-glass: var(--flux-card);
  --x-grad-start: var(--flux-blue); --x-grad-middle: #087c89; --x-grad-end: #0f7f52;
  --x-grad: var(--brand-grad); --x-step-grad: var(--brand-grad);
}
body.ex-ai-mode[data-ai-palette="powerflow"] .btn.primary { color: var(--brand-on); }
body.ex-ai-mode[data-ai-palette="powerflow"] .cx-scene-card { background: var(--flux-card); }
body.ex-ai-mode[data-ai-palette="powerflow"] .fa-banner .fa-badge { gap: 8px; padding: 0 12px; }
body.ex-ai-mode[data-ai-palette="powerflow"] .fa-banner .fa-badge b { height: 20px; line-height: 20px; padding: 0 8px; }
body.ex-ai-mode[data-ai-palette="powerflow"] .cd-ai-orb {
  background: var(--flux-blue) var(--brand-grad); border: 4px solid var(--brand-soft); box-shadow: inset 0 1px 4px #ffffff80,0 4px 16px rgba(0,120,192,.20);
}
body.ex-ai-mode[data-ai-palette="powerflow"] .cd-ai-orb i { border-color: rgba(0,120,192,.4); }
body.ex-ai-mode[data-ai-palette="powerflow"] .cd-ai-orb i:nth-child(2) { border-color: rgba(32,160,96,.4); }
body.ex-ai-mode[data-ai-palette="powerflow"] .fa-banner[data-stage-art] { --fa-ink: var(--flux-blue); --fa-peer: var(--flux-green); }
:root[data-palette="powerflow"] body:not(.ex-ai-mode) .pv-glass {
  background: radial-gradient(circle at 10% 10%,rgba(var(--brand-rgb),.55),transparent 70%),
    radial-gradient(circle at 90% 90%,rgba(var(--brand-peer-rgb),.5),transparent 70%),var(--brand-bg);
}

/* 正文品牌层：实色数据面板与小面积渐变分开，语义红绿仍由 tokens.css 提供。 */
:root[data-palette="powerflow"][data-skin][data-theme],
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-skin][data-ai-theme] {
  --flux-soft: #e6f1f4; --flux-line: rgba(35,105,130,.16); --flux-line-2: rgba(35,105,130,.28);
  --panel: var(--flux-card); --panel-2: var(--flux-soft); --panel-3: var(--flux-soft); --hover: var(--flux-soft);
  --solid-surface: var(--flux-card); --line: var(--flux-line); --line-2: var(--flux-line-2);
  --px-bg: var(--brand-bg); --px-panel: var(--flux-card); --px-panel-2: var(--flux-soft); --px-hover: var(--flux-soft);
  --px-line: var(--flux-line); --px-line-2: var(--flux-line-2);
  --sticky-surface: var(--flux-card); --sticky-highlight: none; --sticky-blur: none;
  --c1: var(--brand-ink); --c2: var(--brand-peer); --c3: var(--brand-c3); --c4: var(--brand-c4);
  --c5: #385673; --c6: #7b8c9c; --c7: #326e9c; --c8: #507285;
  --home-reference-chart: var(--c2);
  --chart-axis: var(--ink-secondary);
}
:root[data-palette="powerflow"][data-skin][data-theme="dark"],
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-skin][data-ai-theme="dark"] {
  --flux-soft: #114259; --flux-line: rgba(118,206,238,.17); --flux-line-2: rgba(118,206,238,.32);
  --c1: #4db4f2; --c2: #37cf92;
  --c5: #7293b1; --c6: #b0c1cc; --c7: #629bc2; --c8: #85b4c7;
}
:root[data-palette="powerflow"][data-skin][data-theme] body:not(.ex-ai-mode) :is(.topbar,.menu,.modal,.toast,.du-progress,.admin-view,.drawer) {
  --panel: var(--flux-card); --panel-2: var(--flux-soft); --panel-3: var(--flux-soft);
  --line: var(--flux-line); --line-2: var(--flux-line-2); --admin-surface: var(--flux-card);
  background: var(--flux-card); border-color: var(--flux-line); backdrop-filter: none; -webkit-backdrop-filter: none;
}
:root[data-palette="powerflow"][data-skin][data-theme] body:not(.ex-ai-mode) :is(#home-time,.market-view .module-window) {
  background: var(--flux-card);
}
:root[data-palette="powerflow"][data-skin][data-theme] body:not(.ex-ai-mode) .card .card {
  background: var(--flux-soft);
}
/* 品牌暗色的侧栏与卡片：侧栏用标志性的蓝→青→绿竖向渐变，卡片顶边一条品牌亮线。 */
html:root[data-palette="powerflow"]:is([data-skin="classic"],[data-skin="glass"])[data-theme="dark"] {
  --look-side: var(--flux-sidebar); --look-selected: #8fe3f2; --sb-active: #8fe3f2;
  --sb-tx: rgba(226,242,248,.80); --sb-tx-hi: #fff; --sb-group: rgba(226,242,248,.62);
}
:root[data-palette="powerflow"][data-skin][data-theme="dark"] body:not(.ex-ai-mode) :is(.card,.kpi):not(.card .card) {
  background-image: linear-gradient(90deg,rgba(30,155,232,.85) 0%,rgba(34,195,192,.55) 46%,rgba(47,208,140,.30) 78%,transparent 100%);
  background-size: 100% 2px; background-repeat: no-repeat; background-position: 0 0;
}
/* AI 模式同一套品牌暗色：侧栏用品牌竖向渐变；「实际」来源标签用半透明绿，不垫近黑色块。 */
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme="dark"] .sidebar { background: var(--flux-sidebar); }
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme="dark"] [data-ai-source="actual"] { --source-bg: rgba(63,211,154,.16); --source-ink: #62e0a6; }
/* ID 筛选条的既有选择器权重较高，在品牌范围内明确统一选中态。 */
:root[data-palette="powerflow"][data-skin][data-theme] body:not(.ex-ai-mode) :is(.seg button.on,#home-time .seg button.on,.market-view .module-window .seg button.on,.ex-mode-switch button.on,.btn.primary,.home-section-index,.avatar),
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme] :is(.seg button.on,.ex-mode-switch button.on,.btn.primary,.cx-btn.primary:not(:disabled),.avatar) {
  background: var(--flux-blue) var(--brand-grad); color: #fff; border-color: transparent; box-shadow: none;
}
:root[data-palette="powerflow"][data-skin][data-theme] body:not(.ex-ai-mode) .btn.primary:hover,
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme] :is(.btn.primary,.cx-btn.primary:not(:disabled)):hover {
  background: var(--brand-hover); color: #fff; border-color: transparent;
}
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-skin][data-ai-theme] {
  --x-bg: var(--brand-bg); --x-panel2: var(--flux-soft); --x-line: var(--flux-line); --x-line2: var(--flux-soft);
  --x-mute: #55667d; --x-warn: #8d4c06;
  --ai-top-bg: var(--flux-card); --ai-badge-panel: var(--flux-card);
  --ai-chart-axis: var(--x-sub); --chart-axis: var(--x-sub);
}
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-skin][data-ai-theme="dark"] { --x-mute: #acbad0; --x-warn: #fbbf24; }
/* 比 look-surfaces.css 的通用经典规则更具体，避免 AI 经典重新落回海军蓝。 */
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-skin="classic"][data-ai-theme="light"] {
  --brand-bg: #eef4f5; --x-bg: #eef4f5; background: #eef4f5;
}
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-skin="classic"][data-ai-theme="dark"] {
  /* 不能写成 --x-bg: var(--brand-bg)：look-surfaces.css 里是 --brand-bg: var(--x-bg)，互相引用会让整条底色失效。 */
  --brand-bg: #06273b; --x-bg: #06273b; background: var(--flux-wall) fixed #06273b;
}
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme] :is(.cx-btn,.cx-date-control input,.cx-date input):focus-visible {
  outline-color: var(--brand-ink);
}
/* 浏览器默认灰色占位字在品牌柔和面上不足 4.5:1，沿用各模式的辅助文字色。 */
:root[data-palette="powerflow"][data-skin][data-theme] body:not(.ex-ai-mode) :is(input,textarea)::placeholder,
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme] :is(input,textarea)::placeholder {
  color: var(--tx-3); opacity: 1;
}
/* 按钮的深色渐变不能反用作暗色面上的文字前景。 */
:root[data-palette="powerflow"][data-skin][data-theme] body:not(.ex-ai-mode) .ai-hello h3,
body.ex-ai-mode[data-ai-palette="powerflow"][data-ai-theme] .ai-hello h3 {
  background: none; color: var(--brand-ink); -webkit-text-fill-color: currentColor;
}

/* 经典布局图表系列色（2026-11-13 用户反馈「线都偏灰暗，不如 PowerX 对比强」）：
   原 c2–c8 取品牌同色系蓝灰，多条线挤在一起分不清。改成高饱和、色相拉开的分类色；
   c1 仍跟品牌走（单系列图保持主题感），c5/c6 仍为红/绿以保留涨跌语义。智能舱、AI 模式各有配色，不受影响。 */
:root[data-skin="classic"][data-theme="light"][data-palette] {
  --c2: #f59e0b; --c3: #7c3aed; --c4: #0d9488; --c5: #e5484d; --c6: #16a34a; --c7: #db2777; --c8: #64748b;
}
:root[data-skin="classic"][data-theme="dark"][data-palette] {
  --c2: #fbbf24; --c3: #a78bfa; --c4: #2dd4bf; --c5: #f87171; --c6: #4ade80; --c7: #f472b6; --c8: #94a3b8;
}
