/* 520FX × Binance polish layer
   Loaded after fx_brand + fx_ux. Maps Discuz chrome + viewthread/portal
   leftovers onto design tokens (light/dark). See docs/X5_UI_BINANCE_POLISH.md */

/* ---------- Global chrome ---------- */
html{scroll-behavior:smooth}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
::selection{background:var(--fx-primary-muted);color:var(--fx-text)}
html[data-theme="dark"] ::selection{background:rgba(246,70,93,.35);color:#fff}

/* Scrollbars — thin Binance-like */
*{scrollbar-width:thin;scrollbar-color:var(--fx-border-strong) transparent}
*::-webkit-scrollbar{width:8px;height:8px}
*::-webkit-scrollbar-thumb{background:var(--fx-border-strong);border-radius:8px}
*::-webkit-scrollbar-thumb:hover{background:var(--fx-text-tertiary)}
*::-webkit-scrollbar-track{background:transparent}

/* Kill Discuz fixed light backgrounds that break dark mode */
html[data-theme="dark"] body,
html[data-theme="dark"] #wp,
html[data-theme="dark"] .wp{
  background-color:var(--fx-bg) !important;
  background-image:none !important;
  color:var(--fx-text) !important;
}
html[data-theme="dark"] .bm,
html[data-theme="dark"] .bm_c,
html[data-theme="dark"] .bm_h,
html[data-theme="dark"] .ct2,
html[data-theme="dark"] .ct3_a,
html[data-theme="dark"] .nfl .f_c,
html[data-theme="dark"] #ct{
  background-color:var(--fx-surface) !important;
  color:var(--fx-text) !important;
  border-color:var(--fx-border) !important;
}

/* Breadcrumb / page tip */
#pt,#pt.bm.cl,.xg1,#pt a{
  color:var(--fx-text-tertiary) !important;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}
#pt a:hover{color:var(--fx-primary) !important}
#pt .z em,#pt .pipe{opacity:.45}

/* Native Discuz tabs */
.tb,.tbmu{
  border-color:var(--fx-border) !important;
  background:transparent !important;
}
.tb li a,.tb a,.tbmu a{
  color:var(--fx-text-tertiary) !important;
  border-radius:var(--fx-radius-md) var(--fx-radius-md) 0 0;
  transition:color var(--fx-motion-fast) var(--fx-ease),background var(--fx-motion-fast) var(--fx-ease);
}
.tb .a a,.tb li.a a,.tbmu .a{
  color:var(--fx-text) !important;
  font-weight:700 !important;
  background:var(--fx-surface) !important;
  border-color:var(--fx-border) !important;
  border-bottom-color:var(--fx-surface) !important;
}
.tb a:hover,.tbmu a:hover{color:var(--fx-text) !important;background:var(--fx-hover) !important}

/* Chips / tags */
.xq-chip,.xq-chip-mute,.xg1 .xq-chip{
  display:inline-flex;align-items:center;gap:4px;
  padding:2px 8px;border-radius:var(--fx-radius-pill);
  background:var(--fx-elevated);color:var(--fx-text-secondary);
  border:1px solid var(--fx-border);font-size:var(--fx-fs-xs);line-height:1.6;
}
.xq-chip-mute{background:transparent;color:var(--fx-text-tertiary)}
.xq-tagcloud a,.xq-tagcloud-hero a{
  border:1px solid var(--fx-border) !important;
  background:var(--fx-surface) !important;
  color:var(--fx-text) !important;
  border-radius:var(--fx-radius-pill) !important;
  transition:border-color var(--fx-motion-fast) var(--fx-ease),background var(--fx-motion-fast) var(--fx-ease),color var(--fx-motion-fast) var(--fx-ease);
}
.xq-tagcloud a:hover,.xq-tagcloud-hero a:hover{
  border-color:var(--fx-primary) !important;
  color:var(--fx-primary) !important;
  background:var(--fx-primary-soft) !important;
}
.xq-tagcloud a em,.xq-tagcloud-hero a em{
  color:var(--fx-text-tertiary);font-style:normal;margin-left:4px;font-size:var(--fx-fs-xs);
}

