/*
 * Consola central de Zynora.
 * Dirección: la misma base del panel del equipo (admin.zynoratek.com,
 * docs/diseno/sistema-base.md): tema claro, un acento #002e5d, Geist 400/600,
 * neutros fríos, retícula de 8 px. Verde, ámbar y rojo solo para estados.
 */
@font-face {
  font-family: 'Geist';
  src: url('fuentes/geist-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
  font-family: 'Geist';
  src: url('fuentes/geist-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --bg-soft: #f3f5f8;
  --bg-card-hover: #f8f9fb;
  --border: #e6e9ef;
  --border-strong: #d5dae3;
  --text: #14202e;
  --text-muted: #4b5869;
  --text-dim: #5f6b7c;
  --accent: #002e5d;
  --accent-soft: #e8f1fc;
  --accent-strong: #0b3f78;
  --on-accent: #ffffff;
  --success: #17804a;
  --success-soft: #e5f4ec;
  --success-strong: #0f5c34;
  --warning: #a86200;
  --warning-soft: #fdf1e0;
  --warning-strong: #7a4700;
  --danger: #c2352b;
  --danger-soft: #fbe9e7;
  --danger-strong: #8f241c;
  --overlay: rgba(16, 32, 56, 0.32);

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.875rem;
  --fs-lg: 1rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.5rem;
  --lh-tight: 1.2;
  --lh-base: 1.45;
  --fw-normal: 400;
  --fw-strong: 600;

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  --e-1: 0 1px 2px rgba(16, 32, 56, 0.06);
  --e-2: 0 8px 24px rgba(16, 32, 56, 0.1), 0 2px 6px rgba(16, 32, 56, 0.05);
  --e-3: 0 24px 64px rgba(16, 32, 56, 0.18), 0 4px 12px rgba(16, 32, 56, 0.06);

  --t-fast: 120ms;
  --t-base: 180ms;
  --t-slow: 240ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  --ring: 0 0 0 3px rgba(0, 46, 93, 0.18);
  --h-control: 36px;
  --h-control-sm: 32px;
  --borde-campo: #8a94a3;
  --ancho-max: 1440px;
  --lateral: 248px;

  --z-sticky: 10;
  --z-menu: 30;
  --z-toast: 80;
  --z-dialog: 100;
}

@media (pointer: coarse), (max-width: 767px) {
  :root {
    --h-control: 44px;
    --h-control-sm: 44px;
  }
}
@media (max-width: 767px) {
  :root {
    --fs-xs: 0.8125rem;
    --fs-sm: 0.875rem;
    --fs-md: 1rem;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-strong);
  line-height: var(--lh-tight);
}
h2 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-strong);
}
h3 {
  font-size: var(--fs-md);
  font-weight: var(--fw-strong);
}
a {
  color: var(--accent-strong);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.oculto-visual {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[hidden] {
  display: none !important;
}

/* ---------- Armazón ---------- */
.armazon {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--lateral) minmax(0, 1fr);
}
.lateral {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: var(--s-5) var(--s-4);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
}
.marca {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-2);
  font-weight: var(--fw-strong);
  font-size: var(--fs-lg);
  color: var(--text);
  text-decoration: none;
}
.marca-sello {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-md);
}
.marca small {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-normal);
  color: var(--text-dim);
}
.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-2);
}
.menu a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--h-control);
  padding: 0 var(--s-3);
  border-radius: var(--r-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: var(--fw-normal);
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.menu a:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.menu a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: var(--fw-strong);
}
.menu svg {
  width: 20px;
  height: 20px;
  flex: none;
}
.lateral-pie {
  margin-top: auto;
  display: grid;
  gap: var(--s-2);
  padding: var(--s-3);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.lateral-pie strong {
  color: var(--text);
  font-weight: var(--fw-strong);
}
.barra-movil {
  display: none;
}
.principal {
  min-width: 0;
  padding: var(--s-6) var(--s-6) var(--s-7);
}
.contenedor {
  max-width: var(--ancho-max);
  margin: 0 auto;
  display: grid;
  gap: var(--s-5);
}
.encabezado {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
}
.encabezado p {
  margin-top: var(--s-1);
  color: var(--text-muted);
}
.migas {
  display: flex;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--text-dim);
  margin-bottom: var(--s-2);
}
.migas {
  align-items: center;
}
.migas a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-muted);
}

