/* =============================================================
   Escáner de Membranas RO — United
   Paleta: blanco + Rojo RGB(192,0,0)
   ============================================================= */

:root {
  --rojo: rgb(192, 0, 0);
  --rojo-osc: rgb(150, 0, 0);
  --rojo-cla: rgb(224, 60, 60);
  --rojo-10: rgba(192, 0, 0, .10);
  --rojo-06: rgba(192, 0, 0, .06);
  --rojo-30: rgba(192, 0, 0, .30);

  --blanco: #ffffff;
  --gris-01: #fafafa;
  --gris-05: #f2f3f5;
  --gris-10: #e6e8ec;
  --gris-30: #b9bec7;
  --gris-60: #6b7280;
  --tinta: #1b1d21;

  --ok: #1a8a4a;
  --ok-bg: #e7f6ed;
  --alerta: #b8860b;
  --alerta-bg: #fdf5e0;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --sombra: 0 1px 2px rgba(16, 18, 22, .06), 0 8px 24px rgba(16, 18, 22, .07);
  --sombra-alta: 0 12px 40px rgba(192, 0, 0, .16);

  --cab: 62px;
  --gutter: 16px;
  --maxw: 1240px;

  --ff: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset ---------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--ff);
  color: var(--tinta);
  background: var(--blanco);
  line-height: 1.5;
  overflow-x: hidden;              /* nunca scroll horizontal de página */
  -webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--rojo); }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.18; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.55rem, 4.6vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.25rem, 3.4vw, 1.9rem); font-weight: 750; letter-spacing: -.01em; }
h3 { font-size: clamp(1.02rem, 2.4vw, 1.2rem); font-weight: 700; }
p  { margin: 0 0 1em; }

.oculto { display: none !important; }
.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;
}

/* ---------- Layout --------------------------------------------------- */

