/* MS-Stock · portal. La familia visual de Uniko (el portal se abre desde ahí): papel frío,
   tinta azul marino, acento azul eléctrico con remate cian, Archivo para la interfaz e
   IBM Plex Mono solo para códigos. Dentro, el kardex: el número de existencia manda y el
   color solo significa (entra, sale, agotado).
   Sin framework, sin build, sin recursos externos (CSP 'self'): las fuentes viven en
   fonts/ (OFL) y el tema se elige con `data-theme` en <html>, escrito por el servidor
   desde la cookie; sin cookie, sigue al sistema. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---- tokens: los de Uniko (src/app/globals.css), mismos nombres ----------- */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-subtle: #f6f8fc;
  --bg-panel: #eef2f9;
  --bg-hover: #e9eef8;
  --text: #0a1730;
  --text-2: #42506b;
  --text-3: #8391aa;
  --border: #e8edf6;
  --border-strong: #dde5f1;

  --accent: #0d5bff;
  --accent-hover: #0a4de6;
  --accent-soft: #d3e2ff;
  --accent-tint: #ebf1ff;
  --accent-text: #0038d8;
  --accent-fg: #ffffff;
  --cyan: #3fdcff;          /* remate de la marca sobre el mosaico */

  --success-tint: #e9f7ee;
  --success-soft: #c9ebd6;
  --success-text: #157a41;
  --warning-tint: #fef6e6;
  --warning-soft: #f8e3b5;
  --warning-text: #935f0b;
  --danger-tint: #fdf0f0;
  --danger-soft: #f5cccc;
  --danger-text: #b73535;

  --grid-line: #d3e2ff;
  --glow-a: rgba(13, 91, 255, 0.16);
  --glow-b: rgba(0, 198, 245, 0.14);

  --radius-sm: 9px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(8, 27, 82, 0.06);
  --shadow-md: 0 14px 40px -16px rgba(8, 27, 82, 0.16);

  /* El kardex sobre la tríada de estado: entra, sale/negativo, agotado. */
  --in: var(--success-text);
  --out: var(--danger-text);
  --low: var(--warning-text);

  --font-sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", monospace;
  --fs-xs: 0.75rem;      /* 12 */
  --fs-sm: 0.8125rem;    /* 13 */
  --fs-md: 0.9375rem;    /* 15: cuerpo */
  --fs-lg: 1.0625rem;    /* 17 */
  --fs-xl: 1.375rem;     /* 22 */
  --fs-2xl: 1.75rem;     /* 28 */
  --fs-stat: 3.5rem;     /* 56: la existencia */
  --measure: 62ch;
  --side-w: 232px;
}

/* Oscuro: el azul marino de Uniko. Dos entradas con el mismo bloque: la elección
   explícita (cookie → data-theme) y, sin elección, la preferencia del sistema. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1327;
  --bg-subtle: #070e20;
  --bg-panel: #111b36;
  --bg-hover: #172346;
  --text: #e8eefc;
  --text-2: #a9b8dc;
  --text-3: #7688b0;
  --border: #1a2748;
  --border-strong: #26376a;
  --accent: #256bff;
  --accent-hover: #4883ff;
  --accent-soft: #122c64;
  --accent-tint: #0e1e41;
  --accent-text: #6294ff;
  --success-tint: #0f2418;
  --success-soft: #1c3d29;
  --success-text: #7fe0a3;
  --warning-tint: #2a1f0c;
  --warning-soft: #4a3714;
  --warning-text: #f7c86f;
  --danger-tint: #2a1216;
  --danger-soft: #4a1f26;
  --danger-text: #f59a9a;
  --grid-line: #122c64;
  --glow-a: rgba(37, 107, 255, 0.22);
  --glow-b: rgba(0, 198, 245, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 14px 40px -16px rgba(0, 0, 0, 0.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1327;
    --bg-subtle: #070e20;
    --bg-panel: #111b36;
    --bg-hover: #172346;
    --text: #e8eefc;
    --text-2: #a9b8dc;
    --text-3: #7688b0;
    --border: #1a2748;
    --border-strong: #26376a;
    --accent: #256bff;
    --accent-hover: #4883ff;
    --accent-soft: #122c64;
    --accent-tint: #0e1e41;
    --accent-text: #6294ff;
    --success-tint: #0f2418;
    --success-soft: #1c3d29;
    --success-text: #7fe0a3;
    --warning-tint: #2a1f0c;
    --warning-soft: #4a3714;
    --warning-text: #f7c86f;
    --danger-tint: #2a1216;
    --danger-soft: #4a1f26;
    --danger-text: #f59a9a;
    --grid-line: #122c64;
    --glow-a: rgba(37, 107, 255, 0.22);
    --glow-b: rgba(0, 198, 245, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 14px 40px -16px rgba(0, 0, 0, 0.6);
  }
}

/* ---- base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--accent-fg); }
a { color: var(--accent-text); text-underline-offset: 0.15em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }

h1 { font-size: var(--fs-2xl); line-height: 1.15; font-weight: 750; letter-spacing: -0.03em; margin: 0 0 .5rem; }
h2 { font-size: var(--fs-lg); line-height: 1.3; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 .9rem; }
h2 .muted { font-weight: 500; }
p { max-width: var(--measure); }
.muted { color: var(--text-2); }
.inline { display: inline; }
.code { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- cascarón con sesión: el lateral de Uniko ----------------------------- */
/* El fondo del lateral lo pinta el cascarón: el lateral es sticky de alto de ventana y,
   en una página larga, la columna debe seguir teñida debajo de él. */