/* ---------- Controles ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--h-control);
  padding: 0 var(--s-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-weight: var(--fw-strong);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled,
.btn[aria-busy='true'] {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primario {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primario:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.btn-fantasma {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}
.btn-fantasma:hover {
  background: var(--accent-soft);
  border-color: transparent;
}
.btn-peligro {
  color: var(--danger-strong);
  border-color: var(--danger-soft);
}
.btn-peligro:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.btn-peligro-lleno {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-peligro-lleno:hover {
  background: var(--danger-strong);
}
.btn-chico {
  min-height: var(--h-control-sm);
  padding: 0 var(--s-3);
  font-size: var(--fs-sm);
}
.btn svg {
  width: 18px;
  height: 18px;
}
.campo {
  display: grid;
  gap: var(--s-1);
  min-width: 0;
}
.campo > label,
.campo > .etiqueta {
  font-size: var(--fs-sm);
  font-weight: var(--fw-strong);
  color: var(--text);
}
.campo .obligatorio {
  color: var(--danger-strong);
  font-weight: var(--fw-normal);
}
.entrada {
  width: 100%;
  min-height: var(--h-control);
  padding: 0 var(--s-3);
  border: 1px solid var(--borde-campo);
  border-radius: var(--r-md);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
textarea.entrada {
  min-height: 96px;
  padding: var(--s-2) var(--s-3);
  resize: vertical;
}
.entrada:hover {
  border-color: var(--text-dim);
}
.entrada:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.entrada[aria-invalid='true'] {
  border-color: var(--danger);
}
.entrada:disabled {
  background: var(--bg-soft);
  color: var(--text-muted);
}
.entrada-color {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}
.entrada-color input[type='color'] {
  flex: none;
  width: max(var(--h-control), 44px);
  height: var(--h-control);
  padding: 2px;
  font-size: 16px;
  border: 1px solid var(--borde-campo);
  border-radius: var(--r-md);
  background: var(--bg-card);
}
.con-unidad {
  display: flex;
  align-items: stretch;
}
.con-unidad .entrada {
  flex: 1 1 auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.con-unidad span {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 0 var(--s-3);
  border: 1px solid var(--borde-campo);
  border-left: 0;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.ayuda {
  font-size: var(--fs-sm);
  color: var(--text-dim);
}
.error-campo {
  font-size: var(--fs-sm);
  color: var(--danger-strong);
}
.interruptor {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--h-control);
}
.interruptor input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

/* ---------- Bloques ---------- */
.tarjeta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--e-1);
  padding: var(--s-5);
  min-width: 0;
}
.tarjeta-cabeza {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.tarjeta-cabeza p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.rejilla-kpi {
  display: grid;
  grid-template-columns: 2fr repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
}
.kpi {
  display: grid;
  gap: var(--s-2);
  align-content: start;
}
.kpi-titulo {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.kpi-valor {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-strong);
  line-height: var(--lh-tight);
}
.kpi-principal .kpi-valor {
  font-size: var(--fs-3xl);
  color: var(--accent);
}
.kpi-nota {
  font-size: var(--fs-sm);
  color: var(--text-dim);
}
.dos-columnas {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: var(--s-5);
  align-items: start;
}
.dos-columnas.parejas {
  align-items: stretch;
}
.pila {
  display: grid;
  gap: var(--s-5);
  min-width: 0;
}

.insignia {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px var(--s-2);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-strong);
  white-space: nowrap;
  background: var(--bg-soft);
  color: var(--text-muted);
}
.insignia::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.insignia-verde {
  background: var(--success-soft);
  color: var(--success-strong);
}
.insignia-ambar {
  background: var(--warning-soft);
  color: var(--warning-strong);
}
.insignia-rojo {
  background: var(--danger-soft);
  color: var(--danger-strong);
}
.insignia-azul {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ---------- Tablas ---------- */
.tabla-caja {
  overflow-x: auto;
  margin: 0 calc(var(--s-5) * -1);
  padding: 0 var(--s-5);
}
.tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
.tabla th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: var(--fw-strong);
  color: var(--text-muted);
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tabla td {
  padding: 10px var(--s-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tabla td + td {
  white-space: nowrap;
}
.tabla td:first-child {
  min-width: 200px;
}
.acciones-admin {
  margin-top: var(--s-4);
}
.tabla tr:last-child td {
  border-bottom: 0;
}
.tabla tbody tr {
  transition: background var(--t-fast) var(--ease-out);
}
.tabla tbody tr[data-ir]:hover {
  background: var(--bg-card-hover);
  cursor: pointer;
}
.tabla .num {
  text-align: right;
  white-space: nowrap;
}
.tabla a.fila-enlace {
  color: var(--text);
  font-weight: var(--fw-strong);
  text-decoration: none;
}
.tabla a.fila-enlace:hover {
  text-decoration: underline;
}
.sub {
  display: block;
  color: var(--text-dim);
  font-size: var(--fs-sm);
  font-weight: var(--fw-normal);
}
.lista-movil {
  display: none;
}

/* ---------- Filtros ---------- */
.filtros {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: end;
}
.filtros .campo {
  min-width: 200px;
}
.filtros .buscar {
  flex: 1 1 260px;
}
.pestanas {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.pestanas a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--h-control);
  padding: 0 var(--s-4);
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.pestanas a[aria-current='page'] {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
  font-weight: var(--fw-strong);
}
.pestanas .cuenta {
  font-size: var(--fs-xs);
  color: var(--text-dim);
}

/* ---------- Ficha ---------- */
.ficha-cabeza {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: center;
  justify-content: space-between;
}
.ficha-titulo {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-width: 0;
}
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: var(--fw-strong);
  font-size: var(--fs-lg);
}
.ficha-titulo h1 {
  overflow-wrap: anywhere;
}
.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.grupo + .grupo {
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--border);
}
.grupo h3 {
  margin-bottom: var(--s-3);
}
.datos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-4) var(--s-5);
  margin: 0;
}
.datos div {
  min-width: 0;
}
.datos dt {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.datos dd {
  margin: 2px 0 0;
  font-weight: var(--fw-strong);
  overflow-wrap: anywhere;
}
.datos dd.vacio {
  color: var(--text-dim);
  font-weight: var(--fw-normal);
}
.muestra-color {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  vertical-align: -2px;
  margin-right: var(--s-2);
}
.formulario {
  display: grid;
  gap: var(--s-5);
}
.formulario fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.formulario legend {
  font-weight: var(--fw-strong);
  font-size: var(--fs-lg);
  padding: 0;
  margin-bottom: var(--s-3);
}
.rejilla-form {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-4);
}
.rejilla-form .ancho {
  grid-column: 1 / -1;
}
.pie-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  justify-content: flex-end;
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
}
.lista-editable {
  display: grid;
  gap: var(--s-3);
}
.lista-editable .renglon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) auto;
  gap: var(--s-3);
  align-items: end;
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-soft);
}

