/* ==========================================================================
   Base — reset, tipografia, layout raiz (sidebar + navbar + contenido)
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background:
    var(--gradient-mesh),
    var(--bg-app);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.015em;
}
p { margin: 0; }

/* Cifras (precios, cantidades, stock) en monoespaciada tabular: refuerza la
   sensación de "libro mayor" preciso en vez de tipografía genérica. */
.num, .tabular, .stat-value, td.num, .price, .almacenes-precio-table td input {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color-strong); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
  box-shadow: var(--ring-focus);
}

/* ---------- Shell de la aplicacion ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--dur-base) var(--ease);
}

.app-shell.is-collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-content {
  padding: var(--sp-8) var(--sp-8) var(--sp-12);
  flex: 1;
  position: relative;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
  flex-wrap: wrap;
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
  font-size: var(--fs-xl);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.page-header h1::before {
  content: "";
  width: 6px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--gradient-brand);
  box-shadow: 0 0 12px rgba(22,184,105,.45);
  flex: none;
}

.page-header .breadcrumb {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.page-header .actions {
  display: flex;
  gap: var(--sp-3);
}

@media (max-width: 992px) {
  .app-shell, .app-shell.is-collapsed { grid-template-columns: 1fr; }
  .app-content { padding: var(--sp-4); }
  .page-header h1 { font-size: var(--fs-lg); }
}