/* ============================================================
 * 云图数智 · 主题包（theme.css）
 * 用法：在 index.html 里 <link> 到 app.css 之后加一行本文件，
 *       再在 <body> 上加 data-theme="dg" / "db" / "light"。
 * 原理：云图数智 v1.12.x 的 app.css 已用 CSS 变量（--bg/--card/--line/--text…），
 *       本文件只覆盖变量 + 少数硬编码浅色的组件，不动原样式结构。
 * 适用范围：桌面端全站 + 手机皮肤（手机皮肤读同一套变量，自动跟随）。
 * 打印：单据打印/PDF 固定浅色，见文件末尾 @media print 段。
 * ============================================================ */

/* ---------------- 1. 局部变量层（不动 :root 默认值） ---------------- */
:root {
  /* 主题名/描述，供设置页下拉展示 */
  --theme-name: "浅色（默认）";
}

/* ---------------- 2. 深灰暗夜版 ---------------- */
body[data-theme="dg"] {
  --theme-name: "深灰暗夜";
  color-scheme: dark;

  --primary: #4f7cff; --primary-d: #3f66e0; --primary-l: #1a2438;
  --violet: #8b7bff; --cyan: #35c6e0;
  --success: #2ecc8f; --success-l: #133527;
  --danger: #ff6b6f; --danger-l: #3a1a1e;
  --warn: #f0b45c; --warn-l: #3a2c17;

  --bg: #0e1116;            /* 页面底 */
  --panel: #12171e;         /* 侧栏 / 顶栏 / 底部条 */
  --panel-2: #10151b;       /* 次级面板 */
  --card: #161b22;          /* 卡片 */
  --card-2: #1b222b;        /* 卡片内的次级块 */
  --line: #262f3b;
  --line2: #1d242d;

  --text: #e7edf6;
  --sub: #a6b4c6;
  --muted: #71808f;

  --sh1: 0 1px 2px rgba(0,0,0,.55), 0 6px 18px rgba(0,0,0,.35);
  --sh2: 0 14px 40px rgba(0,0,0,.6);
  --grad: linear-gradient(135deg, #4f7cff 0%, #7b61ff 100%);
  --grad-soft: linear-gradient(135deg, #182132 0%, #1d1a2e 100%);
}

/* ---------------- 3. 深蓝科技版 ---------------- */
body[data-theme="db"] {
  --theme-name: "深蓝科技";
  color-scheme: dark;

  --primary: #4f7cff; --primary-d: #3a63e6; --primary-l: #17203a;
  --violet: #6f8cff; --cyan: #22d3ee;
  --success: #34d399; --success-l: #0f2b2a;
  --danger: #fb7185; --danger-l: #331822;
  --warn: #fbbf24; --warn-l: #33280f;

  --bg: #080e1c;
  --panel: #0d1526;
  --panel-2: #0a1120;
  --card: #111c31;
  --card-2: #16233c;
  --line: #22304d;
  --line2: #1a2740;

  --text: #e8f1ff;
  --sub: #a2b6da;
  --muted: #6b80a8;

  --sh1: 0 1px 2px rgba(0,0,0,.6), 0 6px 20px rgba(0,0,0,.45);
  --sh2: 0 16px 44px rgba(0,0,0,.65);
  --grad: linear-gradient(135deg, #3b6dff 0%, #22d3ee 100%);
  --grad-soft: linear-gradient(135deg, #0f1b33 0%, #102436 100%);
}

/* ============================================================
 * 4. 组件层覆盖：只处理原 CSS 里硬编码浅色的地方
 *    （没走变量的 #fff / #f8fafc / rgba(255,255,255,…) 等）
 * ============================================================ */
body[data-theme="dg"], body[data-theme="db"] {
  background: var(--bg);
  color: var(--text);
}

/* 4.1 外壳：侧栏 / 顶栏 / 标签条 / 主区 */
body[data-theme="dg"] .sidebar,
body[data-theme="db"] .sidebar { background: var(--panel) !important; border-right: 1px solid var(--line) !important; }
body[data-theme="dg"] .topbar,
body[data-theme="db"] .topbar { background: var(--panel) !important; border-bottom: 1px solid var(--line) !important; }
body[data-theme="dg"] .tabsbar,
body[data-theme="db"] .tabsbar { background: var(--panel) !important; border-bottom: 1px solid var(--line) !important; }
body[data-theme="dg"] .main,
body[data-theme="db"] .main { background: var(--bg) !important; }
body[data-theme="dg"] .content,
body[data-theme="db"] .content { background: transparent !important; }

/* 4.2 侧栏菜单项与 hover */
body[data-theme="dg"] .sidebar .nav-item:hover,
body[data-theme="dg"] .sidebar .mi:hover,
body[data-theme="db"] .sidebar .nav-item:hover,
body[data-theme="db"] .sidebar .mi:hover { background: var(--card-2) !important; }

/* 4.3 卡片 / 面板 / KPI / 统计块 */
body[data-theme="dg"] .panel,
body[data-theme="dg"] .card,
body[data-theme="dg"] .kpi,
body[data-theme="dg"] .dk,
body[data-theme="dg"] .side-card,
body[data-theme="dg"] .hello-card,
body[data-theme="dg"] .mh-card,
body[data-theme="db"] .panel,
body[data-theme="db"] .card,
body[data-theme="db"] .kpi,
body[data-theme="db"] .dk,
body[data-theme="db"] .side-card,
body[data-theme="db"] .hello-card,
body[data-theme="db"] .mh-card {
  background: var(--card) !important;
  border-color: var(--line) !important;
  box-shadow: var(--sh1) !important;
}

/* 4.4 表格：表头 / 行 / hover / 斑马 */
body[data-theme="dg"] table.tbl thead th,
body[data-theme="dg"] .detail-tbl thead th,
body[data-theme="db"] table.tbl thead th,
body[data-theme="db"] .detail-tbl thead th { background: var(--card-2) !important; color: var(--sub) !important; border-color: var(--line) !important; }
body[data-theme="dg"] table.tbl tbody tr:hover,
body[data-theme="db"] table.tbl tbody tr:hover { background: var(--card-2) !important; }
body[data-theme="dg"] table.tbl td,
body[data-theme="db"] table.tbl td { border-color: var(--line2) !important; color: var(--text); }

/* 4.5 输入框 / 下拉 / 按钮 */
body[data-theme="dg"] input, body[data-theme="dg"] select, body[data-theme="dg"] textarea,
body[data-theme="db"] input, body[data-theme="db"] select, body[data-theme="db"] textarea {
  background: var(--card-2) !important; border: 1px solid var(--line) !important; color: var(--text) !important;
}
body[data-theme="dg"] input::placeholder,
body[data-theme="db"] input::placeholder { color: var(--muted) !important; }
body[data-theme="dg"] .btn.ghost,
body[data-theme="db"] .btn.ghost { background: var(--card-2) !important; color: var(--text) !important; border: 1px solid var(--line) !important; }
body[data-theme="dg"] .btn.sm:hover,
body[data-theme="db"] .btn.sm:hover { filter: brightness(1.12); }

/* 4.6 弹窗 / 抽屉 / 遮罩 */
body[data-theme="dg"] .dlg,
body[data-theme="dg"] .modal,
body[data-theme="dg"] .drawer,
body[data-theme="db"] .dlg,
body[data-theme="db"] .modal,
body[data-theme="db"] .drawer { background: var(--card) !important; border: 1px solid var(--line) !important; color: var(--text) !important; }

/* 4.7 标签 / 徽标：浅底改成深底 */
body[data-theme="dg"] .tag,
body[data-theme="dg"] .badge,
body[data-theme="dg"] .pill,
body[data-theme="db"] .tag,
body[data-theme="db"] .badge,
body[data-theme="db"] .pill { background: var(--card-2) !important; color: var(--sub) !important; border-color: var(--line) !important; }

/* 4.8 滚动条 */
body[data-theme="dg"] ::-webkit-scrollbar-thumb,
body[data-theme="db"] ::-webkit-scrollbar-thumb { background: #2b3646; }
body[data-theme="dg"] ::-webkit-scrollbar-thumb:hover,
body[data-theme="db"] ::-webkit-scrollbar-thumb:hover { background: #3a475a; }

/* 4.9 图表：柱状图空槽与网格线 */
body[data-theme="dg"] .chart .col .bars,
body[data-theme="db"] .chart .col .bars { background: transparent !important; }
body[data-theme="dg"] .chart .bar.p,
body[data-theme="db"] .chart .bar.p { background: #2b3646 !important; }
body[data-theme="dg"] .chart .bar.s,
body[data-theme="db"] .chart .bar.s { background: var(--grad) !important; }

/* 4.10 首页问候卡（原为深色渐变，暗色下加深一档避免"卡片里再套亮块"） */
body[data-theme="dg"] .hello-card { background: linear-gradient(135deg, #1b2438 0%, #241d3a 100%) !important; }
body[data-theme="db"] .hello-card { background: linear-gradient(135deg, #10203c 0%, #0f2b3d 100%) !important; }

/* 4.11 手机皮肤同步（mobile.css 里的白底卡片/输入） */
body[data-theme="dg"] #mHead,
body[data-theme="db"] #mHead { background: color-mix(in srgb, var(--panel) 84%, transparent) !important; border-bottom: 1px solid var(--line) !important; }
body[data-theme="dg"] #mBar,
body[data-theme="db"] #mBar { background: color-mix(in srgb, var(--panel) 88%, transparent) !important; border-top: 1px solid var(--line) !important; }
body[data-theme="dg"] #mMenu,
body[data-theme="db"] #mMenu { background: var(--bg) !important; }
body[data-theme="dg"] .m-gp,
body[data-theme="db"] .m-gp { background: var(--card) !important; border-color: var(--line) !important; }
body[data-theme="dg"] .mh-hello,
body[data-theme="db"] .mh-hello { background: var(--grad) !important; }

/* ============================================================
 * 5. 打印固定浅色：主题只管屏幕，单据/报表永远白底黑字
 * ============================================================ */
@media print {
  body, .panel, .card, .tbl, table { background: #fff !important; color: #000 !important; }
  /* v1.12.24：与 app.css / printStyle() / 屏幕预览口径统一为 #f2f2f2，
     原来残留的偏蓝色值会让直接 Ctrl+P 打印页面时表头泛蓝（打印模块有色彩）。 */
  table.tbl thead th { background: #f2f2f2 !important; color: #000 !important; }
  .sidebar, .topbar, .tabsbar, #mHead, #mBar { display: none !important; }
}

/* ============================================================
 * 6. 第二轮覆盖：首页看板里硬编码浅色/深字的块（v1.12.x 实测补丁）
 *    app.css 里这些类直接写死了 #fff / #131d3a / #101a33 等，必须点名覆盖
 * ============================================================ */
body[data-theme="dg"] .dash-hero,
body[data-theme="dg"] .dash-quick,
body[data-theme="dg"] .panel.dash-trend,
body[data-theme="db"] .dash-hero,
body[data-theme="db"] .dash-quick,
body[data-theme="db"] .panel.dash-trend {
  background: var(--card) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--sh1) !important;
}

/* 问候大卡里的标题/副标题/徽标 */
body[data-theme="dg"] .dash-hero .dh-title,
body[data-theme="db"] .dash-hero .dh-title { color: var(--text) !important; }
body[data-theme="dg"] .dash-hero .dh-sub,
body[data-theme="db"] .dash-hero .dh-sub { color: var(--sub) !important; }
body[data-theme="dg"] .dash-hero .dh-eyebrow,
body[data-theme="db"] .dash-hero .dh-eyebrow { color: var(--muted) !important; }

/* 问候卡右侧的小统计块（本月销售额/毛利率） */
body[data-theme="dg"] .dash-hero .dh-mini,
body[data-theme="db"] .dash-hero .dh-mini {
  background: var(--card-2) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
}
body[data-theme="dg"] .dh-mini .lb, body[data-theme="dg"] .dh-mini .df,
body[data-theme="db"] .dh-mini .lb, body[data-theme="db"] .dh-mini .df { color: var(--sub) !important; }
body[data-theme="dg"] .dh-mini .vl,
body[data-theme="db"] .dh-mini .vl { color: var(--text) !important; }

/* 快捷方式 */
body[data-theme="dg"] .dq-head b,
body[data-theme="db"] .dq-head b { color: var(--text) !important; }
body[data-theme="dg"] .dq-head span,
body[data-theme="db"] .dq-head span { color: var(--muted) !important; }
body[data-theme="dg"] .dash-quick .dq-item,
body[data-theme="db"] .dash-quick .dq-item { color: var(--sub) !important; }
body[data-theme="dg"] .dash-quick .dq-item:hover,
body[data-theme="db"] .dash-quick .dq-item:hover { background: var(--card-2) !important; }

/* KPI 四个大数字 */
body[data-theme="dg"] .dk .vl,
body[data-theme="db"] .dk .vl { color: var(--text) !important; }
body[data-theme="dg"] .dk .lb,
body[data-theme="dg"] .dk .ft,
body[data-theme="db"] .dk .lb,
body[data-theme="db"] .dk .ft { color: var(--sub) !important; }

/* 面板标题 / 图例 / 走势图刻度 */
body[data-theme="dg"] .panel-h h3,
body[data-theme="db"] .panel-h h3 { color: var(--text) !important; }
body[data-theme="dg"] .panel-h .lnk,
body[data-theme="db"] .panel-h .lnk { color: var(--primary) !important; }
body[data-theme="dg"] .chart .col .lb,
body[data-theme="db"] .chart .col .lb { color: var(--muted) !important; }

/* 右栏卡片里的文字（通知/待处理/库存预警/催收） */
body[data-theme="dg"] .side-card .sc-h b,
body[data-theme="db"] .side-card .sc-h b { color: var(--text) !important; }
body[data-theme="dg"] .nt .t1,
body[data-theme="db"] .nt .t1 { color: var(--text) !important; }
body[data-theme="dg"] .nt .t2,
body[data-theme="db"] .nt .t2 { color: var(--sub) !important; }
body[data-theme="dg"] .todo .td-tx,
body[data-theme="db"] .todo .td-tx { color: var(--text) !important; }
body[data-theme="dg"] .todo .td-n,
body[data-theme="db"] .todo .td-n { color: var(--primary) !important; }

/* 侧栏当前选中项：浅色胶囊改成深底亮字 */
body[data-theme="dg"] .sidebar .on,
body[data-theme="dg"] .sidebar .active,
body[data-theme="dg"] .sidebar .nav-item.on,
body[data-theme="db"] .sidebar .on,
body[data-theme="db"] .sidebar .active,
body[data-theme="db"] .sidebar .nav-item.on {
  background: var(--card-2) !important;
  color: var(--text) !important;
  box-shadow: inset 2px 0 0 var(--primary) !important;
}

/* 顶栏搜索框与图标 */
body[data-theme="dg"] .top-search input,
body[data-theme="db"] .top-search input { background: var(--card-2) !important; color: var(--text) !important; }
body[data-theme="dg"] .topbar svg,
body[data-theme="db"] .topbar svg { color: var(--sub) !important; }

/* 图表外框（走势图容器若自带白底） */
body[data-theme="dg"] .dash-trend .panel-b,
body[data-theme="db"] .dash-trend .panel-b { background: transparent !important; }

/* ============================================================
 * 7. 第三轮覆盖：按“白底元素扫描”结果逐个点名（v1.12.14 实测）
 * ============================================================ */
body[data-theme="dg"] .dh-eyebrow, body[data-theme="db"] .dh-eyebrow {
  background: var(--card-2) !important; color: var(--sub) !important; border: 1px solid var(--line) !important;
}
body[data-theme="dg"] .dh-badge, body[data-theme="db"] .dh-badge {
  background: var(--card-2) !important; color: var(--sub) !important; border-color: var(--line) !important;
}
body[data-theme="dg"] .dh-badge.r, body[data-theme="db"] .dh-badge.r {
  background: var(--danger-l) !important; color: var(--danger) !important;
}
body[data-theme="dg"] .dh-actions .btn, body[data-theme="dg"] .dh-actions button,
body[data-theme="db"] .dh-actions .btn, body[data-theme="db"] .dh-actions button {
  background: var(--card-2) !important; color: var(--text) !important; border: 1px solid var(--line) !important;
}
body[data-theme="dg"] .tabsbar .tab, body[data-theme="db"] .tabsbar .tab {
  background: transparent !important; color: var(--sub) !important;
}
body[data-theme="dg"] .tabsbar .tab.on, body[data-theme="db"] .tabsbar .tab.on {
  background: var(--card-2) !important; color: var(--text) !important; border-color: var(--line) !important;
}
body[data-theme="dg"] .side-stats .ss, body[data-theme="db"] .side-stats .ss {
  background: var(--card) !important; border: 1px solid var(--line) !important;
}
body[data-theme="dg"] .side-stats .ss .o, body[data-theme="dg"] .side-stats .ss .r, body[data-theme="dg"] .side-stats .ss b,
body[data-theme="db"] .side-stats .ss .o, body[data-theme="db"] .side-stats .ss .r, body[data-theme="db"] .side-stats .ss b {
  color: var(--text) !important;
}
body[data-theme="dg"] .top-search, body[data-theme="db"] .top-search {
  background: var(--card-2) !important; border: 1px solid var(--line) !important;
}
body[data-theme="dg"] .nt.danger, body[data-theme="db"] .nt.danger {
  background: var(--danger-l) !important;
}
body[data-theme="dg"] .wx-days .wx-day, body[data-theme="db"] .wx-days .wx-day {
  background: var(--card-2) !important; color: var(--sub) !important;
}
body[data-theme="dg"] .wx-day.on, body[data-theme="db"] .wx-day.on {
  background: var(--primary-l) !important; color: var(--text) !important;
}
body[data-theme="dg"] .umenu, body[data-theme="db"] .umenu {
  background: var(--card) !important; border: 1px solid var(--line) !important; color: var(--text) !important;
}
body[data-theme="dg"] .umenu * , body[data-theme="db"] .umenu * { color: var(--text) !important; }

/* AI 助手抽屉 / 会话区（v1.12.20）
   深空 AI 舱（.ai-hd / .ai-hi / .ai-cap）对所有主题统一深色，是有意设计；
   深色主题下只需把「抽屉底 / 气泡 / 输入区」收口到变量，绝不能用
   background 简写把网格和渐变压掉（旧版 341~345 就是这么把深空舱压平的）。 */
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-drawer {
  background-color: var(--card) !important; border-left: 1px solid var(--line) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-body { color: var(--text) !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-in {
  background-color: var(--card) !important; border-top: 1px solid var(--line) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-in textarea {
  background-color: var(--card-2) !important; color: var(--text) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-bubble {
  background-color: var(--card) !important; border-color: var(--line) !important; color: var(--text) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-chip {
  background-color: var(--card) !important; border-color: var(--line) !important; color: var(--sub) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-hd,
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-hi,
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-cap { color: var(--ai-void-text) !important; }

/* 头像/状态点 */
body[data-theme="dg"] .hc-av, body[data-theme="db"] .hc-av { background: var(--card-2) !important; color: var(--text) !important; }
body[data-theme="dg"] .hc-dot, body[data-theme="db"] .hc-dot { background: var(--success-l) !important; color: var(--success) !important; }

/* 补充：所有 .panel 的内层标题区 */
body[data-theme="dg"] .panel-h, body[data-theme="db"] .panel-h { background: transparent !important; }

/* 微调：通知条目红色底改成淡红晕，避免整列“大红块” */
body[data-theme="dg"] .nt.danger { background: rgba(229,72,77,.12) !important; }
body[data-theme="db"] .nt.danger { background: rgba(251,113,133,.12) !important; }
/* 微调：首页小徽标文字提亮，保证暗底可读 */
body[data-theme="dg"] .dh-badge, body[data-theme="db"] .dh-badge { color: var(--text) !important; }
body[data-theme="dg"] .dh-badge.r, body[data-theme="db"] .dh-badge.r { color: #ffb0b2 !important; }

/* ================================================================
   八、按截图点名补：顶栏图标 / 侧栏企业卡 / 红冲行 / 状态标签
   ------------------------------------------------------------
   这些元素原 CSS 全部是硬编码浅色（#fff、#fbfbfc、#f4f5f7），
   变量覆盖碰不到，必须逐个点名。
   ================================================================ */

/* 8.1 顶栏图标按钮（预警/待办/帮助）——原来白底 */
body[data-theme="dg"] .top-ico, body[data-theme="db"] .top-ico {
  background: var(--panel-2) !important; border: 1px solid var(--line) !important; color: var(--sub) !important;
}
body[data-theme="dg"] .top-ico:hover, body[data-theme="db"] .top-ico:hover {
  background: var(--card-2) !important; border-color: var(--primary) !important; color: var(--text) !important;
}
body[data-theme="dg"] .top-ico svg, body[data-theme="db"] .top-ico svg { stroke: currentColor; }
/* 角标红色数字保留（是提示不是白块），只压一档亮度防刺眼 */
body[data-theme="dg"] .top-ico .tb, body[data-theme="db"] .top-ico .tb { box-shadow: 0 3px 8px rgba(0,0,0,.45) !important; }

/* 8.2 侧栏底部企业信息卡——原来是白到淡蓝渐变 */
body[data-theme="dg"] .side-ent, body[data-theme="db"] .side-ent {
  background: linear-gradient(160deg, var(--card) 0%, var(--card-2) 100%) !important;
  border: 1px solid var(--line) !important; box-shadow: 0 6px 16px rgba(0,0,0,.35) !important;
}
body[data-theme="dg"] .side-ent:hover, body[data-theme="db"] .side-ent:hover {
  border-color: var(--primary) !important; box-shadow: 0 10px 24px rgba(0,0,0,.45) !important; transform: none !important;
}
body[data-theme="dg"] .side-ent .se-hd b, body[data-theme="db"] .side-ent .se-hd b { color: var(--text) !important; }
body[data-theme="dg"] .side-ent .se-more, body[data-theme="db"] .side-ent .se-more { color: var(--muted) !important; }
body[data-theme="dg"] .side-ent .se-row span, body[data-theme="db"] .side-ent .se-row span { color: var(--muted) !important; }
body[data-theme="dg"] .side-ent .se-row b, body[data-theme="db"] .side-ent .se-row b { color: var(--sub) !important; }
/* 「云版本」原来是渐变文字，暗底会糊成一团，改浅蓝实色 */
body[data-theme="dg"] .side-ent .se-row b.grad, body[data-theme="db"] .side-ent .se-row b.grad {
  background: none !important; -webkit-text-fill-color: #8fb4ff !important; color: #8fb4ff !important;
}
body[data-theme="dg"] .side-ent .se-ico, body[data-theme="db"] .side-ent .se-ico {
  box-shadow: 0 6px 14px rgba(52,87,245,.35) !important;
}

/* 8.3 表格里的「已红冲」行——行内联样式 background:#fbfbfc，靠属性选择器抓 */
body[data-theme="dg"] table.tbl tbody tr[style*="#fbfbfc"],
body[data-theme="db"] table.tbl tbody tr[style*="#fbfbfc"] {
  background: rgba(255,255,255,.03) !important; color: var(--muted) !important;
}
body[data-theme="dg"] table.tbl tbody tr[style*="#fbfbfc"] td,
body[data-theme="db"] table.tbl tbody tr[style*="#fbfbfc"] td { color: var(--muted) !important; }
body[data-theme="dg"] table.tbl tbody tr[style*="#fbfbfc"] b,
body[data-theme="db"] table.tbl tbody tr[style*="#fbfbfc"] b { color: var(--muted) !important; }
/* 同理兜住别处写死的纯白行底 */
body[data-theme="dg"] table.tbl tbody tr[style*="background:#fff"],
body[data-theme="db"] table.tbl tbody tr[style*="background:#fff"] { background: transparent !important; }

/* 8.4 状态标签（已红冲/红字单/草稿）——原来全是浅灰浅橙底 */
body[data-theme="dg"] .pill.gray, body[data-theme="db"] .pill.gray {
  background: rgba(255,255,255,.07) !important; color: var(--muted) !important;
}
body[data-theme="dg"] .pill.g, body[data-theme="db"] .pill.g { background: rgba(15,169,104,.16) !important; color: #56d6a0 !important; }
body[data-theme="dg"] .pill.r, body[data-theme="db"] .pill.r { background: rgba(229,72,77,.16) !important; color: #ff9a9d !important; }
body[data-theme="dg"] .pill.o, body[data-theme="db"] .pill.o { background: rgba(224,147,47,.16) !important; color: #ffc478 !important; }
body[data-theme="dg"] .pill.b, body[data-theme="db"] .pill.b { background: rgba(52,87,245,.18) !important; color: #9db4ff !important; }

/* 8.5 表格商品列文字（.prodcell 写死深蓝 #2b3752） */
body[data-theme="dg"] .prodcell, body[data-theme="db"] .prodcell { color: var(--sub) !important; }

/* 8.6 兜底：表格内联死白底（任何带 background:#fff / #fbfbfc 的行内样式） */
body[data-theme="dg"] .tbl-wrap tr[style*="#fff"], body[data-theme="db"] .tbl-wrap tr[style*="#fff"] {
  background: transparent !important;
}

/* 8.7 顶栏搜索：Ctrl K 快捷键 + 下拉面板（原来都白底） */
body[data-theme="dg"] .top-search kbd, body[data-theme="db"] .top-search kbd {
  background: var(--card-2) !important; border: 1px solid var(--line) !important; color: var(--muted) !important;
}
body[data-theme="dg"] .ts-pop, body[data-theme="db"] .ts-pop {
  background: var(--card) !important; border: 1px solid var(--line) !important; box-shadow: 0 16px 40px rgba(0,0,0,.5) !important;
}
body[data-theme="dg"] .ts-pop *, body[data-theme="db"] .ts-pop * { color: var(--sub); }

/* 8.8 头像下拉里的彩色图标砖（tone-blue 等是浅色底，暗底像白块） */
body[data-theme="dg"] .um-it .um-ic, body[data-theme="db"] .um-it .um-ic { background: rgba(52,87,245,.18) !important; color: #9db4ff !important; }
body[data-theme="dg"] .um-it .um-ic.tone-violet, body[data-theme="db"] .um-it .um-ic.tone-violet { background: rgba(123,97,255,.2) !important; color: #bda9ff !important; }
body[data-theme="dg"] .um-it .um-ic.tone-cyan, body[data-theme="db"] .um-it .um-ic.tone-cyan { background: rgba(18,184,216,.18) !important; color: #7fe3f5 !important; }
body[data-theme="dg"] .um-it .um-ic.tone-red, body[data-theme="db"] .um-it .um-ic.tone-red { background: rgba(229,72,77,.18) !important; color: #ff9a9d !important; }

/* 8.9 首页天气/黄历卡：城市标签、温度、农历都是硬编码深色字 */
body[data-theme="dg"] .sc-h .n, body[data-theme="db"] .sc-h .n {
  background: var(--card-2) !important; color: var(--sub) !important;
}
body[data-theme="dg"] .wx-temp b, body[data-theme="db"] .wx-temp b { color: var(--text) !important; }
body[data-theme="dg"] .wx-temp i, body[data-theme="db"] .wx-temp i { color: var(--muted) !important; }
body[data-theme="dg"] .wx-lunar b, body[data-theme="db"] .wx-lunar b { color: var(--text) !important; }
body[data-theme="dg"] .wx-lunar span, body[data-theme="db"] .wx-lunar span { color: var(--muted) !important; }
body[data-theme="dg"] .wx-day span, body[data-theme="db"] .wx-day span { color: var(--muted) !important; }
body[data-theme="dg"] .wx-day i, body[data-theme="db"] .wx-day i { color: var(--text) !important; }
body[data-theme="dg"] .wx-day i em, body[data-theme="db"] .wx-day i em { color: var(--muted) !important; }
body[data-theme="dg"] .wx-day.on span, body[data-theme="db"] .wx-day.on span { color: var(--sub) !important; }

/* ================================================================
   九、全站布局容器（逐页扫出来的白底）
   ------------------------------------------------------------
   这些是所有功能页共用的壳：筛选条、统计条、页签条、单据卡、
   明细表、流程节点、对账单、打印模板树。原 CSS 全部写死 #fff / #fafbfc。
   ================================================================ */

/* 9.1 通用：筛选条 / 页签条 / 统计条 / 流程提示 */
body[data-theme="dg"] .filters, body[data-theme="db"] .filters,
body[data-theme="dg"] .rtabs, body[data-theme="db"] .rtabs,
body[data-theme="dg"] .stat-strip, body[data-theme="db"] .stat-strip,
body[data-theme="dg"] .flow-hint, body[data-theme="db"] .flow-hint {
  background: var(--card) !important; border: 1px solid var(--line) !important; color: var(--text) !important;
}
body[data-theme="dg"] .rtabs span:hover, body[data-theme="db"] .rtabs span:hover { background: var(--card-2) !important; color: var(--text) !important; }
body[data-theme="dg"] .rtabs span.on, body[data-theme="db"] .rtabs span.on { background: var(--primary-l) !important; color: var(--text) !important; }
body[data-theme="dg"] .stat-strip > div, body[data-theme="db"] .stat-strip > div { border-right-color: var(--line2) !important; }
body[data-theme="dg"] .stat-strip .vl, body[data-theme="db"] .stat-strip .vl { color: var(--text) !important; }
body[data-theme="dg"] .stat-strip .vl.g, body[data-theme="db"] .stat-strip .vl.g { color: #56d6a0 !important; }
body[data-theme="dg"] .stat-strip .vl.r, body[data-theme="db"] .stat-strip .vl.r { color: #ff9a9d !important; }
body[data-theme="dg"] .stat-strip .vl.o, body[data-theme="db"] .stat-strip .vl.o { color: #ffc478 !important; }
body[data-theme="dg"] .flow-hint .fh-icon, body[data-theme="db"] .flow-hint .fh-icon { background: var(--primary-l) !important; color: #9db4ff !important; }

/* 9.2 流程画布节点 / 小标签 */
body[data-theme="dg"] .fnode, body[data-theme="db"] .fnode {
  background: var(--card) !important; border-color: var(--line) !important; color: var(--text) !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.4) !important;
}
body[data-theme="dg"] .fnode.dashed, body[data-theme="db"] .fnode.dashed { color: var(--muted) !important; border-color: var(--line) !important; }
body[data-theme="dg"] .chip, body[data-theme="db"] .chip { background: var(--card-2) !important; border-color: var(--line) !important; color: var(--sub) !important; }
body[data-theme="dg"] .chip b, body[data-theme="db"] .chip b { color: var(--text) !important; }
body[data-theme="dg"] .chip.warn, body[data-theme="db"] .chip.warn { background: rgba(224,147,47,.16) !important; border-color: rgba(224,147,47,.3) !important; color: #ffc478 !important; }
body[data-theme="dg"] .steps .st, body[data-theme="db"] .steps .st { background: var(--card-2) !important; color: var(--sub) !important; }
body[data-theme="dg"] .steps .st.on, body[data-theme="db"] .steps .st.on { background: var(--primary-l) !important; color: #9db4ff !important; }
body[data-theme="dg"] .steps i, body[data-theme="db"] .steps i { background: var(--line) !important; }

/* 9.3 明细表 / 单据卡（新建单据、零售开单整页） */
body[data-theme="dg"] .doc-page, body[data-theme="db"] .doc-page,
body[data-theme="dg"] .page.on.doc-page, body[data-theme="db"] .page.on.doc-page {
  background: var(--card) !important; border: 1px solid var(--line) !important; box-shadow: 0 1px 3px rgba(0,0,0,.3) !important;
}
body[data-theme="dg"] .dp-bar, body[data-theme="db"] .dp-bar,
body[data-theme="dg"] .dp-foot, body[data-theme="db"] .dp-foot {
  background: var(--card-2) !important; border-color: var(--line2) !important;
}
body[data-theme="dg"] .dtw, body[data-theme="db"] .dtw { background: var(--card) !important; border-color: var(--line) !important; }
body[data-theme="dg"] .dt th, body[data-theme="db"] .dt th { background: var(--card-2) !important; border-color: var(--line) !important; color: var(--muted) !important; }
body[data-theme="dg"] .dt td, body[data-theme="db"] .dt td { border-color: var(--line2) !important; }
body[data-theme="dg"] .doc-page .dt tbody tr:nth-child(even) td, body[data-theme="db"] .doc-page .dt tbody tr:nth-child(even) td { background: rgba(255,255,255,.025) !important; }
body[data-theme="dg"] .doc-page .dt tbody tr:hover td, body[data-theme="db"] .doc-page .dt tbody tr:hover td { background: var(--card-2) !important; }
body[data-theme="dg"] .dt td.c-no, body[data-theme="db"] .dt td.c-no { background: var(--card-2) !important; color: var(--muted) !important; }
body[data-theme="dg"] .dt tfoot .dt-sub td, body[data-theme="db"] .dt tfoot .dt-sub td { background: rgba(224,147,47,.12) !important; border-top-color: rgba(224,147,47,.28) !important; }
body[data-theme="dg"] .dt tfoot .dt-sub td.tl, body[data-theme="db"] .dt tfoot .dt-sub td.tl { color: #ffc478 !important; }
body[data-theme="dg"] .dt-thumb, body[data-theme="db"] .dt-thumb { background: var(--card) !important; border-color: var(--line) !important; }
body[data-theme="dg"] .df-bar, body[data-theme="db"] .df-bar { background: var(--card) !important; border-color: var(--line) !important; }
body[data-theme="dg"] .df-settle, body[data-theme="db"] .df-settle { background: var(--card-2) !important; border-color: var(--line) !important; color: var(--sub) !important; }
body[data-theme="dg"] .df-settle input, body[data-theme="dg"] .df-settle select,
body[data-theme="db"] .df-settle input, body[data-theme="db"] .df-settle select {
  background: var(--panel-2) !important; border-color: var(--line) !important; color: var(--text) !important;
}
body[data-theme="dg"] .df-party-info, body[data-theme="db"] .df-party-info { background: var(--card-2) !important; color: var(--sub) !important; }

/* 9.4 普通列表表格的表头（.tbl th 写死 #fafbfc） */
body[data-theme="dg"] .tbl th, body[data-theme="db"] .tbl th { background: var(--card-2) !important; color: var(--muted) !important; }
body[data-theme="dg"] .tbl tbody tr:hover, body[data-theme="db"] .tbl tbody tr:hover { background: rgba(255,255,255,.03) !important; }

/* 9.5 对账单 / 打印预览 / 模板树 */
body[data-theme="dg"] .statement, body[data-theme="db"] .statement { background: var(--card) !important; border: 1px solid var(--line) !important; }
body[data-theme="dg"] .statement th, body[data-theme="db"] .statement th { background: var(--card-2) !important; border-color: var(--line) !important; color: var(--sub) !important; }
body[data-theme="dg"] .statement td, body[data-theme="db"] .statement td { border-color: var(--line) !important; }
body[data-theme="dg"] .statement tfoot td, body[data-theme="db"] .statement tfoot td { background: var(--card-2) !important; }
body[data-theme="dg"] .statement h2, body[data-theme="dg"] .statement h3, body[data-theme="db"] .statement h2, body[data-theme="db"] .statement h3 { color: var(--text) !important; }
/* 打印预览的纸张保持白纸（导出/打印要的是纸），只把外围 UI 变深 */
body[data-theme="dg"] .pv-wrap, body[data-theme="db"] .pv-wrap { background: #eef0f3 !important; }
body[data-theme="dg"] .ptg-side, body[data-theme="db"] .ptg-side { background: var(--card) !important; border-color: var(--line) !important; }
body[data-theme="dg"] .ptg-side-h, body[data-theme="db"] .ptg-side-h { background: var(--card-2) !important; border-color: var(--line) !important; color: var(--text) !important; }
body[data-theme="dg"] .ptg-i, body[data-theme="db"] .ptg-i { background: var(--card-2) !important; border-color: var(--line) !important; color: var(--sub) !important; }
body[data-theme="dg"] .ptg-i.on, body[data-theme="db"] .ptg-i.on { background: var(--primary-l) !important; border-color: var(--primary) !important; color: var(--text) !important; }
body[data-theme="dg"] .ptg-chip, body[data-theme="db"] .ptg-chip { background: var(--card) !important; border-color: var(--line) !important; color: var(--sub) !important; }
body[data-theme="dg"] .ptg-chip.on, body[data-theme="db"] .ptg-chip.on { background: var(--primary-l) !important; color: var(--text) !important; }

/* 9.6 导入提示 / BI 说明条 / 报表时间范围 / 商品缩略占位 */
body[data-theme="dg"] .imp-tip, body[data-theme="db"] .imp-tip { background: var(--card-2) !important; border-color: var(--line2) !important; color: var(--sub) !important; }
body[data-theme="dg"] .bi-note, body[data-theme="db"] .bi-note { background: var(--card-2) !important; color: var(--sub) !important; border-color: var(--line) !important; }
body[data-theme="dg"] .bi-q, body[data-theme="db"] .bi-q,
body[data-theme="dg"] .bi-tab, body[data-theme="db"] .bi-tab { background: var(--card-2) !important; border-color: var(--line) !important; color: var(--text) !important; }
body[data-theme="dg"] .rep-range, body[data-theme="db"] .rep-range { background: var(--card-2) !important; color: var(--sub) !important; }
body[data-theme="dg"] .pd-thumb.no, body[data-theme="db"] .pd-thumb.no { background: var(--card-2) !important; border-color: var(--line) !important; color: var(--muted) !important; }

/* ============================================================
 * 云图数智 · 主题皮肤包（theme.css 续）
 * 十、浅色系换肤（护眼绿 / 可爱粉 / 高贵紫 / 中国红）
 * 十一、换肤选择弹窗（头像下拉 → 主题换肤）
 * ============================================================ */

/* ---------------- 十、浅色系皮肤 ----------------
   浅色皮肤只换主色/底色/描边/渐变，正文深浅不动，
   所以不会影响任何业务页面，只靠覆盖 :root 变量即可。 */

body[data-theme="mint"] {
  --primary: #12a06b; --primary-d: #0b7d54; --primary-l: #e6f7f0;
  --bg: #f2faf6; --card: #ffffff; --line: #dfeee7; --line2: #eef7f2;
  --grad: linear-gradient(135deg, #2ac48c 0%, #0e8f5f 100%);
  --grad-soft: linear-gradient(135deg, #eafaf2 0%, #f6fdfa 100%);
  color-scheme: light;
}
body[data-theme="rose"] {
  --primary: #e2568f; --primary-d: #c03d76; --primary-l: #fdeef5;
  --bg: #fdf5f9; --card: #ffffff; --line: #f7e2ec; --line2: #fdf0f6;
  --grad: linear-gradient(135deg, #ff8fb8 0%, #dd4a85 100%);
  --grad-soft: linear-gradient(135deg, #fff0f7 0%, #fdf8fb 100%);
  color-scheme: light;
}
body[data-theme="violet"] {
  --primary: #7b57d6; --primary-d: #6241b8; --primary-l: #f1ecfd;
  --bg: #f8f5fe; --card: #ffffff; --line: #e8e1f8; --line2: #f4effd;
  --grad: linear-gradient(135deg, #9a78f0 0%, #6b45c9 100%);
  --grad-soft: linear-gradient(135deg, #f3edff 0%, #faf7ff 100%);
  color-scheme: light;
}
body[data-theme="crimson"] {
  --primary: #d33b3b; --primary-d: #b02a2a; --primary-l: #fdecec;
  --bg: #fdf6f5; --card: #ffffff; --line: #f3dedd; --line2: #fbeeed;
  --grad: linear-gradient(135deg, #ef6b5c 0%, #c62f2f 100%);
  --grad-soft: linear-gradient(135deg, #fff0ee 0%, #fdf8f7 100%);
  color-scheme: light;
}

/* 深色皮肤（dg / db）的弹窗、卡片、下拉在别的段里已经覆盖，这里只补
   浅色皮肤下几处「写死蓝色」的地方，避免换了色还留一片蓝。 */

/* ---------------- 十一、换肤弹窗 ---------------- */

.hbb-mask {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: rgba(12, 20, 38, .45); backdrop-filter: blur(3px);
  animation: hbb-fade .16s ease-out;
}
@keyframes hbb-fade { from { opacity: 0 } to { opacity: 1 } }

.hbb-dlg {
  width: min(760px, 92vw); max-height: 86vh; overflow: auto;
  background: var(--card, #fff); color: var(--text, #101828);
  border: 1px solid var(--line, #e9eef7); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(10, 24, 60, .28);
}
.hbb-dlg-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--line2, #f2f5fb);
  position: sticky; top: 0; background: var(--card, #fff); z-index: 2; border-radius: 18px 18px 0 0;
}
.hbb-dlg-hd b { font-size: 15px; }
.hbb-dlg-hd i { font-style: normal; font-size: 11.5px; color: var(--muted, #8b97ab); }
.hbb-dlg-x {
  margin-left: auto; width: 28px; height: 28px; border: 0; border-radius: 9px; cursor: pointer;
  background: var(--card-2, #f4f7fd); color: var(--sub, #556074); font-size: 15px; line-height: 1;
}
.hbb-dlg-x:hover { background: var(--primary-l, #edf2ff); color: var(--primary, #3457f5); }

.hbb-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; padding: 16px 20px 20px;
}
.hbb-card {
  border: 1px solid var(--line, #e9eef7); border-radius: 14px; overflow: hidden;
  background: var(--card, #fff); cursor: pointer; transition: .16s;
}
.hbb-card:hover { border-color: var(--primary, #3457f5); box-shadow: 0 8px 22px rgba(20, 40, 90, .1); transform: translateY(-1px); }
.hbb-card.on { border: 2px solid var(--primary, #3457f5); box-shadow: 0 0 0 3px var(--primary-l, #edf2ff); }

/* 缩略预览：纯 CSS 画的迷你界面，跟着皮肤主色变 */
.hbb-thumb {
  height: 92px; padding: 10px 12px; display: flex; gap: 8px; position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line2, #f2f5fb);
}
.hbb-thumb .t-side { width: 20px; border-radius: 5px; flex: 0 0 auto; }
.hbb-thumb .t-body {
  flex: 1; display: flex; flex-direction: column; gap: 5px;
  background: #fff; border-radius: 7px; padding: 8px; box-shadow: 0 1px 3px rgba(16, 30, 60, .08);
}
.hbb-thumb .t-top { height: 9px; border-radius: 3px; }
.hbb-thumb .t-row { height: 7px; border-radius: 3px; background: #d9e1ec; }
.hbb-thumb .t-row.s { width: 62%; }
.hbb-thumb .t-kpi { display: flex; gap: 5px; margin-top: 2px; }
.hbb-thumb .t-kpi span { flex: 1; height: 20px; border-radius: 5px; background: #eef2f8; }

.hbb-card-tx { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.hbb-card-tx b { font-size: 13px; color: var(--text, #101828); }
.hbb-card-tx span {
  margin-left: auto; font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600;
}
.hbb-card-tx span.now { color: var(--muted, #8b97ab); background: var(--card-2, #f4f7fd); }
.hbb-card-tx span.use { color: #fff; background: var(--primary, #3457f5); }

/* 皮肤缩略配色 */
.hbb-thumb.light   { background: #f5f7fc; }
.hbb-thumb.light   .t-side { background: linear-gradient(160deg, #4f7cff, #7b61ff); }
.hbb-thumb.mint    { background: #f2faf6; }
.hbb-thumb.mint    .t-side { background: linear-gradient(160deg, #2ac48c, #0e8f5f); }
.hbb-thumb.rose    { background: #fdf5f9; }
.hbb-thumb.rose    .t-side { background: linear-gradient(160deg, #ff8fb8, #dd4a85); }
.hbb-thumb.violet  { background: #f8f5fe; }
.hbb-thumb.violet  .t-side { background: linear-gradient(160deg, #9a78f0, #6b45c9); }
.hbb-thumb.crimson { background: #fdf6f5; }
.hbb-thumb.crimson .t-side { background: linear-gradient(160deg, #ef6b5c, #c62f2f); }
.hbb-thumb.dg      { background: #0e1116; }
.hbb-thumb.dg      .t-side { background: #1b222b; }
.hbb-thumb.db      { background: #080e1c; }
.hbb-thumb.db      .t-side { background: #16233c; }

/* 缩略里的白条/色条：按皮肤上色 */
.hbb-thumb.light   .t-top { background: linear-gradient(90deg, #4f7cff, #7b61ff); }
.hbb-thumb.mint    .t-top { background: linear-gradient(90deg, #2ac48c, #0e8f5f); }
.hbb-thumb.rose    .t-top { background: linear-gradient(90deg, #ff8fb8, #dd4a85); }
.hbb-thumb.violet  .t-top { background: linear-gradient(90deg, #9a78f0, #6b45c9); }
.hbb-thumb.crimson .t-top { background: linear-gradient(90deg, #ef6b5c, #c62f2f); }
/* 深色皮肤的缩略：卡片内底改深、条改浅 */
.hbb-thumb.dg .t-body, .hbb-thumb.db .t-body {
  background: #1a222c; box-shadow: none;
}
.hbb-thumb.db .t-body { background: #16233c; }
.hbb-thumb.dg .t-top, .hbb-thumb.db .t-top { background: rgba(255, 255, 255, .30); }
.hbb-thumb.dg .t-row, .hbb-thumb.db .t-row,
.hbb-thumb.dg .t-kpi span, .hbb-thumb.db .t-kpi span { background: rgba(255, 255, 255, .14); }

/* 深色皮肤下弹窗自身的描边/阴影 */
body[data-theme="dg"] .hbb-dlg, body[data-theme="db"] .hbb-dlg { box-shadow: 0 30px 80px rgba(0, 0, 0, .65); }
body[data-theme="dg"] .hbb-card:hover, body[data-theme="db"] .hbb-card:hover { box-shadow: 0 8px 22px rgba(0, 0, 0, .5); }

/* 换肤入口（头像下拉里的那一行，跟着 .um-it 走，不用额外样式，只补图标底色） */
.um-it .um-ic.tone-theme { background: linear-gradient(140deg, #ffd479, #f08a1e); }
body[data-theme="dg"] .um-it .um-ic.tone-theme, body[data-theme="db"] .um-it .um-ic.tone-theme {
  background: rgba(240, 138, 30, .2) !important; color: #ffc478 !important;
}


/* ---------- 十·补：浅色皮肤把「写死的蓝紫」也换掉 ----------
   首页大渐变卡、问候卡、KPI 强调卡、标题渐变字、图表柱、AI 悬浮球
   原来是硬编码的 #3457f5/#4f7cff/#7b61ff，浅色换肤后会留一片蓝紫。 */

:is(body[data-theme="mint"], body[data-theme="rose"], body[data-theme="violet"], body[data-theme="crimson"]) :is(.dk.accent, .hello-card, .dash-hero .dh-btn-main) {
  background: var(--grad) !important;
}
:is(body[data-theme="mint"], body[data-theme="rose"], body[data-theme="violet"], body[data-theme="crimson"]) .dash-hero {
  background: var(--grad-soft) !important;
  border-color: var(--line) !important;
  box-shadow: 0 14px 34px rgba(20, 40, 90, .07) !important;
}
:is(body[data-theme="mint"], body[data-theme="rose"], body[data-theme="violet"], body[data-theme="crimson"]) .dh-title em {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
:is(body[data-theme="mint"], body[data-theme="rose"], body[data-theme="violet"], body[data-theme="crimson"]) :is(.chart .bar.s, .rank-row .bar-in) {
  background: var(--primary) !important;
}
/* v1.12.23：悬浮机器人（.ai-fab）不再跟随主题上色，所有皮肤统一中性。
   根因：.ai-fab.bot 是直角容器（app.css 2155 行 background:transparent），
   里面机器人本体是 22px 圆角白块；容器一上渐变，四个角就露出彩色方角，
   看起来就是「机器人周围一圈彩色光晕」。默认主题没有 data-theme 所以干净，
   其余 6 套都有（用户 2026-11-26 反馈）。主题色只留给抽屉内的 logo / 消息头像。 */
:is(body[data-theme="mint"], body[data-theme="rose"], body[data-theme="violet"], body[data-theme="crimson"]) :is(.ai-logo, .ai-av) {
  background: var(--grad) !important;
}
/* 兜底：任何皮肤下悬浮球容器都必须透明，防止以后再给新主题上色 */
body[data-theme] .ai-fab.bot,
body[data-theme] .ai-fab.bot:hover,
body[data-theme] .ai-fab.bot.dragging { background: transparent !important; }
/* 侧栏企业信息卡里的房子图标、快捷方式的强调砖，跟随主色 */
:is(body[data-theme="mint"], body[data-theme="rose"], body[data-theme="violet"], body[data-theme="crimson"]) .side-ent .se-ico {
  background: var(--grad) !important;
}

/* ============================================================
 * 7. 打印预览区白纸黑字（v2：保留语义色）
 *    深色主题下 .tbl td / thead th 有特异性更高的颜色规则，
 *    只压容器背景会印出「深底浅字」，等于白打。
 *    v1 一刀切 color:#000 会把红色应收金额、打印模板里用户
 *    自定义的颜色也压黑，预览配色失真。v2 改为：
 *      - 屏幕预览：在纸内重定义文字变量，var(--text) 自动变黑，
 *        内联语义色（红/绿/橙）原样保留，预览所见即所得；
 *      - 真正打印：@media print 里统一白纸黑字。
 * ============================================================ */
/* v1.12.24：打印预览「工作台」7 套皮肤统一中性灰 #eef0f3，不随主题变色。
   纸张本身恒白、文字恒黑（下一组），打印模块完全不受换肤影响；
   模板设计器 .pt-pv-* 的容器属于配置界面，仍保留历史「深色无白边」适配。 */
body[data-theme] .pv-wrap {
  background: #eef0f3 !important;
}
body[data-theme] .pv-paper,
body[data-theme] .ptg-pv-paper,
body[data-theme] .print-area,
body[data-theme] .print-sheet {
  background: #fff !important;
  --text: #000; --sub: #333; --muted: #555;
  --danger: #c0392b; --success: #1e7a4d; --warn: #a86a12;
  color: #000 !important;
}

/* 表头浅灰底 + 黑字，表格行压平，避免深底浅字
   v1.12.16f：底色从 #f2f5fb 统一为 #f2f2f2，与 app.css / ptCss 完全一致，
   否则七套皮肤下预览表头比默认主题浅一档，看着就是「颜色不同步」；
   sticky 吸顶时 collapse 边框会掉，补 inset 阴影上下框线。 */
/* v1.12.24：默认主题（无 data-theme）的模板管理预览表头也要与其余 6 套一致。
   用不带 !important 的普通规则，用户自定义模板的内联颜色仍优先，不会被压掉。 */
.ptg-pv-body table thead th { background: #f2f2f2; color: #000; }
body[data-theme] .pv-wrap table thead th,
body[data-theme] .ptg-pv-body table thead th,
body[data-theme] .pt-pv-paper .pt-tbl thead th,
body[data-theme] .ptg-pv-paper .pt-tbl thead th {
  background: #f2f2f2 !important;
  color: #000 !important;
  box-shadow: inset 0 -1px 0 #333, inset 0 1px 0 #333;
}
body[data-theme] .pv-wrap table tbody tr,
body[data-theme] .ptg-pv-body table tbody tr {
  background: #fff !important;
}
/* v1.12.16f：合计行在主题下保持浅灰底，与预览 / 打印 / 单据模板一致 */
body[data-theme] .pv-wrap table tfoot td,
body[data-theme] .ptg-pv-body table tfoot td,
body[data-theme] .pt-pv-paper .pt-tbl tfoot td {
  background: #fafafa !important;
  color: #000 !important;
  font-weight: 600;
}

@media print {
  body[data-theme] .pv-wrap, body[data-theme] .pv-wrap *,
  body[data-theme] .ptg-pv-body, body[data-theme] .ptg-pv-body *,
  body[data-theme] .print-area, body[data-theme] .print-area *,
  body[data-theme] .print-sheet, body[data-theme] .print-sheet * {
    background: #fff !important;
    color: #000 !important;
  }
  body[data-theme] .pv-wrap table thead th,
  body[data-theme] .ptg-pv-body table thead th {
    background: #f2f2f2 !important;
  }
}

/* ============================================================
 * 8. 浅色皮肤：外壳与默认主题保持一致（v3）
 *    v2 用 inset 阴影给顶栏/侧栏描边，实际效果是：
 *      · 顶栏底部一条彩色横线
 *      · 侧栏右缘一条彩色竖线（整页高度）
 *      · 选中菜单再压一条 2px 竖条
 *    用户反馈「缝隙线不要显示、点功能时的颜色框不对、要跟默认
 *    主题一样」。v3 撤掉全部描边与外壳染色，只让选中/悬停用
 *    各自皮肤的淡主色，结构与默认主题的渐变胶囊完全一致，
 *    其余一律交回 app.css 默认样式（白顶栏 / 白侧栏 / 白页签）。
 * ============================================================ */
:is(body[data-theme="mint"], body[data-theme="rose"], body[data-theme="violet"], body[data-theme="crimson"]) .navmod .nmlink:hover {
  background: var(--primary-l) !important;
  color: var(--primary-d) !important;
}
:is(body[data-theme="mint"], body[data-theme="rose"], body[data-theme="violet"], body[data-theme="crimson"]) .navmod.active > .nmlink,
:is(body[data-theme="mint"], body[data-theme="rose"], body[data-theme="violet"], body[data-theme="crimson"]) .navmod .nmlink.on {
  background: linear-gradient(90deg, var(--primary-l) 0%, color-mix(in srgb, var(--primary-l) 42%, #fff) 100%) !important;
  color: var(--primary-d) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 15%, transparent) !important;
}

/* ============================================================
 * 9. 深色主题：文字可读性补齐（v3）
 *    app.css 里有大量写死的深色文字（#111a30 / #16203a /
 *    #43506a / #33405a / #14203a …），深色皮肤下与背景的
 *    对比度只有 1.0–2.5，屏幕上等于看不见。这里逐条点名换成
 *    变量，覆盖：侧栏品牌与菜单、顶栏标题与用户区、首页问候卡
 *    与快捷方式、AI 抽屉、待办、KPI、面板说明与空状态。
 *    注意：这些都是「文字色」，不动背景，也不碰红/绿/橙语义色。
 * ============================================================ */

/* 9.1 主文字（亮） */
:is(body[data-theme="dg"], body[data-theme="db"]) :is(
  .brand .t1, .side-me .nm, .topbar h2, .top-user .un,
  .ai-title, .ai-hi-t, .od-n, .kpi .vl, .dh-badge b
) { color: var(--text) !important; }

/* 9.2 次级文字 */
:is(body[data-theme="dg"], body[data-theme="db"]) :is(
  .navmod .nmlink, .side-me .out, .top-link, .topbar .crumb,
  .ai-hi-s, .ai-cap .ac-t, .dq-item span, .kpi .lb,
  .panel-h .note, .dh-badge
) { color: var(--sub) !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .topbar .crumb-sep { color: var(--muted) !important; }

/* 9.3 弱化文字 */
:is(body[data-theme="dg"], body[data-theme="db"]) :is(
  .nav-cap, .navmod .arw, .topbar .clock, .ai-hi-note, .kpi .ft, .empty
) { color: var(--muted) !important; }
body[data-theme="dg"] .top-search input::placeholder,
body[data-theme="db"] .top-search input::placeholder { color: var(--muted) !important; }

/* 9.4 深蓝强调字：暗底改用浅蓝；v1.12.20 名字渐变改用亮版（深舱里 var(--grad) 偏暗看不清） */
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-hi-s b { color: #9db4ff !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-hi-t em {
  background: linear-gradient(120deg, #9dbcff 0%, #c8adff 100%) !important;
  -webkit-background-clip: text !important; background-clip: text !important;
  -webkit-text-fill-color: transparent !important; color: transparent !important;
}
/* 首页问候卡名字：深色底渐变裁字会糊成一团，改浅蓝实色
   （与 AI 舱名字口径统一；theme_check 也把 transparent 文字判为看不清） */
:is(body[data-theme="dg"], body[data-theme="db"]) .dh-title em {
  background: none !important;
  -webkit-text-fill-color: #9dbcff !important; color: #9dbcff !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-bubble .ai-h,
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-bubble b { color: var(--primary) !important; }

/* 9.5 悬停 / 选中：暗底必须提亮，不能回落到深蓝 */
:is(body[data-theme="dg"], body[data-theme="db"]) .navmod .nmlink:hover { color: var(--text) !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .navmod.active > .nmlink,
:is(body[data-theme="dg"], body[data-theme="db"]) .navmod .nmlink.on { color: #9db4ff !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .od-row:hover .od-n { color: #9db4ff !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .dq-item:hover span { color: var(--text) !important; }

/* 9.6 问候卡正文里的加粗数字（.dh-sub b 写死 #16205c，暗底 1.13） */
body[data-theme="dg"] .dh-sub b, body[data-theme="db"] .dh-sub b { color: var(--text) !important; }

/* ============================================================
 * 10. 打印模板预览（.pt-pv-*）分层（v3）
 *    app.css 里 .pt-pv-wrap 是 #e8ecf0 浅灰底、.pt-bar 是
 *    #f6f9fb，深色皮肤下纸张两侧会露出两条浅灰/白竖边，
 *    工具条也是一整块白。v3 分三层处理：
 *      · 屏幕预览：容器 / 工具条跟主题色走，白边消失；
 *      · 纸张 .pt-pv-paper 仍是白纸（预览所见即所得）；
 *      · 真正打印走 ptDoPrint 的独立 iframe 文档，恒白纸黑字。
 *    theme.js 的 PAPER 例外已同步加入 .pt-pv-*，
 *    白块扫描不会再把这张白纸压成深色。
 * ============================================================ */
:is(body[data-theme="dg"], body[data-theme="db"]) .pt-pv-wrap {
  background: var(--panel-2) !important;
  border: 1px solid var(--line) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) :is(.pt-pv-outer, .pt-pv-scale) { background: transparent !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .pt-bar {
  background: var(--card) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .pt-bar-i { color: var(--sub) !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .pt-bar select {
  background: var(--card-2) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .pt-hint { color: var(--muted) !important; }
/* 纸张：保持白纸，只加主题描边与更深的投影，避免在深底上「炸白」 */
:is(body[data-theme="dg"], body[data-theme="db"]) .pt-pv-paper {
  border: 1px solid var(--line) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55) !important;
}

/* 通用打印预览（利润表 / 对账单等 .pv-wrap）同理：
   容器跟主题走，纸面仍是白的，两侧不再露出浅灰/白块。 */
:is(body[data-theme="dg"], body[data-theme="db"]) .pv-wrap {
  background: #eef0f3 !important;
  border: 1px solid #dfe3e8 !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .pv-paper {
  border: 1px solid #dfe3e8 !important;
  box-shadow: 0 10px 30px rgba(20, 30, 40, .18) !important;
}

/* 页面直接 Ctrl+P 时，模板预览也回到白纸黑字。
   （真正点「打印」走 ptDoPrint 的独立 iframe，本就白纸。） */
@media print {
  body[data-theme] .pt-pv-wrap, body[data-theme] .pt-pv-wrap *,
  body[data-theme] .pt-pv-paper, body[data-theme] .pt-pv-paper *,
  body[data-theme] .pv-wrap, body[data-theme] .pv-wrap *,
  body[data-theme] .pv-paper, body[data-theme] .pv-paper * {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
  }
  body[data-theme] .pt-bar { display: none !important; }
}

/* ============================================================
 * 11. v1.12.17 关联补齐：主题 v3 没收干净的深色残留
 *    这些都不是「新皮肤」，而是此前每次只修了一处、关联处漏改的断点。
 * ============================================================ */

/* ① 打印模板管理页：.ptg-pv-body 是预览容器（app.css 1019 浅灰底），
      v2 误把它和纸一起强制白 → 深色下右侧半屏大白块，且 v3 只补了
      .pt-pv-* / .pv-* 两套容器，漏了这一套。 */
:is(body[data-theme="dg"], body[data-theme="db"]) .ptg-pv-body {
  background: var(--panel-2) !important;
  border-color: var(--line) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .ptg-pv-paper {
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55) !important;
}

/* ② #16205c 深蓝字（RGB 极差 70 > sweep 阈值 46，兜底扫不到），
      v3 第 9 段点名名单漏了这 4 类：首次改密标题、模板分组标题、备份状态文字。 */
:is(body[data-theme="dg"], body[data-theme="db"]) :is(.fp-h, .ptg-sec, .bk-t, .bk-st.ok) {
  color: var(--text) !important;
}

/* ③ 侧栏 hover：4.2 段覆盖的是不存在的 .nav-item / .mi，
      实际 DOM 是 nav.js 生成的 .navmod .nmlink，深色下 hover 会出现近白胶囊。 */
:is(body[data-theme="dg"], body[data-theme="db"]) .navmod .nmlink:hover {
  background: var(--card-2) !important;
  color: var(--text) !important;
}

/* ④ 数据备份卡片是浅蓝白渐变，sweep 因 backgroundImage !== 'none' 跳过，
      这里单独压暗，避免整块浅色割裂深色页面。 */
:is(body[data-theme="dg"], body[data-theme="db"]) .bk-box {
  background: var(--card) !important;
  border-color: var(--line) !important;
}

/* ④-2 v1.12.18：商用加固新增的「异地第二备份」状态条用 .bk-st（不带 ok/err 类），
      app.css 里写死 background:#fff + dashed 浅边框；旧规则只改了 .bk-st.ok 的文字色，
      深色两套主题下这块仍是白底 + 浅字（theme_check 逐页扫描实测白块）。
      这里把基类与 ok / err 三个变体一起压暗，浅色 4 套完全不动。 */
:is(body[data-theme="dg"], body[data-theme="db"]) :is(.bk-st, .bk-st.ok, .bk-st.err) {
  background: var(--card-2) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .bk-st.ok {
  background: rgba(16, 185, 129, .10) !important;
  border-color: rgba(52, 211, 153, .32) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .bk-st.err {
  background: rgba(180, 35, 24, .14) !important;
  border-color: rgba(248, 113, 113, .40) !important;
  color: #fca5a5 !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .bk-path {
  color: var(--muted) !important;
}

/* ⑤ BI 四张看板是原生 SVG 手绘，网格线 / 轴标签 / 柱顶数值 / 环形中心
      用的是写死的 presentation attribute（CSS 变量与 sweep 都吃不到）。
      按颜色值精确覆盖，CSS 优先级高于 presentation attribute，切主题即时生效，
      不必等 30 秒重绘，也无需改动 bi.js 的配色常量。 */
:is(body[data-theme="dg"], body[data-theme="db"]) svg [stroke="#eef2fa"] { stroke: var(--line) !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) svg [fill="#96a2b6"] { fill: var(--muted) !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) svg [fill="#556074"] { fill: var(--sub) !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) svg [fill="#101828"] { fill: var(--text) !important; }

/* ============================================================
 * 12. AI 助手欢迎卡（.ai-hi）深色分层（v1.12.20 改写）
 *     历史背景：旧版 .ai-hi 是白色 linear-gradient，theme.js 的 sweep
 *          只压纯色白底（backgroundImage !== 'none' 直接跳过），压不到它，
 *          深色主题下就出现「白底浅字」。v1.12.16g 曾显式补深色渐变。
 *     v1.12.20：欢迎卡改为「深空 AI 舱」，对 7 套主题统一深色（有意设计，
 *          不是 sweep 误伤）；这里只把 dg/db 的舱底再压深一档、阴影加重，
 *          浅色 4 套（mint/rose/violet/crimson）走 app.css 默认深空渐变，
 *          强调色由 var(--grad) 自动跟随各皮肤主色，无需单独规则。
 * ============================================================ */
/* v1.12.22：深夜暗灰的欢迎卡改灰黑调——原蓝紫舱底与 dg 主题不搭（用户 2026-11-26 反馈） */
:is(body[data-theme="dg"]) .ai-hi {
  background:
    radial-gradient(420px 220px at 50% -10%, rgba(148,163,184,.16), transparent 65%),
    linear-gradient(160deg, #101215 0%, #171a20 55%, #1b1f27 100%) !important;
  border-color: rgba(255,255,255,.12) !important;
  box-shadow: 0 18px 42px rgba(0,0,0,.5) !important;
}
body[data-theme="db"] .ai-hi {
  background:
    radial-gradient(420px 220px at 50% -10%, rgba(34,211,238,.3), transparent 65%),
    linear-gradient(160deg, #06101f 0%, #0a1a33 55%, #0b2444 100%) !important;
  border-color: rgba(120,200,255,.2) !important;
  box-shadow: 0 18px 42px rgba(0,0,0,.5) !important;
}
body[data-theme="db"] .ai-hd {
  background: linear-gradient(120deg, #05101d 0%, #08182e 55%, #0a2240 100%) !important;
}
/* v1.12.22：补 dg 的顶栏覆盖——此前只有欢迎卡有 dg 覆盖、顶栏仍是默认深蓝紫渐变，
   深夜暗灰下 AI 顶栏「跟主题不一样」即此根因 */
body[data-theme="dg"] .ai-hd {
  background: linear-gradient(120deg, #0f1114 0%, #14171d 55%, #191d24 100%) !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-hi::before {
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.05) 1px,transparent 1px) !important;
  background-size: 24px 24px !important;
  width: auto !important; height: auto !important; left: 0 !important; top: 0 !important;
  transform: none !important; border-radius: 0 !important; inset: 0 !important;
}
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-hi-note,
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-cap .ac-s { color: #9aa8cc !important; }

/* 12.1 浅色 4 套皮肤的 AI 舱也带各自色相（墨绿 / 深玫瑰 / 深紫 / 深红），
        顶栏同步，保证「换皮肤 = 整套 AI 舱跟着换」而不是永远一片蓝紫。 */
body[data-theme="mint"] .ai-hi {
  background:
    radial-gradient(420px 220px at 50% -10%, rgba(42,196,140,.34), transparent 65%),
    linear-gradient(160deg, #04120e 0%, #082019 55%, #0a2b21 100%) !important;
  border-color: rgba(80,220,170,.18) !important;
}
body[data-theme="mint"] .ai-hd {
  background: linear-gradient(120deg, #05100c 0%, #08201a 55%, #0a2b22 100%) !important;
}
body[data-theme="rose"] .ai-hi {
  background:
    radial-gradient(420px 220px at 50% -10%, rgba(255,143,184,.32), transparent 65%),
    linear-gradient(160deg, #16060c 0%, #240d18 55%, #2f1120 100%) !important;
  border-color: rgba(255,160,200,.18) !important;
}
body[data-theme="rose"] .ai-hd {
  background: linear-gradient(120deg, #14060b 0%, #220d17 55%, #2d1120 100%) !important;
}
body[data-theme="violet"] .ai-hi {
  background:
    radial-gradient(420px 220px at 50% -10%, rgba(154,120,240,.38), transparent 65%),
    linear-gradient(160deg, #0b0818 0%, #130e2c 55%, #191238 100%) !important;
  border-color: rgba(170,140,255,.2) !important;
}
body[data-theme="violet"] .ai-hd {
  background: linear-gradient(120deg, #0a0716 0%, #120d29 55%, #181135 100%) !important;
}
body[data-theme="crimson"] .ai-hi {
  background:
    radial-gradient(420px 220px at 50% -10%, rgba(239,107,92,.32), transparent 65%),
    linear-gradient(160deg, #150707 0%, #230e0d 55%, #2c1211 100%) !important;
  border-color: rgba(255,150,130,.18) !important;
}
body[data-theme="crimson"] .ai-hd {
  background: linear-gradient(120deg, #130606 0%, #210e0d 55%, #2a1110 100%) !important;
}
/* 绯红皮肤下的名字渐变提亮（红字压深红底会糊） */
body[data-theme="crimson"] .ai-hi-t em {
  background: linear-gradient(120deg, #ffc4b8 0%, #ff9c8f 100%) !important;
  -webkit-background-clip: text !important; background-clip: text !important;
  -webkit-text-fill-color: transparent !important; color: transparent !important;
}

/* ============================================================
 * 13. AI 助手深空舱 · 7 套主题适配说明（v1.12.20）
 *   - 深空舱（.ai-hd/.ai-hi/.ai-cap）对所有主题统一深色：浅色皮肤下
 *     是「浅色页面里嵌入一个深色 AI 终端」，不是被 sweep 压黑的误伤。
 *     因此 ai_theme_check.js 的旧断言「浅色主题 .ai-hi 必须白渐变」
 *     已随设计口径变更更新为「7 套主题 .ai-hi 均为深色且文字对比达标」。
 *   - 强调色（顶栏光带 / 主按钮 / 发送键 / 机器人光晕 / 图标 / 名字）
 *     全部走 var(--grad)、var(--primary)，随 light / mint / rose /
 *     violet / crimson / dg / db 自动变化，无写死蓝色残留。
 *   - 消息区 / 输入区走 --card / --text / --line，深色主题由第 4 段
 *     （341 行附近）与第 9 段文字色规则收口；浅色主题保持白卡片。
 *   - 动画统一受 prefers-reduced-motion 控制，浅色深色一视同仁。
 * ============================================================ */

/* ============================================================
 * 14. AI 对话新增元素 · 深色可读性（v1.12.21 · P9）
 *   思考链 / 来源标注 / 复制朗读操作在 app.css 里用 var(--muted)，
 *   dg/db 下实测是 rgb(113,128,143)，压在 rgb(22,27,34) 气泡上偏暗。
 *   只圈 dg/db 两套深色（浅色 4 套也带 data-theme，一刀切会误改浅卡片）；
 *   思考链选择器与 app.css 一致限定 .ai-think，避免碰到教程列表。
 * ============================================================ */
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-think .ai-steps i,
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-src,
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-ops { color: #a8b6d6 !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-ops span:hover { color: var(--primary) !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-src::before { color: var(--primary) !important; }
:is(body[data-theme="dg"], body[data-theme="db"]) .ai-think-t { color: var(--text) !important; }
