/* admin-theme-light.css — 后台日间模式浅色覆盖
 * 仅在 html[data-theme="light"] 时生效（由 theme-boot.js 按系统时间/手动设置）。
 * 作用范围：后台路由（#/admin*）；驾驶舱不设置 data-theme，保持深色看板。
 * 原则：不改 React 主包，全部通过变量重定义 + 属性/类选择器覆盖。
 */

/* ---------- 1. 设计变量重定义 ---------- */
html[data-theme="light"] {
  --bg-primary: #eef1f7;
  --bg-panel: rgba(255, 255, 255, .78);
  --bg-panel-solid: #ffffff;
  --bg-card: rgba(255, 255, 255, .8);
  --text-primary: #0f172a;
  --text-secondary: rgba(15, 23, 42, .72);
  --text-muted: rgba(15, 23, 42, .5);
  --text-dim: rgba(15, 23, 42, .38);
  /* 主包引用但从未定义的 token：补齐浅色值（深色主题保持原样不动） */
  --text-ultra: rgba(15, 23, 42, .92);
  --text-tertiary: rgba(15, 23, 42, .62);
  --text-subtle: rgba(15, 23, 42, .55);
  --text-faint: rgba(15, 23, 42, .45);
  --text-nano: rgba(15, 23, 42, .4);
  --text-micro: rgba(15, 23, 42, .35);
  --text-ghost: rgba(15, 23, 42, .28);
  --text-quaternary: rgba(15, 23, 42, .32);
  --text-transparent: rgba(15, 23, 42, .18);
  --border-primary: rgba(15, 23, 42, .14);
  --border-secondary: rgba(15, 23, 42, .1);
  --border-tertiary: rgba(15, 23, 42, .08);
  --border-quaternary: rgba(15, 23, 42, .06);
  /* 主包 shadcn 表格类引用但从未定义的 token（深色下继承白字，浅色下必须显式给深值） */
  --foreground: 222 47% 11%;
  --muted-foreground: 215 16% 40%;
  color-scheme: light;
}