.contenedor {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.seccion { padding-block: clamp(32px, 6vw, 68px); }
.seccion--gris { background: var(--gris-01); border-block: 1px solid var(--gris-10); }

/* ---------- Cabecera ------------------------------------------------- */

.cabecera {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 3px solid var(--rojo);
}

.cabecera__int {
  min-height: var(--cab);
  display: flex; align-items: center; gap: 12px;
  max-width: var(--maxw); margin-inline: auto;
  padding: 8px var(--gutter);
}

.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.marca img { height: 26px; width: auto; flex: 0 0 auto; }
.marca__txt { min-width: 0; overflow: hidden; }
.marca__t1 {
  display: block; font-weight: 800; font-size: .88rem; letter-spacing: -.01em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.marca__t2 { display: none; font-size: .72rem; color: var(--gris-60); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cabecera__acc { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.admin-txt { display: none; }
.admin-txt-sm { display: inline; }

/* ---------- Botones -------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1.5px solid transparent; border-radius: 999px;
  font-weight: 650; font-size: .92rem; text-decoration: none;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--rojo-30); outline-offset: 2px; }

.btn--rojo { background: var(--rojo); color: #fff; box-shadow: 0 6px 18px rgba(192, 0, 0, .22); }
.btn--rojo:hover { background: var(--rojo-osc); }
.btn--linea { background: #fff; color: var(--rojo); border-color: var(--rojo); }
.btn--linea:hover { background: var(--rojo-06); }
.btn--gris { background: #fff; color: var(--tinta); border-color: var(--gris-30); }
.btn--gris:hover { background: var(--gris-05); }
.btn--sm { min-height: 38px; padding: 7px 14px; font-size: .84rem; }
.btn--bloque { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Hero (parallax) ------------------------------------------ */

.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #fff 0%, #fff 48%, var(--rojo-06) 100%);
  border-bottom: 1px solid var(--gris-10);
}
.hero__int {
  max-width: var(--maxw); margin-inline: auto;
  padding: clamp(34px, 7vw, 76px) var(--gutter) clamp(28px, 5vw, 56px);
  display: grid; gap: clamp(22px, 4vw, 44px);
  grid-template-columns: 1fr;
  align-items: center;
}
.hero__kicker {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--rojo-10); color: var(--rojo-osc);
  border-radius: 999px; padding: 6px 14px;
  font-size: .76rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 14px;
}
.hero__sub { font-size: clamp(.98rem, 2.2vw, 1.1rem); color: var(--gris-60); max-width: 56ch; }
.hero__acc { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.hero__fig {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  background: #fff; border: 1px solid var(--gris-10); box-shadow: var(--sombra);
  will-change: transform;
}
.hero__fig img { width: 100%; }

/* ---------- Tarjetas ------------------------------------------------- */

.tarjeta {
  background: #fff; border: 1px solid var(--gris-10);
  border-radius: var(--r-md); box-shadow: var(--sombra);
  padding: clamp(16px, 3vw, 24px);
}

.rejilla { display: grid; gap: 16px; grid-template-columns: 1fr; }
.rejilla--2 { grid-template-columns: 1fr; }
.rejilla--3 { grid-template-columns: 1fr; }
.rejilla--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Selector de planta */
.planta-card {
  position: relative; text-align: left; width: 100%;
  background: #fff; border: 2px solid var(--gris-10); border-radius: var(--r-lg);
  padding: 0; overflow: hidden; box-shadow: var(--sombra);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.planta-card:hover, .planta-card:focus-visible { border-color: var(--rojo); box-shadow: var(--sombra-alta); }
.planta-card[aria-pressed="true"] { border-color: var(--rojo); box-shadow: var(--sombra-alta); }
.planta-card__img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--gris-05); }
.planta-card__img img { width: 100%; height: 100%; object-fit: cover; object-position: top center; will-change: transform; }
.planta-card__cuerpo { padding: 16px 18px 18px; }
.planta-card__t { font-size: 1.12rem; font-weight: 800; margin: 0 0 4px; }
.planta-card__d { font-size: .86rem; color: var(--gris-60); margin: 0; }
.planta-card__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.chip {
  display: inline-block; font-size: .72rem; font-weight: 650;
  padding: 4px 10px; border-radius: 999px;
  background: var(--gris-05); color: var(--gris-60); border: 1px solid var(--gris-10);
}
.chip--rojo { background: var(--rojo-10); color: var(--rojo-osc); border-color: var(--rojo-30); }
.chip--ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe4cd; }

/* ---------- Barra de herramientas del rack --------------------------- */

.rack-barra {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.rack-barra .crece { flex: 1 1 180px; min-width: 0; }

.leyenda { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 0; font-size: .78rem; color: var(--gris-60); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--gris-30); background: #fff; }
.leyenda i.lg-ok { background: var(--ok-bg); border-color: var(--ok); }
.leyenda i.lg-sel { background: var(--rojo); border-color: var(--rojo); }
.leyenda i.lg-par { background: var(--alerta-bg); border-color: var(--alerta); }

/* ---------- Diagrama del rack ---------------------------------------- */

.rack-marco {
  position: relative;
  border: 1px solid var(--gris-10); border-radius: var(--r-md);
  background:
    linear-gradient(90deg, var(--gris-01) 0 100%);
  overflow: hidden;
  touch-action: none;                 /* gestionamos el gesto nosotros */
  height: clamp(340px, 62vh, 620px);
  cursor: grab;
}
.rack-marco.arrastrando { cursor: grabbing; }
.rack-lienzo { transform-origin: 0 0; will-change: transform; }

.rack-svg { display: block; max-width: none; height: auto; }
.rack-rotulo-txt { font: 700 15px var(--ff); fill: var(--tinta); }

.vasija { cursor: pointer; }
.vasija .vasija-forma {
  fill: #fff; stroke: var(--gris-30); stroke-width: 1.5;
  transition: fill .15s ease, stroke .15s ease;
}
.vasija .vasija-txt { font: 650 12px var(--ff); fill: var(--tinta); pointer-events: none; user-select: none; }
.vasija:hover .vasija-forma { fill: var(--rojo-10); stroke: var(--rojo); }
.vasija:focus-visible { outline: none; }
.vasija:focus-visible .vasija-forma { stroke: var(--rojo); stroke-width: 3; }

.vasija.es-completo .vasija-forma { fill: var(--ok-bg); stroke: var(--ok); }
.vasija.es-parcial  .vasija-forma { fill: var(--alerta-bg); stroke: var(--alerta); }
.vasija.es-sel      .vasija-forma { fill: var(--rojo); stroke: var(--rojo-osc); stroke-width: 2.5; }
.vasija.es-sel      .vasija-txt   { fill: #fff; }
.vasija.es-resalte  .vasija-forma { stroke: var(--rojo); stroke-width: 3; }

.rack-zoom {
  position: absolute; right: 10px; bottom: 10px; z-index: 5;
  display: flex; flex-direction: column; gap: 6px;
}
.rack-zoom button {
  width: 42px; height: 42px; border-radius: 10px;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--gris-30);
  font-size: 1.1rem; font-weight: 700; color: var(--tinta);
  display: grid; place-items: center; box-shadow: var(--sombra);
}
.rack-zoom button:hover { border-color: var(--rojo); color: var(--rojo); }

.rack-pista {
  position: absolute; left: 10px; top: 10px; z-index: 5;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--gris-10);
  border-radius: 999px; padding: 5px 12px; font-size: .74rem; color: var(--gris-60);
  pointer-events: none;
}

/* ---------- Formularios ---------------------------------------------- */

.campo { display: block; margin-bottom: 14px; }
.campo > span, .campo-lbl {
  display: block; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--gris-60);
  margin-bottom: 6px;
}
.entrada, select.entrada, textarea.entrada {
  width: 100%; min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid var(--gris-30); border-radius: var(--r-sm);
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.entrada { min-height: 84px; resize: vertical; }
.entrada:focus { outline: none; border-color: var(--rojo); box-shadow: 0 0 0 3px var(--rojo-10); }
.entrada[readonly] { background: var(--gris-05); }

.campo-pass { position: relative; }
.campo-pass .entrada { padding-right: 52px; }
.campo-pass__ojo {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 42px; display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--r-sm); color: var(--gris-60);
}
.campo-pass__ojo:hover { color: var(--rojo); background: var(--rojo-06); }

