/* =========================================================
   主题系统 · 白天 / 黑夜
   - :root 为默认（深色）调色板，供已逐页变量化的页面使用
   - html[data-theme="light"] 切换为浅色调色板
   - 全局浅色覆盖层（[data-theme="light"] ... !important）用于
     尚未逐页转换的内联样式页面，保证整站可一键切换
   ========================================================= */

/* ---------- 深色（默认） ---------- */
:root{
    --bg:           #0b0d13;
    --panel:        #0c0e16;
    --panel-2:      #11131c;
    --surface:      #0e1117;
    --border:       #161922;
    --border-strong:#1e2230;
    --text:         #b0b4c0;
    --text-strong:  #e8e6e3;
    --text-muted:   #6b7080;
    --text-faint:   #5a5e6b;
    --text-hover:   #a0a5b0;
    --gold:         #c4a45a;
    --gold-bg:      #1a1810;
    --gold-border:  #2a2618;
    --gold-soft:    rgba(196,164,90,.04);
    --hover-bg:     rgba(255,255,255,.02);
    --shadow:       none;
}

/* ---------- 浅色 ---------- */
html[data-theme="light"]{
    --bg:           #eef1f5;
    --panel:        #ffffff;
    --panel-2:      #f4f6f9;
    --surface:      #f8fafc;
    --border:       #e3e7ee;
    --border-strong:#d3d9e2;
    --text:         #2b3242;
    --text-strong:  #161b26;
    --text-muted:   #6b7384;
    --text-faint:   #8a8f9c;
    --text-hover:   #3a4150;
    --gold:         #a8842f;
    --gold-bg:      #fbf4e3;
    --gold-border:  #ecd9a8;
    --gold-soft:    rgba(168,132,47,.07);
    --hover-bg:     rgba(0,0,0,.03);
    --shadow:       0 1px 3px rgba(20,30,50,.06);
}

/* =========================================================
   全局浅色覆盖层（作用于内联样式未转换的页面）
   只覆盖 background-color / color / border-color，不动渐变与图片
   ========================================================= */
html[data-theme="light"] body{
    background:var(--bg) !important;
    color:var(--text) !important;
}

/* 容器类：统一白底 + 浅色边框 */
html[data-theme="light"] .sidebar,
html[data-theme="light"] .app-header,
html[data-theme="light"] .app-content,
html[data-theme="light"] .sidebar-foot,
html[data-theme="light"] .sidebar-brand,
html[data-theme="light"] .sys-switch,
html[data-theme="light"] .sidebar-nav,
html[data-theme="light"] .chart-section,
html[data-theme="light"] .metric-card,
html[data-theme="light"] .order-section,
html[data-theme="light"] .filter-bar,
html[data-theme="light"] .chart-wrap,
html[data-theme="light"] .toast-layer,
html[data-theme="light"] [class*="section"],
html[data-theme="light"] [class*="card"],
html[data-theme="light"] [class*="panel"],
html[data-theme="light"] [class*="box"],
html[data-theme="light"] [class*="wrap"],
html[data-theme="light"] [class*="modal"],
html[data-theme="light"] [class*="dialog"],
html[data-theme="light"] [class*="table"],
html[data-theme="light"] [class*="form"],
html[data-theme="light"] [class*="bar"],
html[data-theme="light"] [class*="list"],
html[data-theme="light"] [class*="item"],
html[data-theme="light"] [class*="row"],
html[data-theme="light"] [class*="cell"],
html[data-theme="light"] [class*="head"],
html[data-theme="light"] [class*="foot"]{
    background-color:#ffffff !important;
    border-color:var(--border) !important;
    color:var(--text) !important;
}