/* Feed density — Binance list rhythm */
.xq-feed{list-style:none;margin:0;padding:0}
.xq-feed > li{
  border-bottom:1px solid var(--fx-border);
  padding:14px 16px;
  transition:background var(--fx-motion-fast) var(--fx-ease);
}
.xq-feed > li:last-child{border-bottom:0}
.xq-feed > li:hover{background:var(--fx-hover)}
.xq-feed-title{
  color:var(--fx-text) !important;font-weight:600;font-size:var(--fx-fs-md);
  line-height:var(--fx-lh-tight);text-decoration:none !important;
}
.xq-feed-title:hover{color:var(--fx-primary) !important}
.xq-feed-user,.xq-feed-meta{color:var(--fx-text-tertiary);font-size:var(--fx-fs-sm)}
.xq-author-name{color:var(--fx-text) !important;font-weight:600;text-decoration:none !important}
.xq-author-name:hover{color:var(--fx-primary) !important}
.xq-avatar,.xq-avatar-letter{
  border:1px solid var(--fx-border);
  background:var(--fx-elevated);
  color:var(--fx-text-secondary);
}
.xq-feed-thumb img{
  border-radius:var(--fx-radius-md);border:1px solid var(--fx-border);
  background:var(--fx-sunken);object-fit:cover;
}

/* Panels */
.xq-panel,.xq-panel .bm{
  background:var(--fx-surface) !important;
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-lg) !important;
  overflow:hidden;
}
.xq-panel-hd{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 16px;border-bottom:1px solid var(--fx-border);
  background:transparent !important;
}
.xq-panel-hd h2{
  margin:0;font-size:var(--fx-fs-md);font-weight:700;color:var(--fx-text);
  display:inline-flex;align-items:center;gap:6px;
}

/* Viewthread stats: eye / reply lucide instead of 查看:/回复: */
#nv_forum.pg_viewthread .fx-vt-stats,
#nv_forum.pg_viewthread .hm.ptn.fx-vt-stats{
  display:inline-flex;align-items:center;gap:14px;
  padding:8px 0 4px;text-align:left;
}
#nv_forum.pg_viewthread .fx-vt-stat{
  display:inline-flex;align-items:center;gap:5px;
  color:var(--fx-text-tertiary);font-size:var(--fx-fs-sm);line-height:1;
}
#nv_forum.pg_viewthread .fx-vt-stat svg.fx-lucide,
#nv_forum.pg_viewthread .fx-vt-stat i[data-lucide]{
  width:14px;height:14px;flex:none;color:var(--fx-text-tertiary);
}
#nv_forum.pg_viewthread .fx-vt-stat em,
#nv_forum.pg_viewthread .fx-vt-stat .xi1{
  font-style:normal;font-weight:700;color:var(--fx-primary) !important;
}

/* ---------- Viewthread (Discuz native) ---------- */
/* Kill inline font colors Discuz injects (e.g. style="color:#000000") */
#nv_forum.pg_viewthread .pcb font[color],
#nv_forum.pg_viewthread .pcb [style*="color: #000"],
#nv_forum.pg_viewthread .pcb [style*="color:#000"],
#nv_forum.pg_viewthread .pcb [style*="color: #000000"],
#nv_forum.pg_viewthread .pcb [style*="color:#000000"],
html[data-theme="dark"] #nv_forum.pg_viewthread .pcb [style*="color: #000"],
html[data-theme="dark"] #nv_forum.pg_viewthread .pcb [style*="color:#000"],
html[data-theme="dark"] #nv_forum.pg_viewthread .pcb [style*="color: #000000"],
html[data-theme="dark"] #nv_forum.pg_viewthread .pcb [style*="color:#000000"]{
  color:var(--fx-text) !important;
}

#nv_forum.pg_viewthread .ts,
#nv_forum.pg_viewthread #thread_subject,
#nv_forum.pg_viewthread .ts h1{
  color:var(--fx-text) !important;
  font-size:clamp(18px,1.6vw,22px) !important;
  font-weight:700 !important;
  letter-spacing:var(--fx-tracking);
  line-height:1.35 !important;
}
#nv_forum.pg_viewthread .ts .xg1 a{
  color:var(--fx-text-tertiary) !important;
  font-size:var(--fx-fs-sm) !important;
  font-weight:500 !important;
}
#nv_forum.pg_viewthread .ts .xg1 a:hover{color:var(--fx-primary) !important}

/* Ad spacer row between posts — collapse empty chrome */
#nv_forum.pg_viewthread table.ad,
#nv_forum.pg_viewthread table.ad td{
  background:transparent !important;
  border:0 !important;
  height:8px !important;
  padding:0 !important;
}

