/* UXF.1 — Política institucional de contraste y legibilidad.
   Hoja propia: no modifica core.css, theme-default.css ni sus variantes oscuras.
   Se carga después de Sneat y de branding_entidad.css.
   El personalizador intercambia core/theme en su sitio; esta hoja permanece.
   Tema claro: :root y html.light-style. Tema oscuro: html.dark-style
   (también cuando el selector de la barra elige «Sistema»).

   Criterio WCAG 2.2 AA, medido sobre el fondo real de cada superficie:
   texto normal >= 4.5:1, texto grande >= 3:1, borde de control >= 3:1.
   No se altera el morado de marca en fondos decorativos ni el logo por licencia.
*/

:root,
html.light-style {
  --uxf-texto: #516274;
  --uxf-texto-secundario: #5d6c7a;
  --uxf-titulo: #3d4c5c;
  --uxf-primario-texto: #5659d1;
  --uxf-primario-hover: #4548b8;
  --uxf-info-texto: #014e5e;
  --uxf-exito-texto: #2d5816;
  --uxf-aviso-texto: #664400;
  --uxf-peligro-texto: #bf2e16;
  --uxf-etiqueta-texto: #616b77;
  --uxf-borde-control: #8f9396;
  --uxf-boton-primario: #5558d4;
  --uxf-boton-primario-activo: #4c4ec4;
  --uxf-boton-peligro: #c42f16;
  --uxf-boton-peligro-activo: #a82812;
  --uxf-boton-texto-sobre-claro: #233446;
  --uxf-info-fondo: #d7f5fc;
  --uxf-exito-fondo: #e8fadf;
  --uxf-aviso-fondo: #fff2d6;
  --uxf-peligro-fondo: #ffe0db;
  --uxf-etiqueta-fondo: #ebeef0;
  --uxf-primario-fondo: #e7e7ff;

  --bs-body-color: var(--uxf-texto);
  --bs-body-color-rgb: 81, 98, 116;
  --bs-heading-color: var(--uxf-titulo);
  --bs-secondary-color: var(--uxf-texto-secundario);
  --bs-tertiary-color: var(--uxf-texto-secundario);
  --bs-link-color: var(--uxf-primario-texto);
  --bs-link-hover-color: var(--uxf-primario-hover);
  --bs-emphasis-color: var(--uxf-titulo);
}

html.dark-style {
  --uxf-texto: #a3a4cc;
  --uxf-texto-secundario: #9293ba;
  --uxf-titulo: #cbcbe2;
  --uxf-primario-texto: #999bff;
  --uxf-primario-hover: #c5c6ff;
  --uxf-info-texto: #03c3ec;
  --uxf-exito-texto: #71dd37;
  --uxf-aviso-texto: #ffab00;
  --uxf-peligro-texto: #ff7a63;
  --uxf-etiqueta-texto: #a0aab7;
  --uxf-borde-control: #75758c;
  --uxf-boton-primario: #5558d4;
  --uxf-boton-primario-activo: #4c4ec4;
  --uxf-boton-peligro: #c42f16;
  --uxf-boton-peligro-activo: #a82812;
  --uxf-boton-texto-sobre-claro: #233446;
  --uxf-info-fondo: #25445c;
  --uxf-exito-fondo: #36483f;
  --uxf-aviso-fondo: #4d4036;
  --uxf-peligro-fondo: #4d2f3a;
  --uxf-etiqueta-fondo: #393c50;
  --uxf-primario-fondo: #35365f;

  --bs-body-color: var(--uxf-texto);
  --bs-body-color-rgb: 163, 164, 204;
  --bs-heading-color: var(--uxf-titulo);
  --bs-secondary-color: var(--uxf-texto-secundario);
  --bs-tertiary-color: var(--uxf-texto-secundario);
  --bs-link-color: var(--uxf-primario-texto);
  --bs-link-hover-color: var(--uxf-primario-hover);
  --bs-emphasis-color: var(--uxf-titulo);
}

/* Texto principal, secundario y títulos. Sneat fija varios con !important. */
.text-body {
  color: var(--uxf-texto) !important;
}

.text-muted {
  color: var(--uxf-texto-secundario) !important;
}

.text-heading {
  color: var(--uxf-titulo) !important;
}

h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 {
  color: var(--uxf-titulo);
}

.text-primary {
  color: var(--uxf-primario-texto) !important;
}

.text-info {
  color: var(--uxf-info-texto) !important;
}

.text-success {
  color: var(--uxf-exito-texto) !important;
}

