/* Helio Contable — overlay escáner de barras */
#barcode-scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 16px;
}
#barcode-scanner-overlay[hidden] {
  display: none !important;
}
.bcs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
}
.bcs-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 16px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.bcs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}
.bcs-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
}
.bcs-close {
  font-size: 1.4rem;
  line-height: 1;
  color: #94a3b8 !important;
  min-width: 36px;
}
.bcs-video-wrap {
  position: relative;
  margin: 0 16px;
  border-radius: 12px;
  overflow: hidden;
  background: #020617;
  aspect-ratio: 4 / 3;
}
.bcs-video-wrap video,
.bcs-video-wrap #bcs-preview,
.bcs-video-wrap #bcs-reader,
.bcs-video-wrap #bcs-reader video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #020617;
}
.bcs-video-wrap #bcs-preview {
  position: absolute;
  inset: 0;
}
.bcs-photo-ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  background: linear-gradient(180deg, #020617 0%, #0f172a 100%);
  text-align: center;
}
.bcs-photo-ui[hidden] {
  display: none !important;
}
.bcs-photo-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  margin-bottom: 4px;
}
.bcs-photo-icon svg {
  width: 32px;
  height: 32px;
}
.bcs-photo-primary {
  min-height: 44px;
  padding: 0 18px !important;
  border-radius: 10px;
  border: 0;
  background: #2563eb;
  color: #fff !important;
  font-weight: 700;
}
.bcs-photo-ui .btn-secondary {
  min-height: 40px;
}
.bcs-video-wrap #bcs-reader {
  position: absolute;
  inset: 0;
}
.bcs-frame {
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(78%, 300px);
  height: min(42%, 150px);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(59, 130, 246, 0.95);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.35);
}
.bcs-status {
  margin: 12px 16px 0;
  font-size: 0.84rem;
  color: #94a3b8;
  min-height: 1.3em;
}
.bcs-status.bcs-error {
  color: #fca5a5;
}
.bcs-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 16px 16px;
}
.bcs-actions .btn {
  min-height: 38px;
}

/* Campo barras + botón cámara */
.field-with-scan {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.field-with-scan input {
  flex: 1;
  min-width: 0;
}
.btn-scan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 12px !important;
  min-width: 44px;
}
.btn-scan svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.pos-suggest {
  margin-top: 8px;
  display: grid;
  gap: 4px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.pos-suggest[hidden] { display: none !important; }
.pos-suggest-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}
.pos-suggest-item:last-child { border-bottom: 0; }
.pos-suggest-item:hover { background: #eff6ff; }
.pos-suggest-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #0f172a;
}
.pos-suggest-meta {
  grid-column: 1;
  font-size: 0.72rem;
  color: #64748b;
}
.pos-suggest-price {
  grid-row: 1 / span 2;
  align-self: center;
  font-weight: 800;
  color: #1d4ed8;
}
.pos-scan-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.pos-scan-row .pos-scan-input {
  flex: 1;
  min-width: 0;
}
.pos-scan-row .btn-scan {
  align-self: stretch;
  border-radius: var(--radius);
  border: 2px solid var(--brand);
  background: var(--brand);
  color: #fff !important;
  font-weight: 700;
  padding: 0 16px !important;
}
.pos-scan-row .btn-scan:hover {
  filter: brightness(1.06);
}

@media (max-width: 900px) {
  #barcode-scanner-overlay { padding: 8px; align-items: end; }
  .bcs-card { width: 100%; border-radius: 16px 16px 0 0; }
  .bcs-video-wrap { margin: 0 12px; }
}
