/* =========================================================================
   vs-checkout-pdv.css — Tela de PDV (frente de caixa) do checkout.
   Layout fiel ao legado adaptado para web:
   - painel de totais grande a esquerda (Quantidade / Valor Total / Saldo|Troco)
   - cabecalho em grid + grade de itens editavel no centro
   ========================================================================= */

.pdv-shell {
  display: flex;
  gap: 12px;
  align-items: stretch;
  min-height: 480px;
  padding: 10px;
  font-size: 14px;
  color: #1f2937;
}

/* ---------------- Painel esquerdo (totais) ---------------- */
.pdv-side {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 14px;
}
.pdv-side-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .5px;
  color: #0d6efd;
  border-bottom: 2px solid #0d6efd;
  padding-bottom: 6px;
  text-transform: uppercase;
}
.pdv-barcode {
  width: 100%;
  padding: 10px;
  font-size: 15px;
  border: 2px solid #0d6efd;
  border-radius: 6px;
  outline: none;
}
.pdv-barcode:focus { box-shadow: 0 0 0 3px rgba(13,110,253,.2); }

.pdv-suggest {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,.08);
}
.pdv-sug-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid #eee;
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
}
.pdv-sug-item:hover { background: #eef4ff; }
.pdv-sug-item.is-active { background: #d7e6ff; outline: 2px solid #2563eb; outline-offset: -2px; }
.pdv-sug-nome { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdv-sug-preco { font-variant-numeric: tabular-nums; font-weight: 600; color: #0d6efd; }

.pdv-totais {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pdv-totais dt {
  font-size: 13px;
  color: #6b7280;
  text-align: right;
  margin-top: 6px;
}
.pdv-totais dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pdv-totais dd#pdvQtd { font-size: 22px; }
.pdv-totais dd#pdvTotal { font-size: 26px; }
.pdv-totais dt#pdvSaldoLabel { color: #b45309; font-weight: 600; }
.pdv-totais dd#pdvSaldo { font-size: 26px; color: #b45309; }

.pdv-status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
}
.pdv-dot { width: 10px; height: 10px; border-radius: 50%; background: #9ca3af; flex: 0 0 auto; }
.pdv-dot-ok { background: #16a34a; }
.pdv-dot-err { background: #dc2626; }

/* ---------------- Centro (cabecalho + grade) ---------------- */
.pdv-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.pdv-header {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px 10px;
  align-items: end;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}
.pdv-fld { display: flex; flex-direction: column; gap: 3px; grid-column: span 4; min-width: 0; }
.pdv-fld > span { font-size: 12px; color: #6b7280; }
.pdv-fld input {
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 14px;
  outline: none;
  width: 100%;
}
.pdv-fld input:focus { border-color: #0d6efd; box-shadow: 0 0 0 2px rgba(13,110,253,.15); }
.pdv-fld-sm { grid-column: span 2; }
.pdv-fld-sm input { text-align: right; font-variant-numeric: tabular-nums; }

.pdv-finalizar {
  grid-column: span 2;
  align-self: end;
  height: 38px;
  font-weight: 700;
}

/* ---------------- Grade de itens ---------------- */
.pdv-grid-wrap {
  flex: 1 1 auto;
  overflow: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.pdv-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pdv-grid thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  border-bottom: 2px solid #e5e7eb;
  padding: 8px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  z-index: 1;
}
.pdv-grid tbody td {
  padding: 4px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.pdv-grid tbody tr:hover { background: #f9fafb; }
.pdv-col-cod { width: 90px; }
.pdv-col-num { width: 90px; text-align: right; }
.pdv-col-un { width: 56px; }
.pdv-col-act { width: 40px; text-align: center; }
.pdv-cell-desc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdv-num { text-align: right; font-variant-numeric: tabular-nums; }
.pdv-subtotal { font-weight: 600; }

.pdv-cell-input {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 13px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.pdv-cell-input:focus { border-color: #0d6efd; box-shadow: 0 0 0 2px rgba(13,110,253,.15); }

.pdv-rm {
  border: none;
  background: transparent;
  color: #dc2626;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.pdv-rm:hover { background: #fee2e2; }

.pdv-row-cancel td { text-decoration: line-through; color: #9ca3af; }
.pdv-empty td { text-align: center; color: #9ca3af; padding: 24px; }

/* ---------------- responsivo ---------------- */
@media (max-width: 900px) {
  .pdv-shell { flex-direction: column; }
  .pdv-side { flex-basis: auto; }
  .pdv-fld, .pdv-fld-sm, .pdv-finalizar { grid-column: span 6; }
}

/* ---------------- Cabecalho: campos de lookup (codigo + descricao) ---------------- */
.pdv-fld-lookup .pdv-lookup {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.pdv-lookup-code {
  flex: 0 0 88px;
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 14px;
  outline: none;
}
.pdv-lookup-desc {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  font-size: 13px;
  background: #f8fafc;
  color: #475569;
  outline: none;
}
.pdv-lookup-code:focus { border-color: #0d6efd; box-shadow: 0 0 0 2px rgba(13,110,253,.15); }

/* ========================================================================
   Entrada/Sangria como MODAL (showModal), no lugar da aba lado a lado.
   ======================================================================== */
.pdv-sangria-open {
  margin-left: 8px;
  background: #eef2f7;
  color: #1f3a5f;
  border: 1px solid #c9d6e5;
}
.pdv-sangria-open:hover { background: #e2e9f2; }

.pdv-sg-dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  width: min(460px, 92vw);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.pdv-sg-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.pdv-sg-form { padding: 18px 18px 16px; margin: 0; }
.pdv-sg-title { font-size: 16px; font-weight: 600; color: #1f3a5f; margin-bottom: 14px; }
.pdv-sg-fields { display: flex; flex-direction: column; gap: 10px; }
.pdv-sg-fld { display: flex; flex-direction: column; gap: 4px; }
.pdv-sg-fld > span { font-size: 12px; color: #64748b; }
.pdv-sg-fld > input {
  height: 34px; padding: 4px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px;
}
.pdv-sg-fld > input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.pdv-sg-status { min-height: 18px; margin: 10px 0 4px; font-size: 12px; color: #475569; }
.pdv-sg-status.is-error { color: #b91c1c; }
.pdv-sg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.pdv-sg-cancel { background: #f1f5f9; border: 1px solid #cbd5e1; color: #334155; }

/* ========================================================================
   Barra de contexto (REVENDA / FÓRMULAS / SINAL) — alterna com F5 (legado).
   ======================================================================== */
.pdv-context-bar {
  margin: 4px 0 10px;
  font-size: 12px;
  color: #475569;
}
.pdv-context-bar strong {
  color: #1f3a5f;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.pdv-context-hint { color: #94a3b8; }
.pdv-context-btn {
  border: 1px solid #c9d6e5;
  background: #eef2f7;
  color: #1f3a5f;
  font-weight: 700;
  letter-spacing: 0.3px;
  border-radius: 6px;
  padding: 2px 10px;
  cursor: pointer;
  font-size: 12px;
}
.pdv-context-btn:hover { background: #e2e9f2; }