html[data-theme="light"] body {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* ---------- 2. 玻璃面板 / 卡片 ---------- */
html[data-theme="light"] .glass-panel {
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 4px 20px rgba(15, 23, 42, .08), inset 0 1px rgba(255, 255, 255, .6);
}
html[data-theme="light"] .glass-card {
  background: rgba(255, 255, 255, .75);
  border: 1px solid rgba(15, 23, 42, .07);
}

/* ---------- 3. 主包内联样式压制（背景/文字硬编码） ----------
 * 注意：React style prop 序列化后为 rgb()/rgba() 形式，hex 选择器兜底保留 */
html[data-theme="light"] [style*="#0a0e1a"],
html[data-theme="light"] [style*="rgb(10, 14, 26)"] { background: #eef1f7 !important; }
html[data-theme="light"] [style*="#0f1525"],
html[data-theme="light"] [style*="rgb(15, 21, 37)"] { background: #ffffff !important; }
html[data-theme="light"] [style*="rgba(10, 14, 26"] { background: rgba(255, 255, 255, .88) !important; }
html[data-theme="light"] [style*="rgba(20, 28, 48"] { background: rgba(255, 255, 255, .75) !important; }
html[data-theme="light"] [style*="background"][style*="rgba(255, 255, 255, 0.03)"],
html[data-theme="light"] [style*="background"][style*="rgba(255, 255, 255, 0.05)"],
html[data-theme="light"] [style*="background"][style*="rgba(255,255,255,0.05)"] { background: rgba(15, 23, 42, .04) !important; }
html[data-theme="light"] [style*="background"][style*="rgba(255, 255, 255, 0.08)"],
html[data-theme="light"] [style*="background"][style*="rgba(255,255,255,0.08)"] { background: rgba(15, 23, 42, .06) !important; }
html[data-theme="light"] [style*="background"][style*="rgba(255, 255, 255, 0.1)"] { background: rgba(15, 23, 42, .08) !important; }
/* 内联白色文字 → 深色（按 alpha 分档保持层次） */
html[data-theme="light"] [style*="color: rgb(255, 255, 255)"],
html[data-theme="light"] [style*="color:#fff"],
html[data-theme="light"] [style*="color: #fff"],
html[data-theme="light"] [style*="color:white"],
html[data-theme="light"] [style*="color: white"] { color: #0f172a !important; }
html[data-theme="light"] [style*="rgba(255, 255, 255, 0.9)"] { color: rgba(15, 23, 42, .9) !important; }
html[data-theme="light"] [style*="rgba(255, 255, 255, 0.8)"] { color: rgba(15, 23, 42, .8) !important; }
html[data-theme="light"] [style*="rgba(255, 255, 255, 0.7)"] { color: rgba(15, 23, 42, .7) !important; }
html[data-theme="light"] [style*="rgba(255, 255, 255, 0.6)"] { color: rgba(15, 23, 42, .6) !important; }
html[data-theme="light"] [style*="rgba(255, 255, 255, 0.45)"] { color: rgba(15, 23, 42, .58) !important; }
html[data-theme="light"] [style*="rgba(255, 255, 255, 0.4)"] { color: rgba(15, 23, 42, .5) !important; }
html[data-theme="light"] [style*="rgba(255, 255, 255, 0.25)"] { color: rgba(15, 23, 42, .38) !important; }
/* 内联浅灰蓝文字（注入面板标题/下拉，#e2e8f0）→ 深色 */
html[data-theme="light"] [style*="color:#e2e8f0"],
html[data-theme="light"] [style*="color: #e2e8f0"],
html[data-theme="light"] [style*="color: rgb(226, 232, 240)"] { color: #1e293b !important; }
/* 内联 30% 白字（合规模块页签计数徽标）→ 深色 */
html[data-theme="light"] [style*="color: rgba(255, 255, 255, 0.3)"],
html[data-theme="light"] [style*="color:rgba(255,255,255,0.3)"] { color: rgba(15, 23, 42, .5) !important; }
/* React 表格表头：--foreground 缺失时继承白字，此处兜底 */
html[data-theme="light"] table thead th,
html[data-theme="light"] th.text-foreground { color: rgba(15, 23, 42, .55) !important; }
/* 内联白色边框 → 深色细线 */
html[data-theme="light"] [style*="border"][style*="rgba(255, 255, 255, 0.08)"] { border-color: rgba(15, 23, 42, .1) !important; }
html[data-theme="light"] [style*="border"][style*="rgba(255, 255, 255, 0.1)"] { border-color: rgba(15, 23, 42, .12) !important; }

/* ---------- 4. Tailwind 白字 / 白色透明工具类 ---------- */
html[data-theme="light"] .text-white { color: #0f172a !important; }
html[data-theme="light"] .text-white\/90 { color: rgba(15, 23, 42, .9) !important; }
html[data-theme="light"] .text-white\/80 { color: rgba(15, 23, 42, .8) !important; }
html[data-theme="light"] .text-white\/70 { color: rgba(15, 23, 42, .7) !important; }
html[data-theme="light"] .text-white\/60 { color: rgba(15, 23, 42, .6) !important; }
html[data-theme="light"] .text-white\/45 { color: rgba(15, 23, 42, .45) !important; }
html[data-theme="light"] .text-gray-400 { color: #64748b !important; }
html[data-theme="light"] .bg-white\/10 { background: rgba(15, 23, 42, .07) !important; }
html[data-theme="light"] .hover\:bg-white\/10:hover { background: rgba(15, 23, 42, .08) !important; }
html[data-theme="light"] .hover\:bg-white\/20:hover { background: rgba(15, 23, 42, .12) !important; }
html[data-theme="light"] .border-white\/10 { border-color: rgba(15, 23, 42, .1) !important; }
html[data-theme="light"] .border-white\/25 { border-color: rgba(15, 23, 42, .18) !important; }
html[data-theme="light"] .border-white\/40 { border-color: rgba(15, 23, 42, .28) !important; }

/* ---------- 5. 滚动条 ---------- */
html[data-theme="light"] ::-webkit-scrollbar { width: 8px; height: 8px; }
html[data-theme="light"] ::-webkit-scrollbar-track { background: #e2e8f0; }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
html[data-theme="light"] * { scrollbar-color: #cbd5e1 #e2e8f0; }

/* ---------- 6. 概览页注入内容（overview-dashboard-inject.js） ---------- */
html[data-theme="light"] #sci-ov-dashboard .sci-ov-kpi,
html[data-theme="light"] #sci-ov-dashboard .sci-ov-card {
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 4px 20px rgba(15, 23, 42, .08), inset 0 1px rgba(255, 255, 255, .6);
}
html[data-theme="light"] #sci-ov-dashboard .sci-ov-tab {
  background: rgba(15, 23, 42, .04);
  border-color: rgba(15, 23, 42, .1);
}

/* ---------- 7. 门店管理注入（store-charts-inject.js 指标卡） ---------- */
html[data-theme="light"] #sci-metrics-panel {
  background: #eef1f7;
  border-bottom-color: rgba(15, 23, 42, .08);
}
html[data-theme="light"] .sci-metric-card {
  background: rgba(255, 255, 255, .85);
  border-color: rgba(15, 23, 42, .08);
  box-shadow: 0 2px 12px rgba(15, 23, 42, .06);
}
html[data-theme="light"] .sci-metric-card .title { color: rgba(15, 23, 42, .65); }
html[data-theme="light"] .sci-metric-card .sub { color: rgba(15, 23, 42, .5); }
/* 金色主数值在白底上对比度不足 → 深琥珀色 */
html[data-theme="light"] .sci-metric-card .value,
html[data-theme="light"] .sci-metric-card .num,
html[data-theme="light"] .sci-metric-card.accent-amber .num,
html[data-theme="light"] .sci-metric-targets .value { color: #b45309; }
html[data-theme="light"] .sci-metric-targets .sep { color: rgba(15, 23, 42, .45); }
/* 门店管理全屏容器残留深色底 */
html[data-theme="light"] .sci-store-fs-container:fullscreen { background: #eef1f7 !important; }

/* ---------- 8. 用户管理注入（admin-user-mgmt-inject.js 弹窗/按钮） ---------- */
html[data-theme="light"] .sci-user-modal {
  background: #ffffff;
  border-color: rgba(15, 23, 42, .1);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
  color: #1e293b;
}
html[data-theme="light"] .sci-user-modal-header { border-bottom-color: rgba(15, 23, 42, .08); }
html[data-theme="light"] .sci-user-modal-header .dept,
html[data-theme="light"] .sci-user-modal-close,
html[data-theme="light"] .sci-user-modal-row label { color: #64748b; }
html[data-theme="light"] .sci-user-modal-close:hover { color: #0f172a; }
html[data-theme="light"] .sci-user-modal-row input,
html[data-theme="light"] .sci-user-modal-row select {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, .15);
  color: #0f172a;
}

/* ---------- 9. 门店费用弹窗（store-management-inject.js） ---------- */
html[data-theme="light"] .sci-fee-modal-content {
  background: #ffffff !important;
  color: #1e293b !important;
  border-color: rgba(15, 23, 42, .1) !important;
}
html[data-theme="light"] .sci-fee-cell:hover { color: #0284c7; }

/* ---------- 10. 飞书登录浮层（feishu-login-inject.js） ---------- */
html[data-theme="light"] #sci-feishu-login-overlay { background: rgba(238, 241, 247, .96) !important; }
html[data-theme="light"] .sci-feishu-login-card {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, .1) !important;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .15) !important;
}
html[data-theme="light"] .sci-feishu-login-card h1 { color: #0f172a !important; }
html[data-theme="light"] .sci-feishu-login-card p { color: #64748b !important; }

/* ---------- 11. AI 助理悬浮窗（ai-assistant-inject.js，基础浅色化） ---------- */
html[data-theme="light"] #sci-ai-button-wrap > button {
  box-shadow: 0 6px 20px rgba(15, 23, 42, .25);
}

/* ---------- 12. 日间模式：模块卡片/图表卡 半透明毛玻璃 + 悬浮 ---------- */
html[data-theme="light"] .glass-panel,
html[data-theme="light"] .glass-card,
html[data-theme="light"] #sci-ov-dashboard .sci-ov-kpi,
html[data-theme="light"] #sci-ov-dashboard .sci-ov-card,
html[data-theme="light"] .sci-metric-card {
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .78);
  box-shadow: 0 6px 24px rgba(15, 23, 42, .08), inset 0 1px rgba(255, 255, 255, .85);
  transition: transform .18s ease, box-shadow .18s ease;
}
html[data-theme="light"] .glass-card:hover,
html[data-theme="light"] #sci-ov-dashboard .sci-ov-kpi:hover,
html[data-theme="light"] #sci-ov-dashboard .sci-ov-card:hover,
html[data-theme="light"] .sci-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .13), inset 0 1px rgba(255, 255, 255, .9);
}
/* 图表卡片/弹窗（注入面板与主包内联深色底 #0f1525）→ 浅色毛玻璃 */
html[data-theme="light"] [style*="background: rgb(15, 21, 37)"],
html[data-theme="light"] [style*="background:#0f1525"],
html[data-theme="light"] [style*="background: #0f1525"] {
  background: rgba(255, 255, 255, .72) !important;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-color: rgba(15, 23, 42, .08) !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, .06), inset 0 1px rgba(255, 255, 255, .7);
}
/* 注入面板内联浅灰文字（#94a3b8）→ 深灰 */
html[data-theme="light"] [style*="color:#94a3b8"],
html[data-theme="light"] [style*="color: #94a3b8"],
html[data-theme="light"] [style*="color: rgb(148, 163, 184)"] { color: rgba(15, 23, 42, .6) !important; }

/* ---------- 13. 日间模式：按钮毛玻璃质感与悬浮 ---------- */
html[data-theme="light"] #sci-ov-dashboard .sci-ov-tab {
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(15, 23, 42, .12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
html[data-theme="light"] #sci-ov-dashboard .sci-ov-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .1);
}
html[data-theme="light"] #sci-ov-dashboard .sci-ov-tab.on {
  color: #1d4ed8;
  background: rgba(59, 130, 246, .14);
  border-color: rgba(59, 130, 246, .3);
}
/* 深色主按钮（蓝底白字）：日间保持原配色，仅加悬浮 */
html[data-theme="light"] .sci-refresh-btn { transition: transform .15s ease, box-shadow .15s ease, filter .15s ease; }
html[data-theme="light"] .sci-refresh-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(59, 130, 246, .32); }
/* 注入面板筛选条按钮等主包外的按钮悬浮 */
html[data-theme="light"] button { transition: transform .15s ease, box-shadow .15s ease, background .15s ease, filter .15s ease; }

/* ---------- 14. 深色/彩色按钮保持浅色文字（须置于第 3、4 节压深规则之后） ---------- */
html[data-theme="light"] [style*="background: rgb(59, 130, 246)"],
html[data-theme="light"] [style*="background:rgb(59,130,246)"],
html[data-theme="light"] [style*="background:#3b82f6"],
html[data-theme="light"] [style*="background: #3b82f6"],
html[data-theme="light"] [style*="background: rgb(168, 85, 247)"],
html[data-theme="light"] [style*="background:rgb(168,85,247)"],
html[data-theme="light"] [style*="background:#a855f7"],
html[data-theme="light"] [style*="background: #a855f7"],
html[data-theme="light"] [style*="background: rgb(239, 68, 68)"],
html[data-theme="light"] [style*="background:rgb(239,68,68)"],
html[data-theme="light"] [style*="background:#ef4444"],
html[data-theme="light"] [style*="background: #ef4444"],
html[data-theme="light"] [style*="background: rgb(34, 197, 94)"],
html[data-theme="light"] [style*="background:rgb(34,197,94)"],
html[data-theme="light"] [style*="background:#22c55e"],
html[data-theme="light"] [style*="background: #22c55e"],
html[data-theme="light"] [style*="background: rgb(245, 158, 11)"],
html[data-theme="light"] [style*="background:rgb(245,158,11)"],
html[data-theme="light"] [style*="background:#f59e0b"],
html[data-theme="light"] [style*="background: #f59e0b"] { color: #ffffff !important; }