.linea-tiempo {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-4);
}
.linea-tiempo li {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: var(--s-3);
}
.linea-tiempo .punto {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--border-strong);
}
.linea-tiempo .punto.ok {
  background: var(--success);
}
.linea-tiempo .punto.mal {
  background: var(--danger);
}
.linea-tiempo time {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-dim);
}

/* ---------- Avisos, vacío, carga ---------- */
.aviso {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger-strong);
}
.aviso-ambar {
  background: var(--warning-soft);
  color: var(--warning-strong);
}
.aviso-verde {
  background: var(--success-soft);
  color: var(--success-strong);
}
.aviso .acciones {
  margin-left: auto;
}
.vacio {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-7) var(--s-4);
  text-align: center;
  color: var(--text-muted);
}
.vacio h2 {
  color: var(--text);
}
.vacio p {
  max-width: 44ch;
}
.esqueleto {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg-soft), var(--border), var(--bg-soft));
  background-size: 200% 100%;
  animation: brillo 1.2s linear infinite;
  min-height: 16px;
}
.esqueleto + .esqueleto {
  margin-top: var(--s-3);
}
.esq-0 { width: 90%; }
.esq-1 { width: 76%; }
.esq-2 { width: 62%; }
.esq-3 { width: 48%; }
@keyframes brillo {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Diálogo y avisos flotantes ---------- */
dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  border: 0;
  border-radius: var(--r-xl);
  padding: var(--s-5);
  box-shadow: var(--e-3);
  color: var(--text);
}
dialog::backdrop {
  background: var(--overlay);
}
dialog .formulario {
  gap: var(--s-4);
}
.flotantes {
  position: fixed;
  right: var(--s-5);
  bottom: var(--s-5);
  z-index: var(--z-toast);
  display: grid;
  gap: var(--s-2);
}
.flotante {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--text);
  color: #fff;
  box-shadow: var(--e-2);
  max-width: 420px;
  animation: entrar var(--t-base) var(--ease-out);
}
.flotante.mal {
  background: var(--danger-strong);
}
@keyframes entrar {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Productos ---------- */
.rejilla-productos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--s-4);
}
.producto {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
  align-content: start;
}
.producto-cabeza {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  align-items: flex-start;
}
.producto-cabeza > div {
  min-width: 0;
}