.text-warning {
  color: var(--uxf-aviso-texto) !important;
}

.text-danger {
  color: var(--uxf-peligro-texto) !important;
}

.text-secondary {
  color: var(--uxf-etiqueta-texto) !important;
}

/* Alertas: Sneat pisa el color accesible de Bootstrap con el color de marca. */
.alert-info {
  color: var(--uxf-info-texto);
  background-color: var(--uxf-info-fondo);
}

.alert-info .alert-link {
  color: var(--uxf-info-texto);
}

.alert-success {
  color: var(--uxf-exito-texto);
  background-color: var(--uxf-exito-fondo);
}

.alert-success .alert-link {
  color: var(--uxf-exito-texto);
}

.alert-warning {
  color: var(--uxf-aviso-texto);
  background-color: var(--uxf-aviso-fondo);
}

.alert-warning .alert-link {
  color: var(--uxf-aviso-texto);
}

.alert-danger {
  color: var(--uxf-peligro-texto);
  background-color: var(--uxf-peligro-fondo);
}

.alert-danger .alert-link {
  color: var(--uxf-peligro-texto);
}

.alert-secondary {
  color: var(--uxf-etiqueta-texto);
  background-color: var(--uxf-etiqueta-fondo);
}

.alert-secondary .alert-link {
  color: var(--uxf-etiqueta-texto);
}

/* Etiquetas (badges suaves y encabezados de tarjeta). El fondo de Sneat se conserva. */
.bg-label-primary,
.bg-label-hover-primary {
  color: var(--uxf-primario-texto) !important;
}

.bg-label-info,
.bg-label-hover-info {
  color: var(--uxf-info-texto) !important;
}

.bg-label-success,
.bg-label-hover-success {
  color: var(--uxf-exito-texto) !important;
}

.bg-label-warning,
.bg-label-hover-warning {
  color: var(--uxf-aviso-texto) !important;
}

.bg-label-danger,
.bg-label-hover-danger {
  color: var(--uxf-peligro-texto) !important;
}

.bg-label-secondary,
.bg-label-hover-secondary {
  color: var(--uxf-etiqueta-texto) !important;
}

.bg-label-hover-primary:hover,
.bg-label-hover-info:hover,
.bg-label-hover-success:hover,
.bg-label-hover-warning:hover,
.bg-label-hover-danger:hover,
.bg-label-hover-secondary:hover {
  color: #fff !important;
}

/* Controles: borde y placeholder. No se oscurecen los bordes decorativos de tarjetas. */
.form-control,
.form-select,
.input-group-text,
.form-check-input {
  border-color: var(--uxf-borde-control);
}

.form-control,
.form-select {
  color: var(--uxf-texto);
}

.form-control::placeholder {
  color: var(--uxf-texto-secundario);
  opacity: 1;
}

.form-label,
.col-form-label {
  color: var(--uxf-titulo);
}

/* Botones sólidos cuyo texto blanco no alcanza 4.5:1 sobre el color de marca. */
.btn-primary,
.btn-primary:focus,
.btn-primary.focus,
.page-item.active .page-link,
.page-item.active .page-link:hover,
.page-item.active .page-link:focus,
.pagination li.active > a:not(.page-link),
.badge.bg-primary {
  background-color: var(--uxf-boton-primario) !important;
  border-color: var(--uxf-boton-primario) !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
  background-color: var(--uxf-boton-primario-activo) !important;
  border-color: var(--uxf-boton-primario-activo) !important;
  color: #fff !important;
}