#nv_forum.pg_viewthread #ct,
#nv_forum.pg_viewthread .bm,
#nv_forum.pg_viewthread .bm_c{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}
#nv_forum.pg_viewthread #postlist,
#nv_forum.pg_viewthread .pl,
#nv_forum.pg_viewthread table.pl{
  background:transparent !important;
  border:0 !important;
}
#nv_forum.pg_viewthread .pls,
#nv_forum.pg_viewthread td.pls{
  background:var(--fx-elevated) !important;
  border-color:var(--fx-border) !important;
  color:var(--fx-text) !important;
  vertical-align:top;
}
#nv_forum.pg_viewthread .plc,
#nv_forum.pg_viewthread td.plc{
  background:var(--fx-surface) !important;
  border-color:var(--fx-border) !important;
  color:var(--fx-text) !important;
}
#nv_forum.pg_viewthread .pi{
  border-bottom:1px solid var(--fx-border) !important;
  color:var(--fx-text-secondary) !important;
  background:transparent !important;
}
#nv_forum.pg_viewthread .authi a,
#nv_forum.pg_viewthread .authi .xi2,
#nv_forum.pg_viewthread .pi .authi a{
  color:var(--fx-text) !important;font-weight:600;
}
#nv_forum.pg_viewthread .authi a:hover{color:var(--fx-primary) !important}
#nv_forum.pg_viewthread .pcb,
#nv_forum.pg_viewthread .t_f,
#nv_forum.pg_viewthread .t_fsz{
  color:var(--fx-text) !important;
  font-size:var(--fx-fs-md);line-height:var(--fx-lh-rich);
}
#nv_forum.pg_viewthread .pcb a{color:var(--fx-primary)}
#nv_forum.pg_viewthread .po{
  border-top:1px solid var(--fx-border) !important;
  background:transparent !important;
}
#nv_forum.pg_viewthread .po a,
#nv_forum.pg_viewthread .pob em a{
  color:var(--fx-text-secondary) !important;
  border-radius:var(--fx-radius-sm);
  padding:4px 8px;
  transition:background var(--fx-motion-fast) var(--fx-ease),color var(--fx-motion-fast) var(--fx-ease);
}
#nv_forum.pg_viewthread .po a:hover,
#nv_forum.pg_viewthread .pob em a:hover{
  background:var(--fx-hover) !important;color:var(--fx-primary) !important;
}
#nv_forum.pg_viewthread .quote,
#nv_forum.pg_viewthread blockquote,
#nv_forum.pg_viewthread .blockcode{
  background:var(--fx-sunken) !important;
  border:1px solid var(--fx-border) !important;
  border-left:3px solid var(--fx-primary) !important;
  border-radius:var(--fx-radius-md) !important;
  color:var(--fx-text-secondary) !important;
}
#nv_forum.pg_viewthread .attach_noperm,
#nv_forum.pg_viewthread .attnm,
#nv_forum.pg_viewthread .tattl{
  background:var(--fx-elevated) !important;
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-md) !important;
  color:var(--fx-text-secondary) !important;
}
#nv_forum.pg_viewthread #f_pst,
#nv_forum.pg_viewthread #fastposteditor,
#nv_forum.pg_viewthread .tedt{
  background:var(--fx-surface) !important;
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-lg) !important;
  color:var(--fx-text) !important;
}
#nv_forum.pg_viewthread .tedt .bar,
#nv_forum.pg_viewthread .fpd{
  background:var(--fx-elevated) !important;
  border-color:var(--fx-border) !important;
}
#nv_forum.pg_viewthread .tedt .area textarea,
#nv_forum.pg_viewthread #fastpostmessage{
  background:var(--fx-input-bg) !important;
  color:var(--fx-text) !important;
  border:0 !important;
}
#nv_forum.pg_viewthread .pls .avatar img,
#nv_forum.pg_viewthread .user_avatar img{
  border-radius:50%;border:1px solid var(--fx-border);
}
#nv_forum.pg_viewthread .pil,
#nv_forum.pg_viewthread .tns,
#nv_forum.pg_viewthread .tns th,
#nv_forum.pg_viewthread .tns td{
  color:var(--fx-text-tertiary) !important;
  border-color:var(--fx-border) !important;
}
#nv_forum.pg_viewthread .psti,
#nv_forum.pg_viewthread .rate,
#nv_forum.pg_viewthread .ratl{
  background:var(--fx-elevated) !important;
  border-color:var(--fx-border) !important;
  color:var(--fx-text-secondary) !important;
}
#nv_forum.pg_viewthread .sign{
  margin-top:16px !important;padding-top:12px !important;
  border-top:1px dashed var(--fx-border) !important;
  color:var(--fx-text-tertiary) !important;font-size:var(--fx-fs-sm) !important;
}
#nv_forum.pg_viewthread #postlist > table{
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-lg) !important;
  overflow:hidden;
  margin-bottom:10px !important;
  background:var(--fx-surface) !important;
}
#nv_forum.pg_viewthread #postlist > table.pl{
  box-shadow:none !important;
}
#nv_forum.pg_viewthread .psth,
#nv_forum.pg_viewthread .cm .psth{
  background:var(--fx-elevated) !important;
  color:var(--fx-text-secondary) !important;
  border-color:var(--fx-border) !important;
}