.producto-cifras {
  display: flex;
  gap: var(--s-5);
}
.producto-cifras strong {
  display: block;
  font-size: var(--fs-xl);
}
.producto-cifras span {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.chip {
  padding: 2px var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  background: var(--bg-soft);
}
.campos-producto {
  display: grid;
  gap: var(--s-1);
  font-size: var(--fs-sm);
}
.campos-producto div {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-1) 0;
  border-bottom: 1px dashed var(--border);
}
.campos-producto div:last-child {
  border-bottom: 0;
}
.campos-producto span:last-child {
  color: var(--text-dim);
  white-space: nowrap;
}

/* ---------- Éxito ---------- */
.exito {
  display: grid;
  justify-items: center;
  gap: var(--s-4);
  padding: var(--s-7) var(--s-4);
  text-align: center;
}
.exito-sello {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success-strong);
}
.exito-sello svg {
  width: 32px;
  height: 32px;
}
.exito .datos {
  width: min(560px, 100%);
  text-align: left;
  padding: var(--s-4);
  border-radius: var(--r-lg);
  background: var(--bg-soft);
}

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s-5);
}
.login .tarjeta {
  width: min(420px, 100%);
  padding: var(--s-6);
  display: grid;
  gap: var(--s-5);
}
.login .marca {
  padding: 0;
}
.qr-texto {
  font-family: ui-monospace, 'Cascadia Mono', monospace;
  font-size: var(--fs-sm);
  word-break: break-all;
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--bg-soft);
}

