/* ==========================================================================
   全站主题包（前端 + 后台通用）
   --------------------------------------------------------------------------
   实现方式：所有主题只覆盖 tokens.css 里的品牌色变量与页面底色，
   不改任何组件样式 —— 所以切主题不会出现「某个按钮没跟着变」的漏网。
   切换：在 <html> 上加 data-theme="xxx"，或后台写入 setting['site_theme']。
   ========================================================================== */

/* ---------- 主题 1：薄荷绿（默认，即 tokens.css 的原始值） ---------- */
html[data-theme="mint"] {
    --brand:      #10b981;
    --brand-dark: #059669;
    --brand-soft: #f0fdf4;
    --brand-line: #bbf7d0;
    --brand-2:    #84cc16;
    --brand-grad: linear-gradient(135deg, #10b981 0%, #84cc16 100%);
    --theme-page-grad: linear-gradient(135deg, #eafaf1 0%, #e6f7ee 38%, #eaf6e8 68%, #e8f4ec 100%);
    --theme-dot: rgba(15, 90, 68, .16);
    --theme-glow-a: rgba(16, 185, 129, .30);
    --theme-glow-b: rgba(132, 204, 22, .24);
    --theme-glow-c: rgba(56, 189, 248, .14);
}

/* ---------- 主题 2：深海蓝 ---------- */
html[data-theme="ocean"] {
    --brand:      #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff6ff;
    --brand-line: #bfdbfe;
    --brand-2:    #38bdf8;
    --brand-grad: linear-gradient(135deg, #2563eb 0%, #38bdf8 100%);
    --theme-page-grad: linear-gradient(135deg, #eaf2fb 0%, #e6efff 38%, #e8f0fb 68%, #eaf4fd 100%);
    --theme-dot: rgba(23, 58, 110, .16);
    --theme-glow-a: rgba(37, 99, 235, .30);
    --theme-glow-b: rgba(56, 189, 248, .24);
    --theme-glow-c: rgba(129, 140, 248, .16);
    /* 语义色保持"成功=绿"不变，避免状态判断被主题干扰 */
}

/* ---------- 主题 3：暖橘 ---------- */
html[data-theme="sunset"] {
    --brand:      #f97316;
    --brand-dark: #ea580c;
    --brand-soft: #fff7ed;
    --brand-line: #fed7aa;
    --brand-2:    #fbbf24;
    --brand-grad: linear-gradient(135deg, #f97316 0%, #fbbf24 100%);
    --theme-page-grad: linear-gradient(135deg, #fef6ec 0%, #fdf0e4 38%, #fdf3e8 68%, #fef7ef 100%);
    --theme-dot: rgba(120, 60, 20, .14);
    --theme-glow-a: rgba(249, 115, 22, .28);
    --theme-glow-b: rgba(251, 191, 36, .22);
    --theme-glow-c: rgba(244, 114, 182, .14);
}

/* ---------- 主题 4：暗夜（深色） ---------- */
html[data-theme="dark"] {
    --brand:      #34d399;
    --brand-dark: #10b981;
    --brand-soft: rgba(52, 211, 153, .14);
    --brand-line: rgba(52, 211, 153, .35);
    /* 渐变用较深的绿：白字压在 #10b981 上对比度只有 1.9，改为深绿后约 3.4 */
    --brand-2:    #059669;
    --brand-grad: linear-gradient(135deg, #047857 0%, #059669 100%);

    /* 深色主题下把三层背景反转 */
    --tx-1: #f1f5f9;
    --tx-2: #cbd5e1;
    --tx-3: #94a3b8;
    --tx-4: #64748b;
    --bg-page:  #0b1220;
    --bg-card:  #151d2e;
    --bg-inset: #1c2537;
    --ln-1: #2a3446;
    --ln-2: #222b3c;

    /* 语义色在深色下必须换成半透明彩色底 + 提亮的文字色，
       否则浅红/浅绿底配深红字会在暗背景上炸出一块白斑 */
    --ok-soft:     rgba(16, 185, 129, .14);
    --ok-dark:     #6ee7b7;
    --warn-soft:   rgba(245, 158, 11, .14);
    --warn-dark:   #fcd34d;
    --warn-line:   rgba(245, 158, 11, .32);
    --danger-soft: rgba(239, 68, 68, .14);
    --danger-dark: #fca5a5;
    --danger-line: rgba(239, 68, 68, .32);
    --info-soft:   rgba(59, 130, 246, .14);
    --info-dark:   #93c5fd;
    --info-line:   rgba(59, 130, 246, .32);

    --theme-page-grad: linear-gradient(135deg, #0b1220 0%, #0e1728 40%, #101a2c 70%, #0c1524 100%);
    --theme-dot: rgba(148, 163, 184, .10);
    --theme-glow-a: rgba(16, 185, 129, .18);
    --theme-glow-b: rgba(56, 189, 248, .14);
    --theme-glow-c: rgba(129, 140, 248, .12);
}

/* ==========================================================================
   主题变量的实际应用
   ========================================================================== */

/* 页面底色 + 点阵 + 氛围光，全部改为读主题变量 */
body {
    background-image: var(--theme-page-grad, none) !important;
}
body::before {
    background-image: radial-gradient(circle at 1px 1px, var(--theme-dot, transparent) 1px, transparent 0) !important;
}
body::after {
    background-image:
        radial-gradient(46% 42% at 12% 16%, var(--theme-glow-a, transparent), transparent 64%),
        radial-gradient(50% 44% at 88% 84%, var(--theme-glow-b, transparent), transparent 68%),
        radial-gradient(38% 34% at 72% 8%, var(--theme-glow-c, transparent), transparent 62%) !important;
}
html::before {
    background-image: radial-gradient(circle, var(--theme-glow-a, transparent) 0%, transparent 70%) !important;
}
html::after {
    background-image: radial-gradient(circle, var(--theme-glow-b, transparent) 0%, transparent 72%) !important;
}

/* 深色主题的补充修正：让原本写死白底的组件跟随主题 */
html[data-theme="dark"] body {
    color: var(--tx-2);
}
html[data-theme="dark"] .s-card,
html[data-theme="dark"] .s-site,
html[data-theme="dark"] .s-overview,
html[data-theme="dark"] .s-step,
html[data-theme="dark"] .s-stat,
html[data-theme="dark"] .s-modal,
html[data-theme="dark"] .s-renew__step,
html[data-theme="dark"] .s-table-wrap,
html[data-theme="dark"] .s-nav {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
}
html[data-theme="dark"] .s-site__meta,
html[data-theme="dark"] .s-acct__item,
html[data-theme="dark"] .s-renew__buy,
html[data-theme="dark"] .s-urlbox,
html[data-theme="dark"] .s-table th,
html[data-theme="dark"] .s-side a {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
}
html[data-theme="dark"] .s-urlbox__input,
html[data-theme="dark"] .s-input {
    background: transparent !important;
    color: var(--tx-1) !important;
}
html[data-theme="dark"] .s-brand,
html[data-theme="dark"] .s-card__title,
html[data-theme="dark"] .s-site__name,
html[data-theme="dark"] .s-step__title,
html[data-theme="dark"] .s-table td,
html[data-theme="dark"] .s-overview__value {
    color: var(--tx-1) !important;
}
html[data-theme="dark"] .s-muted,
html[data-theme="dark"] .s-site__meta,
html[data-theme="dark"] .s-step__desc,
html[data-theme="dark"] .s-table__url {
    color: var(--tx-3) !important;
}
/* 深色下的图片/图标容器 */
html[data-theme="dark"] .s-site__icon img {
    background: #fff;
}
/* 导航栏半透明白底在深色下要换成深色 */
html[data-theme="dark"] .s-nav {
    background: rgba(21, 29, 46, .88) !important;
}
html[data-theme="dark"] .s-nav__link { color: var(--tx-2); }

/* 后台深色：body.a-body 走同一套 tokens，这里只补几个写死白底的地方 */
html[data-theme="dark"] body.a-body .card,
html[data-theme="dark"] body.a-body .a-card,
html[data-theme="dark"] body.a-body .a-savebar,
html[data-theme="dark"] body.a-body .bk-site,
html[data-theme="dark"] body.a-body .a-input,
html[data-theme="dark"] body.a-body .a-select,
html[data-theme="dark"] body.a-body .form-control {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-1) !important;
}
html[data-theme="dark"] body.a-body .a-card__head,
html[data-theme="dark"] body.a-body .bk-toolbar,
html[data-theme="dark"] body.a-body .a-table thead th {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
}
html[data-theme="dark"] body.a-body,
html[data-theme="dark"] body {
    background-color: var(--bg-page) !important;
}


/* ==========================================================================
   深色主题完整补丁（第二版）
   --------------------------------------------------------------------------
   第一版只覆盖了卡片底色，实测后台仍有大量「浅色文字 + 浅色底」的组合：
   顶部标题、表头、分页、按钮文字、主题卡片等。
   这里按组件逐块补齐，全部使用 tokens 变量。
   ========================================================================== */

/* ---------- 后台：顶栏 ---------- */
html[data-theme="dark"] body.a-body .a-topbar {
    background: var(--bg-card) !important;
    border-bottom-color: var(--ln-1) !important;
}
html[data-theme="dark"] body.a-body .a-topbar__title {
    color: var(--tx-1) !important;
}
html[data-theme="dark"] body.a-body .a-topbar__link,
html[data-theme="dark"] body.a-body .a-topbar__user {
    color: var(--tx-2) !important;
    border-color: var(--ln-1) !important;
    background: transparent !important;
}
html[data-theme="dark"] body.a-body .a-topbar__toggle {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-2) !important;
}

/* ---------- 后台：左侧菜单 ---------- */
html[data-theme="dark"] body.a-body .a-sidebar {
    background: var(--bg-card) !important;
    border-right-color: var(--ln-1) !important;
}
html[data-theme="dark"] body.a-body .a-sidebar__logo-text { color: var(--tx-1) !important; }
html[data-theme="dark"] body.a-body .a-nav__link { color: var(--tx-2) !important; }
html[data-theme="dark"] body.a-body .a-nav__link:hover { background: var(--bg-inset) !important; color: var(--tx-1) !important; }
html[data-theme="dark"] body.a-body .a-nav__link.is-active { color: var(--brand) !important; }
html[data-theme="dark"] body.a-body .a-nav__sub .a-nav__link { color: var(--tx-3) !important; }
html[data-theme="dark"] body.a-body .a-sidebar__foot { border-top-color: var(--ln-1) !important; }
html[data-theme="dark"] body.a-body .a-sidebar__uname { color: var(--tx-1) !important; }
html[data-theme="dark"] body.a-body .a-sidebar__logout {
    background: var(--danger-soft) !important;
    border-color: var(--danger-line) !important;
    color: var(--danger-dark) !important;
}

/* ---------- 后台：表格 ---------- */
html[data-theme="dark"] body.a-body .table,
html[data-theme="dark"] body.a-body .a-table { color: var(--tx-2) !important; }
html[data-theme="dark"] body.a-body .table td,
html[data-theme="dark"] body.a-body .table th,
html[data-theme="dark"] body.a-body .a-table td,
html[data-theme="dark"] body.a-body .a-table th {
    border-color: var(--ln-2) !important;
    color: var(--tx-2) !important;
}
html[data-theme="dark"] body.a-body .table thead th,
html[data-theme="dark"] body.a-body .a-table thead th {
    background: var(--bg-inset) !important;
    color: var(--tx-3) !important;
}
html[data-theme="dark"] body.a-body .table tbody tr:hover,
html[data-theme="dark"] body.a-body .a-table tbody tr:hover {
    background: var(--bg-inset) !important;
}
/* 表格内强文本（卡密等） */
html[data-theme="dark"] body.a-body .a-table strong,
html[data-theme="dark"] body.a-body .table strong {
    color: var(--tx-1) !important;
}

/* ---------- 后台：分页 ---------- */
html[data-theme="dark"] body.a-body .page-link {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-2) !important;
}
html[data-theme="dark"] body.a-body .page-link:hover {
    background: var(--bg-inset) !important;
    color: var(--brand) !important;
}
html[data-theme="dark"] body.a-body .page-item.disabled .page-link {
    background: var(--bg-inset) !important;
    color: var(--tx-4) !important;
}
html[data-theme="dark"] body.a-body .page-item.active .page-link {
    background: var(--brand-grad) !important;
    border-color: transparent !important;
    color: #fff !important;
}

/* ---------- 后台：按钮 ---------- */
/* 主按钮/成功按钮保持白字（它们是品牌色实底） */
html[data-theme="dark"] body.a-body .btn-primary,
html[data-theme="dark"] body.a-body .btn-success,
html[data-theme="dark"] body.a-body .a-btn--primary {
    color: #fff !important;
}
/* 幽灵按钮：深色底 + 浅色文字 */
html[data-theme="dark"] body.a-body .a-btn--ghost,
html[data-theme="dark"] body.a-body .btn-default,
html[data-theme="dark"] body.a-body .btn-outline-secondary,
html[data-theme="dark"] body.a-body .btn-light {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-2) !important;
}
html[data-theme="dark"] body.a-body .a-btn--ghost:hover,
html[data-theme="dark"] body.a-body .btn-light:hover {
    background: var(--bg-inset) !important;
    color: var(--brand) !important;
}
/* 浅底彩色按钮：深色下用半透明底 */
html[data-theme="dark"] body.a-body .btn-danger {
    background: rgba(239, 68, 68, .16) !important;
    border-color: rgba(239, 68, 68, .4) !important;
    color: #fca5a5 !important;
}
html[data-theme="dark"] body.a-body .btn-warning {
    background: rgba(245, 158, 11, .16) !important;
    border-color: rgba(245, 158, 11, .4) !important;
    color: #fcd34d !important;
}
html[data-theme="dark"] body.a-body .btn-info {
    background: rgba(59, 130, 246, .16) !important;
    border-color: rgba(59, 130, 246, .4) !important;
    color: #93c5fd !important;
}
html[data-theme="dark"] body.a-body .btn-secondary {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-2) !important;
}

/* ---------- 后台：表单 ---------- */
html[data-theme="dark"] body.a-body label { color: var(--tx-2) !important; }
html[data-theme="dark"] body.a-body .form-control,
html[data-theme="dark"] body.a-body .a-input,
html[data-theme="dark"] body.a-body .a-select {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-1) !important;
}
html[data-theme="dark"] body.a-body .form-control::placeholder { color: var(--tx-4) !important; }
html[data-theme="dark"] body.a-body .form-control:focus {
    border-color: var(--brand) !important;
    background: var(--bg-card) !important;
}

/* ---------- 后台：卡片 / 分组 ---------- */
html[data-theme="dark"] .set-group,
html[data-theme="dark"] body.a-body .a-card,
html[data-theme="dark"] body.a-body .a-card__head,
html[data-theme="dark"] body.a-body .card,
html[data-theme="dark"] body.a-body .card-header,
html[data-theme="dark"] body.a-body .card-body,
html[data-theme="dark"] body.a-body .a-savebar,
html[data-theme="dark"] body.a-body .bk-toolbar,
html[data-theme="dark"] body.a-body .a-fold__body {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
}
html[data-theme="dark"] .set-group__head { background: var(--bg-inset) !important; border-bottom-color: var(--ln-2) !important; }
html[data-theme="dark"] .set-group__title,
html[data-theme="dark"] body.a-body .a-card__title,
html[data-theme="dark"] body.a-body .card-header,
html[data-theme="dark"] .step-block,
html[data-theme="dark"] .acc-pop__title {
    color: var(--tx-1) !important;
}
html[data-theme="dark"] .set-group__desc,
html[data-theme="dark"] body.a-body .a-card__desc,
html[data-theme="dark"] .a-hint,
html[data-theme="dark"] .hint {
    color: var(--tx-3) !important;
}

/* ---------- 后台：主题选择卡片 ---------- */
html[data-theme="dark"] .theme-card {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
}
html[data-theme="dark"] .theme-card.is-active {
    background: var(--brand-soft) !important;
    border-color: var(--brand) !important;
}
html[data-theme="dark"] .theme-card__body b { color: var(--tx-1) !important; }
html[data-theme="dark"] .theme-card__body small { color: var(--tx-3) !important; }
html[data-theme="dark"] .theme-card__check { border-color: var(--ln-1) !important; }

/* ---------- 后台：单选/复选卡片 ---------- */
html[data-theme="dark"] .a-radio,
html[data-theme="dark"] .a-check {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-2) !important;
}
html[data-theme="dark"] .a-radio.is-checked,
html[data-theme="dark"] .a-check.is-checked {
    background: var(--brand-soft) !important;
    border-color: var(--brand) !important;
    color: var(--brand) !important;
}
html[data-theme="dark"] .a-radio input[type="radio"],
html[data-theme="dark"] .a-check input[type="checkbox"] {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
}

/* ---------- 后台：徽标 / 状态 ---------- */
html[data-theme="dark"] body.a-body .badge-secondary,
html[data-theme="dark"] .a-badge {
    background: var(--bg-inset) !important;
    color: var(--tx-3) !important;
}

/* ---------- 后台：仪表盘数字与统计 ---------- */
html[data-theme="dark"] .adx-hero,
html[data-theme="dark"] .adx-mini,
html[data-theme="dark"] .adx-chartcard,
html[data-theme="dark"] .adx-site {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-2) !important;
}
html[data-theme="dark"] .adx-hero__sub,
html[data-theme="dark"] .adx-chartcard__head h4 { color: var(--tx-2) !important; }
html[data-theme="dark"] .adx-rangebtns button {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-2) !important;
}
html[data-theme="dark"] .adx-rangebtns button.is-on {
    /* 同 .s-fab-help：白字必须压在深色渐变上，--brand 太亮 */
    background: var(--brand-grad) !important;
    border-color: transparent !important;
    color: #fff !important;
}