.shell {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh;
  background: linear-gradient(to right, var(--bg-subtle) calc(var(--side-w) - 1px), var(--border) 0 var(--side-w), var(--bg) 0);
}
.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 16px 12px 14px;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; color: var(--text); text-decoration: none; }
.brand:hover .wordmark { color: var(--text); }
.tile {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--accent-fg);
}
.tile svg { width: 19px; height: 19px; }
.tile .remate { stroke: var(--cyan); }
.wordmark { font-size: 1.3125rem; font-weight: 800; line-height: 1; letter-spacing: -0.045em; }
.brand-sub { display: block; margin: 8px 8px 0; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-2); letter-spacing: 0.02em; }

.side nav { display: flex; flex-direction: column; gap: 2px; margin-top: 22px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-2);
  font: inherit; font-size: 0.84375rem; font-weight: 600; text-align: left; text-decoration: none;
  cursor: pointer;
}
.nav-item svg { width: 17px; height: 17px; color: var(--text-3); }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--accent-tint); color: var(--accent-text); }
.nav-item[aria-current="page"] svg { color: var(--accent); }
.spacer { flex: 1; }
.side-break { display: none; }

.account { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding: 8px 10px; border-radius: var(--radius-sm); }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0;
}
.avatar svg { width: 16px; height: 16px; }
.account-text { min-width: 0; flex: 1; line-height: 1.25; }
.who, .who-key { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.who small, .account-text > small { display: block; font-size: 0.6875rem; font-weight: 400; color: var(--text-2); }
.icon-btn {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none; padding: 0;
  border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn[hidden] { display: none; }

/* El tema pintado decide el icono (sol = claro, luna = oscuro), como en Uniko. */
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme]) .theme-toggle .i-moon { display: block; }
}

.main { min-width: 0; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1080px; padding: 28px 32px 32px; flex: 1; }
.foot { padding: 0 32px 24px; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-2); letter-spacing: 0.04em; }

/* ---- sin sesión: la escenografía de entrada de Uniko ---------------------- */
.auth {
  position: relative; overflow: hidden; min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 16px;
  background: var(--bg-subtle);
}
.auth-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, #000 30%, transparent 75%);
}
.glow { position: absolute; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.glow-a { width: 640px; height: 640px; right: -160px; top: -120px; background: radial-gradient(circle, var(--glow-a), transparent 65%); }
.glow-b { width: 460px; height: 460px; left: -140px; bottom: -180px; background: radial-gradient(circle, var(--glow-b), transparent 65%); }
@media (prefers-reduced-motion: no-preference) {
  .glow-a { animation: drift 14s ease-in-out infinite alternate; }
  .glow-b { animation: drift 18s ease-in-out infinite alternate-reverse; }
}
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(-40px, 30px) scale(1.08); } }
.auth-inner { position: relative; width: 100%; max-width: 400px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 28px; }
.auth-brand .tile { width: 44px; height: 44px; border-radius: 13px; }
.auth-brand .tile svg { width: 27px; height: 27px; }
.auth-brand .wordmark { font-size: 1.875rem; }
.auth-tools { position: absolute; top: 14px; right: 14px; }
.auth .foot { padding: 16px 0 0; text-align: center; }
.card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 28px;
}
.card h1 { font-size: var(--fs-xl); }
.card .actions { margin-bottom: 0; }

