/* Ventas Nubecol — shared layout, built on top of theme.css tokens */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  transition: background-color .2s ease, color .2s ease;
}

.screen {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 20px calc(40px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar / theme toggle ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.menu-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 48px;
  right: 0;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
}

.dropdown-menu.open {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.dropdown-item:hover,
.dropdown-item:active {
  background: var(--surface-muted);
}

.dropdown-item-danger {
  color: var(--accent);
}

.dropdown-info {
  min-width: 240px;
  max-width: 280px;
  padding: 14px;
  gap: 6px;
}

.dropdown-info-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.dropdown-info-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.dropdown-icon {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border-radius: 28px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ---------- Forms: pill inputs & buttons ---------- */

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 6px 6px;
}

.phone-row {
  display: flex;
  gap: 8px;
}

.phone-row .code-select {
  flex: 0 0 96px;
  width: auto;
  padding-left: 14px;
  padding-right: 8px;
}

.phone-row .pill-input:not(.code-select) {
  flex: 1;
  min-width: 0;
}

.pill-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.pill-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

.otp-code-input {
  text-align: center;
  letter-spacing: 8px;
  font-size: 20px;
  font-weight: 600;
}

/* input[type=date] es sensible a que le agranden el padding — sus
 * sub-campos (día/mes/año) internos se desbordan si se le quita espacio
 * de más. Solo se le da un pequeño margen al ícono, sin tocar el padding
 * del input. */
.pill-input[type="date"]::-webkit-calendar-picker-indicator {
  margin-left: 6px;
  cursor: pointer;
}

/* Los <select> pill usan una flecha propia (en vez de la nativa, que
 * queda pegada al borde redondeado de forma inconsistente entre
 * navegadores). */
select.pill-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236B7086' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 16px;
}

/* La flecha del select es una imagen de fondo (no puede leer variables
 * CSS), así que en modo oscuro se reemplaza por una versión clara. */
:root[data-theme="dark"] select.pill-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23A9AEC4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.input-with-action {
  position: relative;
}

.input-with-action .pill-input {
  padding-right: 52px;
}

.icon-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

/* Buscador: dos botones dentro del mismo input (borrar + escanear). */
.input-buscador .pill-input {
  padding-right: 92px;
}

.icon-btn-clear {
  right: 6px;
  width: 28px;
  height: 28px;
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Fila del botón principal de registrar venta + acceso directo a escanear,
 * para poder registrar el siguiente producto sin volver a subir a la
 * barra de búsqueda — la app está pensada para vender lo más rápido
 * posible. */
.registrar-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.registrar-row .btn {
  flex: 1;
}

.icon-btn-static {
  position: static;
  transform: none;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

.btn-accent {
  background: var(--accent);
  color: var(--primary-contrast);
}

.btn-primary:disabled,
.btn-accent:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -3px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.link-muted {
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: none;
  margin-top: 14px;
}

.link-primary {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Login page mascot / hero ---------- */

.hero {
  text-align: center;
  margin: 8px 0 28px;
}

.hero-mark {
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  border-radius: 28px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
}

.hero h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.hero p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

/* ---------- Sales page ---------- */

.qty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  border-radius: 999px;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.chip.selected {
  background: var(--surface-muted);
  color: var(--primary);
  border-color: var(--primary);
  border-width: 2px;
}

/* Carritos "enviados" (a delivery) se ven distintos de los "abiertos" en
   la lista de chips solo por el color del texto — el borde queda igual
   que un chip normal; el segundo renglón con el nombre del delivery ya
   es en sí mismo un indicador visual de que fue enviado. */
.chip-enviado {
  color: var(--primary);
}

/* Carrito actualmente abierto en pantalla: borde con el color secundario
   (mismo criterio que .btn-secondary) + check al inicio del chip. */
.chip-carrito.selected {
  border-color: var(--accent);
  border-width: 2px;
}

.chip-carrito-check {
  display: inline-flex;
  margin-right: 4px;
  color: var(--accent);
}

.divider {
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.product-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.product-thumb {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--bg-blush);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  overflow: hidden;
}

.list-item-thumb {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-blush);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--text-muted);
}

.list-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.product-info { flex: 1; min-width: 0; }
.product-info .name { font-weight: 600; font-size: 15px; }
.product-info .code { color: var(--text-muted); font-size: 12px; }
.product-info .price { color: var(--primary); font-weight: 700; font-size: 15px; margin-top: 2px; }

.section-label {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 6px 8px;
}

.spacer { flex: 1; }

/* ---------- CRUD: listas, badges, botones pequeños, checkbox ---------- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 18px;
}

.page-header h1 {
  font-size: 19px;
  margin: 0;
}

.btn-fab {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.list-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 32px 16px;
}

/* ---------- Reportes de ventas: filtros y resumen ---------- */

.filter-row {
  display: flex;
  gap: 8px;
}

.filter-row .field {
  flex: 1;
  margin-bottom: 0;
}

/* Versión compacta de .card para tarjetas de filtros (desde/hasta +
   selects/buscador + botón Filtrar) — mismo layout, menos alto: bajan el
   padding de la tarjeta, el alto de los inputs/label y el botón, que en
   la versión normal ocupan más de lo que hace falta para una tarjeta que
   el usuario suele mirar una sola vez antes de tocar "Filtrar". */
.card-filters {
  padding: 14px 18px;
  margin-bottom: 14px;
}

.card-filters .field {
  margin-bottom: 8px;
}

.card-filters .field label {
  font-size: 12px;
  margin: 0 4px 3px;
}

.card-filters .pill-input {
  padding: 10px 16px;
  font-size: 14px;
}

/* select.pill-input reserva 46px de padding-right para la flecha (regla
 * más abajo en este mismo archivo) — sin este override puntual, el
 * padding acortado de arriba se lo pisaría por especificidad y el texto
 * del select quedaría por debajo de la flecha. */
.card-filters select.pill-input {
  padding: 10px 46px 10px 16px;
}

.card-filters .btn {
  padding: 11px 20px;
  font-size: 14px;
  margin-top: 4px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.summary-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.summary-stat .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.summary-stat .stat-value {
  font-size: 17px;
  font-weight: 700;
}

/* Variante compacta — "Ventas del comercio"/"Mis ventas", donde el resumen
   es solo un dato de referencia rápida arriba de una lista/buscador que es
   lo que realmente importa en esa pantalla. */
.summary-grid-compact {
  gap: 8px;
  margin-bottom: 14px;
}

.summary-grid-compact .summary-stat {
  padding: 10px 12px;
  border-radius: 12px;
}

.summary-grid-compact .stat-label {
  font-size: 11px;
  margin-bottom: 2px;
}

.summary-grid-compact .stat-value {
  font-size: 15px;
}

.action-grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.action-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.action-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.action-grid-4 {
  grid-template-columns: repeat(2, 1fr);
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 8px;
  text-decoration: none;
  color: var(--text);
  text-align: center;
}

.action-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-card-label {
  font-size: 13px;
  font-weight: 600;
}

.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.list-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.list-item-title {
  font-weight: 600;
  font-size: 15px;
}

/* Filas plegables (Mis ventas / Ventas del comercio): <details>/<summary>
 * nativos, sin JS — el resumen (cliente/producto + total) siempre visible,
 * el resto (vendedor, dirección, líneas de producto) solo al desplegar. */
.list-details summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list-details summary::-webkit-details-marker,
.list-details summary::marker {
  display: none;
}

.list-details-chevron {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform .15s ease;
}

.list-details[open] .list-details-chevron {
  transform: rotate(180deg);
}

.list-details-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.list-item-sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.list-item-meta {
  font-size: 13px;
  color: var(--text);
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-on {
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--primary);
}

.badge-off {
  background: color-mix(in srgb, var(--text-muted) 20%, transparent);
  color: var(--text-muted);
}

.badge-warn {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
  margin-left: 6px;
}

.btn-icon-warn-on {
  background: var(--accent);
  color: var(--primary-contrast);
  border-color: var(--accent);
}

.actions-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn-status {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-status-on {
  background: var(--primary);
  color: var(--primary-contrast);
}

.btn-status-off {
  background: color-mix(in srgb, var(--text-muted) 25%, transparent);
  color: var(--text-muted);
}

.btn-status-warn-on {
  background: var(--accent);
  color: var(--primary-contrast);
}

.status-group {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-sm {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* Acciones secundarias (guardar dirección/delivery, etc.) — borde de color
   en vez de relleno, mismo criterio que los chips seleccionados. */
.btn-secondary {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-muted);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  padding: 0;
}

.btn-icon-danger {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.btn-add {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.btn-sm-danger {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 6px 18px;
}

.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.checkbox-row label {
  font-size: 14px;
}

/* ---------- Switch deslizante (formularios: activo, modo tienda) ---------- */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 6px 18px;
}

.switch-row-label {
  font-size: 14px;
  color: var(--text);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--text-muted) 30%, transparent);
  border-radius: 999px;
  transition: background-color .15s ease;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s ease;
}

.switch input:checked + .switch-track {
  background: var(--primary);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

.switch input:disabled + .switch-track {
  opacity: .5;
  cursor: not-allowed;
}

.logo-picker {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.logo-picker-preview {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
}

.logo-picker-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-picker-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

.form-error {
  color: var(--accent);
  font-size: 14px;
  margin-top: 0;
}

.form-success {
  color: var(--primary);
  font-size: 14px;
  margin-top: 0;
}

/* ---------- Búsqueda de productos: chips recientes y escáner ---------- */

.chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}

.chips-scroll .chip {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Variante compacta — Recientes y Carritos abiertos en Modo Tienda, para
   que quepan todos los controles nuevos sin empujar el registrar/agregar
   fuera de la primera pantalla. */
.chips-sm.chips-scroll {
  gap: 6px;
  padding-bottom: 10px;
}

.chips-sm .chip {
  height: 28px;
  min-width: unset;
  padding: 0 10px;
  font-size: 12px;
}

/* Chips de "Carritos abiertos": a diferencia del resto de los chips (una
   sola línea, pill completa), estos llevan un segundo renglón opcional con
   el delivery asignado — por eso pasan a layout en columna con esquinas
   menos redondeadas en vez del pill de altura fija. */
.chip-carrito.chip {
  height: auto;
  min-height: 28px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  border-radius: 14px;
  padding: 5px 12px;
  gap: 2px;
  text-align: left;
}

.chip-carrito-line1 {
  white-space: nowrap;
}

.chip-carrito-line2 {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.chip-carrito-line2 svg {
  flex-shrink: 0;
}

.scanner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.scanner-box {
  background: var(--surface);
  border-radius: 20px;
  padding: 16px;
  width: 100%;
  max-width: 380px;
}

#scannerReader {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 12px;
  /* Sin una altura propia, un <video> con height:100% dentro de un
     contenedor de alto automático colapsa/se descuadra (visto en
     iPhone) — con aspect-ratio fijo el video siempre tiene un marco
     estable para llenar, sin importar la resolución real de la cámara. */
  aspect-ratio: 3 / 4;
  background: #000;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Marco de esquinas verdes sobre el video — le confirma al usuario que
   el escáner está activo y mirando, no solo un video mudo. */
.scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 82%;
  height: 42%;
  pointer-events: none;
}

.scan-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 3px solid #4CAF50;
}

.scan-corner-tl { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 8px; }
.scan-corner-tr { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 8px; }
.scan-corner-bl { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 8px; }
.scan-corner-br { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 8px; }

/* ---------- Visor de imagen (lightbox), ver app.js ---------- */

.image-viewer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.image-viewer-overlay.open {
  display: flex;
}

.image-viewer-box {
  position: relative;
  max-width: 100%;
  max-height: 100%;
}

.image-viewer-box img {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
}

.image-viewer-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* Contenedor de scroll horizontal para tablas anchas que no entran en
   .screen{max-width:420px} (ej. la tabla de 10 columnas de Rights
   Manager) — la tabla se desplaza sola en vez de desbordar la página. */
.tabla-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.reporte-tabla-admin {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

.reporte-tabla-admin th,
.reporte-tabla-admin td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.reporte-tabla-admin th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.reporte-tabla-admin input.pill-input {
  min-width: 90px;
  padding: 6px 10px;
}
