/* Ultimate contrast and mobile menu fix for CustodyProviders.com
   Loaded last on every page. Keeps the institutional white/navy look and fixes low contrast text. */
:root{
  --cp-navy:#071a2f;
  --cp-navy-2:#0f2748;
  --cp-text:#172033;
  --cp-body:#334155;
  --cp-muted:#475569;
  --cp-soft:#64748b;
  --cp-blue:#2563eb;
  --cp-blue-light:#eff6ff;
  --cp-line:#dbe4f0;
  --cp-card:#ffffff;
  --cp-page:#f8fafc;
}
html,body{background:var(--cp-page)!important;color:var(--cp-text)!important;text-shadow:none!important;}
body *{text-shadow:none!important;}

/* Main readable content on white cards */
main p, main li, main dd, main dt, main figcaption,
.content-card p,.content-card li,.content-card span:not(.eyebrow):not(.badge):not(.pill),
.sidebar-card p,.sidebar-card li,.sidebar-card span:not(.eyebrow):not(.badge):not(.pill),
.hero-copy p,.hero-copy .lead,.hero-card p,.hero-card span,
.provider-card p,.provider-card .provider-sub,.provider-card .provider-description,.provider-card .status-note,
.topic-card p,.faq-item p,.cta-panel p,.legal-card p,.research-card p,.notice-card p,
.mini-metrics span,.meta-box span,.signal span,.metric span,
.footer-copy,.section-lead,.lead,.muted,.small,.plan-note,.micro-note,.tier-note,.price-period,.price-subline,
.provider-logo-label,.score-label,.filter-hint,.count-pill{
  color:var(--cp-body)!important;
  opacity:1!important;
}
main h1,main h2,main h3,main h4,main h5,main h6,
.content-card h1,.content-card h2,.content-card h3,.sidebar-card h3,
.hero-copy h1,.hero-card h3,.cta-panel h2,.provider-card h3,.provider-name,
.provider-logo-name,.mini-metrics strong,.meta-box strong,.signal strong,.metric strong,
.faq-item summary,.section-title,strong,b{
  color:var(--cp-navy)!important;
  opacity:1!important;
}

