/* Apexion One v6.19.49 - global dark-mode contrast/accessibility layer.
   This file is intentionally loaded after all other app styles. It does not
   redesign pages; it normalises dark surfaces, text, controls and empty states
   so feature-specific light-mode rules cannot leak into dark mode. */

html.ald-dark-mode,
html.ald-dark-mode body.ald-apexion-one-body,
html.ald-dark-mode .ald-app-document,
html.ald-dark-mode .ald-one-app {
  color-scheme: dark;
}

/* Getting Started / setup status. */
html.ald-dark-mode .ald-one-app .ald-ux-resume.is-setup-status {
  background:#101d30 !important;
  border-color:#34485f !important;
  color:#edf4ff !important;
}
html.ald-dark-mode .ald-one-app .ald-ux-resume.is-setup-status span {
  color:#f0bf55 !important;
}
html.ald-dark-mode .ald-one-app .ald-ux-resume.is-setup-status strong {
  color:#f4f7fc !important;
}
html.ald-dark-mode .ald-one-app .ald-ux-resume.is-setup-status small {
  color:#c1ccdb !important;
}
html.ald-dark-mode .ald-one-app .ald-ux-resume.is-setup-status > a {
  background:#14263a !important;
  border-color:#62d5dc !important;
  color:#f7fbff !important;
}

/* Insight Inbox. These styles also cover the empty-state contrast failure that
   previously rendered near-white copy on a white card in dark mode. */
html.ald-dark-mode .ald-one-app .ald-insight-inbox > header h1 {
  color:#f5f8ff !important;
}
html.ald-dark-mode .ald-one-app .ald-insight-inbox > header p {
  color:#c0cbda !important;
}
html.ald-dark-mode .ald-one-app .ald-insight-inbox > header button,
html.ald-dark-mode .ald-one-app .ald-insight-inbox > header span {
  color:#75d9df !important;
}
html.ald-dark-mode .ald-one-app .ald-insight-inbox > nav a {
  background:#101b2c !important;
  border-color:#43536a !important;
  color:#cbd5e3 !important;
}
html.ald-dark-mode .ald-one-app .ald-insight-inbox > nav a:hover,
html.ald-dark-mode .ald-one-app .ald-insight-inbox > nav a:focus-visible {
  background:#17283d !important;
  border-color:#65cfd6 !important;
  color:#f3f8ff !important;
}
html.ald-dark-mode .ald-one-app .ald-insight-inbox > nav a.is-active {
  background:#1d4384 !important;
  border-color:#5fcdd5 !important;
  color:#fff !important;
}
html.ald-dark-mode .ald-one-app .ald-retention-empty,
html.ald-dark-mode .ald-one-app .ald-insight-list > article,
html.ald-dark-mode .ald-one-app .ald-insight-list > a,
html.ald-dark-mode .ald-one-app .ald-insight-detail {
  background:#111f33 !important;
  border-color:#35485f !important;
  color:#edf4ff !important;
  box-shadow:0 10px 28px rgba(0,0,0,.2) !important;
}
html.ald-dark-mode .ald-one-app .ald-retention-empty h2,
html.ald-dark-mode .ald-one-app .ald-insight-list h2,
html.ald-dark-mode .ald-one-app .ald-insight-detail h2 {
  color:#f5f8ff !important;
}
html.ald-dark-mode .ald-one-app .ald-retention-empty p,
html.ald-dark-mode .ald-one-app .ald-insight-list p,
html.ald-dark-mode .ald-one-app .ald-insight-detail p {
  color:#c0cbda !important;
}

/* Shared readable dark cards. The selectors target reusable secondary surfaces
   that have historically gained hard-coded white backgrounds in feature CSS. */
