/* Fase 24 · Neutral dark controls / móvil y tablet.
   La UI antigua mezclaba backgrounds blancos de style.css/Bootstrap con
   textos nocturnos de epqa-theme.css. No reemplazar CTA de marca.
   Cargar AL FINAL tras CSS tardío del footer, sin cambiar modo claro o desktop. */
@media (max-width:1199.98px) {
  html[data-theme="dark"] body.stem-playground {
    --epqa-m-night-control:#344967;
    --epqa-m-night-control-hover:#426188;
    --epqa-m-night-border:#799ac8;
    --epqa-m-night-text:#f4f8ff;
    --epqa-m-night-muted:#c4d6ed;
    --epqa-m-night-focus:#83d6ff;
  }

  /* Bootstrap neutral y acciones secundarias (NO CTA primary/success/warning/
     danger/info, ni acciones con gradientes de marca). */
  html[data-theme="dark"] body.stem-playground :is(
    .btn-light,.btn-outline-primary,.btn-outline-secondary,
    .btn-outline-light,.btn-outline-dark,.btn-secondary,
    .btn-alt,.stem-btn-ghost,.btn-white
  ):not(.epqa-l-btn--primary):not(.epqa-creations__primary):not(.epqa-catalog-actions__download) {
    background:var(--epqa-m-night-control)!important;
    background-image:none!important;
    border-color:var(--epqa-m-night-border)!important;
    color:var(--epqa-m-night-text)!important;
    -webkit-text-fill-color:var(--epqa-m-night-text)!important;
    opacity:1;
  }
  html[data-theme="dark"] body.stem-playground :is(
    .btn-light,.btn-outline-primary,.btn-outline-secondary,
    .btn-outline-light,.btn-outline-dark,.btn-secondary,
    .btn-alt,.stem-btn-ghost,.btn-white
  ):not(:disabled):not(.disabled):is(:hover,:focus-visible,:active) {
    background:var(--epqa-m-night-control-hover)!important;
    border-color:#a0bee9!important;
    color:#fff!important;
    -webkit-text-fill-color:#fff!important;
  }
  html[data-theme="dark"] body.stem-playground :is(
    .btn-light,.btn-outline-primary,.btn-outline-secondary,
    .btn-outline-light,.btn-outline-dark,.btn-secondary,
    .btn-alt,.stem-btn-ghost,.btn-white
  ):is(:disabled,.disabled,[aria-disabled="true"]) {
    background:#35445b!important;
    border-color:#677e9e!important;
    color:var(--epqa-m-night-muted)!important;
    -webkit-text-fill-color:var(--epqa-m-night-muted)!important;
    opacity:.76;
  }

  /* SmartNav: corregir TODAS las opciones, no solo Panel y Salir. */
  html[data-theme="dark"] body.stem-playground .site-header #mainNav .navbar-nav > .nav-item > .nav-link:not(.nav-user-identity):not(.active):not([aria-current="page"]) {
    background:#394c69!important;
    border:1px solid #607da6!important;
    color:var(--epqa-m-night-text)!important;
    -webkit-text-fill-color:var(--epqa-m-night-text)!important;
  }
  html[data-theme="dark"] body.stem-playground .site-header #mainNav .navbar-nav > .nav-item > .nav-link:not(.nav-user-identity):not(.active):not([aria-current="page"]):is(:hover,:focus-visible) {
    background:var(--epqa-m-night-control-hover)!important;
    border-color:#9fc1ed!important;
  }
  html[data-theme="dark"] body.stem-playground .site-header #mainNav .navbar-nav > .nav-item > .nav-link:is(.active,[aria-current="page"]) {
    background:#264b7d!important;
    border:1px solid #79a7e9!important;
    color:#f6faff!important;
    -webkit-text-fill-color:#f6faff!important;
  }
  html[data-theme="dark"] body.stem-playground .site-header #mainNav .navbar-nav > .nav-item > .nav-link[data-nav="logout"] {
    background:#273f63!important;
    border:1px solid #819cc7!important;
    color:#f3f8ff!important;
    -webkit-text-fill-color:#f3f8ff!important;
  }
  html[data-theme="dark"] body.stem-playground .site-header #mainNav .navbar-nav > .nav-item > .nav-link:is(.active,[data-nav="logout"]) .nav-link-label,
  html[data-theme="dark"] body.stem-playground .site-header #mainNav .navbar-nav > .nav-item > .nav-link .nav-link-label {
    color:inherit!important;
    opacity:1!important;
    -webkit-text-fill-color:currentColor!important;
    text-shadow:none!important;
  }

  /* Panel de navegación, botones de cabecera, menú administrador y búsqueda. */
  html[data-theme="dark"] body.stem-playground .site-header :is(
    .epqa-theme-switch,.epqa-nav-mobile-search,.navbar-toggler,
    .epqa-language-toggle,.epqa-admin-shortcut__toggle
  ) {
    background:#394e70!important;border-color:#7b9ac4!important;
    color:#f2f8ff!important;-webkit-text-fill-color:#f2f8ff!important;
  }
  html[data-theme="dark"] body.stem-playground .site-header :is(
    .epqa-theme-switch,.epqa-nav-mobile-search,.navbar-toggler,
    .epqa-language-toggle,.epqa-admin-shortcut__toggle
  ):is(:hover,:focus-visible,[aria-expanded="true"]) {
    background:#486589!important;border-color:#9fbde8!important;
  }
  html[data-theme="dark"] body.stem-playground .site-header #epqa-menu-search{
    background:#263850!important;border:1px solid #819cc1!important;
    color:#fff!important;-webkit-text-fill-color:#fff!important;
  }
  html[data-theme="dark"] body.stem-playground .site-header #epqa-menu-search::placeholder{
    color:#c5d4eb!important;-webkit-text-fill-color:#c5d4eb!important;opacity:1;
  }

  /* Catálogo: filtros neutros, orden móvil y opciones del menú desplegable. */
  html[data-theme="dark"] body.page-recursos.stem-playground :is(
    #resource-clear-filters,.epqa-mobile-facets-toggle,
    .epqa-mobile-sort__toggle,.epqa-catalog-view-controls button,
    .resource-filters button:not(.is-active)
  ) {
    background:var(--epqa-m-night-control)!important;
    border-color:var(--epqa-m-night-border)!important;
    color:var(--epqa-m-night-text)!important;
    -webkit-text-fill-color:var(--epqa-m-night-text)!important;
  }
  html[data-theme="dark"] body.page-recursos.stem-playground :is(
    #resource-clear-filters,.epqa-mobile-facets-toggle,
    .epqa-mobile-sort__toggle,.epqa-catalog-view-controls button,
    .resource-filters button:not(.is-active)
  ):is(:hover,:focus-visible,[aria-expanded="true"]) {
    background:var(--epqa-m-night-control-hover)!important;
    border-color:#a0bdec!important;
  }
  html[data-theme="dark"] body.page-recursos.stem-playground .epqa-mobile-sort__menu {
    background:#293952!important;border:1px solid #7b97be!important;
  }
  html[data-theme="dark"] body.page-recursos.stem-playground .epqa-mobile-sort__menu button {
    background:transparent!important;color:#f2f7ff!important;
    -webkit-text-fill-color:#f2f7ff!important;
  }
  html[data-theme="dark"] body.page-recursos.stem-playground .epqa-mobile-sort__menu button:is(:hover,.is-selected,:focus-visible) {
    background:#43638b!important;
  }

  /* Campos/acciones neutras en los paneles de usuario y listas. */
  html[data-theme="dark"] body.stem-playground :is(
    .form-control,.form-select,.epqa-creations__search input
  ):not([type="checkbox"]):not([type="radio"]) {
    color-scheme:dark;
  }
  html[data-theme="dark"] body.stem-playground :is(
    .epqa-creations__filter:not([aria-pressed="true"]),
    .epqa-creations__actions .epqa-creations__secondary
  ) {
    background:#344967!important;border-color:#7898c5!important;
    color:#f4f8ff!important;-webkit-text-fill-color:#f4f8ff!important;
  }
  html[data-theme="dark"] body.stem-playground :is(
    .epqa-creations__filter:not([aria-pressed="true"]),
    .epqa-creations__actions .epqa-creations__secondary
  ):is(:hover,:focus-visible) {
    background:#43618a!important;border-color:#9fc1ed!important;
  }

  /* Estados de foco legibles en teclado/lector; no neutraliza su identidad. */
  html[data-theme="dark"] body.stem-playground :is(
    button,a.btn,.nav-link,.epqa-mobile-sort__toggle,.epqa-mobile-facets-toggle
  ):focus-visible {
    outline:3px solid var(--epqa-m-night-focus,#83d6ff)!important;
    outline-offset:2px!important;
  }
}