/* Thread / forum tools bar */
.pgs,.pgbtn,.pgs .pg{
  display:flex;flex-wrap:wrap;align-items:center;gap:6px;
}
.pg a,.pg strong,.pgb a,.pg label{
  min-width:32px;height:32px;line-height:30px;text-align:center;
  box-sizing:border-box;padding:0 8px !important;
  background:var(--fx-surface) !important;
}
.pg label{border:1px solid var(--fx-border);border-radius:var(--fx-radius-sm);color:var(--fx-text-tertiary)}

/* Forumdisplay leftovers */
#nv_forum.pg_forumdisplay .bm_h,
#nv_forum.pg_forumdisplay .pbn,
#nv_forum.pg_forumdisplay .bw0{
  background:transparent !important;border:0 !important;box-shadow:none !important;
}
#nv_forum.pg_forumdisplay #pgt .pg,
#nv_forum.pg_forumdisplay .pgs{
  margin:8px 0 12px;
}

/* ---------- Portal ---------- */
#nv_portal .xq-shell,
#nv_portal .fx-portal-shell{
  background:var(--fx-bg-subtle);
}
#nv_portal .fx-article-shell .xq-panel,
#nv_portal .fx-article-hd{
  background:var(--fx-surface);
}
#nv_portal .fx-article-summary{
  color:var(--fx-text-secondary);
  background:var(--fx-elevated);
  border:1px solid var(--fx-border);
  border-radius:var(--fx-radius-md);
  padding:12px 14px;
}
#nv_portal .fx-article-ops .xq-btn{
  border-radius:var(--fx-radius-pill);
}

/* Guest walls / teaser */
.xq-guest-wall,.fx-empty,.xq-guest-teaser{
  background:var(--fx-elevated) !important;
  border:1px dashed var(--fx-border) !important;
  border-radius:var(--fx-radius-lg) !important;
  color:var(--fx-text-secondary) !important;
  padding:20px 18px !important;
  text-align:center;
  margin:12px 0;
}
.xq-guest-wall p,.xq-guest-teaser p,.fx-empty p{
  margin:0 0 14px !important;
  color:var(--fx-text-secondary) !important;
  font-size:var(--fx-fs-sm);
  line-height:1.55;
}
.xq-guest-wall .xq-btn{margin:0 4px 4px}
.xq-guest-wall-inline{margin:8px 0 14px !important}
.xq-guest-hidden{
  display:flex;align-items:center;justify-content:center;
  min-height:56px;padding:14px 12px;
  color:var(--fx-text-tertiary) !important;
  background:var(--fx-sunken) !important;
  border:1px dashed var(--fx-border) !important;
  border-radius:var(--fx-radius-md) !important;
  font-size:var(--fx-fs-sm);
}

/* Viewthread toolbar: unify ghost + primary (rewrite URLs are forum-33-1.html) */
#nv_forum.pg_viewthread #pgt .pgb a,
#nv_forum.pg_viewthread #pgt a.btn{
  display:inline-flex !important;align-items:center;justify-content:center;gap:6px;
  height:36px;padding:0 14px !important;box-sizing:border-box;
  border-radius:var(--fx-radius-pill) !important;
  border:1px solid var(--fx-border-strong, var(--fx-border)) !important;
  background:var(--fx-elevated) !important;
  color:var(--fx-text) !important;
  font-weight:600;text-decoration:none !important;
  line-height:1 !important;
}
#nv_forum.pg_viewthread #pgt #newspecial,
#nv_forum.pg_viewthread #pgt #post_reply,
#nv_forum.pg_viewthread #pgt a.pgsbtn{
  display:inline-flex !important;align-items:center;justify-content:center;
  height:36px;padding:0 16px !important;box-sizing:border-box;
  border-radius:var(--fx-radius-pill) !important;
  background:var(--fx-primary) !important;
  border:0 !important;
  color:var(--fx-on-primary) !important;
  font-weight:700;text-decoration:none !important;line-height:1 !important;
}
.xq-guest-wall{
  border-color:var(--fx-border-strong, var(--fx-border)) !important;
  background:color-mix(in srgb,var(--fx-elevated) 88%,var(--fx-primary) 12%) !important;
}

