/* ═══════════════════════════════════════════════════════════════════════════
   NovaCore POS Desktop — Base: reinicio, tipografía y utilidades
   ═══════════════════════════════════════════════════════════════════════════ */

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

* { margin: 0; }

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

body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--fg);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

img, svg, video, canvas { display: block; max-width: 100%; }
svg { flex: none; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button { background: none; border: 0; padding: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semi);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

p { text-wrap: pretty; }

ul, ol { list-style: none; padding: 0; }

table { border-collapse: collapse; width: 100%; }

hr { border: 0; border-top: 1px solid var(--border); }

/* Foco visible solo para teclado: el ratón no debe dejar anillos por todos
   lados, pero navegar con Tab tiene que ser perfectamente claro. */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }

::selection {
  background: color-mix(in srgb, var(--brand) 24%, transparent);
  color: var(--fg);
}

/* ── Barras de desplazamiento ──────────────────────────────────────────────
   Delgadas y del color del contenido: en pantallas densas, una barra gruesa
   del sistema rompe la composición. */
* { scrollbar-width: thin; scrollbar-color: var(--n-400) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--fg-faint) 45%, transparent);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--fg-faint) 75%, transparent);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

/* ── Cifras ───────────────────────────────────────────────────────────────
   Todo dato numérico va en cifras tabulares: sin esto, las columnas de dinero
   bailan al actualizarse y las tablas se leen mal. */
.num,
td.num,
.money,
.stat-value,
input[type="number"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ── Utilidades tipográficas ─────────────────────────────────────────────── */
.t-2xs { font-size: var(--fs-2xs); }
.t-xs  { font-size: var(--fs-xs); }
.t-sm  { font-size: var(--fs-sm); }
.t-md  { font-size: var(--fs-md); }
.t-lg  { font-size: var(--fs-lg); }
.t-xl  { font-size: var(--fs-xl); }

.fw-medium { font-weight: var(--fw-medium); }
.fw-semi   { font-weight: var(--fw-semi); }
.fw-bold   { font-weight: var(--fw-bold); }

.muted  { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.faint  { color: var(--fg-faint); }

.c-ok   { color: var(--ok); }
.c-warn { color: var(--warn); }
.c-dan  { color: var(--dan); }
.c-info { color: var(--info); }
.c-brand{ color: var(--brand); }

/* Etiqueta de sección en versalitas */
.eyebrow {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Utilidades de composición ───────────────────────────────────────────── */
.row  { display: flex; align-items: center; gap: var(--s-2); }
.col  { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center  { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }

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

.mt-1 { margin-top: var(--s-1); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mt-8 { margin-top: var(--s-8); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
.ml-auto { margin-left: auto; }

.hidden { display: none !important; }

/* Oculto en pantalla pero legible por 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;
}

/* ── Animaciones compartidas ──────────────────────────────────────────────
   Solo transform y opacity: son las dos propiedades que el navegador puede
   animar en la GPU sin recalcular el diseño de la página. */
@keyframes fade-in     { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise        { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise-lg     { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes pop         { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes slide-left  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes spin        { to { transform: rotate(360deg); } }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
@keyframes shimmer { to { background-position-x: -200%; } }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.anim-rise { animation: rise var(--t-slow) var(--ease-out) both; }
.anim-pop  { animation: pop var(--t-base) var(--ease-out) both; }

/* Marcador de posición mientras cargan los datos: evita el salto de diseño
   que se produce al reemplazar un "Cargando..." por una tabla completa. */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-subtle) 25%,
    color-mix(in srgb, var(--bg-subtle) 55%, var(--bg-surface)) 37%,
    var(--bg-subtle) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

/* Respeta a quien pidió menos movimiento en su sistema operativo. */
@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;
  }
}

/* ── Impresión ───────────────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}
