/* rb-control — estilos propios (mismo criterio que rb-fl5) sobre Bootstrap 5.3.
   Pensado para personas con baja visión: Atkinson Hyperlegible, letra base de 18px
   ajustable (A−/A+), contrastes AA o mejores en claro y oscuro y foco siempre visible. */

@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/vendor/fonts/atkinson-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/vendor/fonts/atkinson-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/vendor/fonts/atkinson-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/vendor/fonts/atkinson-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: italic; font-weight: 400; font-display: swap;
  src: url(/vendor/fonts/atkinson-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: italic; font-weight: 700; font-display: swap;
  src: url(/vendor/fonts/atkinson-700-italic.woff2) format("woff2"); }

/* --- Escala de letra (la elige el usuario, queda en localStorage) --- */
html[data-escala="0"] { font-size: 100%; }    /* 16px */
html[data-escala="1"] { font-size: 112.5%; }  /* 18px, por defecto */
html[data-escala="2"] { font-size: 125%; }    /* 20px */
html[data-escala="3"] { font-size: 137.5%; }  /* 22px */

:root {
  --bs-body-font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bs-body-line-height: 1.55;
  --foco: #0b57d0;
}
[data-bs-theme="light"] {
  --bs-body-color: #16181b;               /* casi negro: contraste ~17:1 */
  --bs-secondary-color: #4a5058;          /* texto secundario ≥ 7:1 (AAA) */
  --bs-link-color: #0a4fb8; --bs-link-color-rgb: 10, 79, 184;
  --bs-link-hover-color: #073a88; --bs-link-hover-color-rgb: 7, 58, 136;
  --ok: #047857;                          /* ≥ 5:1 sobre blanco */
  --error: #b91c1c;
  --alerta: #92400e;
}
[data-bs-theme="dark"] {
  --bs-body-bg: #121417;
  --bs-body-color: #eceff3;
  --bs-secondary-color: #bcc3cc;          /* ≥ 9:1 sobre el fondo oscuro */
  --bs-tertiary-bg: #1b1f24;
  --bs-link-color: #8ab4ff; --bs-link-color-rgb: 138, 180, 255;
  --bs-link-hover-color: #b3ceff; --bs-link-hover-color-rgb: 179, 206, 255;
  --foco: #8ab4ff;
  --ok: #6fdc94;
  --error: #ff9a9a;
  --alerta: #fcd34d;
}

/* Foco bien visible para quien navega con teclado */
:focus-visible { outline: 3px solid var(--foco) !important; outline-offset: 2px; box-shadow: none !important; }
.btn, .form-control, .form-select { --bs-border-width: 1.5px; }
.form-control::placeholder { color: var(--bs-secondary-color); opacity: .85; }

/* El atributo hidden siempre oculta, aunque el elemento tenga d-flex u otra utilidad de display de Bootstrap. */
[hidden] { display: none !important; }

/* --- Nav --- */
.navbar .nav-link, .dropdown-item { font-size: 1rem; }
.navbar .nav-link.active { font-weight: 700; text-decoration: underline; text-underline-offset: .35em; }
.dropdown-menu { max-height: calc(100vh - 6rem); overflow-y: auto; }
.menu-usuario { min-width: 16rem; }
/* Celular (menú colapsado): el menú de usuario va dentro del flujo, a todo el ancho que queda, en vez de flotar
   alineado a la derecha del botón (se salía de la pantalla y tapaba A− / A+). El menú desplegado scrollea si no entra. */
@media (max-width: 991.98px) {
  .navbar-collapse { max-height: calc(100vh - 4.5rem); max-height: calc(100dvh - 4.5rem); overflow-y: auto; }
  .navbar-collapse .menu-usuario { position: static; min-width: 0; max-height: none; overflow: visible; margin-top: .5rem; }
}
[data-bs-theme="light"] .tema-claro, [data-bs-theme="dark"] .tema-oscuro { display: none; }

/* --- Login --- */
.login-card { border-radius: 1rem; }

.table { --bs-table-bg: transparent; }
.table > thead th { background: var(--bs-secondary-bg); }
.table-responsive { position: relative; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* Modo oscuro: botones outline más claros para mantener contraste AA */
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: #ced4da; --bs-btn-border-color: #8c959f; }
[data-bs-theme="dark"] .btn-outline-danger { --bs-btn-color: #f19ca4; --bs-btn-border-color: #f19ca4; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #8ab4ff; --bs-btn-border-color: #8ab4ff; }
/* La confirmación puede abrirse sobre otro modal: va por encima. */
#confirmModal { z-index: 1070; }


/* --- Estados (bloqueos, servicios, backups): color + ícono + texto, nunca sólo color --- */
.estado { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; }
.estado-ok { color: var(--ok); }
.estado-error { color: var(--error); }
.estado-alerta { color: var(--alerta); }
.tarjeta-estado { border-left: 6px solid var(--bs-border-color); overflow-wrap: anywhere; }
.tarjeta-estado .flex-grow-1, .tarjeta-estado .card-body > div { min-width: 0; }
.tarjeta-estado.borde-ok { border-left-color: var(--ok); }
.tarjeta-estado.borde-error { border-left-color: var(--error); }
.tarjeta-estado.borde-alerta { border-left-color: var(--alerta); }
.td-num, .table td.td-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.texto-log { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .85rem;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.btn-grande { min-height: 3rem; }
.form-angosto { max-width: 44rem; }

/* --- Gestor de la base --- */
.tabla-datos td, .tabla-datos th { white-space: nowrap; }
.tabla-datos td.celda { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; }
.tabla-datos .celda-nula { color: var(--bs-secondary-color); font-style: italic; }
.tabla-datos thead .filtros th { background: var(--bs-tertiary-bg); }
.tabla-datos thead .filtros input { min-width: 6rem; }
.orden-activo { text-decoration: underline; text-underline-offset: .3em; }
.lista-tablas { columns: 16rem auto; column-gap: 1.5rem; }
.lista-tablas li { break-inside: avoid; }
.json-cambio { max-height: 12rem; overflow: auto; }