/* Modals / tips */
.tip,.tip_c,.tip_4,.blk,
#append_parent .tip,#append_parent .p_pof{
  background:var(--fx-surface) !important;
  border:1px solid var(--fx-border) !important;
  color:var(--fx-text) !important;
  box-shadow:var(--fx-shadow-pop) !important;
  border-radius:var(--fx-radius-md) !important;
}
.tip_horn{display:none !important}
#fwin_content,#fwin_content .c,#fwin_content .m,
.fwinmask .pm{
  background:var(--fx-surface) !important;
  color:var(--fx-text) !important;
  border-color:var(--fx-border) !important;
}
#fwin_content .flb{
  background:var(--fx-elevated) !important;
  border-bottom:1px solid var(--fx-border) !important;
  color:var(--fx-text) !important;
}
#fwin_content .flb em{color:var(--fx-text) !important;font-weight:700}
#fwin_content .flb span{color:var(--fx-text-tertiary) !important}

/* Tables / misc Discuz */
.dt th,.dt td,.tdat th,.tdat td{
  border-color:var(--fx-border) !important;
  color:var(--fx-text) !important;
}
.dt th,.tdat th{background:var(--fx-elevated) !important;color:var(--fx-text-secondary) !important}
.alt,.alt td,.alt th{background:var(--fx-sunken) !important}
.xw1{color:var(--fx-text) !important}
.xg1,.xg2{color:var(--fx-text-tertiary) !important}
.xi1{color:var(--fx-primary) !important}
.xi2,.xi2 a{color:var(--fx-text) !important}
.xi2 a:hover{color:var(--fx-primary) !important}

/* Ad grid inside themed shell */
.xq-shell .a_t,.xq-shell .a_t td{background:transparent !important;border:0 !important}
.xq-shell .a_t img{box-shadow:var(--fx-shadow)}

/* Mobile tabbar contrast */
.fx-mobile-tabbar{
  background:var(--fx-nav-bg) !important;
  border-top:1px solid var(--fx-nav-border) !important;
  backdrop-filter:blur(12px);
}
.fx-mtab{color:var(--fx-nav-muted) !important}
.fx-mtab.is-on,.fx-mtab:hover{color:var(--fx-primary) !important}

/* Dark: soften Discuz default blue links & white cards */
html[data-theme="dark"] a{color:var(--fx-text)}
html[data-theme="dark"] a:hover{color:var(--fx-primary)}
html[data-theme="dark"] img{opacity:.98}
html[data-theme="dark"] .a_t img{opacity:1;box-shadow:0 2px 8px rgba(0,0,0,.35)}

