/* =========================================================================
   BASE
   Reset minimo, tipografia, primitivas compartidas y el anillo de foco.
   Aqui no hay ni una clase de componente: eso vive en components.css.
   ========================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
#app {
  user-select: none;
  height: 100%;
  margin: 0;
}

html {
  /* La app no hace scroll de pagina en escritorio; el scroll vive en los
     paneles. Evita el salto de layout al aparecer una barra. */
  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: 400;
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.011em;
}

p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

/* Los controles nativos de formulario NO se heredan solos: sin esto, un
   `<option>` sale con el fondo claro del sistema sobre un panel oscuro. */
select,
option,
input {
  color-scheme: dark;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(67, 97, 238, 0.32);
}

/* --- utilidades ---------------------------------------------------------- */
.muted {
  color: var(--muted);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warn {
  color: var(--warn);
}

.text-primary {
  color: var(--primary);
}

.hidden {
  display: none !important;
}

/* Cifras: la misma anchura por digito sin cambiar de familia. Esto es lo que
   sustituye a la fuente mono que llevaba antes la interfaz. */
.num,
.stat p,
.metric-stat-value,
.data-table,
.sweep-status {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.empty-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* Texto solo para lectores de pantalla. */
.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;
}

/* --- barra de scroll ----------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--r-full);
  background: var(--line2);
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: #3d465c;
  background-clip: content-box;
}

/* --- foco ----------------------------------------------------------------
   Un solo anillo para todo lo interactivo. Se acota a `:focus-visible` para
   no dibujar cajas al pinchar con el raton. */
:where(button, select, input, a, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* --- movimiento ---------------------------------------------------------- */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-2px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* Sin movimiento si el sistema lo pide. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
