/* Light member account surfaces: sidebar, header and History / Keys / Referral / Profile.
   Presentation only. Admin panel and payment dialogs keep the dark theme. */
:is(#sidebar, .topbar, .usr-dropdown, .mobile-bottom-nav, #pg-history, #pg-keys, #pg-referral, #pg-profile) {
  color-scheme: light;
  --text: #172033; --muted: #526075; --card: #fff; --border: #dbe3ef; --sb: #fff;
  --cyan: #0e7490; --green: #15803d; --purple: #6d28d9; --pink: #be185d; --orange: #b45309;
  color: var(--text);
}
body:not(:has(#pg-admin.active)) { background: #f5f7fb !important; }
.main { min-width: 0; }
:is(#sidebar, .topbar, #pg-history, #pg-keys, #pg-referral, #pg-profile) :focus-visible { outline-color: #1d4ed8 !important; }

/* Sidebar */
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is(.key-mono, .stat-lbl, .btn-sm, .phoa-badge, .hist-date, .hist-date .time, .hist-amount .cur, .hist-note-inp, .hist-key-sub) { font-size: 12px !important; }
.usr-dropdown .udd-sub { font-size: 12px !important; }
#sidebar :is(.logo-tagline, .bal-label, .nav-group-title, .user-role, .nav-badge),
#sidebar .ref-sub-prominent, #sidebar .nav-badge-referral { font-size: 12px !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is(th, .stbadge, .ii-label, .pfield-label, .pfield-note, .badge-rt, .prof-badge-verified, .hist-subtitle) { font-size: 12px !important; text-transform: none !important; letter-spacing: 0 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is([style*="font-size:10px"], [style*="font-size:11px"], [style*="font-size: 10px"], [style*="font-size: 11px"]) { font-size: 12px !important; }
.mobile-bottom-nav :is(.mob-nav-btn span, .mob-center-lbl) { font-size: 12px !important; letter-spacing: 0 !important; text-transform: none !important; }
.member-advanced { min-width: 0; padding: 12px; border: 1px solid #dbe3ef; border-radius: 10px; }
.member-advanced summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: #1d4ed8; }
.member-advanced .pfield-block { margin-top: 12px; }
.member-context-help { display: inline-flex; align-items: center; min-height: 44px; margin-top: 12px; color: #1d4ed8; text-decoration: underline; }
#sidebar { background: #fff; border-right: 1px solid #dbe3ef; }
#sidebar .sb-logo { background: none; border-bottom: 1px solid #e2e8f0; }
#sidebar .logo-mark-img { border-color: #dbe3ef; }
#sidebar .logo-name { color: #172033; }
#sidebar .logo-brand-tools { color: #2563eb !important; -webkit-text-fill-color: #2563eb !important; }
#sidebar .logo-tagline { color: #64748b; font-size: 11px; letter-spacing: 0; text-transform: none; }
#sidebar .sb-balance { background: #eff6ff; border: 1px solid #bfdbfe; }
#sidebar .bal-label { color: #475569; }
#sidebar .bal-num { color: #172033; }
#sidebar .bal-unit { color: #526075; }
#sidebar .btn-nap { min-height: 44px; background: #2563eb; border-color: #2563eb; color: #fff; }
#sidebar .btn-nap:hover { background: #1d4ed8; }
#sidebar .nav-group-title { color: #64748b; }
#sidebar .nav-item { min-height: 44px; color: #334155; }
#sidebar .nav-item:hover { color: #172033; background: #f1f5f9; border-color: transparent; }
#sidebar .nav-item.active { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
#sidebar .nav-item-referral { background: #f8fafc !important; border: 1px solid #dbe3ef !important; }
#sidebar .nav-item-referral:hover, #sidebar .nav-item-referral.active { background: #eff6ff !important; border-color: #bfdbfe !important; }
#sidebar .nav-item-referral .ref-icon { color: #2563eb !important; }
#sidebar .nav-item-referral .ref-title-prominent { color: #172033 !important; }
#sidebar .nav-item-referral .ref-sub-prominent { color: #475569 !important; }
#sidebar .nav-badge-referral { background: #dbeafe !important; color: #1d4ed8 !important; border-color: #bfdbfe !important; }
#sidebar .nav-badge { background: #f1f5f9; color: #334155; border: 1px solid #dbe3ef; }
#sidebar .fa-youtube { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5' stroke-linejoin='round'%3E%3Crect x='2' y='5' width='20' height='14' rx='4'/%3E%3Cpath d='m10 9 5 3-5 3Z'/%3E%3C/svg%3E"); }
#sidebar .sb-user { background: #fff; border-top: 1px solid #e2e8f0; }
#sidebar .user-av { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
#sidebar .user-name { color: #172033; }
#sidebar .user-role { color: #64748b; }
#sidebar .btn-out { min-width: 44px; min-height: 44px; color: #64748b; }
#sidebar .btn-out:hover { color: #b91c1c; }

/* Header, account menu, mobile navigation */
.topbar { background: #fff !important; border-bottom: 1px solid #dbe3ef !important; box-shadow: none !important; }
.topbar .menu-btn, .topbar .icon-btn { color: #172033; border-color: #dbe3ef; background: #fff; }
.topbar .usr-av-ring { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.topbar .mob-logo-text { color: #172033 !important; }
.topbar .mob-logo-text em { color: #2563eb !important; -webkit-text-fill-color: #2563eb !important; }
.topbar .mobile-topbar-bal { background: #eff6ff !important; border: 1px solid #bfdbfe !important; color: #1d4ed8 !important; box-shadow: none !important; }
.usr-dropdown { background: #fff !important; border: 1px solid #dbe3ef !important; box-shadow: 0 12px 32px #17203320 !important; }
.usr-dropdown .udd-name { color: #172033; }
.usr-dropdown .udd-sub { color: #64748b; }
.usr-dropdown .udd-divider { background: #e2e8f0; }
.usr-dropdown .udd-item { color: #334155; min-height: 44px; }
.usr-dropdown .udd-item:hover { background: #f1f5f9; }
.usr-dropdown .udd-logout, .usr-dropdown .udd-logout i { color: #b91c1c; }
@media (max-width: 768px) {
  #sidebar:not(.open) { box-shadow: none !important; }
  #sidebar { box-shadow: 12px 0 40px #17203326 !important; }
  .topbar .mob-logo-text { font-size: 15px !important; white-space: nowrap; }
  .topbar .mobile-topbar-brand { flex-shrink: 0; overflow: visible !important; max-width: none !important; }
  .topbar .mob-logo-text-box { min-width: 0; overflow: visible; }
  #pg-profile .prof-quick-actions { flex-wrap: wrap; }
  #pg-profile .btn-prof-action { white-space: nowrap; }
  .topbar { gap: 6px !important; }
  .mobile-bottom-nav { background: #fffffff5 !important; border-top: 1px solid #dbe3ef !important; }
  .mob-nav-btn { color: #64748b !important; }
  .mob-nav-btn.active, .mob-nav-btn.active i, .mob-nav-btn.active span { color: #1d4ed8 !important; }
}
/* The bell has no action; hide it where header space is scarce. */
@media (max-width: 420px) {
  .topbar .mob-logo-text { font-size: 14px !important; }
  .topbar .icon-btn { display: none !important; }
}

/* Account pages */
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is(.table-card, .stat-box, .prof-section, .prof-card-hero, .bulk-bar, .hist-table-wrap, .lb-section, .activation-guide) {
  background: #fff !important; border: 1px solid #dbe3ef !important; box-shadow: 0 2px 10px #17203308 !important;
}
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is(.page-header h2, .page-header h2 em, .hist-title, .prof-name-text, .tcard-title, .lb-title, .psec-head, .bulk-title) {
  color: #172033 !important; -webkit-text-fill-color: #172033 !important; text-shadow: none !important;
}
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) .hist-title em { background: none !important; color: #1d4ed8 !important; -webkit-text-fill-color: #1d4ed8 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is(.tcard-head, .psec-head) { border-color: #e2e8f0 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is(th, td) { border-color: #eef2f7 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) td { color: #334155; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) tr:hover td { background: #f8fafc; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is(.info-item, .pmeta-item) { background: #f8fafc; border-color: #dbe3ef; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is(.pfield-inp, .field, .hist-note-inp, input:not([type=checkbox]), select, textarea) {
  background: #fff !important; border: 1px solid #cbd5e1 !important; color: #172033 !important;
}
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) ::placeholder { color: #64748b !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) .cbx-box { border-color: #94a3b8; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) .st-ok { background: #dcfce7 !important; color: #166534 !important; border-color: #bbf7d0 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) .st-no { background: #fee2e2 !important; color: #991b1b !important; border-color: #fecaca !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) .st-pend { background: #fef3c7 !important; color: #92400e !important; border-color: #fde68a !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is(.btn-bulk, .btn-sm.btn-green) { background: #15803d !important; color: #fff !important; border: 0; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) .btn-prof-action.outline { background: #fff; color: #1d4ed8; border-color: #bfdbfe; }
#pg-profile .btn-prof-action.primary, #pg-profile .btn-full.btn-purple { background: #2563eb !important; color: #fff !important; box-shadow: none !important; }
#pg-history .hist-title { font-style: normal; font-weight: 700; letter-spacing: -.5px; font-size: clamp(26px,3vw,34px); }
#pg-history .hist-title em { font-style: normal; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) .badge-rt { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

/* Legacy inline neon/white text written for dark backgrounds. */
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is([style*="color:#fff"], [style*="color: #fff"]) { color: #172033 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) [style*="color:#cbd5e1"] { color: #334155 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is([style*="color:#b8b8cc"], [style*="color:#6b748a"]) { color: #475569 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is([style*="color:#00ff88"], [style*="color:#c8facc"], [style*="color:#6ee7b7"]) { color: #166534 !important; text-shadow: none !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is([style*="color:#00f2ff"], [style*="color:#00d4ff"], [style*="color:#00bcd4"]) { color: #0e7490 !important; text-shadow: none !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is([style*="color:#ffcc00"], [style*="color:#ffaa00"], [style*="color:#fbbf24"], [style*="color:#ffd700"]) { color: #a16207 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is([style*="color:#ff5252"], [style*="color:#ff8a80"]) { color: #b91c1c !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) [style*="color:#b39ddb"] { color: #5b21b6 !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) :is([style*="background:rgba(0,0,0"], [style*="background: rgba(0,0,0"]) { background: #f8fafc !important; border-color: #dbe3ef !important; }
#pg-referral :is([style*="rgba(0,255,136,0.12)"], [style*="rgba(0,242,255,0.12)"]) { background: #f1f5f9 !important; border-color: #cbd5e1 !important; box-shadow: none !important; }
:is(#pg-history, #pg-keys, #pg-referral, #pg-profile) [style*="text-shadow"] { text-shadow: none !important; }
