/* ── Pagamento view (tela cheia) ─────────────────────── */

.vendas-pagamento-view:not(.hidden) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 20px;
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 110px);
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

.vendas-pagamento-body {
  display: flex;
  flex-direction: column;
  flex: none;
  min-width: 0;
  overflow: visible;
}

/* ── Layout unificado (2 colunas) ────────────────────── */
.vpag-unified {
  display: block;
  max-width: 1400px;
  width: 100%;
  align-self: center;
  box-sizing: border-box;
}

.vpag-col-resumo {
  display: flex;
  flex-direction: column;
  padding-right: 20px;
  border-right: 1px solid var(--line);
}

.vpag-col-pag {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 24px;
}

/* ── Resumo ──────────────────────────────────────────── */
.vpag-items-resumo {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 12px;
  font-size: 0.85rem;
  scrollbar-width: thin;
}

.vpag-resumo-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f4;
}

.vpag-resumo-totais {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vpag-rt-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 0.9rem;
}
.vpag-rt-label { color: var(--muted); font-weight: 600; }
.vpag-rt-val   { font-weight: 700; color: var(--text); }
.vpag-rt-grand {
  background: rgba(93,22,116,0.07);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px -4px 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--purple);
  border-top: 2px solid rgba(93,22,116,0.18) !important;
  border-bottom: none !important;
}
.vpag-rt-grand strong { font-size: 1.08rem; font-weight: 900; color: var(--purple); }

.vpag-discount-input {
  width: 100px;
  text-align: right;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: none;
  min-height: auto;
  font-size: 0.9rem;
  color: var(--text);
}