/* ---- mensajes ------------------------------------------------------------- */
.flash {
  max-width: none; margin: 0 0 20px; padding: 10px 14px;
  border: 1px solid; border-radius: var(--radius); font-size: var(--fs-sm); font-weight: 500;
}
.flash-ok { background: var(--success-tint); border-color: var(--success-soft); color: var(--success-text); }
.flash-error { background: var(--danger-tint); border-color: var(--danger-soft); color: var(--danger-text); }
.hint { color: var(--text-2); font-size: var(--fs-sm); margin: 6px 0 0; }
section.empty, p.empty {
  max-width: none; margin: 0; padding: 40px 24px; text-align: center; color: var(--text-2);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-subtle);
}
section.empty p { margin: 0 auto .75rem; }
section.empty p:last-child { margin-bottom: 0; }
section.empty strong { color: var(--text); }

/* ---- controles: píldoras de Uniko ----------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text);
  font: inherit; font-size: 0.875rem; font-weight: 600; line-height: 1; letter-spacing: -0.01em;
  white-space: nowrap; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger-text); border-color: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger-text); }
.btn-link { height: auto; padding: 0; border: 0; border-radius: 0; background: none; color: var(--text-2); font-weight: 500; text-decoration: underline; text-underline-offset: 0.15em; }
.btn-link:hover { color: var(--text); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: progress; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav-item, .icon-btn, input, select, textarea { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s; }
  .btn:not(.btn-link):hover { transform: translateY(-1px); }
  .btn:not(.btn-link):active { transform: none; }
}

form.stack { display: grid; gap: 18px; max-width: 520px; }
label { display: block; margin-bottom: 6px; font-size: 0.84375rem; font-weight: 600; }
label .muted { font-weight: 400; }
input[type="text"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm);
  font: inherit; font-size: var(--fs-md); letter-spacing: -0.005em;
}
textarea { resize: vertical; }
::placeholder { color: var(--text-3); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger-text); }
input[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 3px var(--danger-soft); }
.field-error { color: var(--danger-text); margin: 6px 0 0; font-size: var(--fs-sm); font-weight: 500; }
input[type="file"] {
  width: 100%; padding: 6px; font: inherit; font-size: var(--fs-sm); color: var(--text-2);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg-subtle);
}
input[type="file"]::file-selector-button {
  margin-right: 12px; height: 32px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer;
}
input[type="file"][aria-invalid="true"] { border-color: var(--danger-text); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 500; color: var(--text-2); }
.check input { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 16px 0 0; }

/* ---- cabecera de página (Productos) -------------------------------------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .count { margin-left: 8px; font-size: var(--fs-md); font-weight: 500; letter-spacing: 0; color: var(--text-2); }
.searchbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 0; }
.search-field { position: relative; flex: 1 1 280px; }
.search-field svg { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search-field input[type="search"] { padding-left: 36px; min-width: 280px; }

/* ---- el kardex: cabecera del producto ------------------------------------ */
.crumbs { margin: 0 0 14px; font-size: var(--fs-sm); color: var(--text-2); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.kardex {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  padding-bottom: 24px; border-bottom: 1px solid var(--border);
}
.kardex .identity { flex: 1 1 220px; min-width: 0; }
.kardex h1 { margin-bottom: 6px; }
.kardex .sku { margin: 0; color: var(--text-2); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
h1 .label { color: var(--text-2); font-weight: 400; }
figure.photo { margin: 0; flex: 0 0 auto; }
.kardex .photo, .kardex img.photo { width: 160px; height: 160px; }
img.photo { display: block; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-subtle); }
.photo.empty { flex: 0 0 auto; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-subtle); }
.stock { text-align: right; }
.stock .label { font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 4px; }
.stat { font-size: var(--fs-stat); line-height: .95; font-weight: 800; letter-spacing: -0.045em; }
.stat small { margin-left: 6px; font-size: var(--fs-md); font-weight: 500; letter-spacing: -0.01em; color: var(--text-2); }
.stock .state { margin-top: 8px; }
.negative { color: var(--out); }
.low { color: var(--low); }

/* Insignias de estado: tríada tint/soft/text, como el Badge de Uniko. */
.state {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-panel); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; white-space: nowrap; vertical-align: middle;
}
.state.low { background: var(--warning-tint); border-color: var(--warning-soft); color: var(--warning-text); }
td.qty .state { margin-left: 8px; }

dl.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 24px;
  margin: 20px 0 0;
}
dl.facts dt { font-size: var(--fs-sm); color: var(--text-2); }
dl.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }

/* Secciones del detalle: cada una con su encabezado; los formularios en un panel. */
.container > section + section { margin-top: 36px; }
.panel {
  padding: 22px 24px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg); box-shadow: var(--shadow-sm);
}
.panel > form.inline { display: block; margin-top: 12px; }