/* ---------- 后台：后台首页的服务器信息块 ---------- */
html[data-theme="dark"] body.a-body table.table td,
html[data-theme="dark"] body.a-body table.table th {
    color: var(--tx-2) !important;
}

/* ---------- 前台：补充遗漏 ---------- */
html[data-theme="dark"] .s-hero__card {
    background: rgba(21, 29, 46, .78) !important;
    border-color: var(--ln-1) !important;
}
html[data-theme="dark"] .s-urlbox { background: var(--bg-inset) !important; }
html[data-theme="dark"] .s-urlbox__input { color: var(--tx-1) !important; }
html[data-theme="dark"] .s-urlbox__input::placeholder { color: var(--tx-4) !important; }
html[data-theme="dark"] .s-tag {
    background: rgba(52, 211, 153, .12) !important;
    border-color: var(--brand-line) !important;
    color: var(--brand) !important;
}
html[data-theme="dark"] .s-hero__title { color: var(--tx-1); }
html[data-theme="dark"] .s-btn--ghost {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-2) !important;
}
html[data-theme="dark"] .s-copy {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-3) !important;
}
html[data-theme="dark"] .s-site__quota.is-ok {
    background: rgba(52, 211, 153, .16) !important;
    color: var(--brand) !important;
}
html[data-theme="dark"] .s-site__quota.is-none {
    background: var(--bg-inset) !important;
    color: var(--tx-3) !important;
}
html[data-theme="dark"] .s-site__quota.is-off {
    background: rgba(239, 68, 68, .16) !important;
    color: #fca5a5 !important;
}
html[data-theme="dark"] .s-badge { background: var(--bg-inset) !important; color: var(--tx-3) !important; }
html[data-theme="dark"] .s-badge--ok { background: rgba(52, 211, 153, .16) !important; color: var(--brand) !important; }
html[data-theme="dark"] .s-badge--err { background: rgba(239, 68, 68, .16) !important; color: #fca5a5 !important; }
html[data-theme="dark"] .s-table th { background: var(--bg-inset) !important; color: var(--tx-3) !important; }
html[data-theme="dark"] .s-table td { color: var(--tx-2) !important; border-color: var(--ln-2) !important; }
html[data-theme="dark"] .s-renew__buy { background: var(--bg-inset) !important; border-color: var(--ln-1) !important; }
html[data-theme="dark"] .s-renew__form-tip { color: var(--danger) !important; }
html[data-theme="dark"] .s-renew__qr-empty { background: var(--bg-card) !important; border-color: var(--ln-1) !important; }
html[data-theme="dark"] .s-acct__item { background: var(--bg-inset) !important; border-color: var(--ln-1) !important; }
html[data-theme="dark"] .s-acct__value { color: var(--tx-1) !important; }
html[data-theme="dark"] .s-empty__ico { background: var(--bg-inset) !important; color: var(--tx-4) !important; }
html[data-theme="dark"] .s-empty__title { color: var(--tx-2) !important; }
html[data-theme="dark"] .s-hero-user {
    background: linear-gradient(135deg, rgba(16,185,129,.10) 0%, var(--bg-card) 55%, rgba(16,185,129,.06) 100%) !important;
    border-color: var(--brand-line) !important;
}
html[data-theme="dark"] .s-hero-user__name { color: var(--tx-1) !important; }
html[data-theme="dark"] .s-hero-user__badge { background: var(--bg-inset) !important; border-color: var(--ln-1) !important; color: var(--tx-2) !important; }
html[data-theme="dark"] .s-overview { background: var(--bg-card) !important; border-color: var(--ln-1) !important; }
html[data-theme="dark"] .s-overview__label { color: var(--tx-3) !important; }
html[data-theme="dark"] .s-overview__ico { background: var(--bg-inset) !important; }
html[data-theme="dark"] .s-step__no { border-color: var(--brand-line) !important; color: var(--brand) !important; }
html[data-theme="dark"] .s-step__ico { background: var(--bg-inset) !important; }
/* 公告条背景 / 圆角 / 文字色现在由后台「首页公告 → 滚动条样式」以内联样式下发，
   这里只在没有配置（无内联 style）时兜底，故去掉 !important，避免盖掉用户配色 */
html[data-theme="dark"] .s-notice:not([style*="background"]) { background: var(--bg-card); }
html[data-theme="dark"] .s-notice { border-color: var(--ln-1); }
/* 用深色渐变而不是纯 --brand：--brand 在暗色主题下是亮绿 #34d399，
   白字压上去对比度只有 1.9；渐变起点 #047857 约 3.4，勉强达标 */
html[data-theme="dark"] .s-fab-help { background: var(--brand-grad) !important; }
html[data-theme="dark"] .s-footer { background: var(--bg-card) !important; border-top-color: var(--ln-1) !important; }
html[data-theme="dark"] .s-footer, html[data-theme="dark"] .s-footer a { color: var(--tx-3) !important; }

/* ==========================================================================
   深色主题补丁（第三版）：页面内联样式里的硬编码色
   --------------------------------------------------------------------------
   部分页面（如 Cookie 列表）把颜色写在自己的 <style> 里，
   这些规则在 themes.css 之前执行，且用具体色值，需要针对性覆盖。
   ========================================================================== */

/* ---------- Cookie 列表页 ---------- */
html[data-theme="dark"] .ck-body {
    background: var(--bg-page) !important;
}
html[data-theme="dark"] .ck-site {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
}
html[data-theme="dark"] .ck-site.is-ok {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(16,185,129,.10) 100%) !important;
}
html[data-theme="dark"] .ck-site.is-warn {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(245,158,11,.10) 100%) !important;
}
html[data-theme="dark"] .ck-site.is-danger {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239,68,68,.10) 100%) !important;
}
html[data-theme="dark"] .ck-site__name { color: var(--tx-1) !important; }
html[data-theme="dark"] .ck-site__domain { color: var(--tx-4) !important; }
html[data-theme="dark"] .ck-total { color: var(--tx-4) !important; }
html[data-theme="dark"] .ck-num { color: var(--brand) !important; }
html[data-theme="dark"] .ck-site.is-warn .ck-num { color: var(--warn) !important; }
html[data-theme="dark"] .ck-site.is-danger .ck-num { color: var(--danger) !important; }
html[data-theme="dark"] .ck-bar { background: var(--ln-1) !important; }
html[data-theme="dark"] .ck-exp { color: var(--tx-2) !important; }
html[data-theme="dark"] .ck-exp.is-warn { color: var(--warn) !important; }
html[data-theme="dark"] .ck-exp.is-danger { color: var(--danger) !important; }
html[data-theme="dark"] .ck-site__flag {
    background: rgba(16,185,129,.2) !important;
    color: var(--brand) !important;
}
html[data-theme="dark"] .ck-switch {
    background: var(--bg-inset) !important;
    color: var(--tx-3) !important;
}
html[data-theme="dark"] .ck-switch.is-on {
    background: rgba(16,185,129,.18) !important;
    color: var(--brand) !important;
}

