/* Base · mobile-first */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

a { color: var(--color-primary); transition: color var(--t-fast); }
a:hover { color: var(--color-primary-hover); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--space-4); letter-spacing: -0.01em; }

.titulo { font-size: var(--text-2xl); font-weight: 700; }
.subtitulo { font-size: var(--text-xl); font-weight: 700; }
.texto-grande { font-size: var(--text-lg); }
.texto-secundario { color: var(--color-text-muted); }
.texto-sm { font-size: var(--text-sm); }
.texto-xs { font-size: var(--text-xs); }

.contenedor {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.contenedor--ancho { max-width: 1080px; }

.principal { flex: 1; padding-top: var(--space-6); padding-bottom: var(--space-12); }

/* Encabezado */
.encabezado {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 20;
}
.encabezado--admin { border-bottom: 2px solid var(--color-primary); }

.encabezado__interno {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    min-height: 60px;
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
}

.encabezado__marca {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    text-decoration: none;
    color: var(--color-text);
    font-size: var(--text-lg);
}
.encabezado__logo { max-height: 36px; width: auto; }
.navegacion a.activo { border-bottom-color: var(--color-primary); font-weight: 700; }

.encabezado__usuario { display: flex; align-items: center; gap: var(--space-3); }
.encabezado__nombre { font-size: var(--text-sm); color: var(--color-text-muted); }

.navegacion { display: flex; gap: var(--space-1); flex-wrap: wrap; align-items: center; }
.navegacion a {
    text-decoration: none;
    color: var(--color-text-muted);
    font-weight: 600;               /* fijo en todos los estados: evita el salto de layout */
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    white-space: nowrap;
    transition: color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.navegacion a:hover { color: var(--color-primary); background: var(--color-primary-soft); }
.navegacion a.activo {
    color: var(--color-primary);
    background: var(--color-primary-soft);
    box-shadow: inset 0 0 0 1px var(--color-border-strong);
}

/* Pie */
.pie {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--space-8) 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* Formularios */
.campo { margin-bottom: var(--space-4); }
.campo label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-2);
}
.campo input[type="text"],
.campo input[type="email"],
.campo input[type="password"],
.campo input[type="tel"],
.campo input[type="number"],
.campo input[type="date"],
.campo input[type="file"],
.campo select,
.campo textarea {
    width: 100%;
    min-height: var(--touch-min);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    font: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.campo input::placeholder, .campo textarea::placeholder { color: var(--color-text-soft); }
.campo input:focus, .campo select:focus, .campo textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.campo select { cursor: pointer; }
.campo__error {
    color: var(--color-error);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}
.campo__ayuda {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Utilidades */
.acciones { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; margin-top: var(--space-6); }
.oculto-visualmente {
    position: absolute; width: 1px; height: 1px;
    clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}