.btn-outline-primary {
  color: var(--uxf-primario-texto) !important;
  border-color: var(--uxf-boton-primario);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active {
  background-color: var(--uxf-boton-primario-activo) !important;
  border-color: var(--uxf-boton-primario-activo) !important;
  color: #fff !important;
}

.btn-label-primary {
  color: var(--uxf-primario-texto);
  background: var(--uxf-primario-fondo);
}

.btn-label-primary:hover,
.btn-label-primary:focus,
.btn-label-primary:active,
.btn-label-primary.active {
  background: var(--uxf-boton-primario-activo) !important;
  background-color: var(--uxf-boton-primario-activo) !important;
  color: #fff !important;
}

.btn-success,
.btn-success:hover,
.btn-success:focus,
.btn-success:active,
.btn-success.active,
.btn-info,
.btn-info:hover,
.btn-info:focus,
.btn-info:active,
.btn-info.active,
.btn-warning,
.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active,
.btn-warning.active {
  color: var(--uxf-boton-texto-sobre-claro) !important;
}

.badge.bg-success,
.badge.bg-info,
.badge.bg-warning {
  color: var(--uxf-boton-texto-sobre-claro);
}

.btn-danger,
.btn-danger:focus,
.badge.bg-danger {
  background-color: var(--uxf-boton-peligro) !important;
  border-color: var(--uxf-boton-peligro) !important;
  color: #fff !important;
}

.btn-danger:hover,
.btn-danger:active,
.btn-danger.active {
  background-color: var(--uxf-boton-peligro-activo) !important;
  border-color: var(--uxf-boton-peligro-activo) !important;
  color: #fff !important;
}

.btn-label-secondary {
  color: var(--uxf-etiqueta-texto);
  background: var(--uxf-etiqueta-fondo);
}

.btn-label-secondary:hover,
.btn-label-secondary:focus,
.btn-label-secondary:active {
  background: #54606b !important;
  color: #fff !important;
}

/* Menú lateral: el texto completo se lee; el modo colapsado sigue ocultando la etiqueta. */
html:not(.layout-menu-collapsed) .layout-menu .menu-link > div.text-truncate,
html:not(.layout-menu-collapsed) .layout-menu .menu-toggle > div.text-truncate,
html.layout-menu-hover .layout-menu .menu-link > div.text-truncate,
html.layout-menu-hover .layout-menu .menu-toggle > div.text-truncate {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
  overflow-wrap: break-word;
}

html:not(.layout-menu-collapsed) .layout-menu .app-brand-text.text-truncate,
html.layout-menu-hover .layout-menu .app-brand-text.text-truncate {
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.25;
}

.bg-menu-theme {
  color: var(--uxf-texto);
}

.bg-menu-theme .menu-link,
.bg-menu-theme .menu-horizontal-prev,
.bg-menu-theme .menu-horizontal-next,
.bg-menu-theme .menu-inner > .menu-item.menu-item-closing .menu-item.open .menu-toggle {
  color: var(--uxf-texto);
}

.bg-menu-theme .menu-link:hover,
.bg-menu-theme .menu-link:focus,
.bg-menu-theme .menu-text,
.bg-menu-theme .menu-item.open:not(.menu-item-closing) > .menu-toggle {
  color: var(--uxf-titulo);
}

.bg-menu-theme .menu-header {
  color: var(--uxf-texto-secundario);
}

/* Claro: ítem activo sobre velo primario. Oscuro: Sneat pinta el ítem con fondo sólido; el texto sigue en blanco y el fondo se oscurece. */
html:not(.dark-style) .bg-menu-theme .menu-inner > .menu-item.active > .menu-link,
html:not(.dark-style) .bg-menu-theme .menu-inner .menu-sub > .menu-item.active .menu-icon {
  color: var(--uxf-primario-texto);
}

html.dark-style .bg-menu-theme .menu-inner > .menu-item.active > .menu-link {
  background-color: var(--uxf-boton-primario) !important;
  color: #fff;
}

html.dark-style .bg-menu-theme .menu-inner > .menu-item.active:before {
  background: var(--uxf-boton-primario);
}

html.dark-style .bg-menu-theme .menu-inner .menu-sub > .menu-item.active .menu-icon {
  color: var(--uxf-primario-texto);
}

/* El avatar de Sneat no declara display: en un <span> el alto se ignora y el icono absoluto se monta sobre el texto. */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Estado vacío: caja de icono en el flujo, separada del mensaje. */
.uxf-estado-vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  padding-block: 1.5rem;
}

.uxf-estado-vacio-icono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  flex: 0 0 4.5rem;
  border-radius: 50%;
  background: var(--uxf-info-fondo);
  color: var(--uxf-info-texto);
  line-height: 1;
}

.uxf-estado-vacio-icono .bx {
  font-size: 1.75rem;
  line-height: 1;
}

.uxf-estado-vacio-icono-secundario {
  background: var(--uxf-etiqueta-fondo);
  color: var(--uxf-etiqueta-texto);
}

.uxf-estado-vacio-texto {
  max-width: 32rem;
}

.uxf-estado-vacio-texto > :last-child {
  margin-bottom: 0;
}

/* KPI sin corte publicado: no es un importe en cero. */
.uxf-kpi-sin-informacion {
  display: inline-block;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--uxf-texto-secundario);
}

/* Engranaje de demostración de Sneat. El selector claro/oscuro de la barra no usa este panel. */
#template-customizer {
  display: none !important;
}