/* Dark: override Discuz extend_common hard-coded light colors */
html[data-theme="dark"] .guestbox,
html[data-theme="dark"] #uhd,
html[data-theme="dark"] .portal_nav,
html[data-theme="dark"] .timeline_entry_list_container,
html[data-theme="dark"] .fx-footer-qrcode,
html[data-theme="dark"] .poptip-popper{
  background:var(--fx-surface) !important;
  border-color:var(--fx-border) !important;
  color:var(--fx-text) !important;
}
html[data-theme="dark"] .header-login a,
html[data-theme="dark"] .header-client .client-icon,
html[data-theme="dark"] .header-client .client-content .client-text,
html[data-theme="dark"] .header-user-login a,
html[data-theme="dark"] .header-user .author_intro p,
html[data-theme="dark"] .header-user .user-card-top .block_tip,
html[data-theme="dark"] .dz_index_member_info_btm p,
html[data-theme="dark"] .header-searcher .search-panel .e-title{
  color:var(--fx-text-secondary) !important;
}
html[data-theme="dark"] .dz_nav .dz_nav_logo .dz_nav_logo_txt{color:var(--fx-nav-text) !important}
html[data-theme="dark"] .header-login .break,
html[data-theme="dark"] .header-user-login .user-login-separate{background-color:var(--fx-border) !important;color:var(--fx-border) !important}
html[data-theme="dark"] .pmm .pmd{
  background:color-mix(in srgb,var(--fx-up) 75%,#000) !important;
  color:#fff !important;
}

/* Hero / page title denser Binance rhythm */
.xq-forum-hero,.xq-hero{
  border-bottom:1px solid var(--fx-border);
}
.fx-page-title{
  letter-spacing:var(--fx-tracking);
  font-weight:700;
}
.xq-hero-actions{gap:10px}
.xq-more{
  display:inline-flex;align-items:center;gap:6px;
  color:var(--fx-text-tertiary) !important;font-size:var(--fx-fs-sm);
  text-decoration:none !important;padding:10px 0;
}
.xq-more:hover{color:var(--fx-primary) !important}

/* Side quick links */
.xq-quick{list-style:none;margin:0;padding:8px 12px}
.xq-quick li{margin:0}
.xq-quick a{
  display:flex;align-items:center;gap:8px;padding:10px 10px;border-radius:var(--fx-radius-md);
  color:var(--fx-text) !important;text-decoration:none !important;
  transition:background var(--fx-motion-fast) var(--fx-ease);
}
.xq-quick a:hover{background:var(--fx-hover)}

/* Post editor / reply pages */
#nv_forum.pg_post #ct,
#nv_forum.pg_post .bm,
#nv_forum.pg_post .bm_c{
  background:var(--fx-surface) !important;
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-lg) !important;
  color:var(--fx-text) !important;
}
#nv_forum.pg_post .tedt,
#nv_forum.pg_post .edt{
  border-color:var(--fx-border) !important;
  background:var(--fx-surface) !important;
}
#nv_forum.pg_post .bar{background:var(--fx-elevated) !important;border-color:var(--fx-border) !important}

/* Spacecp / home soft polish */
#nv_home .bm_h h2,#nv_home .bm_h h1{color:var(--fx-text) !important}
#nv_home .tfm th,#nv_home .tfm td{color:var(--fx-text-secondary) !important;border-color:var(--fx-border) !important}
#nv_home .tfm caption{color:var(--fx-text) !important}

/* Auth pages — ensure polish tokens even when member tpl loads old brand stamp */
#nv_member.pg_logging .fx-auth-shell,
#nv_member.pg_register .fx-auth-shell{
  min-height:calc(100vh - var(--fx-nav-height,64px));
  background:var(--fx-bg-subtle);
  display:flex;align-items:flex-start;justify-content:center;
  padding:32px var(--fx-gutter) 64px;
}
#nv_member .fx-auth-card{
  width:100%;max-width:420px;
  background:var(--fx-surface) !important;
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-xl) !important;
  box-shadow:var(--fx-shadow) !important;
  padding:8px 0 20px;
}
#nv_member .fx-auth-card .rfm th{
  color:var(--fx-text-secondary) !important;font-weight:600 !important;
}
#nv_member .fx-auth-card .rfm td{color:var(--fx-text) !important}
#nv_member .fx-auth-card select{
  background:var(--fx-input-bg) !important;color:var(--fx-text) !important;
  border:1px solid transparent !important;border-radius:var(--fx-radius-md) !important;
}

/* Plugin shells share surface language */
#nv_plugin .xq-shell,
#nv_plugin .fx-market-shell,
#nv_plugin .fx-column-shell,
#nv_plugin .fx-resources-shell{
  background:var(--fx-bg-subtle);
  min-height:60vh;padding-bottom:48px;
}
#nv_plugin .xq-panel-hd h2{font-size:var(--fx-fs-md)}

/* ---------- Search ---------- */
#nv_search{
  background:var(--fx-bg-subtle) !important;
  color:var(--fx-text);
}
#nv_search #ct,
#nv_search .bm,
#nv_search .bm_c{
  background:var(--fx-surface) !important;
  border-color:var(--fx-border) !important;
  color:var(--fx-text) !important;
  border-radius:var(--fx-radius-lg);
}
#nv_search .bm_h,
#nv_search .tbmu{
  background:transparent !important;
  border-color:var(--fx-border) !important;
  color:var(--fx-text) !important;
}
#nv_search .slst a,
#nv_search .slst li,
#nv_search .xs2,
#nv_search .pbn{
  color:var(--fx-text) !important;
}
#nv_search .slst a:hover{color:var(--fx-primary) !important}
#nv_search .px,#nv_search .pt{
  background:var(--fx-input-bg) !important;
  color:var(--fx-text) !important;
  border:1px solid transparent !important;
  border-radius:var(--fx-radius-md) !important;
}
#nv_search .pn{
  border-radius:var(--fx-radius-md) !important;
}