.ayuda { font-size: .78rem; color: var(--gris-60); margin-top: -8px; margin-bottom: 14px; }
.error-txt { color: var(--rojo); font-size: .84rem; font-weight: 600; margin: 8px 0 0; }

/* ---------- Escaneo -------------------------------------------------- */

.escaner-cam {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  max-height: 58vh; background: #111; border-radius: var(--r-md); overflow: hidden;
}
.escaner-cam video { width: 100%; height: 100%; object-fit: cover; }
.escaner-mira {
  position: absolute; inset: 16% 8%;
  border: 2.5px solid rgba(255, 255, 255, .85); border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .38);
  pointer-events: none;
}
.escaner-mira::after {
  content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px;
  background: var(--rojo); box-shadow: 0 0 12px var(--rojo);
  animation: barrido 2.1s ease-in-out infinite;
}
@keyframes barrido { 0%,100% { top: 12%; } 50% { top: 88%; } }
.escaner-msj {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  background: rgba(0, 0, 0, .62); color: #fff;
  padding: 10px 14px; font-size: .84rem; text-align: center;
}

/* Lista de posiciones 7 → 1 */
.pos-lista { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pos-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center; gap: 10px;
  border: 1.5px solid var(--gris-10); border-radius: var(--r-sm);
  padding: 10px 12px; background: #fff;
  transition: border-color .15s ease, background .15s ease;
}
.pos-item.activa { border-color: var(--rojo); background: var(--rojo-06); box-shadow: 0 0 0 3px var(--rojo-10); }
.pos-item.lista-ok { border-color: var(--ok); background: var(--ok-bg); }
.pos-num {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 1rem; background: var(--gris-05); color: var(--tinta);
  border: 1.5px solid var(--gris-30);
}
.pos-item.activa   .pos-num { background: var(--rojo); color: #fff; border-color: var(--rojo); }
.pos-item.lista-ok .pos-num { background: var(--ok); color: #fff; border-color: var(--ok); }
.pos-datos { min-width: 0; }
.pos-serie { font-weight: 700; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .95rem; overflow-wrap: anywhere; }
.pos-modelo { font-size: .76rem; color: var(--gris-60); overflow-wrap: anywhere; }
.pos-acciones { display: flex; gap: 4px; flex: 0 0 auto; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--gris-10);
  background: #fff; display: grid; place-items: center; color: var(--gris-60);
}
.icon-btn:hover { border-color: var(--rojo); color: var(--rojo); }

.progreso { height: 8px; border-radius: 999px; background: var(--gris-10); overflow: hidden; margin: 6px 0 16px; }
.progreso > i { display: block; height: 100%; background: var(--rojo); width: 0; transition: width .35s ease; }

/* ---------- Modal ---------------------------------------------------- */

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(18, 20, 24, .55);
  padding: var(--gutter);
  overscroll-behavior: contain;
}
.modal__caja {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: #fff; border-radius: var(--r-lg); box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
  padding: clamp(18px, 4vw, 28px);
}
.modal__caja--ancho { max-width: 900px; }
.modal__cab { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal__cab h3 { margin: 0; flex: 1 1 auto; }
.modal__x { width: 38px; height: 38px; border: 0; background: var(--gris-05); border-radius: 50%; font-size: 1.1rem; color: var(--gris-60); flex: 0 0 auto; }
.modal__x:hover { background: var(--rojo-10); color: var(--rojo); }
.modal__pie { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal__pie .btn { flex: 1 1 140px; }

/* ---------- Tablas --------------------------------------------------- */

.tabla-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--gris-10); border-radius: var(--r-md); }
table.tabla { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 620px; }
table.tabla th, table.tabla td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gris-10); white-space: nowrap; }
table.tabla th { background: var(--gris-05); font-weight: 750; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gris-60); position: sticky; top: 0; z-index: 1; }
table.tabla tbody tr:hover { background: var(--rojo-06); }
table.tabla td.serie { font-family: ui-monospace, Consolas, monospace; }

