/* PrimChat v263 FINAL — one global theme layer for every visible page */
html,body{min-height:100%;}
html[data-site-theme="dark"],html[data-theme="dark"],html.site-theme-dark,body.site-theme-dark,body.dark{
 color-scheme:dark!important;background:#070b14!important;color:#e8eef7!important;
 --pc-bg:#070b14;--pc-surface:#0f172a;--pc-surface-2:#111c2e;--pc-surface-3:#17243a;
 --pc-text:#e8eef7;--pc-muted:#94a3b8;--pc-line:#29384d;--pc-input:#0b1320;--pc-hover:#18263c;
}
html[data-site-theme="dark"] body,html[data-theme="dark"] body,body.site-theme-dark,body.dark,
html[data-site-theme="dark"] #app,html[data-site-theme="dark"] main{background:#070b14!important;color:#e8eef7!important;}
html[data-site-theme="dark"] body::before,html[data-site-theme="dark"] body::after,body.dark::before,body.dark::after{background:transparent!important;}
/* Universal containers: catches both modern and old page-specific markup. */
html[data-site-theme="dark"] :where(.card,.panel,.box,.section,.section-card,.content,.content-box,.container-card,.surface,.sheet,.modal,.modal-content,.dialog,.drawer,.popup,.popover,.dropdown,.menu,.menu-panel,.list,.list-item,.item,.tile,.widget,.block,.story-card,.story-view,.story-settings,.social-card,.feed-card,.side-card,.group-card,.city-card,.people-card,.friends-card,.notification-card,.conversation-list,.conversation,.auth,.setup,.admin-card,.admin-section,.rules-card,.forum-card,.topic-list,.profile-card,.profile-panel,.market-card,.market-tabs,.market-tools,.market-form,.gallery-main,.seller-box,.chatbox,.users-panel,.online-panel,.thread,.thread-card,.topic-card,.post-card,.reply-card,.announcement-card,.news-card,.search-card,.rating-card,.activity-card,.settings-card,.friend-card,.album-card,.photo-card,.table-wrap){background:var(--pc-surface)!important;color:var(--pc-text)!important;border-color:var(--pc-line)!important;}
/* Legacy inline light surfaces */
html[data-site-theme="dark"] :where([style*="background:#fff"],[style*="background: #fff"],[style*="background:white"],[style*="background: white"],[style*="background:#f8fafc"],[style*="background: #f8fafc"],[style*="background:#eef1f5"],[style*="background: #eef1f5"],[style*="background:#eff6ff"],[style*="background: #eff6ff"],[style*="background:#f1f5f9"],[style*="background: #f1f5f9"]){background:var(--pc-surface)!important;color:var(--pc-text)!important;border-color:var(--pc-line)!important;}
html[data-site-theme="dark"] :where(header,footer,.topbar,.navbar,.topnav,.sidebar,.left-sidebar,.right-sidebar,.mobile-nav,.mobile-menu,.bottom-nav,.tabs,.toolbar,.filters,.searchbar,.chat-topline){background:#0a111d!important;color:var(--pc-text)!important;border-color:var(--pc-line)!important;}
html[data-site-theme="dark"] :where(a){color:#b9d8ff;}
html[data-site-theme="dark"] :where(h1,h2,h3,h4,h5,h6,strong,b,label,legend,th){color:var(--pc-text)!important;}
html[data-site-theme="dark"] :where(p,span,small,.muted,.hint,.description,.meta){color:inherit;}
html[data-site-theme="dark"] :where(input,textarea,select,option){background:var(--pc-input)!important;color:var(--pc-text)!important;border-color:var(--pc-line)!important;}
html[data-site-theme="dark"] :where(button,.btn){border-color:var(--pc-line)!important;color:var(--pc-text)!important;}
html[data-site-theme="dark"] :where(button:not(.primary):not(.danger):not(.success),.btn:not(.primary):not(.danger):not(.success)){background:var(--pc-surface-2)!important;}
html[data-site-theme="dark"] :where(table){background:var(--pc-surface)!important;color:var(--pc-text)!important;border-color:var(--pc-line)!important;}
html[data-site-theme="dark"] :where(th,td){border-color:var(--pc-line)!important;}
html[data-site-theme="dark"] :where(hr){border-color:var(--pc-line)!important;}
html[data-site-theme="dark"] :where(.badge,.counter,.notification-badge,.nav-badge){color:#fff!important;}
html[data-site-theme="dark"] :where(.modal-backdrop,.overlay,.lightbox,.backdrop){background:rgba(0,0,0,.78)!important;}
html[data-site-theme="dark"] :where(.chatbox,.messages,.messages-list,.chat-messages){scrollbar-color:#33445b #0b1320;}
/* Never let old page-specific white shells reappear around the new theme. */
html[data-site-theme="dark"] :where(#page,#app,.page,.wrapper,.wrap,.layout,.main,.content-area,.profile-page,.forum-page,.market-page,.notifications-page,.friends-page,.people-page,.rules-page,.admin-page,.search-page,.rating-page,.city-page,.group-page,.story-page,.social-page,.chat-page){background:transparent!important;color:var(--pc-text)!important;}
/* Mobile: no horizontal theme-shell overflow. */
*,*::before,*::after{box-sizing:border-box;}
img,video,iframe,canvas{max-width:100%;}
pre,code{max-width:100%;overflow:auto;}
input,textarea,select,button{max-width:100%;}
@media(max-width:700px){
 body{overflow-x:hidden!important;}
 main,.page,.wrapper,.wrap,.layout{max-width:100%!important;}
 .topnav{overflow-x:auto!important;scrollbar-width:none;}
 .topnav::-webkit-scrollbar{display:none;}
 .mobile-nav,.bottom-nav{max-width:100vw!important;}
}
