:root {
  --fondo: #f4f6f9;
  --superficie: #ffffff;
  --borde: #dce2ec;
  --texto: #1e293b;
  --texto-suave: #64748b;
  --primario: #0f62fe;
  --primario-hover: #0353e9;
  --peligro: #dc2626;
  --peligro-hover: #b91c1c;
  --exito-fondo: #ecfdf5;
  --exito-texto: #065f46;
  --error-fondo: #fef2f2;
  --error-texto: #991b1b;
  --radio: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--fondo);
  color: var(--texto);
  line-height: 1.45;
}

.oculto {
  display: none !important;
}

.contenedor {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Login */
.cuerpo-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.tarjeta-login {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 32px 26px;
  width: 100%;
  max-width: 410px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.tarjeta-login-google {
  text-align: center;
}

.icono-candado-envoltura {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #eff6ff;
  color: var(--primario);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.icono-candado-svg {
  width: 24px;
  height: 24px;
}

.login-titulo {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--texto);
}

.login-descripcion {
  font-size: 0.92rem;
  color: var(--texto-suave);
  margin: 0 0 22px;
  line-height: 1.5;
}

.boton-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--texto);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.boton-google:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.logo-google-svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.login-pie {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--borde);
  font-size: 0.8rem;
  color: var(--texto-suave);
  line-height: 1.45;
}

.marca-cabecera,
.marca-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.marca-cabecera {
  margin-bottom: 20px;
}

.icono-marca {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primario);
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.marca-cabecera h1,
.marca-inline h1 {
  font-size: 1.15rem;
  margin: 0;
}

.subtitulo {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--texto-suave);
}

/* Barra superior */
.barra-superior {
  background: var(--superficie);
  border-bottom: 1px solid var(--borde);
  position: sticky;
  top: 0;
  z-index: 20;
}

.barra-contenido {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.insignia-contador {
  font-size: 0.8rem;
  color: var(--texto-suave);
}

.acciones-barra {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-inline {
  margin: 0;
}

.principal {
  padding-top: 20px;
  padding-bottom: 48px;
}

/* Formularios y botones */
.formulario-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--texto);
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--borde);
  border-radius: 8px;
  background: #fff;
  color: var(--texto);
}

input:focus {
  outline: 2px solid var(--primario);
  border-color: transparent;
}

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease;
}

.boton-chico {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.boton-ancho {
  width: 100%;
  margin-top: 6px;
}

.boton-primario {
  background: var(--primario);
  color: #fff;
}

.boton-primario:hover {
  background: var(--primario-hover);
}

.boton-secundario {
  background: #fff;
  border-color: var(--borde);
  color: var(--texto);
}

.boton-secundario:hover {
  background: #f1f5f9;
}

.boton-peligro {
  background: var(--peligro);
  color: #fff;
}

.boton-peligro:hover {
  background: var(--peligro-hover);
}

.boton-icono {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--texto-suave);
  padding: 4px 8px;
}

/* Alertas */
.alerta {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.alerta-error {
  background: var(--error-fondo);
  color: var(--error-texto);
  border: 1px solid #fecaca;
}

.alerta-exito {
  background: var(--exito-fondo);
  color: var(--exito-texto);
  border: 1px solid #a7f3d0;
}

/* Recuadro de estado Google Drive */
.recuadro-drive {
  border-radius: var(--radio);
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--borde);
  background: var(--superficie);
}

.recuadro-drive-pendiente {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.recuadro-drive-ok {
  background: var(--exito-fondo);
  border-color: #a7f3d0;
  color: var(--exito-texto);
}

.drive-estado-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.drive-estado-texto {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9rem;
}

.drive-estado-acciones {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

a.boton {
  text-decoration: none;
}

/* Panel de carga */
.panel-tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.cabecera-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.cabecera-panel h2,
.cabecera-panel h3 {
  margin: 0;
  font-size: 1.1rem;
}

.fila-codigo {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.campo-flexible {
  flex: 1 1 220px;
}

.acciones-escaner {
  flex: 0 0 auto;
}

.caja-escaner {
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 12px;
  background: #0f172a;
  color: #fff;
}

.escaner-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.visor-video-envoltura {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
}

#video-escaner {
  width: 100%;
  display: block;
  max-height: 260px;
  object-fit: cover;
}

.guia-laser {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: 2px;
  background: rgba(239, 68, 68, 0.85);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.9);
  pointer-events: none;
}

.vista-previa-caja {
  text-align: center;
  background: #f8fafc;
  border: 1px dashed var(--borde);
  border-radius: 8px;
  padding: 10px;
}

.vista-previa-caja img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 6px;
  object-fit: contain;
}

.acciones-formulario {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* Buscador y grilla */
.barra-busqueda {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.estado-vacio {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 36px 20px;
  text-align: center;
  color: var(--texto-suave);
}

.grilla-tarjetas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 14px;
}

.tarjeta-item {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tarjeta-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.miniatura-envoltura {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--borde);
}

.miniatura-envoltura img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tarjeta-info {
  padding: 10px 12px;
}

.codigo-monoespacio {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--texto-suave);
  margin: 0 0 4px;
  word-break: break-all;
}

.nombre-articulo {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Modal */
.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-caja {
  background: var(--superficie);
  border-radius: var(--radio);
  max-width: 520px;
  width: 100%;
  padding: 20px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
}

.modal-imagen-envoltura {
  background: #f8fafc;
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  margin-bottom: 16px;
}

.modal-imagen-envoltura img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.modal-acciones {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.confirmacion-borrado {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--error-fondo);
  color: var(--error-texto);
  border: 1px solid #fecaca;
}

.confirmacion-borrado p {
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.acciones-confirmacion {
  display: flex;
  gap: 10px;
}