/* ── Formas de pagamento ─────────────────────────────── */
.vpag-metodos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.vpag-metodo {
  padding: 13px 8px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  text-align: center;
  width: 100%;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.vpag-metodo:hover {
  background: #4a1160;
  border-color: #4a1160;
  color: #fff;
}

.vpag-metodo.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* ── Numpad + pagamentos (grid interno) ──────────────── */
.vpag-cols {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}
.vpag-col-left  { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vpag-col-right {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  padding-left: 14px;
}

.vpag-numpad-area  { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.vpag-metodo-label { font-size: 0.82rem; color: var(--muted); font-weight: 700; }
#vpag-add-payment  { background: var(--purple); color: #fff; border-color: var(--purple); }
#vpag-add-payment:hover { background: #4a1160; }

.vpag-valor-input {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: right;
  padding: 8px 12px;
  border: 2px solid var(--purple);
  border-radius: 10px;
  background: var(--bg);
  color: var(--purple);
  width: 100%;
}

.vpag-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 44px);
  gap: 4px;
}

.vpag-num {
  padding: 4px;
  font-size: clamp(0.95rem, 2vh, 1.25rem);
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.1s, border-color 0.1s, transform 0.08s;
  min-height: 36px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vpag-num:hover  { background: var(--bg); border-color: var(--purple); color: var(--purple); }
.vpag-num:active { transform: scale(0.95); }
.vpag-num-zero   { grid-column: span 1; }

.vpag-payments-list  {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px;
  max-height: 220px; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
}

/* ── Totais coluna direita ───────────────────────────── */
.vpag-totais-right {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.vpag-tr-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}
.vpag-tr-label { font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.vpag-tr-val   { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.vpag-tr-total { color: var(--purple); font-size: 1rem; }
.vpag-tr-pago  { color: #1a7a45; }
.vpag-tr-troco { color: var(--orange); font-size: 1.05rem; }

.vpag-payment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0faf4;
  border: 1px solid #a8d5b8;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.88rem;
}

.vpag-payment-del {
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
}

.vendas-pagamento-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 10px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
#vpag-message {
  min-height: 0;
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

.vpag-finalizar-btn {
  font-size: 1.05rem;
  font-weight: 800;
  padding: 14px;
  border-radius: 12px;
  background: var(--orange);
  box-shadow: var(--shadow);
  letter-spacing: 0.04em;
  transition: background 0.15s, transform 0.08s;
  width: 100%;
}

.vpag-finalizar-btn:hover {
  background: var(--orange-dark);
  transform: translateY(-1px);
}

#vendas-back-to-comanda2 {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #dc2626 !important;
}
#vendas-back-to-comanda2:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
}

/* ── Dividir conta / Pagamento parcial ───────────────── */
.vpag-opcoes-btns { display: flex; gap: 10px; }
.vpag-opcao-btn {
  flex: 1; padding: 8px 8px; border-radius: 8px; font-size: 0.82rem;
  border: none; background: var(--orange);
  font-size: 0.92rem; font-weight: 800; color: #fff;
  cursor: pointer; transition: background 0.15s;
}
.vpag-opcao-btn:hover  { background: var(--orange-dark); }
.vpag-opcao-btn.active { background: var(--orange-dark); }

.vpag-dividir-box {
  margin-top: 10px; padding: 12px 14px;
  background: #f5f0ff; border: 1px solid var(--border); border-radius: 10px;
}
.vpag-dividir-label { font-size: 0.82rem; font-weight: 700; color: var(--text); display: block; margin-bottom: 8px; }
.vpag-dividir-row   { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; }
.vpag-dividir-ctrl  {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--purple); color: #fff; border: none;
  font-size: 1.2rem; font-weight: 700; cursor: pointer; line-height: 1;
}
.vpag-dividir-ctrl:hover { background: var(--magenta); }
.vpag-dividir-input {
  width: 56px; text-align: center; font-size: 1.1rem; font-weight: 800;
  color: var(--text); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 5px 4px; background: #fff;
}
.vpag-dividir-valor { text-align: center; font-size: 0.9rem; font-weight: 800; color: var(--purple); }

.vpag-resumo-pago { color: #10b981; font-weight: 700; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.vc2-comanda-parcial-info { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: 0.75rem; }
.vc2-parcial-pago     { color: #10b981; font-weight: 700; }
.vc2-parcial-restante { color: #ef4444; font-weight: 700; }

/* ── Cliente (fechar venda) ──────────────────────────────── */
.fv-cliente-btn {
  height: 34px;
  padding: 0 16px;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(109, 40, 217, 0.32);
  transition: box-shadow 0.15s, transform 0.1s, background 0.15s;
  flex-shrink: 0;
}
.fv-cliente-btn:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.42);
  transform: translateY(-1px);
}
.fv-cliente-btn:active { transform: scale(0.97); }

.fv-cliente-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 10px;
  padding: 4px 10px 4px 8px;
  flex-shrink: 0;
}
.fv-cliente-badge-label {
  font-size: 0.6rem;
  color: #7c3aed;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.fv-cliente-badge-nome {
  font-size: 0.82rem;
  font-weight: 700;
  color: #5b21b6;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fv-cliente-limpar-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.1s;
}
.fv-cliente-limpar-btn:hover { background: #dc2626; }

.fv-cliente-modal-card {
  background: var(--panel);
  border-radius: 14px;
  padding: 24px;
  width: 440px;
  max-width: 96vw;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fv-cliente-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.fv-cliente-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.fv-cliente-modal-title { font-size: 1rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.fv-cliente-modal-sub   { font-size: 0.73rem; color: var(--muted); margin-top: 2px; }
.fv-cliente-search-row  { display: flex; gap: 8px; margin-bottom: 14px; }
.fv-cliente-search-input {
  flex: 1;
  height: 40px;
  border: 1.5px solid #d0d7e6;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 0.88rem;
  outline: none;
  background: #f9fafb;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--text);
}
.fv-cliente-search-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
  background: #fff;
}
.fv-cliente-search-btn {
  height: 40px;
  padding: 0 18px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, box-shadow 0.12s;
  box-shadow: 0 2px 6px rgba(255, 61, 16, 0.3);
}
.fv-cliente-search-btn:hover { background: var(--orange-dark); box-shadow: 0 4px 12px rgba(255, 61, 16, 0.38); }
.fv-cliente-results {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.85rem;
  background: #fff;
  display: none;
}
.fv-cliente-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f2f5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.1s;
}
.fv-cliente-result-item:last-child { border-bottom: none; }
.fv-cliente-result-item:hover      { background: #f5f3ff; }
.fv-cliente-result-nome { font-weight: 700; color: #1f2937; font-size: 0.88rem; }
.fv-cliente-result-info { font-size: 0.73rem; color: #6b7280; display: flex; gap: 10px; flex-wrap: wrap; }
.fv-cliente-modal-footer { display: flex; justify-content: flex-end; margin-top: 16px; }
.fv-cliente-fechar-btn {
  padding: 9px 22px;
  border-radius: 8px;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d0d7e6;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.fv-cliente-fechar-btn:hover { background: #e5e7eb; }

/* ── Preenche viewport quando hospedado no content-stack ── */
.content-stack:has(> #fechar-venda-root) {
  padding: 0; gap: 0;
  display: flex; flex-direction: column;
  height: calc(100vh - 68px); overflow: hidden;
}
.content-stack > #fechar-venda-root {
  flex: 1; min-height: 0;
  padding: 8px 14px;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.content-stack > #fechar-venda-root .vendas-pagamento-body {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.content-stack > #fechar-venda-root .vpag-unified.card {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  padding: 12px 16px;
}
.content-stack > #fechar-venda-root .vpag-col-pag {
  flex: 1; min-height: 0;
}
.content-stack > #fechar-venda-root .vpag-cols {
  flex: 1; min-height: 0;
}
.content-stack > #fechar-venda-root .vpag-numpad {
  grid-template-rows: repeat(4, 36px);
}
.content-stack > #fechar-venda-root .vpag-metodos {
  margin-bottom: 6px; padding-bottom: 6px;
}
.content-stack > #fechar-venda-root .vendas-pagamento-actions {
  margin-top: auto;
}