/* ---------- 富文本编辑器（设置页） ---------- */
html[data-theme="dark"] .rte {
    background: var(--bg-card) !important;
    border-color: var(--ln-1) !important;
}
html[data-theme="dark"] .rte__bar,
html[data-theme="dark"] .rte__foot {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-3) !important;
}
html[data-theme="dark"] .rte__editor {
    color: var(--tx-2) !important;
    background: transparent !important;
}
html[data-theme="dark"] .rte__btn {
    color: var(--tx-2) !important;
}
html[data-theme="dark"] .rte__btn:hover {
    background: var(--ln-1) !important;
    color: var(--brand) !important;
}
html[data-theme="dark"] .rte__sep { background: var(--ln-1) !important; }

/* ---------- 后台：页面标签导航 ---------- */
html[data-theme="dark"] body.a-body .nav-tabs.page-tabs {
    background: var(--bg-inset) !important;
    border-bottom-color: var(--ln-1) !important;
}
html[data-theme="dark"] body.a-body .nav-tabs.page-tabs > li > a {
    color: var(--tx-3) !important;
}
html[data-theme="dark"] body.a-body .nav-tabs.page-tabs > li.active > a {
    background: var(--bg-card) !important;
    color: var(--brand) !important;
    border-color: var(--ln-1) !important;
}