/* ---------- Light+dark: remap extend_common hardcodes ---------- */
.guestbox{
  border:1px solid var(--fx-border) !important;
  background:var(--fx-elevated) !important;
  color:var(--fx-text) !important;
  border-radius:var(--fx-radius-lg) !important;
}
#uhd{
  background:var(--fx-surface) !important;
  border-color:var(--fx-border) !important;
  color:var(--fx-text) !important;
}
.portal_nav,
.timeline_entry_list_container{
  background:var(--fx-surface) !important;
  border-color:var(--fx-border) !important;
  color:var(--fx-text) !important;
}
.dz_nav .dz_nav_logo .dz_nav_logo_txt{color:var(--fx-nav-text) !important}
.header-login a,
.header-client .client-icon,
.header-client .client-content .client-text,
.header-user-login a{
  color:var(--fx-nav-muted) !important;
}
.header-login .break,
.header-user-login .user-login-separate{
  background-color:var(--fx-border) !important;
  color:var(--fx-border) !important;
}
.header-user .author_intro p,
.header-user .user-card-top .block_tip,
.dz_index_member_info_btm p,
.header-searcher .search-panel .e-title{
  color:var(--fx-text-tertiary) !important;
}
.dz_good_author ul li em{
  color:var(--fx-text-tertiary) !important;
  background:var(--fx-sunken) !important;
}

/* PM bubbles stay readable in both themes */
.pmm .pmd{
  background:color-mix(in srgb,var(--fx-up) 72%,transparent) !important;
  color:var(--fx-text) !important;
}
html[data-theme="dark"] .pmm .pmd{
  background:color-mix(in srgb,var(--fx-up) 55%,#0B0E11) !important;
  color:#fff !important;
}
.pmb h4{
  background:var(--fx-hover) !important;
  color:var(--fx-text-secondary) !important;
}

/* ---------- Forumdisplay: thread type chips (#thread_types.ttp) ---------- */
#thread_types.ttp,
#nv_forum.pg_forumdisplay #thread_types{
  display:flex;flex-wrap:wrap;gap:8px;align-items:center;
  background:var(--fx-surface) !important;
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-lg) !important;
  padding:12px 14px !important;
  margin:0 0 12px !important;
  box-shadow:none !important;
}
#thread_types.ttp li{
  float:none !important;margin:0 !important;padding:0 !important;
  background:transparent !important;border:0 !important;
}
#thread_types.ttp a,
#thread_types.ttp li a{
  float:none !important;
  display:inline-flex !important;align-items:center;gap:6px;
  height:auto !important;line-height:1.2 !important;
  padding:7px 12px !important;margin:0 !important;
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-pill) !important;
  background:var(--fx-elevated) !important;
  color:var(--fx-text) !important;
  font-weight:600;text-decoration:none !important;
  box-shadow:none !important;
}
#thread_types.ttp a:hover,
#thread_types.ttp li a:hover{
  border-color:var(--fx-primary) !important;
  color:var(--fx-primary) !important;
  background:var(--fx-primary-soft) !important;
}
#thread_types.ttp .a a,
#thread_types.ttp li.a a,
#thread_types.ttp li.xw1 a{
  background:var(--fx-primary-soft) !important;
  border-color:var(--fx-primary) !important;
  color:var(--fx-primary) !important;
  box-shadow:inset 3px 0 0 var(--fx-primary);
}
#thread_types.ttp .num,
#thread_types.ttp .xg1.num{
  color:var(--fx-text-tertiary) !important;
  font-weight:500;
}

