/* ==========================================================================
   AGM SYSTEM - Vistas: POS, dashboard, inventario, escaner QR y recibos.
   ========================================================================== */

/* --- POS --- */
.pos { display: grid; grid-template-columns: 1fr 380px; gap: 14px; align-items: start; }
.pos-left { min-width: 0; }
.pos-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pos-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  max-height: calc(100vh - 190px);
  overflow: auto;
}
.prod-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.prod-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(226, 118, 27, 0.14); }
.prod-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.prod-thumb:not(.placeholder) { cursor: zoom-in; }
.prod-thumb:not(.placeholder):hover { outline: 2px solid var(--brand); outline-offset: 1px; }
.prod-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--panel-soft);
}
.prod-info { min-width: 0; flex: 1; line-height: 1.35; }
.prod-name { min-width: 0; font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
.prod-meta { font-size: 11px; margin-top: 2px; overflow-wrap: anywhere; }
.prod-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; }
.prod-price { font-size: 13px; }
.prod-stock {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--ok);
  background: var(--panel-soft);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}
.prod-stock.low { color: var(--warn); }
.prod-stock.out { color: var(--danger); }

/* --- Foto ampliada del producto (POS) --- */
.photo-box { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.photo-large {
  max-width: 100%;
  max-height: 58vh;
  border-radius: 12px;
  object-fit: contain;
  background: var(--panel-soft);
}
.photo-meta { font-size: 12px; }
.photo-price { font-size: 16px; font-weight: 700; }

.pos-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 130px);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.pos-cart { flex: 1; overflow: auto; padding: 10px; }
.cart-line { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.cart-line-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cart-name { font-weight: 700; font-size: 13px; }
.cart-line-grid { display: grid; grid-template-columns: 70px 1fr; gap: 8px; margin: 8px 0; }
.cart-line-grid .lbl { display: block; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.qty-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.cart-line-total { display: flex; align-items: center; justify-content: space-between; }
.pos-totals { border-top: 1px solid var(--line); padding: 12px; background: var(--panel-soft); }
.totals-card { display: flex; flex-direction: column; gap: 8px; }
.total-row { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.total-row b { font-size: 18px; }

/* --- Panel de pago del POS: un solo método o PAGO FRACCIONADO --- */
.pay-panel { border-top: 1px dashed var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.pay-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pay-title { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.pay-mode { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.pay-mode-btn {
  border: 0; background: transparent; padding: 5px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.pay-mode-btn.active { background: var(--brand); color: #fff; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pay-field .lbl { display: block; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.pay-hint { font-size: 11px; margin: 0; }

/* --- Pago fraccionado: cada metodo es una tarjeta con sus campos rotulados ---
   Los campos van a ancho completo y con su etiqueta visible, para que el cajero
   lea que dice cada input y lo que esta colocando. */
.pay-split { display: flex; flex-direction: column; gap: 10px; }
.pay-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.pay-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pay-row-title { font-size: 11px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.pay-row-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.pay-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pay-cell .lbl { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.pay-cell .input, .pay-cell select { width: 100%; }
/* El monto se lee grande y a la derecha: es el dato que digita el cajero. */
.pay-row-amount { text-align: right; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pay-remaining {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 700; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.pay-remaining.ok { border-color: var(--ok); color: var(--ok); }
.pay-remaining.err { border-color: var(--danger); color: var(--danger); }

/* --- Escaner --- */
.scanner-box { display: flex; flex-direction: column; gap: 10px; }
.scanner-video { width: 100%; max-height: 320px; border-radius: 12px; background: #000; object-fit: cover; }

/* --- QR producto --- */
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.qr-img { width: 200px; height: 200px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }

/* --- Dashboard / estadisticas --- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.grid-cards { display: flex; flex-direction: column; gap: 12px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 800; }
.stat-sub { font-size: 12px; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; }
  .pos-panel { max-height: none; }
  .form-grid { grid-template-columns: 1fr; }
  .pay-row-grid { grid-template-columns: 1fr; }
  .layout { flex-direction: column; }
  .nav { width: 100%; flex-direction: row; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .topbar { flex-wrap: wrap; }
}

/* --- Precio sugerido (costos operativos / margen) --- */
.field.span-2 { grid-column: 1 / -1; }
.suggest-box {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fafbfc;
}
.suggest-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.price-config-row { display: flex; align-items: center; gap: 8px; max-width: 360px; margin-bottom: 6px; }
.price-config-row .input { max-width: 120px; }
.plabel { min-width: 90px; font-weight: 600; }
.chip-warn { background: #fff4e5; border-color: #f0c07a; color: #8a5a00; }

