/* ==========================================================================
   BASE — Reset mínimo, tipografía, layout raíz y helpers.
   Refactor 2026-08-07 + auditoría visual.
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-base);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: var(--header-height);
    transition: background-color var(--transition), color var(--transition);
}

img,
svg {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-blue-hover);
}

input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* ---------- Scrollbar discreta (WebKit) ---------- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

/* ---------- Helpers de layout ---------- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-5) var(--space-6);
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-strong { color: var(--text-strong); }
.text-blue { color: var(--accent-blue); }
.text-green { color: var(--accent-green); }
.text-danger { color: var(--accent-danger); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.uppercase { text-transform: uppercase; }
.opacity-70 { opacity: .7; }
.opacity-80 { opacity: .8; }

.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-md { font-size: var(--fs-md); }
.text-lg { font-size: var(--fs-lg); }
.text-xl { font-size: var(--fs-xl); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Bloqueo de scroll cuando hay modal abierto.
   Crítico en iOS Safari: position:fixed es la única forma efectiva. */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

/* Filas "ocultas" por el filtro de búsqueda. Usamos clase (no style)
   para que el responsive pueda redefinir el display sin conflicto. */
.is-hidden {
    display: none !important;
}

/* Responsive: en pantallas grandes subimos la fuente base un punto para que
   los textos de las tablas no se vean "demasiado chicos". */
@media (min-width: 1280px) {
    body { font-size: 14.5px; }
}