/* ---------- 批量生成页：站点权限格 ---------- */
html[data-theme="dark"] .bk-site {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
}
html[data-theme="dark"] .bk-site__name { color: var(--tx-1) !important; }
html[data-theme="dark"] .bk-site__used { color: var(--tx-4) !important; }
html[data-theme="dark"] .bk-toolbar { background: var(--bg-inset) !important; }
html[data-theme="dark"] .bk-toolbar__label { color: var(--tx-2) !important; }
html[data-theme="dark"] .bk-legend { color: var(--tx-3) !important; }
html[data-theme="dark"] .bk-ipt > span { color: var(--tx-3) !important; }

/* ---------- 续费管理页 ---------- */
html[data-theme="dark"] .qr-preview {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
    color: var(--tx-4) !important;
}
html[data-theme="dark"] .step-block {
    background: var(--bg-inset) !important;
    border-color: var(--ln-1) !important;
}

/* ---------- 滑块 ---------- */
html[data-theme="dark"] input[type="range"].set-range {
    background: var(--ln-1) !important;
}

/* ---------- 空状态 / 徽标 ---------- */
html[data-theme="dark"] .a-empty { color: var(--tx-3) !important; }

/* ---------- 全局兜底：深色下所有白底元素 ---------- */
/* 用属性选择器兜住内联 style 里写死 background:#fff 的情况 */
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background-color:#fff"],
html[data-theme="dark"] [style*="background-color: #fff"] {
    background: var(--bg-card) !important;
}