/* Keep all white cards white and readable */
.hero,.hero-subpage{background:linear-gradient(180deg,#ffffff 0%,#f8fafc 100%)!important;border-bottom:1px solid var(--cp-line)!important;}
.hero-copy,.hero-card,.content-card,.sidebar-card,.contact-card,.pricing-card,.pricing-tier,.pricing-tier-clean,
.provider-card,.card,.notice-card,.topic-card,.faq-card,.research-card,.legal-card,.filters-shell,.results-shell,.cta-panel,
.mini-metrics div,.meta-box,.signal,.metric,.pill,.badge,details,summary{
  background:#ffffff!important;
  color:var(--cp-text)!important;
  border-color:var(--cp-line)!important;
}

/* Eyebrows, badges and inline links */
.eyebrow,.section-eyebrow,.hero-eyebrow,.toc-label,.provider-logo-label{color:var(--cp-blue)!important;}
main a:not(.btn):not(.pill):not(.topic-card):not(.provider-card){color:#1d4ed8!important;}
.pill,a.pill,.badge,.badge-standard,.badge-featured,.badge-institutional{
  color:#1e3a5f!important;background:#f8fafc!important;border-color:var(--cp-line)!important;
}
.badge-pending{color:#92400e!important;background:#fffbeb!important;border-color:#fde68a!important;}
.badge-verified{color:#166534!important;background:#f0fdf4!important;border-color:#bbf7d0!important;}

/* Buttons */
.btn-primary,.btn.primary,a.btn-primary,button.btn-primary,.nav-cta,.header-actions .btn-primary{
  background:var(--cp-blue)!important;border-color:var(--cp-blue)!important;color:#ffffff!important;
}
.btn-primary *,.btn.primary *{color:#ffffff!important;}
.btn:not(.btn-primary):not(.primary),a.btn:not(.btn-primary):not(.primary),button.btn:not(.btn-primary):not(.primary){
  color:var(--cp-navy)!important;background:#ffffff!important;border-color:#cbd5e1!important;
}
.btn:not(.btn-primary):not(.primary):hover{background:var(--cp-blue-light)!important;border-color:#bfdbfe!important;color:#1d4ed8!important;}

/* Forms */
input,textarea,select,option,.form-input,.form-select,.form-textarea,.search-input{
  background:#ffffff!important;color:#172033!important;border-color:#cbd5e1!important;
}
input::placeholder,textarea::placeholder,.search-input::placeholder{color:#64748b!important;opacity:1!important;}
label,.form-label{color:var(--cp-navy)!important;}

/* Header and navigation */
.header,.site-header{background:#ffffff!important;border-bottom:1px solid var(--cp-line)!important;color:var(--cp-navy)!important;}
.brand,.brand span,.brand em,.logo,.logo span,.logo em{color:var(--cp-navy)!important;}
.brand-mark,.logo-icon{background:var(--cp-blue)!important;color:#ffffff!important;}
.navlinks a,.main-nav a{color:#243145!important;background:transparent!important;}
.navlinks a:hover,.main-nav a:hover,.main-nav a.active{color:#1d4ed8!important;background:var(--cp-blue-light)!important;}

/* Mobile menu: forced high contrast across all page templates */
.mobile-menu-toggle,#subpage-mobile-menu-toggle,.mobile-toggle,.hamburger{
  display:none;
  background:#ffffff!important;
  border:1px solid #cbd5e1!important;
  color:var(--cp-navy)!important;
}
.mobile-menu-toggle span,#subpage-mobile-menu-toggle span,.mobile-toggle span,.hamburger span{background:var(--cp-navy)!important;}
#global-mobile-menu-backdrop{background:rgba(15,23,42,.42)!important;}
#global-mobile-menu-panel,.mobile-nav,.mobile-panel{
  background:var(--cp-navy)!important;
  border:1px solid rgba(255,255,255,.14)!important;
  box-shadow:0 28px 70px rgba(7,26,47,.36)!important;
  color:#ffffff!important;
}
#global-mobile-menu-panel a,.mobile-nav a,.mobile-panel a{
  background:var(--cp-navy-2)!important;
  border:1px solid rgba(255,255,255,.14)!important;
  color:#ffffff!important;
  opacity:1!important;
  text-decoration:none!important;
  font-weight:750!important;
}
#global-mobile-menu-panel a:visited,.mobile-nav a:visited,.mobile-panel a:visited{color:#ffffff!important;}
#global-mobile-menu-panel a:hover,#global-mobile-menu-panel a:focus,
.mobile-nav a:hover,.mobile-nav a:focus,.mobile-panel a:hover,.mobile-panel a:focus{
  background:#1d4ed8!important;color:#ffffff!important;outline:none!important;
}
#global-mobile-menu-panel a *, .mobile-nav a *, .mobile-panel a *{color:#ffffff!important;}

/* Footer and dark sections */
.footer,.site-footer,.steps-section,.cta-band{background:var(--cp-navy)!important;color:#ffffff!important;}
.footer h1,.footer h2,.footer h3,.footer h4,.footer strong,.site-footer h1,.site-footer h2,.site-footer h3,.site-footer h4,.site-footer strong,
.steps-section h1,.steps-section h2,.steps-section h3,.steps-section h4,.steps-section strong{color:#ffffff!important;}
.footer p,.footer li,.footer-copy,.footer a,.footer-grid a,.site-footer p,.site-footer a,.steps-section p,.steps-section li{color:#dbeafe!important;opacity:1!important;}
.footer a:hover,.footer-grid a:hover,.site-footer a:hover{color:#ffffff!important;}

/* Modals */
.modal-card,.lead-gate-card,.profile-modal-card{background:#ffffff!important;color:var(--cp-text)!important;border-color:var(--cp-line)!important;}
.modal-card h2,.modal-card h3,.lead-gate-card h2,.lead-gate-card h3,.profile-modal-card h2,.profile-modal-card h3{color:var(--cp-navy)!important;}
.modal-card p,.lead-gate-card p,.profile-modal-card p{color:var(--cp-body)!important;}
.profile-modal-close,.modal-close{color:var(--cp-navy)!important;background:#ffffff!important;border-color:#cbd5e1!important;}

@media (max-width:760px){
  body{background:var(--cp-page)!important;color:var(--cp-text)!important;}
  .header,.site-header{position:sticky!important;top:0!important;background:#ffffff!important;backdrop-filter:none!important;}
  .mobile-menu-toggle,#subpage-mobile-menu-toggle,.mobile-toggle,.hamburger{display:inline-flex!important;}
  #global-mobile-menu-panel{position:fixed!important;top:74px!important;left:16px!important;right:16px!important;display:grid!important;grid-template-columns:1fr!important;gap:10px!important;max-height:calc(100vh - 96px)!important;overflow:auto!important;padding:14px!important;border-radius:18px!important;z-index:99999!important;}
  #global-mobile-menu-backdrop{position:fixed!important;inset:0!important;z-index:99998!important;}
  #global-mobile-menu-backdrop[hidden],#global-mobile-menu-panel[hidden]{display:none!important;}
}


/* Provider filter dropdown visibility fix, especially iOS Safari */
html body .filters-shell .filters-bar,
html body .filters-shell .filters-bar-enhanced{
  display:grid!important;
  grid-template-columns:minmax(260px,1.4fr) repeat(3,minmax(160px,1fr)) minmax(150px,auto)!important;
  gap:12px!important;
  align-items:end!important;
}
html body .filters-shell .filter-field{
  display:flex!important;
  flex-direction:column!important;
  gap:7px!important;
  min-width:0!important;
  width:100%!important;
  color:#071a2f!important;
}
html body .filters-shell .filter-field > span{
  display:block!important;
  font-size:13px!important;
  line-height:1.2!important;
  font-weight:800!important;
  color:#071a2f!important;
  letter-spacing:.01em!important;
}
html body .filters-shell .search-input,
html body .filters-shell .select,
html body .filters-shell select,
html body .filters-shell input[type="search"]{
  width:100%!important;
  min-height:54px!important;
  height:54px!important;
  border:1.5px solid #cbd5e1!important;
  border-radius:14px!important;
  background:#ffffff!important;
  color:#071a2f!important;
  -webkit-text-fill-color:#071a2f!important;
  opacity:1!important;
  font:700 16px/1.2 Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  padding:0 16px!important;
  box-shadow:none!important;
  color-scheme:light!important;
}
html body .filters-shell .select,
html body .filters-shell select{
  -webkit-appearance:menulist!important;
  appearance:auto!important;
  padding-right:40px!important;
  cursor:pointer!important;
}
html body .filters-shell .select option,
html body .filters-shell select option{
  background:#ffffff!important;
  color:#071a2f!important;
  -webkit-text-fill-color:#071a2f!important;
}
html body .filters-shell .search-input::placeholder{
  color:#64748b!important;
  -webkit-text-fill-color:#64748b!important;
  opacity:1!important;
}
html body .filters-shell .search-input:focus,
html body .filters-shell .select:focus,
html body .filters-shell select:focus{
  border-color:#2563eb!important;
  box-shadow:0 0 0 4px rgba(37,99,235,.14)!important;
  outline:none!important;
}
html body .filters-shell .filter-reset-btn{
  min-height:54px!important;
  height:54px!important;
  align-self:end!important;
  width:100%!important;
}
html body .filters-shell .filter-empty-state,
html body .filters-shell #provider-filter-empty{
  background:#ffffff!important;
  color:#071a2f!important;
  border:1.5px solid #cbd5e1!important;
}
html body .filters-shell .filter-empty-state span,
html body .filters-shell #provider-filter-empty span{
  color:#475569!important;
  opacity:1!important;
}
html body .directory-card.is-hidden{display:none!important;}

@media (max-width:900px){
  html body .filters-shell .filters-bar,
  html body .filters-shell .filters-bar-enhanced{
    grid-template-columns:1fr!important;
    gap:14px!important;
  }
  html body .filters-shell .search-input,
  html body .filters-shell .select,
  html body .filters-shell select,
  html body .filters-shell input[type="search"],
  html body .filters-shell .filter-reset-btn{
    min-height:56px!important;
    height:56px!important;
    font-size:16px!important;
  }
}