/* ---------- Métricas ------------------------------------------------- */

.metricas { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metrica { background: #fff; border: 1px solid var(--gris-10); border-left: 4px solid var(--rojo); border-radius: var(--r-sm); padding: 14px 16px; }
.metrica__n { font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 800; line-height: 1.1; }
.metrica__l { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gris-60); font-weight: 650; }

/* ---------- Avisos --------------------------------------------------- */

.aviso { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); font-size: .86rem; margin-bottom: 14px; border: 1px solid; }
.aviso--info { background: var(--rojo-06); border-color: var(--rojo-30); color: var(--rojo-osc); }
.aviso--ok { background: var(--ok-bg); border-color: #bfe4cd; color: var(--ok); }
.aviso--alerta { background: var(--alerta-bg); border-color: #e8d49a; color: var(--alerta); }

.toast-zona { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--tinta); color: #fff; border-radius: 10px; padding: 12px 16px; font-size: .88rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: sube .25s ease; }
.toast--ok { background: var(--ok); }
.toast--err { background: var(--rojo); }
@keyframes sube { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Pestañas ------------------------------------------------- */

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--gris-10); margin-bottom: 20px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 12px 16px; margin-bottom: -2px; font-weight: 650; color: var(--gris-60); white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--rojo); border-bottom-color: var(--rojo); }

/* ---------- Secciones informativas (parallax) ------------------------ */

.info-fig {
  border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--gris-10); box-shadow: var(--sombra); background: #fff;
}
.info-fig img { width: 100%; will-change: transform; }

.pasos { counter-reset: paso; display: grid; gap: 14px; padding: 0; margin: 0; list-style: none; }
.pasos li { counter-increment: paso; position: relative; padding-left: 48px; }
.pasos li::before {
  content: counter(paso); position: absolute; left: 0; top: 0;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--rojo); color: #fff; font-weight: 800; font-size: .92rem;
  display: grid; place-items: center;
}
.pasos strong { display: block; }