html.ald-dark-mode .ald-one-app :where(
  .ald-weekly-card,
  .ald-weekly-entry,
  .ald-weekly-history,
  .ald-weekly-progress-summary,
  .ald-weekly-progress-summary__grid article,
  .ald-what-works-history,
  .ald-what-works-baseline,
  .ald-what-works-baseline article,
  .ald-proactive-grid article,
  .ald-home-intelligence,
  .ald-home-intelligence__grid,
  .ald-home-intelligence__insight,
  .ald-home-intelligence__next,
  .ald-progress-graph__preliminary,
  .ald-ux-home-progress__empty
) {
  background:#101d30 !important;
  border-color:#34475e !important;
  color:#edf4ff !important;
}
html.ald-dark-mode .ald-one-app :where(
  .ald-weekly-card,
  .ald-weekly-entry,
  .ald-weekly-history,
  .ald-weekly-progress-summary,
  .ald-what-works-history,
  .ald-what-works-baseline,
  .ald-proactive-grid,
  .ald-home-intelligence,
  .ald-progress-graph__preliminary,
  .ald-ux-home-progress__empty
) :where(h1,h2,h3,h4,strong,b) {
  color:#f3f7ff !important;
}
html.ald-dark-mode .ald-one-app :where(
  .ald-weekly-card,
  .ald-weekly-entry,
  .ald-weekly-history,
  .ald-weekly-progress-summary,
  .ald-what-works-history,
  .ald-what-works-baseline,
  .ald-proactive-grid,
  .ald-home-intelligence,
  .ald-progress-graph__preliminary,
  .ald-ux-home-progress__empty
) :where(p,small,em) {
  color:#bdc9d8 !important;
}

/* Generic controls and disabled states. Disabled must still be readable. */
html.ald-dark-mode .ald-one-app :where(button,a[role="button"],.ald-button) {
  text-shadow:none;
}
html.ald-dark-mode .ald-one-app :where(button,input,select,textarea):disabled,
html.ald-dark-mode .ald-one-app :where(.is-disabled,[aria-disabled="true"]) {
  opacity:1 !important;
}
html.ald-dark-mode .ald-one-app :where(button,input,select,textarea):disabled {
  background:#162337 !important;
  border-color:#394b62 !important;
  color:#9facbd !important;
  -webkit-text-fill-color:#9facbd !important;
}
html.ald-dark-mode .ald-one-app :where(input,textarea)::placeholder {
  color:#98a7ba !important;
  opacity:1 !important;
}

/* Links and status text should not fall back to dark navy on dark surfaces. */
html.ald-dark-mode .ald-one-app :where(
  .ald-health-ref-link,
  .ald-research-ref-link,
  .ald-progress-ref-link,
  .ald-settings-ref a,
  .ald-blood-tests a,
  .ald-navigator-page a
) {
  color:#78dbe0 !important;
}

/* Bottom navigation: retain hierarchy while meeting mobile contrast targets. */
html.ald-dark-mode .ald-one-app .ald-mobile-nav > a {
  color:#a9b7ca !important;
}
html.ald-dark-mode .ald-one-app .ald-mobile-nav > a small {
  color:inherit !important;
}
html.ald-dark-mode .ald-one-app .ald-mobile-nav > a.is-active {
  color:#7ce0e5 !important;
}

/* Explicit semantic helpers for warning/success/muted text used across feature
   screens. Avoid low-contrast light-mode navy/grey leaking into dark mode. */
html.ald-dark-mode .ald-one-app :where(.is-muted,.ald-muted,.ald-meta,.ald-supporting-text) {
  color:#b7c3d3 !important;
}
html.ald-dark-mode .ald-one-app :where(.is-success,.ald-success) {
  color:#77dbc4 !important;
}
html.ald-dark-mode .ald-one-app :where(.is-warning,.ald-warning) {
  color:#ffd28a !important;
}

/* Focus visibility in dark mode. */
html.ald-dark-mode .ald-one-app :where(a,button,input,select,textarea):focus-visible {
  outline:3px solid #64d4dc !important;
  outline-offset:2px !important;
}

/* v6.19.50: Mobile Insight Inbox tabs remain horizontally swipeable but the
   native horizontal scrollbar must never render through/under the pill tabs. */
.ald-one-app .ald-insight-inbox > nav {
  scrollbar-width:none !important;
  -ms-overflow-style:none !important;
  -webkit-overflow-scrolling:touch;
}
.ald-one-app .ald-insight-inbox > nav::-webkit-scrollbar {
  display:none !important;
  width:0 !important;
  height:0 !important;
}