/* ---------- Pantallas medianas ---------- */
@media (max-width: 1279px) {
  .rejilla-kpi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dos-columnas {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Teléfono y tablet vertical ---------- */
@media (max-width: 1023px) {
  .armazon {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-content: start;
  }
  .lateral {
    position: fixed;
    inset: 0;
    z-index: var(--z-menu);
    width: 100%;
    height: 100%;
    border-right: 0;
    padding-top: var(--s-4);
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--ease-out);
    visibility: hidden;
  }
  .lateral.abierta {
    transform: none;
    visibility: visible;
  }
  .lateral .menu a {
    min-height: 48px;
    font-size: var(--fs-lg);
  }
  .lateral .marca,
  .lateral .cerrar-menu,
  .lateral-pie .btn {
    min-height: 48px;
  }
  .producto {
    gap: var(--s-2);
  }
  .producto-cifras {
    gap: var(--s-4);
  }
  .producto-cifras div {
    display: flex;
    align-items: baseline;
    gap: var(--s-1);
  }
  .producto-cifras strong {
    font-size: var(--fs-lg);
  }

  .producto-cabeza > div {
    min-width: 0;
  }
  .producto .acciones .btn-fantasma {
    padding: 0 var(--s-2);
  }
  .barra-movil {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    min-height: 56px;
    padding: 0 var(--s-4);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
  }
  .barra-movil .marca {
    padding: 0;
  }
  .cerrar-menu {
    align-self: flex-end;
  }
  .principal {
    padding: var(--s-5) var(--s-4) var(--s-7);
  }
  body.menu-abierto {
    overflow: hidden;
  }
}
@media (min-width: 1024px) {
  .cerrar-menu {
    display: none;
  }
}
@media (max-width: 767px) {
  body {
    font-size: var(--fs-lg);
  }
  h1 {
    font-size: var(--fs-xl);
  }
  .entrada {
    font-size: var(--fs-lg);
  }
  .rejilla-kpi {
    grid-template-columns: minmax(0, 1fr);
  }
  .kpi-principal .kpi-valor {
    font-size: var(--fs-2xl);
  }
  .tarjeta {
    padding: var(--s-4);
  }
  .tabla-caja {
    margin: 0 calc(var(--s-4) * -1);
    padding: 0 var(--s-4);
  }
  .tabla-escritorio {
    display: none;
  }
  .lista-movil {
    display: grid;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .lista-movil li + li {
    border-top: 1px solid var(--border);
  }
  .lista-movil a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--s-1) var(--s-3);
    padding: var(--s-3) 0;
    min-height: 56px;
    color: var(--text);
    text-decoration: none;
  }
  .lista-movil .titulo {
    font-weight: var(--fw-strong);
    overflow-wrap: anywhere;
  }
  .lista-movil .detalle {
    grid-column: 1 / -1;
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }
  .encabezado .btn-primario,
  .pie-form .btn {
    width: 100%;
  }
  .filtros .campo {
    min-width: 0;
    flex: 1 1 100%;
  }
  .datos {
    grid-template-columns: minmax(0, 1fr);
  }
  .dos-columnas,
  .pila {
    gap: var(--s-4);
  }
  .flotantes {
    left: var(--s-4);
    right: var(--s-4);
    bottom: var(--s-4);
  }
  dialog {
    margin: auto 0 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .producto-cifras {
    gap: var(--s-4);
  }
  .rejilla-productos {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Ajustes de vistas ---------- */
.datos .ancho-completo {
  grid-column: 1 / -1;
}
.datos-una {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-3);
  margin-top: var(--s-3);
}
.separador {
  height: var(--s-4);
}
.cuenta-resultados {
  margin-bottom: var(--s-2);
}
.titulo-seccion {
  font-size: var(--fs-lg);
  margin-bottom: var(--s-3);
}
.login-titulo {
  margin-top: var(--s-5);
  font-size: var(--fs-xl);
}
.detalles summary {
  font-size: 0.875rem;
  min-height: var(--h-control-sm);
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: var(--fw-strong);
}
.detalles[open] summary {
  margin-bottom: var(--s-2);
}
.grupo-titulo {
  margin-top: var(--s-3);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.lista-movil.lista-siempre {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
}
.lista-siempre li + li {
  border-top: 1px solid var(--border);
}
.lista-siempre a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-1) var(--s-3);
  padding: var(--s-3) 0;
  color: var(--text);
  text-decoration: none;
}
.lista-siempre .titulo {
  font-weight: var(--fw-strong);
}
.lista-siempre .detalle {
  grid-column: 1 / -1;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.encabezado .campo {
  min-width: 180px;
}
.datos dd.sin-dato {
  color: var(--text-dim);
  font-weight: var(--fw-normal);
}
.separado {
  margin-top: var(--s-4);
}
.grupo-casillas {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  align-content: start;
}
.grupo-casillas legend {
  padding: 0;
  margin-bottom: var(--s-1);
}
.lateral-pie .acciones {
  gap: var(--s-2);
}
.lateral-pie .acciones .btn {
  flex: 1 1 auto;
}

.migas a {
  min-width: 44px;
  justify-content: center;
}
@media (max-width: 1023px) {
  .lateral-pie .btn {
    font-size: var(--fs-lg);
  }
}

@media (max-width: 767px) {
  .ficha-cabeza .acciones {
    width: 100%;
  }
  .ficha-cabeza .acciones .btn {
    flex: 1 1 100%;
  }
}

.correo-boton {
  display: none;
}
@media (max-width: 767px) {
  .correo-texto {
    display: none;
  }
  .correo-boton {
    display: inline-flex;
  }
}
