/* V5 深色覆盖；所有业务样式只在 dark 下生效 */
/* 深色主题兼容层：把旧页面的硬编码浅色统一映射到原站风格 */
html[data-theme="dark"] body{background:var(--page-bg)!important;color:var(--text)!important}
html[data-theme="dark"] :is(.page-header,.set-header,.top-header,.header,.market-header){background:var(--header-bg)!important;color:var(--text)!important}
html[data-theme="dark"] :is(.bottom-nav-fixed,.bottom-nav,.nav-bottom){background:var(--nav-bg)!important;border-color:var(--border)!important}
html[data-theme="dark"] :is(.back-btn,.back-arr,.back-button,.lang-icon,.theme-icon){background:var(--surface)!important;border-color:var(--border)!important;color:var(--text)!important}
html[data-theme="dark"] :is(
  .card,.pwd-card,.common-list,.position-card,.second-card,.empty-box,.product-card,.record-card,
  .wallet-card,.asset-card,.info-card,.setting-card,.invite-card,.loan-card,.fund-card,.follow-card,
  .trader-card,.notice-card,.coin-card,.form-card,.detail-card,.panel,.section-card,.content-card
){background:var(--surface)!important;border-color:var(--border)!important;box-shadow:var(--shadow)!important}
html[data-theme="dark"] :is(
  .tab-first,.tab-second,.tabs,.tab-box,.filter-tabs,.sort-select,.badge,.status-tag,.pop-desc,
  .grid-item,.list-row,.menu-row,.item-row,.info-row,.form-row,.select-box,.amount-box
){background-color:var(--surface-2)!important;border-color:var(--border)!important;color:var(--text)!important}
html[data-theme="dark"] :is(input,textarea,select,.input-box,.input-field,.input-line input,.search-input,.form-input){background:var(--input-bg)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:var(--text-3)!important}
html[data-theme="dark"] :is(.tab-first-item.active,.tab-second-item.active,.tab-item.active,.tabs .active){background:var(--brand)!important;color:#fff!important;border-color:var(--brand)!important}
html[data-theme="dark"] :is(.bottom-popup,.popup,.modal,.dialog,.top-notice){background:var(--surface)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-theme="dark"] :is(.sl-btn,.btn-cancel,.secondary-btn){background:var(--surface-2)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-theme="dark"] :is(.submit-pwd,.btn-main,.primary-btn,.btn-save){background:var(--brand)!important;color:#fff!important}
html[data-theme="dark"] :is(.input-label,.label,.order-id,.empty-desc,.row-small-text,.version-text,.arrow-right,.nav-item,.sub-text,.desc,.time,.date){color:var(--text-2)!important}
html[data-theme="dark"] hr{border-color:var(--border)!important}
html[data-theme="dark"] a{color:inherit}
html[data-theme="dark"] .nav-item.active{color:var(--brand)!important}
.theme-switch .switch-dot{transition:left .2s ease,right .2s ease,transform .2s ease;background:#fff!important}
.theme-switch[data-theme-state="dark"]{background:var(--brand)!important}
.theme-switch[data-theme-state="light"]{background:#d5dbe2!important}
.theme-switch[data-theme-state="dark"] .switch-dot{right:2px!important;left:auto!important}
.theme-switch[data-theme-state="light"] .switch-dot{left:2px!important;right:auto!important}
/* 第二轮完整深色适配：覆盖各业务页历史硬编码组件 */
html[data-theme="dark"] :is(
  .balance-section,.action-btn,.coin-item,.coin-icon,.base-card,.calc-card,.total-line,
  .top-desc-card,.address-item,.net-tag,.tag-item,.search-box,.avatar,.data-item,
  .top-tab,.period-item,.kline-box,.sub-tab,.input-control,.lev-item,.margin-info,
  .option-stat,.dir-item,.expire-item,.amount-card,.amount-control,.confirm-desc,
  .product-info,.product-data,.stat-item,.trade-item,.record-item,.list-item,
  .detail-box,.summary-box,.result-box,.profile-box,.user-card,.asset-item
){background:var(--surface-2)!important;border-color:var(--border)!important;color:var(--text)!important}
html[data-theme="dark"] :is(
  .modal,.modal-box,.modal-content,.option-modal-content,.confirm-modal-content,
  .tip-toast,.toast,.top-notice
){background:var(--surface)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-theme="dark"] :is(
  .balance-label,.balance-desc,.action-icon,.action-text,.coin-available,.coin-frozen-tip,
  .info-left,.calc-label,.data-label,.quote-info,.amount-title,.balance-tip,.toast-desc,
  .notice-desc,.desc-text,.coin-text,.filter-label,.item-label,.trade-desc,.follow-count-text
){color:var(--text-2)!important}
html[data-theme="dark"] :is(.amount-input,.search-box input,.input-control input,.amount-control input){color:var(--text)!important}
html[data-theme="dark"] :is(.amount-input,.input-control,.amount-control){background:var(--input-bg)!important}
html[data-theme="dark"] :is(.btn-apply,.btn-cancel-order){background:var(--surface-2)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-theme="dark"] .kline-box{background:var(--surface)!important}
/* 第三轮定点修复：index / language / trade / 主要操作按钮 */
html[data-theme="dark"] body{background:var(--page-bg)!important;}
/* 首页：完全使用深色主题表面，不保留浅色硬编码卡片 */
html[data-theme="dark"] .top-head{background:var(--page-bg)!important;}
html[data-theme="dark"] .top-icon-btn{
  background:var(--surface)!important;
  color:var(--text)!important;
  border:1px solid var(--border)!important;
}
html[data-theme="dark"] .search-wrap{
  background:var(--input-bg)!important;
  border:1px solid var(--border)!important;
  color:var(--text)!important;
}
html[data-theme="dark"] .search-wrap input{color:var(--text)!important;}
html[data-theme="dark"] .search-wrap input::placeholder{color:var(--text-2)!important;}
html[data-theme="dark"] .balance-card{
  background:#202a38!important;
  border:1px solid #273342!important;
  color:var(--text)!important;
}
html[data-theme="dark"] .quote-single-card{
  background:#171e27!important;
  border:1px solid #222b36!important;
  color:var(--text)!important;
}
html[data-theme="dark"] .quote-single-card:nth-child(2){background:#171c17!important;border-color:#252d24!important;}
html[data-theme="dark"] .func-item{color:var(--text-2)!important;}
html[data-theme="dark"] .func-icon-box{
  background:var(--surface)!important;
  border:1px solid var(--border)!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .list-trade-item{border-color:var(--border)!important;}
html[data-theme="dark"] .btn-green{background:var(--brand)!important;color:#fff!important;}
/* 语言页：列表卡片使用原站深灰表面，文字保持高对比 */
html[data-theme="dark"] .lang-header{background:var(--page-bg)!important;}
html[data-theme="dark"] .lang-item,
html[data-theme="dark"] .lang-item.active{
  background:#151b23!important;
  border:1px solid #202832!important;
  color:var(--text)!important;
}
html[data-theme="dark"] .lang-item.active{background:#1b222c!important;}
html[data-theme="dark"] .lang-text-group .main-name{color:var(--text)!important;}
html[data-theme="dark"] .lang-text-group .sub-name{color:var(--text-2)!important;}
html[data-theme="dark"] .check-circle{background:var(--brand)!important;color:#fff!important;}
/* 交易页：激活项必须在通用深色覆盖规则之后，确保点击立即变绿 */
html[data-theme="dark"] .top-tab.active,
html[data-theme="dark"] .sub-tab.active,
html[data-theme="dark"] .period-item.active,
html[data-theme="dark"] .lev-item.active{
  background:var(--brand)!important;
  border-color:var(--brand)!important;
  color:#fff!important;
}
html[data-theme="dark"] .top-tab:not(.active),
html[data-theme="dark"] .sub-tab:not(.active),
html[data-theme="dark"] .period-item:not(.active),
html[data-theme="dark"] .lev-item:not(.active){
  background:var(--surface-2)!important;
  color:var(--text)!important;
  border-color:var(--border)!important;
}
/* 第四轮定点修复：仅修复深色模式，不改变白天原版 */
/* trade.html 期限弹窗：通用深色规则之后重新声明选中态 */
html[data-theme="dark"] .option-modal-content{
  background:#151b23!important;
  border:1px solid #202832!important;
  border-bottom:0!important;
}
html[data-theme="dark"] .dir-item{
  background:#11171f!important;
  border:1px solid #202832!important;
  color:#a2adbc!important;
}
html[data-theme="dark"] .dir-item.up.active,
html[data-theme="dark"] .dir-item.up[aria-selected="true"]{
  background:var(--brand)!important;
  border-color:var(--brand)!important;
  color:#fff!important;
}
html[data-theme="dark"] .dir-item.down.active,
html[data-theme="dark"] .dir-item.down[aria-selected="true"]{
  background:#f54545!important;
  border-color:#f54545!important;
  color:#fff!important;
}
html[data-theme="dark"] .expire-item{
  background:#11171f!important;
  border:1px solid #202832!important;
  color:#f2f5f7!important;
}
html[data-theme="dark"] .expire-item.active,
html[data-theme="dark"] .expire-item[aria-selected="true"]{
  background:var(--brand)!important;
  border-color:var(--brand)!important;
  color:#fff!important;
}
html[data-theme="dark"] #selected_expire_time{color:var(--text-2)!important;}
html[data-theme="dark"] .amount-card{background:#11171f!important;border:1px solid #202832!important;}
html[data-theme="dark"] .amount-control{background:#1b222c!important;}
/* copytrade_setting.html */
html[data-theme="dark"] .nav-bar{background:var(--page-bg)!important;border-color:var(--border)!important;}
html[data-theme="dark"] .wrap{background:var(--page-bg)!important;}
html[data-theme="dark"] .trader-info{
  background:#151b23!important;
  border:1px solid #202832!important;
  color:#f2f5f7!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .mode-tab .tab-item{
  background:#11171f!important;
  border-color:#667180!important;
  color:#a2adbc!important;
}
html[data-theme="dark"] .mode-tab .tab-item.active{
  background:var(--brand)!important;
  border-color:var(--brand)!important;
  color:#fff!important;
}
html[data-theme="dark"] .input-group .input-box{
  background:#1b222c!important;
  border:1px solid #202832!important;
  color:#f2f5f7!important;
}
/* profile.html：外层保持页面底色，真正的卡片使用深灰 */
html[data-theme="dark"] .user-card{background:transparent!important;border:0!important;box-shadow:none!important;}
html[data-theme="dark"] .user-card-inner{
  background:#151b23!important;
  border:1px solid #202832!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .menu-group{background:transparent!important;}
html[data-theme="dark"] .menu-group-inner{
  background:#151b23!important;
  border:1px solid #202832!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .menu-group-inner .menu-row{
  background:#151b23!important;
  border-color:#202832!important;
  color:#f2f5f7!important;
}
html[data-theme="dark"] .menu-icon-box{
  background:#1b222c!important;
  color:#f2f5f7!important;
}
html[data-theme="dark"] .logout-btn{background:#151b23!important;border:1px solid #202832!important;}
/* withdraw.html */
html[data-theme="dark"] .top-desc-card,
html[data-theme="dark"] .top-info-cell,
html[data-theme="dark"] .fee-card,
html[data-theme="dark"] .address-empty{
  background:#151b23!important;
  border:1px solid #202832!important;
  color:#f2f5f7!important;
}
html[data-theme="dark"] .tag-item{
  background:#1b222c!important;
  border:1px solid #202832!important;
  color:#a2adbc!important;
}
html[data-theme="dark"] .tag-item.active{
  background:var(--brand)!important;
  border-color:var(--brand)!important;
  color:#fff!important;
}
html[data-theme="dark"] .address-item{
  background:#151b23!important;
  border-color:#2a3440!important;
  color:#f2f5f7!important;
}
html[data-theme="dark"] .manage-address-btn,
html[data-theme="dark"] .all-btn{
  background:#1b222c!important;
  border:1px solid #202832!important;
  color:#f2f5f7!important;
}
/* trade.html 期限下单交互状态（只影响黑夜） */
html[data-theme="dark"] .dir-item.up.active,
html[data-theme="dark"] .dir-item.up[aria-selected="true"]{background:var(--brand)!important;border-color:var(--brand)!important;color:#fff!important;}
html[data-theme="dark"] .dir-item.down.active,
html[data-theme="dark"] .dir-item.down[aria-selected="true"]{background:#f54545!important;border-color:#f54545!important;color:#fff!important;}
html[data-theme="dark"] .expire-item.active,
html[data-theme="dark"] .expire-item[aria-selected="true"]{background:var(--brand)!important;border-color:var(--brand)!important;color:#fff!important;}



/* recharge.html */

[data-theme="dark"] .info-cell{
    background:#1b222d;
}

[data-theme="dark"] .tip-card{
    background:#1b222d;
}

[data-theme="dark"] .history-item{
    background:#1b222d;
}

[data-theme="dark"] .info-label{
    color:#8f9bb3 !important;
}

[data-theme="dark"] .info-value{
    color:#ffffff !important;
}

[data-theme="dark"] .history-name{
    color:#ffffff !important;
}

[data-theme="dark"] .history-time{
    color:#9ca3af !important;
}

[data-theme="dark"] .history-amount{
    color:#ffffff !important;
}

[data-theme="dark"] .history-status{
    background:#2b3443;
    color:#ffffff !important;
}

[data-theme="dark"] .tip-text{
    color:#ffffff !important;
}


/* userinfo.html / 個人資料页 */
html[data-theme="dark"] .profile-card{
    background:#171e28;
    border:1px solid #202936;
}

html[data-theme="dark"] .username{
    color:#ffffff !important;
}

html[data-theme="dark"] .tip-text{
    color:#9aa6b8 !important;
}

html[data-theme="dark"] .label{
    color:#aab4c3 !important;
}

html[data-theme="dark"] .form-input{
    background:#1d2632 !important;
    color:#ffffff !important;
    border:1px solid #273242;
}

html[data-theme="dark"] .form-input::placeholder{
    color:#6f7c8f !important;
}

html[data-theme="dark"] .form-input:disabled{
    background:#18212c !important;
    color:#8f9bad !important;
    opacity:1;
    -webkit-text-fill-color:#8f9bad;
}

html[data-theme="dark"] .save-btn{
    background:#86c900;
    color:#ffffff;
}

html[data-theme="dark"] .top-notice{
    background:#171e28;
    color:#ffffff;
}

html[data-theme="dark"] .notice-title{
    color:#ffffff;
}

html[data-theme="dark"] .notice-desc{
    color:#aab4c3;
}


/* Layer 弹窗：黑夜模式 */
html[data-theme="dark"] .layui-layer,
body.dark-mode .layui-layer {
    background:#171b21 !important;
    color:#f3f4f6 !important;
    border:1px solid #2b313a !important;
    box-shadow:0 10px 35px rgba(0,0,0,.55) !important;
}

/* 弹窗标题 */
html[data-theme="dark"] .layui-layer-title,
body.dark-mode .layui-layer-title {
    background:#171b21 !important;
    color:#f3f4f6 !important;
    border-bottom:1px solid #2b313a !important;
}

/* 弹窗正文 */
html[data-theme="dark"] .layui-layer-content,
body.dark-mode .layui-layer-content {
    background:#171b21 !important;
    color:#f3f4f6 !important;
}

/* 按钮区域 */
html[data-theme="dark"] .layui-layer-btn,
body.dark-mode .layui-layer-btn {
    background:#171b21 !important;
    border-top:0 !important;
}

/* 确定按钮 */
html[data-theme="dark"] .layui-layer-btn .layui-layer-btn0,
body.dark-mode .layui-layer-btn .layui-layer-btn0 {
    background:#22c55e !important;
    border-color:#22c55e !important;
    color:#fff !important;
}

/* 取消按钮 */
html[data-theme="dark"] .layui-layer-btn .layui-layer-btn1,
body.dark-mode .layui-layer-btn .layui-layer-btn1 {
    background:#252b34 !important;
    border-color:#3a424e !important;
    color:#f3f4f6 !important;
}

/* 右上角关闭图标 */
html[data-theme="dark"] .layui-layer-setwin .layui-layer-close,
body.dark-mode .layui-layer-setwin .layui-layer-close {
    filter:brightness(2);
}