/* Apexion One v6.19.54 - dark Home readability follow-up.
   Keep the larger mobile type and raise contrast on Home components that still
   inherited legacy 7-11px copy or light-mode navy text. */
@media (max-width: 767px) {
  /* Momentum becomes a readable single-column card on phones. */
  html.ald-dark-mode .ald-one-app .ald-momentum-card,
  .ald-one-app.is-dark .ald-momentum-card,
  .ald-one-app.ald-theme-dark .ald-momentum-card,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 20px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__score > span,
  .ald-one-app.is-dark .ald-momentum-card__score > span,
  .ald-one-app.ald-theme-dark .ald-momentum-card__score > span,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__score > span {
    color:#68d8df !important;
    font-size:13px !important;
    line-height:1.35 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__score > strong,
  .ald-one-app.is-dark .ald-momentum-card__score > strong,
  .ald-one-app.ald-theme-dark .ald-momentum-card__score > strong,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__score > strong {
    color:#f7faff !important;
    font-size:34px !important;
    line-height:1.1 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__score > strong small,
  .ald-one-app.is-dark .ald-momentum-card__score > strong small,
  .ald-one-app.ald-theme-dark .ald-momentum-card__score > strong small,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__score > strong small {
    color:#cbd6e5 !important;
    font-size:17px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__score p,
  .ald-one-app.is-dark .ald-momentum-card__score p,
  .ald-one-app.ald-theme-dark .ald-momentum-card__score p,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__score p {
    color:#c8d3e2 !important;
    font-size:16px !important;
    line-height:1.5 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__status,
  .ald-one-app.is-dark .ald-momentum-card__status,
  .ald-one-app.ald-theme-dark .ald-momentum-card__status,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__status {
    background:#dff7f7 !important;
    color:#086f78 !important;
    font-size:14px !important;
    padding:6px 10px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__next > small,
  .ald-one-app.is-dark .ald-momentum-card__next > small,
  .ald-one-app.ald-theme-dark .ald-momentum-card__next > small,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__next > small {
    color:#c7d2e1 !important;
    font-size:16px !important;
    line-height:1.45 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__next > a,
  .ald-one-app.is-dark .ald-momentum-card__next > a,
  .ald-one-app.ald-theme-dark .ald-momentum-card__next > a,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__next > a {
    color:#69d7de !important;
    font-size:15px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__components,
  .ald-one-app.is-dark .ald-momentum-card__components,
  .ald-one-app.ald-theme-dark .ald-momentum-card__components,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__components {
    grid-column:1 !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:14px 18px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__components span,
  .ald-one-app.is-dark .ald-momentum-card__components span,
  .ald-one-app.ald-theme-dark .ald-momentum-card__components span,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__components span {
    color:#c6d2e2 !important;
    font-size:14px !important;
    line-height:1.3 !important;
    min-height:0 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__components strong,
  .ald-one-app.is-dark .ald-momentum-card__components strong,
  .ald-one-app.ald-theme-dark .ald-momentum-card__components strong,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__components strong {
    color:#f5f8ff !important;
    font-size:14px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__components i,
  .ald-one-app.is-dark .ald-momentum-card__components i,
  .ald-one-app.ald-theme-dark .ald-momentum-card__components i,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__components i {
    background:#31445f !important;
    height:6px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-momentum-card__note,
  .ald-one-app.is-dark .ald-momentum-card__note,
  .ald-one-app.ald-theme-dark .ald-momentum-card__note,
  .ald-one-app[data-ald-theme="dark"] .ald-momentum-card__note {
    color:#c6d2e2 !important;
    border-top-color:#3a4e68 !important;
    font-size:16px !important;
    line-height:1.5 !important;
  }

  /* Since last visit: headings and empty-state copy must not disappear into navy. */
  html.ald-dark-mode .ald-one-app .ald-since-visit,
  .ald-one-app.is-dark .ald-since-visit,
  .ald-one-app.ald-theme-dark .ald-since-visit,
  .ald-one-app[data-ald-theme="dark"] .ald-since-visit {
    background:#13233e !important;
    border-color:#344a65 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-since-visit > header span,
  html.ald-dark-mode .ald-one-app .ald-since-visit > header a,
  .ald-one-app.is-dark .ald-since-visit > header span,
  .ald-one-app.is-dark .ald-since-visit > header a,
  .ald-one-app.ald-theme-dark .ald-since-visit > header span,
  .ald-one-app.ald-theme-dark .ald-since-visit > header a,
  .ald-one-app[data-ald-theme="dark"] .ald-since-visit > header span,
  .ald-one-app[data-ald-theme="dark"] .ald-since-visit > header a {
    color:#68d8df !important;
    font-size:14px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-since-visit > div > a,
  .ald-one-app.is-dark .ald-since-visit > div > a,
  .ald-one-app.ald-theme-dark .ald-since-visit > div > a,
  .ald-one-app[data-ald-theme="dark"] .ald-since-visit > div > a {
    background:#101d31 !important;
    border-color:#31465f !important;
  }
  html.ald-dark-mode .ald-one-app .ald-since-visit > div span,
  .ald-one-app.is-dark .ald-since-visit > div span,
  .ald-one-app.ald-theme-dark .ald-since-visit > div span,
  .ald-one-app[data-ald-theme="dark"] .ald-since-visit > div span {
    color:#b9c7d9 !important;
    font-size:14px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-since-visit > div strong,
  .ald-one-app.is-dark .ald-since-visit > div strong,
  .ald-one-app.ald-theme-dark .ald-since-visit > div strong,
  .ald-one-app[data-ald-theme="dark"] .ald-since-visit > div strong {
    color:#f5f8ff !important;
    font-size:18px !important;
    line-height:1.35 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-since-visit > div small,
  .ald-one-app.is-dark .ald-since-visit > div small,
  .ald-one-app.ald-theme-dark .ald-since-visit > div small,
  .ald-one-app[data-ald-theme="dark"] .ald-since-visit > div small {
    color:#c4d0df !important;
    font-size:16px !important;
    line-height:1.5 !important;
  }

  /* Weekly Plan readability. */
  html.ald-dark-mode .ald-one-app .ald-home-weekly-plan > header span,
  .ald-one-app.is-dark .ald-home-weekly-plan > header span,
  .ald-one-app.ald-theme-dark .ald-home-weekly-plan > header span,
  .ald-one-app[data-ald-theme="dark"] .ald-home-weekly-plan > header span {
    color:#68d8df !important;
    font-size:14px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-home-weekly-plan > header > strong,
  .ald-one-app.is-dark .ald-home-weekly-plan > header > strong,
  .ald-one-app.ald-theme-dark .ald-home-weekly-plan > header > strong,
  .ald-one-app[data-ald-theme="dark"] .ald-home-weekly-plan > header > strong {
    color:#f5f8ff !important;
    font-size:15px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-home-weekly-plan__actions > a > span,
  .ald-one-app.is-dark .ald-home-weekly-plan__actions > a > span,
  .ald-one-app.ald-theme-dark .ald-home-weekly-plan__actions > a > span,
  .ald-one-app[data-ald-theme="dark"] .ald-home-weekly-plan__actions > a > span {
    color:#70d9df !important;
    font-size:18px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-home-weekly-plan__actions strong,
  .ald-one-app.is-dark .ald-home-weekly-plan__actions strong,
  .ald-one-app.ald-theme-dark .ald-home-weekly-plan__actions strong,
  .ald-one-app[data-ald-theme="dark"] .ald-home-weekly-plan__actions strong {
    color:#f4f8ff !important;
    font-size:17px !important;
    line-height:1.35 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-home-weekly-plan__actions small,
  .ald-one-app.is-dark .ald-home-weekly-plan__actions small,
  .ald-one-app.ald-theme-dark .ald-home-weekly-plan__actions small,
  .ald-one-app[data-ald-theme="dark"] .ald-home-weekly-plan__actions small {
    color:#c5d0df !important;
    font-size:16px !important;
    line-height:1.5 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-home-weekly-plan__open,
  .ald-one-app.is-dark .ald-home-weekly-plan__open,
  .ald-one-app.ald-theme-dark .ald-home-weekly-plan__open,
  .ald-one-app[data-ald-theme="dark"] .ald-home-weekly-plan__open {
    color:#69d7de !important;
    font-size:15px !important;
  }

  /* Latest Activity: eliminate 8-10px legacy copy and navy-on-navy text. */
  html.ald-dark-mode .ald-one-app .ald-ux-home-activity,
  .ald-one-app.is-dark .ald-ux-home-activity,
  .ald-one-app.ald-theme-dark .ald-ux-home-activity,
  .ald-one-app[data-ald-theme="dark"] .ald-ux-home-activity {
    background:#13233e !important;
    border-color:#344a65 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-ux-home-activity__list > a,
  .ald-one-app.is-dark .ald-ux-home-activity__list > a,
  .ald-one-app.ald-theme-dark .ald-ux-home-activity__list > a,
  .ald-one-app[data-ald-theme="dark"] .ald-ux-home-activity__list > a {
    border-bottom-color:#344a65 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-ux-home-activity__copy strong,
  .ald-one-app.is-dark .ald-ux-home-activity__copy strong,
  .ald-one-app.ald-theme-dark .ald-ux-home-activity__copy strong,
  .ald-one-app[data-ald-theme="dark"] .ald-ux-home-activity__copy strong {
    color:#f5f8ff !important;
    font-size:17px !important;
    line-height:1.35 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-ux-home-activity__copy small,
  html.ald-dark-mode .ald-one-app .ald-ux-home-activity__copy time,
  .ald-one-app.is-dark .ald-ux-home-activity__copy small,
  .ald-one-app.is-dark .ald-ux-home-activity__copy time,
  .ald-one-app.ald-theme-dark .ald-ux-home-activity__copy small,
  .ald-one-app.ald-theme-dark .ald-ux-home-activity__copy time,
  .ald-one-app[data-ald-theme="dark"] .ald-ux-home-activity__copy small,
  .ald-one-app[data-ald-theme="dark"] .ald-ux-home-activity__copy time {
    color:#c3cedd !important;
    font-size:15px !important;
    line-height:1.45 !important;
  }
  html.ald-dark-mode .ald-one-app .ald-ux-home-activity__action,
  .ald-one-app.is-dark .ald-ux-home-activity__action,
  .ald-one-app.ald-theme-dark .ald-ux-home-activity__action,
  .ald-one-app[data-ald-theme="dark"] .ald-ux-home-activity__action {
    color:#70d9df !important;
    font-size:14px !important;
  }
  html.ald-dark-mode .ald-one-app .ald-pm-section-heading > div > span,
  html.ald-dark-mode .ald-one-app .ald-pm-section-heading > a,
  .ald-one-app.is-dark .ald-pm-section-heading > div > span,
  .ald-one-app.is-dark .ald-pm-section-heading > a,
  .ald-one-app.ald-theme-dark .ald-pm-section-heading > div > span,
  .ald-one-app.ald-theme-dark .ald-pm-section-heading > a,
  .ald-one-app[data-ald-theme="dark"] .ald-pm-section-heading > div > span,
  .ald-one-app[data-ald-theme="dark"] .ald-pm-section-heading > a {
    color:#69d7de !important;
    font-size:14px !important;
  }
}

/* Apexion One 6.19.63 - Ask Apexion mobile hierarchy dark-mode parity */
@media (max-width: 700px) {
  html.ald-dark-mode body.ald-apexion-one-body .ald-ask-reference-page .ald-ask-knows__grid > a,
  html.ald-dark-mode body.ald-apexion-one-body .ald-ask-reference-page .ald-ask-knows__grid > article {
    background:#111e30 !important;
    border-color:#304159 !important;
  }
  html.ald-dark-mode body.ald-apexion-one-body .ald-ask-reference-page .ald-ask-brief__grid > button,
  html.ald-dark-mode body.ald-apexion-one-body .ald-ask-reference-page .ald-ask-brief__grid > a {
    background:#121f31 !important;
    border-color:#304159 !important;
  }
  html.ald-dark-mode body.ald-apexion-one-body .ald-ask-reference-page .ald-ask-explore-grid > button,
  html.ald-dark-mode body.ald-apexion-one-body .ald-ask-reference-page .ald-ask-explore-grid > a {
    background:#111e30 !important;
    border-color:#304159 !important;
  }
}