/* ---- tablas del kardex --------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { padding-top: 10px; padding-bottom: 10px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); background: var(--bg-subtle); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-subtle); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.qty { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.02em; }
td.qty small { margin-left: 4px; font-size: var(--fs-sm); font-weight: 400; letter-spacing: 0; color: var(--text-2); }
td.code { color: var(--text-2); }
td.in { color: var(--in); font-weight: 600; }
td.out { color: var(--out); font-weight: 600; }
tr.inactive td { color: var(--text-2); }
tr.inactive td.name a { color: var(--text-2); }
td.row-actions { text-align: right; white-space: nowrap; }
table.variants td.qty { font-size: var(--fs-md); }

.prod { display: flex; align-items: center; gap: 12px; min-width: 0; }
.prod-text { min-width: 0; }
td.name a { color: var(--text); font-weight: 600; text-decoration: none; }
td.name a:hover { color: var(--accent-text); }
.thumb { width: 44px; height: 44px; flex: none; object-fit: cover; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-subtle); }
.thumb.empty { display: inline-block; border-style: dashed; border-color: var(--border-strong); }

/* Tallas (005): el desglose del modelo como fichas; la agotada lleva el ámbar. */
.sizes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sizes .sep { display: none; }
td.name .sizes a {
  display: inline-flex; gap: 5px; align-items: baseline; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
}
td.name .sizes a b { color: var(--text); font-weight: 700; }
td.name .sizes a.low { border-color: var(--warning-soft); background: var(--warning-tint); color: var(--warning-text); }
td.name .sizes a.low b { color: var(--warning-text); }
td.name .sizes a.inactive { text-decoration: line-through; color: var(--text-3); }
td.name .sizes a:hover { border-color: var(--accent); }

.variant-rows { display: grid; gap: 12px; }
.variant-row { display: grid; grid-template-columns: 1fr 200px; gap: 8px 12px; align-items: start; }
.variant-row label { font-weight: 500; }
fieldset#tallas { margin: 0; padding: 14px 18px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius); }
fieldset#tallas legend { padding: 0 6px; font-size: 0.84375rem; font-weight: 600; }
fieldset#tallas [data-add-row] { margin-top: 12px; }
form.add-variant { margin-top: 20px; }

.pagination { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 16px; font-size: var(--fs-sm); }
.pagination span:last-child { display: flex; gap: 8px; }

/* ---- utilidades ----------------------------------------------------------- */
.narrow { max-width: 560px; }

/* ---- tableta y teléfono: el lateral se vuelve barra superior -------------- */
@media (max-width: 900px) {
  .shell { display: block; background: var(--bg); }
  .side {
    position: static; height: auto; overflow: visible;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 4px;
    padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { order: 1; padding: 2px 4px; margin-right: auto; }
  .brand-sub, .spacer { display: none; }
  .side-foot { display: contents; }
  .account { order: 2; margin: 0; padding: 0; min-width: 0; max-width: 60%; }
  .side-break { display: block; order: 3; flex-basis: 100%; height: 0; }
  .side nav { order: 4; flex-direction: row; flex-wrap: wrap; gap: 2px; margin: 0; }
  .side-foot > .nav-item { order: 5; }
  .side-foot > form { order: 6; }
  .nav-item { width: auto; padding: 6px 10px; }
  .container { padding: 20px 16px 24px; }
  .foot { padding: 0 16px 20px; }
}
@media (max-width: 640px) {
  :root { --fs-stat: 2.75rem; --fs-2xl: 1.5rem; }
  .account .avatar { display: none; }
  .account-text > small, .who small { display: none; }
  .kardex { align-items: flex-start; }
  .kardex .photo, .kardex img.photo { width: 96px; height: 96px; }
  .stock { text-align: left; flex-basis: 100%; }
  .card { padding: 22px 18px; }
  .panel { padding: 18px 16px; }
  .search-field input[type="search"] { min-width: 0; }
  /* Safari en iOS hace zoom al enfocar un campo de menos de 16px y no lo devuelve. */
  input:not([type="checkbox"]):not([type="radio"]), textarea, select { font-size: 16px; }

  /* Cada renglón del kardex se apila. */
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; left: -9999px; }
  tbody tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  tbody tr:last-child { border-bottom: 0; }
  tbody tr:hover { background: none; }
  td { border: none; padding: 3px 0; display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
  td::before { content: attr(data-label); flex: 0 0 auto; color: var(--text-2); font-size: var(--fs-sm); font-weight: 400; letter-spacing: 0; }
  td.name { display: block; padding-bottom: 6px; }
  td.name::before, td.row-actions::before { display: none; }
  td.row-actions { justify-content: flex-end; }
  td.num { text-align: right; }
  .variant-row { grid-template-columns: 1fr; }
}
