/* Dark mode contrast correction based on Android production screenshots. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #151c30;
  --ink: #edf2ff;
  --muted: #aab6ce;
  --line: #303b55;
  --brand: #75a7ff;
  --brand-2: #8bb7ff;
  --info-soft: #202f4c;
  --accent-soft: #292443;
  --shadow: 0 10px 28px rgba(0,0,0,.22);
}
:root[data-theme="dark"] body,
:root[data-theme="dark"] .shell,
:root[data-theme="dark"] .main,
:root[data-theme="dark"] .page {
  background: #0b1020 !important;
  color: #edf2ff !important;
}
:root[data-theme="dark"] .top,
:root[data-theme="dark"] .side {
  background: #11182a !important;
  color: #edf2ff !important;
  border-color: #28344d !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
:root[data-theme="dark"] .top .brand,
:root[data-theme="dark"] .top .brand span,
:root[data-theme="dark"] .top-brand,
:root[data-theme="dark"] .top-brand *,
:root[data-theme="dark"] .profile-mini,
:root[data-theme="dark"] .profile-mini-text {
  color: #edf2ff !important;
}
:root[data-theme="dark"] .dashboard .card,
:root[data-theme="dark"] .dashboard .dash-panel,
:root[data-theme="dark"] .dashboard .dash-recent-panel,
:root[data-theme="dark"] .dashboard .dash-stat,
:root[data-theme="dark"] .dashboard .quick-item,
:root[data-theme="dark"] .dashboard .dash-recommend-row,
:root[data-theme="dark"] .dashboard .dash-stat-grid > *,
:root[data-theme="dark"] .dashboard .dash-exam-picker {
  color: #edf2ff !important;
  background-color: #151c30 !important;
  background-image: none !important;
  border-color: #303b55 !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.22) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
:root[data-theme="dark"] .dashboard .dash-panel h1,
:root[data-theme="dark"] .dashboard .dash-panel h2,
:root[data-theme="dark"] .dashboard .dash-panel h3,
:root[data-theme="dark"] .dashboard .dash-panel b,
:root[data-theme="dark"] .dashboard .dash-panel strong,
:root[data-theme="dark"] .dashboard .dash-panel-head *,
:root[data-theme="dark"] .dashboard .dash-recommend-copy *,
:root[data-theme="dark"] .dashboard .dash-stat * {
  color: #edf2ff !important;
}
:root[data-theme="dark"] .dashboard .dash-panel p,
:root[data-theme="dark"] .dashboard .dash-recommend-meta,
:root[data-theme="dark"] .dashboard .dash-recommend-meta *,
:root[data-theme="dark"] .dashboard .dash-stat-caption,
:root[data-theme="dark"] .dashboard .dash-section-kicker {
  color: #aab6ce !important;
}
:root[data-theme="dark"] .dashboard .dash-inline-link,
:root[data-theme="dark"] .dashboard .dash-panel a,
:root[data-theme="dark"] .dashboard .dash-secondary-link {
  color: #9fc3ff !important;
}
:root[data-theme="dark"] .dashboard .dash-recommend-icon,
:root[data-theme="dark"] .dashboard .dash-recommend-cta {
  color: #e4dcff !important;
  background: #302951 !important;
  border-color: #494070 !important;
}
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  color: #edf2ff !important;
  background: #11182a !important;
  border-color: #3a4660 !important;
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #9ba9c3 !important;
}
:root[data-theme="dark"] .side .nav:not(.on) { color: #c1cbe0 !important; }
:root[data-theme="dark"] .side .nav.on { color: #fff !important; }
@media (max-width: 820px) {
  :root[data-theme="dark"] .bottom {
    background: #11182a !important;
    background-color: #11182a !important;
    background-image: none !important;
    border-color: #303b55 !important;
    box-shadow: 0 -8px 28px rgba(0,0,0,.38) !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  :root[data-theme="dark"] .bottom .nav { color: #c1cbe0 !important; }
  :root[data-theme="dark"] .bottom .nav.on {
    color: #d9e7ff !important;
    background: #24385d !important;
    box-shadow: inset 0 0 0 1px #405d8a !important;
  }
}


/* Mobile drawer contrast: prevent dark-theme overrides from leaving a white drawer with pale text. */
:root[data-theme="dark"] .side,
:root[data-theme="dark"] .side.mobile-open {
  background: #11182a !important;
  color: #edf2ff !important;
  border-color: #303b55 !important;
  box-shadow: 18px 0 45px rgba(0,0,0,.42) !important;
  opacity: 1 !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
:root[data-theme="dark"] .side .brand,
:root[data-theme="dark"] .side .brand b,
:root[data-theme="dark"] .side .brand span,
:root[data-theme="dark"] .side .brand small,
:root[data-theme="dark"] .side .nav,
:root[data-theme="dark"] .side .nav:not(.on),
:root[data-theme="dark"] .side .side-foot,
:root[data-theme="dark"] .side .sidebar-profile,
:root[data-theme="dark"] .side .sidebar-profile * {
  color: #d7e1f5 !important;
}
:root[data-theme="dark"] .side .nav:not(.on) {
  background: transparent !important;
}
:root[data-theme="dark"] .side .nav.on {
  color: #ffffff !important;
  background: linear-gradient(110deg,#1769ff,#3688ff) !important;
}
:root[data-theme="dark"] .mobile-nav-scrim,
:root[data-theme="dark"] .mobile-nav-scrim.is-open {
  background: rgba(2,8,23,.64) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}
@media (max-width: 820px) {
  :root[data-theme="dark"] body #app .side.mobile-open {
    background: #11182a !important;
    color: #edf2ff !important;
  }
}


/* Final high-specificity mobile drawer override. Keep the scrim behind the drawer. */
@media (max-width: 820px) {
  html[data-theme="dark"] body #app nav#mobileSideNav.side,
  html[data-theme="dark"] body #app nav#mobileSideNav.side.mobile-open {
    display: flex !important;
    position: fixed !important;
    z-index: 1001 !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: min(84vw, 320px) !important;
    height: 100dvh !important;
    background: #11182a !important;
    background-color: #11182a !important;
    background-image: none !important;
    color: #edf2ff !important;
    opacity: 1 !important;
    filter: none !important;
    -webkit-filter: none !important;
    mix-blend-mode: normal !important;
    isolation: isolate !important;
    transform: translateX(-105%);
  }
  html[data-theme="dark"] body #app nav#mobileSideNav.side.mobile-open {
    transform: translateX(0) !important;
  }
  html[data-theme="dark"] body #app nav#mobileSideNav.side > .brand,
  html[data-theme="dark"] body #app nav#mobileSideNav.side > .brand *,
  html[data-theme="dark"] body #app nav#mobileSideNav.side > a.nav,
  html[data-theme="dark"] body #app nav#mobileSideNav.side > a.nav span,
  html[data-theme="dark"] body #app nav#mobileSideNav.side > .side-foot,
  html[data-theme="dark"] body #app nav#mobileSideNav.side > .side-foot * {
    color: #d7e1f5 !important;
    opacity: 1 !important;
    text-shadow: none !important;
  }
  html[data-theme="dark"] body #app nav#mobileSideNav.side > a.nav:not(.on) {
    background: transparent !important;
  }
  html[data-theme="dark"] body #app nav#mobileSideNav.side > a.nav.on {
    background: linear-gradient(110deg,#1769ff,#3688ff) !important;
    color: #ffffff !important;
  }
  html[data-theme="dark"] body #app button.mobile-nav-scrim,
  html[data-theme="dark"] body #app button.mobile-nav-scrim.is-open {
    z-index: 1000 !important;
    background: rgba(2,8,23,.64) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}