/* ---------- Pop menus: visited forums / forum jump / generic .p_pop ---------- */
#visitedforums_menu,
#fjump_menu,
#qmenu_menu,
.p_pop.h_pop,
#append_parent .p_pop,
#append_parent .h_pop{
  background:var(--fx-surface) !important;
  border:1px solid var(--fx-border) !important;
  color:var(--fx-text) !important;
  box-shadow:var(--fx-shadow-pop) !important;
  border-radius:var(--fx-radius-md) !important;
}
#visitedforums_menu h3,
#visitedforums_menu .c,
#fjump_menu,
.p_pop li,
.p_pop a,
#visitedforums_menu a,
#fjump_menu a,
#append_parent .p_pop a{
  color:var(--fx-text) !important;
  background:transparent !important;
  border-color:var(--fx-border) !important;
}
#visitedforums_menu a:hover,
#fjump_menu a:hover,
#append_parent .p_pop a:hover,
.p_pop a:hover{
  color:var(--fx-primary) !important;
  background:var(--fx-hover) !important;
}
#visitedforums_menu li,
#fjump_menu li,
.p_pop li{
  border-color:var(--fx-border) !important;
}
/* Discuz style_11 hardcodes a{#333}/body{#444} — kill in dark pops */
html[data-theme="dark"] #visitedforums_menu,
html[data-theme="dark"] #visitedforums_menu *,
html[data-theme="dark"] #fjump_menu,
html[data-theme="dark"] #fjump_menu a,
html[data-theme="dark"] .p_pop,
html[data-theme="dark"] .p_pop a{
  color:var(--fx-text) !important;
}
html[data-theme="dark"] #visitedforums_menu a:hover,
html[data-theme="dark"] .p_pop a:hover{
  color:var(--fx-primary) !important;
}

/* ---------- Post editor (white box → tokens) ---------- */
.tedt,
.edt,
#nv_forum.pg_post .tedt,
#nv_forum.pg_post .edt,
#fastposteditor .tedt{
  background:var(--fx-surface) !important;
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-lg) !important;
  overflow:hidden;
}
.tedt .bar,
.edt .bar,
#nv_forum.pg_post .bar,
#e_body .bar{
  background:var(--fx-elevated) !important;
  border-bottom:1px solid var(--fx-border) !important;
  color:var(--fx-text-secondary) !important;
}
.tedt .area,
.edt .area,
.tedt .pt,
#e_textarea,
textarea#e_textarea,
#fastpostmessage,
.tedt textarea{
  background:var(--fx-input-bg, var(--fx-sunken)) !important;
  color:var(--fx-text) !important;
  border:0 !important;
  caret-color:var(--fx-primary);
}
/* iframe chrome + color-scheme so UA paints dark form controls */
#e_iframe,
.edt iframe,
.tedt iframe,
iframe[id$="_iframe"],
iframe[id^="e_"]{
  background:var(--fx-input-bg, var(--fx-sunken)) !important;
  color-scheme:light dark;
  border:0 !important;
}
html[data-theme="dark"] #e_iframe,
html[data-theme="dark"] .edt iframe,
html[data-theme="dark"] .tedt iframe,
html[data-theme="dark"] iframe[id^="e_"]{
  color-scheme:dark;
  background:#1E2329 !important;
}
/* unused-image tip bar on post page */
#nv_forum.pg_post .notice,
#nv_forum.pg_post .ntc_l,
#e_tip,
.upfile_info{
  background:var(--fx-elevated) !important;
  color:var(--fx-text) !important;
  border:1px solid var(--fx-border) !important;
  border-radius:var(--fx-radius-md) !important;
}

/* fx_guard 发帖须知 — was inline #fff8e8 / #5a4500 (breaks dark) */
.fx-post-guard{
  margin:10px 0 14px;
  padding:12px 14px;
  border:1px solid color-mix(in srgb,var(--fx-warning, #F0B90B) 45%,var(--fx-border));
  background:var(--fx-warning-soft, color-mix(in srgb,var(--fx-warning, #F0B90B) 14%,var(--fx-surface)));
  color:var(--fx-text);
  border-radius:var(--fx-radius-md);
  line-height:1.65;
  font-size:var(--fx-fs-sm, 13px);
}
html[data-theme="dark"] .fx-post-guard{
  border-color:color-mix(in srgb,#F0B90B 35%,var(--fx-border));
  background:color-mix(in srgb,#F0B90B 12%,var(--fx-elevated));
  color:var(--fx-text);
}

/* QA solved badges — replace inline #e8f5e9 / #2e7d32 */
.fx-qa-solved{
  display:inline-flex;align-items:center;
  padding:2px 8px;margin-left:6px;
  border-radius:var(--fx-radius-pill);
  font-size:var(--fx-fs-xs,12px);font-weight:600;
  background:color-mix(in srgb,var(--fx-up,#0ECB81) 16%,var(--fx-surface));
  color:var(--fx-up,#0ECB81);
  border:1px solid color-mix(in srgb,var(--fx-up,#0ECB81) 35%,transparent);
  vertical-align:middle;
}
.fx-qa-solved-em,.fx-qa-mark{color:var(--fx-up,#0ECB81) !important;font-style:normal;font-weight:600}
.fx-qa-mark:hover{color:var(--fx-primary) !important}
