/* G318 后台主题令牌（暗色 / 浅色）
 *
 * 这个文件是两套后台**唯一的颜色来源**：admin / agent 的 css/app.css 只管组件形状，
 * 颜色一律 var(--token)。C 端不引用本文件（它有自己的令牌集），所以改这里不会影响 C 端。
 *
 * 两条铁律：
 *   1) 暗色值 = 改造前的字面量原文 —— 保证"加了浅色主题，暗色一点没变"；
 *      这不是靠人眼保证的，是 _probe/theme-shot.mjs 逐像素比对出来的。
 *   2) 只放**会随主题变**的值。品牌色 / 图表系列色 / 彩色徽标底 / 二维码白底 /
 *      播放器黑底 / 图片上的黑色蒙层在两套主题通用，继续写在各自 app.css 里。
 *
 * 主题通过 <html data-theme="dark|light"> 切换；未标注时默认暗色。
 */

:root, :root[data-theme="dark"] {  /* 暗色（默认）= 改造前的原值 */
  --bg: #0f1115;
  --bg2: #161a22;
  --card: #1c212b;
  --card2: #232936;
  --line: #2a3140;
  --text: #e7ecf3;
  --muted: #8b94a7;
  --brand: #6c5ce7;
  --brand2: #a855f7;
  --accent: #00d4aa;
  --warn: #f6a53c;
  --danger: #ff5b6a;
  --on-brand: #ffffff;
  --on-accent: #04231c;
  --brand-ink: #a79bfa;
  --brand-ink-2: #d5ccff;
  --brand-ink-3: #dcd6ff;
  --brand-ink-4: #e2d4ff;
  --brand-ink-5: #cfc6ff;
  --nav-fg: #93a3c4;
  --nav-sub-fg: #9aa4bb;
  --nav-hover-ico: #b9c6e2;
  --nav-active-ico: #cbc2ff;
  --nav-active-fg: #ffffff;
  --nav-brand-fg: #ffffff;
  --ok-ink: #7fd8a8;
  --warn-ink: #ffcc66;
  --danger-ink: #ffb4b4;
  --danger-ink-soft: #ffd9dc;
  --danger-ink-strong: #ff9d9d;
  --coin-ink: #ffd166;
  --hero-fg: #c4c9d8;
  --code-fg: #dbe3f4;
  --diff-hunk-ink: #8fb7ff;
  --notice-ink: #f5c451;
  --gutter-fg: #5b6478;
  --badge-bg: #2c3446;
  --badge-fg: #b9c2d6;
  --toast-bg: #232936;
  --toast-fg: #ffffff;
  --toast-line: rgba(255,255,255,.16);
  --toast-err-bg: #b81723;
  --glass: rgba(15,17,21,.85);
  --overlay: rgba(6,8,14,.62);
  --bubble-bg: rgba(28,33,43,.95);
  --hover: rgba(255,255,255,.04);
  --hover-soft: rgba(255,255,255,.02);
  --row-tint: rgba(255,255,255,.045);
  --row-tint-alt: rgba(255,255,255,.008);
  --shadow: rgba(0,0,0,.45);
  --shadow-lg: rgba(0,0,0,.5);
  --shadow-sm: rgba(0,0,0,.4);
  --thumb-bg: #232936;
  --hero-bg: linear-gradient(135deg,#0f1a33,#1b1138,#24114a);
  --hero-line: #342a5c;
  --surface-2: #181c25;
  --surface-3: #211a39;
  --surface-4: #1a1c27;
  --glass-strong: rgba(15,17,21,.92);
  --glass-nav: rgba(18,21,28,.88);
  --ink-violet: #d6cffa;
  --ink-violet-2: #c8bdfd;
  --ink-violet-3: #e7e2ff;
  --ink-soft: #cfc7e8;
  --muted-2: #9aa4bd;
  --line-soft: rgba(255,255,255,.06);
  --line-soft-14: rgba(255,255,255,.14);
  --line-soft-16: rgba(255,255,255,.16);
  --brand-soft-16: rgba(108,92,231,.16);
  --brand-soft-8: rgba(108,92,231,.08);
  --brand-line-35: rgba(108,92,231,.35);
  --brand2-soft-6: rgba(168,85,247,.06);
  --coin-soft-12: rgba(255,209,102,.12);
  --line-soft-10: rgba(255,255,255,.1);
  --dialog-bg: linear-gradient(160deg,#181c25,#211a39);
  --grad-brand: linear-gradient(90deg,var(--brand),var(--brand2));
  --gold: #f0b429;
  --brand-fill: #6c5ce7;
  --danger-fill: #c81e3a;
  --c-hero-bg: linear-gradient(120deg,#1b1138,#24114a 60%,#0f1a33);
  --bubble-shadow: rgba(0,0,0,.4);
  --accent-ink: #00d4aa;
  --modal-overlay: rgba(8,10,14,.72);
  --card-shadow: rgba(0,0,0,.25);
  --tile-shadow: rgba(0,0,0,.38);
  --tile-shadow-hover: rgba(0,0,0,.46);
  --on-vip: #fff;
  --glow: rgba(108,92,231,.45);
  --fx-page-1: rgba(245,69,124,0);
  --fx-page-2: rgba(168,85,247,0);
  --fx-page-3: rgba(255,159,67,0);
  --fx-page-4: rgba(168,85,247,0);
  --fx-page-5: rgba(16,185,129,0);
  --fx-aurora-1: rgba(245,69,124,0);
  --fx-aurora-2: rgba(16,185,129,0);
  --fx-dust: rgba(255,255,255,0);
  --fx-dust-2: rgba(245,69,124,0);
  --fx-dust-3: rgba(52,211,153,0);
  --fx-dust-4: rgba(168,85,247,0);
  --fx-band: rgba(255,255,255,0);
  --fx-glow-1: rgba(108,92,231,0);
  --fx-glow-2: rgba(108,92,231,0);
  --fx-sheen: rgba(255,255,255,0);
  --c-shadow: rgba(0,0,0,.45);
  --c-shadow-lg: rgba(0,0,0,.5);
  --c-card-shadow: rgba(0,0,0,.25);
  --c-bubble-shadow: rgba(0,0,0,.4);
  --c-tile-shadow: rgba(0,0,0,.38);
  --c-tile-shadow-hover: rgba(0,0,0,.46);
  --nav-active-bg: linear-gradient(135deg,rgba(108,92,231,.18),rgba(168,85,247,.10));
  --page-wash: none;
}

:root, :root[data-theme="dark"] { color-scheme: dark; }

:root[data-theme="light"] {  /* 浅色：冷灰白底 + 白卡，品牌紫不变 */
  --bg: #f5f6f8;
  --bg2: #ffffff;
  --card: #ffffff;
  --card2: #f2f4f7;
  --line: #e3e7ee;
  --text: #1b2130;
  --muted: #5b6472;
  --brand: #6c5ce7;
  --brand2: #a855f7;
  --accent: #00b894;
  --warn: #e08b14;
  --danger: #e04452;
  --on-brand: #ffffff;
  --on-accent: #04231c;
  --brand-ink: #5b4bd6;
  --brand-ink-2: #4a3bc0;
  --brand-ink-3: #4a3bc0;
  --brand-ink-4: #4a3bc0;
  --brand-ink-5: #4a3bc0;
  --nav-fg: #5b6472;
  --nav-sub-fg: #6b7488;
  --nav-hover-ico: #3a4356;
  --nav-active-ico: #5b4bd6;
  --nav-active-fg: #1b2130;
  --nav-brand-fg: #1b2130;
  --ok-ink: #0f7a5c;
  --warn-ink: #8a5a00;
  --danger-ink: #c0392b;
  --danger-ink-soft: #b83a44;
  --danger-ink-strong: #cc3340;
  --coin-ink: #b26a00;
  --hero-fg: #4a5262;
  --code-fg: #37415a;
  --diff-hunk-ink: #2f6fed;
  --notice-ink: #8a5a00;
  --gutter-fg: #6b7488;
  --badge-bg: #eceff4;
  --badge-fg: #4a5262;
  --toast-bg: #ffffff;
  --toast-fg: #1b2130;
  --toast-line: rgba(16,24,40,.10);
  --toast-err-bg: #c0392b;
  --glass: rgba(255,255,255,.82);
  --overlay: rgba(16,24,40,.42);
  --bubble-bg: rgba(255,255,255,.97);
  --hover: rgba(16,24,40,.045);
  --hover-soft: rgba(16,24,40,.03);
  --row-tint: rgba(16,24,40,.035);
  --row-tint-alt: rgba(16,24,40,.015);
  --shadow: rgba(16,24,40,.14);
  --shadow-lg: rgba(16,24,40,.18);
  --shadow-sm: rgba(16,24,40,.12);
  --thumb-bg: #eceff4;
  --hero-bg: linear-gradient(135deg,#eef2fb,#f3efe9,#efeafc);
  --hero-line: #ddd6f7;
  --surface-2: #ffffff;
  --surface-3: #faf7ff;
  --surface-4: #eef1f6;
  --glass-strong: rgba(255,255,255,.90);
  --glass-nav: rgba(255,255,255,.88);
  --ink-violet: #5b4bd6;
  --ink-violet-2: #5b4bd6;
  --ink-violet-3: #4a3bc0;
  --ink-soft: #6b7488;
  --muted-2: #6b7488;
  --line-soft: rgba(16,24,40,.06);
  --line-soft-14: rgba(16,24,40,.10);
  --line-soft-16: rgba(16,24,40,.12);
  --brand-soft-16: rgba(108,92,231,.10);
  --brand-soft-8: rgba(108,92,231,.06);
  --brand-line-35: rgba(108,92,231,.28);
  --brand2-soft-6: rgba(168,85,247,.05);
  --coin-soft-12: rgba(224,139,20,.10);
  --line-soft-10: rgba(16,24,40,.08);
  --dialog-bg: linear-gradient(160deg,#ffffff,#faf7ff);
  --grad-brand: linear-gradient(90deg,var(--brand),var(--brand2));
  --gold: #9a5f00;
  --brand-fill: #6c5ce7;
  --danger-fill: #c0392b;
  --c-hero-bg: linear-gradient(120deg,#eef2fb,#efeafc 60%,#f7f3ee);
  --bubble-shadow: rgba(16,24,40,.14);
  --accent-ink: #0b7a63;
  --modal-overlay: rgba(16,24,40,.45);
  --card-shadow: rgba(16,24,40,.07);
  --tile-shadow: rgba(16,24,40,.10);
  --tile-shadow-hover: rgba(16,24,40,.14);
  --on-vip: #3a2300;
  --glow: rgba(108,92,231,.28);
  --fx-page-1: rgba(245,69,124,0);
  --fx-page-2: rgba(168,85,247,0);
  --fx-page-3: rgba(255,159,67,0);
  --fx-page-4: rgba(168,85,247,0);
  --fx-page-5: rgba(16,185,129,0);
  --fx-aurora-1: rgba(245,69,124,0);
  --fx-aurora-2: rgba(16,185,129,0);
  --fx-dust: rgba(255,255,255,0);
  --fx-dust-2: rgba(245,69,124,0);
  --fx-dust-3: rgba(52,211,153,0);
  --fx-dust-4: rgba(168,85,247,0);
  --fx-band: rgba(255,255,255,0);
  --fx-glow-1: rgba(108,92,231,0);
  --fx-glow-2: rgba(108,92,231,0);
  --fx-sheen: rgba(255,255,255,0);
  --c-shadow: rgba(108,92,231,.14);
  --c-shadow-lg: rgba(108,92,231,.18);
  --c-card-shadow: rgba(108,92,231,.08);
  --c-bubble-shadow: rgba(108,92,231,.16);
  --c-tile-shadow: rgba(108,92,231,.10);
  --c-tile-shadow-hover: rgba(108,92,231,.14);
  --nav-active-bg: linear-gradient(135deg,rgba(108,92,231,.12),rgba(168,85,247,.07));
  --page-wash: linear-gradient(168deg,#fbfcff 0%,#f6f8fc 40%,#f7f9fd 100%);
}

:root[data-theme="light"] { color-scheme: light; }

/* 跟随系统：没手选过主题时才生效（手选后由 [data-theme] 覆盖） */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) { color-scheme: light; }
}

/* ---------------- 主题切换器（三端共用一套样式，将来加配色不用改这里） ----------------
   后台：侧栏底部 / 顶栏一个"图标+文案"的循环按钮。
   C 端：右上角一个圆形图标 + 底部抽屉（三套以上配色时循环切换没法用）。 */
.theme-btn{display:inline-flex;align-items:center;gap:6px;flex:none}
.theme-btn .ico{color:var(--brand-ink)}
.theme-btn-lab{font-size:12.5px}
@media (max-width:900px){.theme-btn-lab{display:none}}

/* C 端：右上角图标按钮（移动端只显示图标，不去挤头像 / 注册按钮） */
.theme-entry{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;
  border:1px solid var(--line);border-radius:50%;background:var(--card2);color:var(--brand-ink);
  cursor:pointer;padding:0;flex:none}
.theme-entry:hover{background:var(--card)}
.theme-entry .ico{width:18px;height:18px}

/* C 端：底部抽屉 */
.theme-sheet-mask{position:fixed;inset:0;z-index:1200;background:var(--overlay);
  display:flex;align-items:flex-end;justify-content:center;opacity:0;transition:opacity .18s}
.theme-sheet-mask.show{opacity:1}
.theme-sheet{width:100%;max-width:520px;background:var(--card);border:1px solid var(--line);
  border-radius:18px 18px 0 0;padding:14px 16px calc(16px + env(safe-area-inset-bottom));
  transform:translateY(12px);transition:transform .18s;box-shadow:var(--shadow-lg)}
.theme-sheet-mask.show .theme-sheet{transform:none}
@media (min-width:769px){.theme-sheet{border-radius:18px;margin-bottom:8vh}}
.theme-sheet-head{display:flex;align-items:center;justify-content:space-between;
  font-size:15px;color:var(--text);padding:2px 2px 10px}
.theme-close{border:0;background:none;color:var(--muted);font-size:15px;cursor:pointer;padding:4px 6px}
.theme-opt{display:flex;align-items:center;gap:12px;width:100%;text-align:left;cursor:pointer;
  background:var(--card2);border:1px solid var(--line);border-radius:12px;padding:11px 12px;margin-bottom:8px}
.theme-opt:hover{border-color:var(--brand)}
.theme-opt.on{border-color:var(--brand);background:var(--brand-soft-16)}
.theme-sw{display:inline-flex;flex:none}
.theme-sw i{width:16px;height:16px;border-radius:50%;display:inline-block;margin-left:-5px;
  border:1px solid var(--line)}
.theme-sw i:first-child{margin-left:0}
.theme-txt{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.theme-txt b{font-size:14px;color:var(--text);font-weight:600}

.theme-tick{color:var(--brand-ink);font-weight:700;flex:none}


/* 动效开关（只在当前主题支持动效时渲染，见 theme.js）：沿用主题的卡片与品牌色 */
.theme-fx{display:flex;align-items:center;gap:12px;background:var(--card2);border:1px solid var(--line);
  border-radius:12px;padding:11px 12px;margin-bottom:8px}
.theme-fx-txt{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.theme-fx-txt b{font-size:14px;color:var(--text);font-weight:600}
.theme-fx-txt em{font-size:11.5px;color:var(--muted);font-style:normal}
.theme-sw-btn{position:relative;flex:none;display:inline-flex;align-items:center;gap:6px;cursor:pointer;
  border:1px solid var(--line);background:var(--card);color:var(--muted);border-radius:999px;
  padding:5px 10px 5px 24px;font-size:12px;font-weight:700}
.theme-sw-btn i{position:absolute;left:5px;top:50%;transform:translateY(-50%);width:14px;height:14px;
  border-radius:50%;background:var(--muted);transition:.18s}
.theme-sw-btn.on{border-color:var(--brand);color:var(--brand-ink)}
.theme-sw-btn.on i{left:calc(100% - 19px);background:var(--brand)}

:root[data-theme="rose"] {  /* 玫粉：对标 v7.mscmsx.com（浅薰衣草底 + 玫粉品牌 + 紫罗兰副色） */
  --bg: #fbf7ff;
  --bg2: #ffffff;
  --card: #ffffff;
  --card2: #f6f2fb;
  --line: #efe8f7;
  --text: #2e2840;
  --muted: #69637a;
  --brand: #f5457c;
  --brand2: #a855f7;
  --accent: #10b981;
  --warn: #ff9f43;
  --danger: #ff4d6d;
  --on-brand: #ffffff;
  --on-accent: #04231c;
  --brand-ink: #c43764;
  --brand-ink-2: #4a3bc0;
  --brand-ink-3: #4a3bc0;
  --brand-ink-4: #4a3bc0;
  --brand-ink-5: #4a3bc0;
  --nav-fg: #6f6a7d;
  --nav-sub-fg: #6f6a7d;
  --nav-hover-ico: #a256cf;
  --nav-active-ico: #c02f63;
  --nav-active-fg: #a8305c;
  --nav-brand-fg: #c43764;
  --ok-ink: #0b7a5c;
  --warn-ink: #a35a00;
  --danger-ink: #c81e5b;
  --danger-ink-soft: #b83a44;
  --danger-ink-strong: #cc3340;
  --coin-ink: #8f5200;
  --hero-fg: #6b5a7a;
  --code-fg: #37415a;
  --diff-hunk-ink: #2f6fed;
  --notice-ink: #a35a00;
  --gutter-fg: #6b7488;
  --badge-bg: #eceff4;
  --badge-fg: #4a5262;
  --toast-bg: #ffffff;
  --toast-fg: #2e2840;
  --toast-line: rgba(168,107,216,.18);
  --toast-err-bg: #c0392b;
  --glass: rgba(255,255,255,.86);
  --overlay: rgba(46,24,58,.40);
  --bubble-bg: rgba(255,255,255,.98);
  --hover: rgba(245,69,124,.06);
  --hover-soft: rgba(168,107,216,.05);
  --row-tint: rgba(245,69,124,.04);
  --row-tint-alt: rgba(168,107,216,.05);
  --shadow: rgba(168,107,216,.14);
  --shadow-lg: rgba(168,107,216,.18);
  --shadow-sm: rgba(16,24,40,.12);
  --thumb-bg: #f3eef9;
  --hero-bg: linear-gradient(135deg,#ffd9e6,#efe0ff,#dff5ff);
  --hero-line: #f2d9ea;
  --surface-2: #ffffff;
  --surface-3: #faf6ff;
  --surface-4: #f3eef9;
  --glass-strong: rgba(255,255,255,.92);
  --glass-nav: rgba(255,255,255,.92);
  --ink-violet: #7d3fb0;
  --ink-violet-2: #7a3fb0;
  --ink-violet-3: #6a2f9c;
  --ink-soft: #6f6a7d;
  --muted-2: #69637a;
  --line-soft: rgba(168,107,216,.10);
  --line-soft-14: rgba(168,107,216,.14);
  --line-soft-16: rgba(168,107,216,.16);
  --brand-soft-16: rgba(245,69,124,.12);
  --brand-soft-8: rgba(245,69,124,.07);
  --brand-line-35: rgba(245,69,124,.35);
  --brand2-soft-6: rgba(168,107,216,.06);
  --coin-soft-12: rgba(255,159,67,.14);
  --line-soft-10: rgba(168,107,216,.10);
  --dialog-bg: linear-gradient(160deg,#ffffff,#fdf7ff);
  --grad-brand: linear-gradient(135deg,#f5457c,#a855f7);
  --gold: #9a5c00;
  --brand-fill: #cf2f63;
  --danger-fill: #c81e5b;
  --c-hero-bg: linear-gradient(120deg,#ffe6f0,#f3e4ff 60%,#e9f7ff);
  --bubble-shadow: rgba(245,69,124,.18);
  --accent-ink: #0b7a5c;
  --modal-overlay: rgba(46,24,58,.45);
  --card-shadow: rgba(168,107,216,.10);
  --tile-shadow: rgba(168,107,216,.12);
  --tile-shadow-hover: rgba(168,107,216,.16);
  --on-vip: #3a2300;
  --glow: rgba(245,69,124,.30);
  --fx-page-1: rgba(245,69,124,.50);
  --fx-page-2: rgba(168,85,247,.42);
  --fx-page-3: rgba(255,159,67,.30);
  --fx-page-4: rgba(186,104,200,.34);
  --fx-page-5: rgba(52,211,153,.26);
  --fx-aurora-1: rgba(245,69,124,.40);
  --fx-aurora-2: rgba(52,211,153,.30);
  --fx-dust: rgba(255,255,255,.98);
  --fx-dust-2: rgba(245,69,124,.55);
  --fx-dust-3: rgba(52,211,153,.5);
  --fx-dust-4: rgba(168,85,247,.5);
  --fx-band: rgba(255,255,255,.55);
  --fx-glow-1: rgba(245,69,124,.42);
  --fx-glow-2: rgba(168,85,247,.38);
  --fx-sheen: rgba(255,255,255,.42);
  --c-shadow: rgba(168,107,216,.14);
  --c-shadow-lg: rgba(168,107,216,.18);
  --c-card-shadow: rgba(168,107,216,.10);
  --c-bubble-shadow: rgba(245,69,124,.18);
  --c-tile-shadow: rgba(168,107,216,.12);
  --c-tile-shadow-hover: rgba(168,107,216,.16);
  --nav-active-bg: linear-gradient(135deg,rgba(245,69,124,.14),rgba(168,107,216,.10));
  --page-wash: linear-gradient(168deg,#fdf8ff 0%,#f8f2ff 38%,#fbf7ff 100%);
}
:root[data-theme="rose"] { color-scheme: light; }