/* Esquema de la vasija (7 membranas) */
.vasija-esq { display: flex; align-items: stretch; gap: 3px; overflow-x: auto; padding: 14px 4px; }
.vasija-esq__m {
  flex: 1 0 64px; min-width: 64px; border: 1.5px solid var(--gris-30); border-left: 5px solid var(--rojo);
  border-radius: 4px; padding: 8px 4px; text-align: center; background: #fff;
}
.vasija-esq__m.c5 { background: #eaf3fb; border-left-color: #2a6fa8; }
.vasija-esq__m.c6 { background: #fdeee9; border-left-color: var(--rojo); }
.vasija-esq__n { font-weight: 800; font-size: 1.05rem; }
.vasija-esq__t { font-size: .66rem; color: var(--gris-60); line-height: 1.25; }

/* ---------- Pie ------------------------------------------------------ */

.pie { background: var(--tinta); color: #cfd3da; padding: 28px 0; margin-top: 40px; font-size: .84rem; }
.pie__int { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.pie img { height: 26px; filter: brightness(0) invert(1); opacity: .85; }

/* ---------- Login ---------------------------------------------------- */

.login-pagina { min-height: 100dvh; display: grid; place-items: center; padding: var(--gutter); background: linear-gradient(150deg, #fff 0%, #fff 55%, var(--rojo-10) 100%); }
.login-caja { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--gris-10); border-top: 5px solid var(--rojo); border-radius: var(--r-lg); box-shadow: var(--sombra); padding: clamp(22px, 5vw, 34px); }
.login-caja img.logo { height: 34px; margin-bottom: 18px; }

/* ---------- Animación de entrada (GSAP hace fade-in) ----------------- */

.gsap-fade { opacity: 1; }
html.gsap-listo .gsap-fade { opacity: 0; }

/* =============================================================
   RESPONSIVE
   ============================================================= */

/* Móviles muy angostos */
@media (max-width: 767px) {
  #sesionChip { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 359px) {
  :root { --gutter: 12px; }
  .marca__t1 { font-size: .8rem; }
  .btn { padding: 10px 12px; font-size: .84rem; }
}

/* Teléfonos en horizontal / phablets */
@media (min-width: 480px) {
  .marca__t1 { font-size: .95rem; }
  .rejilla--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metricas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal__pie .btn { flex: 0 0 auto; }
}

/* Tablet vertical */
@media (min-width: 768px) {
  :root { --gutter: 24px; --cab: 70px; }
  .marca img { height: 34px; }
  .marca__t1 { font-size: 1.05rem; white-space: normal; }
  .marca__t2 { display: block; }
  .admin-txt { display: inline; }
  .admin-txt-sm { display: none; }
  .rejilla--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rejilla--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metricas { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pos-item { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .escaner-cam { aspect-ratio: 16 / 10; }
}

/* Tablet horizontal / laptop */
@media (min-width: 1024px) {
  .hero__int { grid-template-columns: 1.05fr .95fr; }
  .dos-col { display: grid; grid-template-columns: 1.35fr .65fr; gap: 24px; align-items: start; }
  .dos-col--inv { grid-template-columns: .65fr 1.35fr; }
  .pegado { position: sticky; top: calc(var(--cab) + 16px); }
  .rack-marco { height: clamp(420px, 68vh, 720px); }
}

/* Escritorio grande */
@media (min-width: 1440px) {
  :root { --maxw: 1360px; }
}

/* Pantallas bajas en horizontal (teléfono acostado) */
@media (max-height: 500px) and (orientation: landscape) {
  .cabecera { position: static; }
  .rack-marco { height: 74vh; }
  .escaner-cam { max-height: 70vh; aspect-ratio: 16 / 9; }
}

/* Accesibilidad: sin movimiento */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html.gsap-listo .gsap-fade { opacity: 1; }
}

/* Impresión */
@media print {
  .cabecera, .rack-zoom, .btn, .tabs, .pie { display: none !important; }
  .rack-marco { height: auto; overflow: visible; border: 0; }
  body { background: #fff; }
}