/* 输入框 / 下拉 / 文本域 */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .layui-input,
html[data-theme="light"] .layui-textarea,
html[data-theme="light"] .layui-select,
html[data-theme="light"] .layui-form-select .layui-input{
    background-color:#ffffff !important;
    color:var(--text) !important;
    border-color:var(--border) !important;
}
html[data-theme="light"] .layui-form-select .layui-edge{border-top-color:var(--text-muted)!important}
html[data-theme="light"] .layui-form-select dl{background-color:#fff!important;border-color:var(--border)!important}
html[data-theme="light"] .layui-form-select dl dd:hover,
html[data-theme="light"] .layui-form-select dl dd.layui-this{background-color:var(--gold-bg)!important;color:var(--gold)!important}

/* 文字类：恢复可读性 */
html[data-theme="light"] .nav-item,
html[data-theme="light"] .sys-tab,
html[data-theme="light"] .mc-label,
html[data-theme="light"] .mc-sub,
html[data-theme="light"] .chart-title,
html[data-theme="light"] .nav-label,
html[data-theme="light"] .hdr-sep,
html[data-theme="light"] td,
html[data-theme="light"] th,
html[data-theme="light"] label,
html[data-theme="light"] .pagination a,
html[data-theme="light"] .tag,
html[data-theme="light"] .badge{
    color:var(--text) !important;
}

/* ---------- 恢复金色强调（不被上面的文字规则覆盖） ---------- */
html[data-theme="light"] .nav-item.on,
html[data-theme="light"] .sys-tab.on,
html[data-theme="light"] .brand-icon,
html[data-theme="light"] .brand-text,
html[data-theme="light"] .mc-value,
html[data-theme="light"] [class*="gold"],
html[data-theme="light"] [class*="active"],
html[data-theme="light"] .highlight,
html[data-theme="light"] .confirm-highlight{
    color:var(--gold) !important;
}
html[data-theme="light"] .nav-item.on,
html[data-theme="light"] .sys-tab.on{
    background-color:var(--gold-bg) !important;
    border-color:var(--gold-border) !important;
}

/* 表格头 / 单元格（覆盖内联深色） */
html[data-theme="light"] [class*="table"] th,
html[data-theme="light"] [class*="table"] td{
    background-color:#ffffff !important;
    color:var(--text) !important;
    border-color:var(--border) !important;
}
html[data-theme="light"] [class*="table"] th{
    background-color:#f4f6f9 !important;
    color:var(--text-muted) !important;
}

/* 表格斑马纹 / 悬停 */
html[data-theme="light"] table{border-color:var(--border)!important}
html[data-theme="light"] tr:hover td,
html[data-theme="light"] .layui-table tbody tr:hover{background-color:var(--hover-bg)!important}

/* ---------- member.html 专用覆盖 ---------- */
html[data-theme="light"] .sys-tab{
    background-color:var(--panel-2) !important;
    border-color:var(--border) !important;
    color:var(--text-muted) !important;
}
html[data-theme="light"] .sys-tab.on{
    background-color:var(--gold-bg) !important;
    border-color:var(--gold-border) !important;
    color:var(--gold) !important;
}
html[data-theme="light"] .section-header{
    border-color:var(--border) !important;
}
html[data-theme="light"] .order-section,
html[data-theme="light"] .chart-section{
    background-color:#ffffff !important;
    border-color:var(--border) !important;
}

/* 滚动条 */
html[data-theme="light"] ::-webkit-scrollbar-thumb{background:#c9cfda!important}
html[data-theme="light"] ::-webkit-scrollbar-track{background:transparent!important}

/* ---------- 按钮（覆盖内联深色样式） ---------- */
html[data-theme="light"] .btn,
html[data-theme="light"] .btn-primary,
html[data-theme="light"] .btn-outline,
html[data-theme="light"] .btn-danger{
    box-shadow:none !important;
}
html[data-theme="light"] .btn-primary{
    background:var(--gold) !important;
    color:#ffffff !important;
    border-color:var(--gold) !important;
}
html[data-theme="light"] .btn-primary:hover{
    background:#b8922f !important;
    border-color:#b8922f !important;
}
html[data-theme="light"] .btn-outline{
    background:transparent !important;
    color:var(--text-muted) !important;
    border-color:var(--border-strong) !important;
}
html[data-theme="light"] .btn-outline:hover{
    color:var(--text-strong) !important;
    border-color:var(--gold) !important;
}
html[data-theme="light"] .btn-danger{
    background:transparent !important;
    color:#c0392b !important;
    border-color:#e3b6b1 !important;
}
html[data-theme="light"] .btn-danger:hover{
    background:rgba(192,57,43,.06) !important;
    border-color:#c0392b !important;
}

/* ============================================================
   白天模式全局覆盖：修复默认深色页面的颜色反转
   ============================================================ */

/* --- 覆盖内联 :root 变量（类型 A 页面） --- */
html[data-theme="light"] {
    --bg: #f3f4f6;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #333333;
    --text-bright: #0f172a;
    --text-dim: #64748b;
    --muted: #64748b;
    --input: #f8fafc;
    --input-bg: #f8fafc;
    --accent: #c4a45a;
    --gold: #c4a45a;
    --green: #27ae60;
    --red: #e74c3c;
    --blue: #3b82f6;
    --amber: #f59e0b;
}

/* --- 针对类型 B 硬编码深色页面的常见类名兜底 --- */
html[data-theme="light"] .metric-card,
html[data-theme="light"] .chart-section,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .search-panel,
html[data-theme="light"] .data-panel,
html[data-theme="light"] .panel-head,
html[data-theme="light"] .panel-title,
html[data-theme="light"] .section,
html[data-theme="light"] .card,
html[data-theme="light"] .wrap,
html[data-theme="light"] .container {
    background-color: #ffffff !important;
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #333333 !important;
}

html[data-theme="light"] .data-table th,
html[data-theme="light"] .data-table td {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #333333 !important;
}

html[data-theme="light"] .mc-label,
html[data-theme="light"] .mc-sub,
html[data-theme="light"] .chart-title,
html[data-theme="light"] .panel-title,
html[data-theme="light"] .pager-info {
    color: #64748b !important;
}

html[data-theme="light"] .mc-value {
    color: #0f172a !important;
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .form-control,
html[data-theme="light"] .finp,
html[data-theme="light"] .inp {
    background-color: #f8fafc !important;
    background: #f8fafc !important;
    color: #333333 !important;
    border-color: #e2e8f0 !important;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
    color: #94a3b8 !important;
}

html[data-theme="light"] .btn {
    background-color: #f8fafc !important;
    color: #333333 !important;
    border-color: #e2e8f0 !important;
}

html[data-theme="light"] .badge-ok {
    color: #27ae60 !important;
    border-color: #b6e2c6 !important;
    background: rgba(39,174,96,0.08) !important;
}
html[data-theme="light"] .badge-warn {
    color: #d4b46a !important;
    border-color: #e8dcb6 !important;
    background: rgba(212,180,106,0.08) !important;
}
html[data-theme="light"] .badge-err {
    color: #e74c3c !important;
    border-color: #f5c6cb !important;
    background: rgba(231,76,60,0.08) !important;
}

/* --- 更多兜底：原生深色页面的常见组件 --- */
html[data-theme="light"] .banner {
    background: linear-gradient(135deg, #f0f0f5, #e8e8f0) !important;
    border-color: rgba(0,0,0,.08) !important;
    color: #0f172a !important;
}
html[data-theme="light"] .search-bar,
html[data-theme="light"] .table-wrap,
html[data-theme="light"] .data-panel,
html[data-theme="light"] .panel-head {
    background-color: #ffffff !important;
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #333333 !important;
}
html[data-theme="light"] .tbl th,
html[data-theme="light"] .tbl td {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #333333 !important;
}
html[data-theme="light"] .tbl tbody tr:hover td {
    background-color: #f8fafc !important;
}
html[data-theme="light"] .switch .slider {
    background-color: #e2e8f0 !important;
}
html[data-theme="light"] .switch .slider:before {
    background-color: #94a3b8 !important;
}
html[data-theme="light"] ::-webkit-scrollbar-thumb {
    background-color: #cbd5e1 !important;
}
html[data-theme="light"] .banner-url {
    background: rgba(0,0,0,.06) !important;
    border-color: rgba(0,0,0,.08) !important;
    color: #0f172a !important;
}
html[data-theme="light"] .banner-url:hover {
    background: rgba(0,0,0,.1) !important;
}
