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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-bg-app);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--color-bg-app);
  color: var(--color-text-primary);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.mono-code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

/* Enlace de salto accesible WCAG 2.4.1 */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-brand-navy);
  color: var(--color-text-inverse);
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-3);
}

/* Foco de teclado visible universal WCAG 2.4.7 / 2.4.11 */
:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.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;
}

.boot-loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.boot-loading__text {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  font-weight: 500;
}

/* Botones reutilizables */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background-color: var(--color-brand-navy);
  color: var(--color-text-inverse);
}

.btn--primary:hover:not(:disabled) {
  background-color: var(--color-brand-navy-hover);
}

.btn--secondary {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

.btn--secondary:hover:not(:disabled) {
  background-color: var(--color-surface-muted);
}

.btn--ghost {
  background-color: transparent;
  color: var(--color-text-inverse);
  border-color: rgba(255, 255, 255, 0.35);
}

.btn--ghost:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.12);
}

.btn--sm {
  min-height: 2.25rem;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
}

/* Badges semánticos */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.1875rem var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge--approved {
  background-color: var(--color-status-approved-bg);
  color: var(--color-status-approved-fg);
  border-color: var(--color-status-approved-border);
}

.badge--failed {
  background-color: var(--color-status-failed-bg);
  color: var(--color-status-failed-fg);
  border-color: var(--color-status-failed-border);
}

.badge--warn {
  background-color: var(--color-status-warn-bg);
  color: var(--color-status-warn-fg);
  border-color: var(--color-status-warn-border);
}

.badge--neutral {
  background-color: var(--color-surface-muted);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-status-failed-border);
  background-color: var(--color-status-failed-bg);
  color: var(--color-status-failed-fg);
  font-size: var(--text-sm);
  font-weight: 500;
}

@media (max-width: 767px) {
  .btn,
  .btn--sm {
    min-height: var(--control-height-touch);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

