/* ── VPL (lançamento POS split) ──────────────────────── */

.vpl-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: #f0f2f5;
}

.vpl-infobar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 7px 12px;
  min-height: 48px;
  flex-shrink: 0;
  overflow-x: auto;
}

.vpl-back-btn {
  background: var(--menu-ink);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.15s;
}

.vpl-cliente-btn { margin-right: 16px; white-space: nowrap; }

.vpl-back-btn:hover { background: #464c54; }

.vpl-voltar-confirmar-btn {
  background: #c0392b;
  color: #fff;
  padding: 7px 14px;
  border-radius: 7px;
  border: none;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.vpl-voltar-confirmar-btn:hover { background: #a93226; }

.vpl-info-sep {
  width: 1px;
  height: 26px;
  background: var(--line);
  margin: 0 4px;
  flex-shrink: 0;
  align-self: center;
}

.vpl-info-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 8px;
}

.vpl-info-label {
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

.vpl-info-item strong {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.vpl-info-val-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vpl-status-badge { border-radius: 6px; padding: 2px 7px; font-size: 0.6rem; font-weight: 800; line-height: 1.4; letter-spacing: 0.03em; }
.vpl-aberta  { background: #10b981; color: #fff; }
.vpl-fechada { background: #9ca3af; color: #fff; }

.vpl-body { display: flex; flex: 1; overflow: hidden; gap: 0; }

.vpl-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #d0d7e6;
  background: #fff;
}

/* Celular: alterna entre tela de Produtos e tela de Itens da Mesa/Comanda
   (ver @media max-width:900px). No desktop fica sempre oculto. */
.vpl-mobile-switch-btn {
  display: none;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.vpl-mobile-switch-row {
  display: none;
}
#vpl-ver-itens-btn { background: var(--menu-ink); color: #fff; }
#vpl-voltar-produtos-btn { background: #6b7280; color: #fff; margin: 8px 10px 0; }
.vpl-mobile-cancelar-btn { background: #dc2626; color: #fff; }

.vpl-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.vpl-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 14px;
  font-size: 0.88rem;
  color: #1a1a1a;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
}

.vpl-search-bar button {
  background: var(--orange);
  border: none;
  border-radius: 5px;
  color: #fff;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.1s;
}

.vpl-search-bar button:hover { background: var(--orange-dark); }

.vpl-search-lupa-btn { background: var(--orange) !important; }
.vpl-search-lupa-btn:hover { background: var(--orange-dark) !important; }

.vpl-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  background: #eef0f4;
  padding: 10px 14px;
  border-bottom: 1px solid #d8dce6;
  align-items: center;
}

.vpl-categories::-webkit-scrollbar { display: none; }

.vpl-cat-btn {
  border: none;
  border-radius: 22px;
  background: #fff;
  color: #4b5563;
  padding: 8px 20px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.vpl-cat-btn:hover {
  background: var(--orange);
  color: #fff;
  transform: translateY(-1px);
}

.vpl-cat-btn.active {
  background: var(--orange);
  color: #fff;
}

.vpl-product-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0;
  align-content: start;
  padding: 8px;
}

.vpl-product-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid #e8ecf2;
  border-radius: 6px;
  margin: 3px;
  background: #fff;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
  text-align: center;
}

.vpl-product-card:hover  { background: rgba(232, 64, 14, 0.04); border-color: var(--orange); transform: translateY(-1px); }
.vpl-product-card:active { transform: scale(0.97); }

.vpl-product-img { width: 80px; height: 70px; object-fit: contain; border-radius: 4px; }

.vpl-product-img-placeholder {
  width: 80px;
  height: 70px;
  background: #f0f2f5;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #9ca3af;
}

.vpl-product-name  { font-size: 0.75rem; font-weight: 600; color: var(--text); line-height: 1.2; text-transform: uppercase; }
.vpl-product-price { font-size: 0.8rem; font-weight: 700; color: var(--orange); }
.vpl-product-cat   { font-size: 0.62rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

.vpl-right {
  width: 460px;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
}

.vpl-items-header {
  background: var(--bg);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 14px 16px;
  flex-shrink: 0;
  border-bottom: 2px solid var(--orange);
}

.vpl-items-table-wrap { flex: 1; overflow-y: auto; background: #fff; }

.vpl-items-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }

.vpl-items-table thead th {
  background: #f0f2f5;
  color: #6b7280;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 7px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.vpl-items-table thead th.tc { text-align: center; }
.vpl-th-qtd { width: 44px; }

.vpl-item-row td {
  padding: 9px 10px;
  border-bottom: 1px solid #f0f2f5;
  color: #374151;
  vertical-align: middle;
}

.vpl-item-row:last-child td  { border-bottom: none; }
.vpl-item-row.selected td    { background: rgba(232, 64, 14, 0.06); }
.vpl-item-row:hover td       { background: var(--bg); }
.vpl-item-row.selected:hover td { background: rgba(232, 64, 14, 0.1); }

.vpl-td-qty { font-weight: 700; text-align: center; color: var(--text); }
.vpl-item-name-cell .vpl-item-name { font-weight: 600; color: var(--text); text-transform: uppercase; font-size: 0.78rem; }
.vpl-item-obs { font-size: 0.7rem; color: #9ca3af; margin-top: 1px; }

.vpl-item-actions { display: flex; gap: 4px; justify-content: center; }

.vpl-edit-btn, .vpl-del-btn {
  background: none;
  border: 1px solid #d0d7e6;
  border-radius: 5px;
  padding: 3px 7px;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1;
  transition: background 0.1s;
}

.vpl-edit-btn { color: var(--blue); }
.vpl-edit-btn:hover { background: #edf3f8; }
.vpl-del-btn { color: #c0392b; border-color: #f5c0bb; }
.vpl-del-btn:hover { background: #fdf2f1; }
.vpl-empty-row { text-align: center; color: #9ca3af; padding: 24px; font-size: 0.82rem; }

.vpl-item-pending td { background: rgba(255, 150, 0, 0.06); }
.vpl-item-pending:hover td { background: rgba(255, 150, 0, 0.12); }

.vpl-pending-badge {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: 0.04em;
}

.vpl-item-editor {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.vpl-item-editor.hidden { display: none !important; }

.vpl-item-editor-modal {
  background: var(--panel);
  border-radius: 12px;
  padding: 22px 24px;
  width: 340px;
  max-width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#vpl-item-editor .vpl-item-editor-modal:has(#vpl-mod-wrap:not(:empty)) { width: 420px; }

.vpl-mod-group { margin-bottom: 4px; }
.vpl-mod-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.vpl-mod-group-title { font-size: 0.85rem; font-weight: 700; color: var(--menu-ink); }
.vpl-mod-group-badge {
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.04em;
  color: var(--orange); background: rgba(232, 64, 14, 0.1);
  border-radius: 999px; padding: 2px 7px; white-space: nowrap;
}
.vpl-mod-group-meta { font-size: 0.72rem; color: var(--muted); margin-bottom: 6px; }
.vpl-mod-option {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; margin-bottom: 5px; cursor: pointer; font-size: 0.82rem;
}
.vpl-mod-option input {
  flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--orange, #e8400e);
  cursor: pointer; outline: none; box-shadow: none;
}
.vpl-mod-option:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.vpl-mod-option input:disabled { cursor: not-allowed; }
.vpl-mod-option-nome { flex: 1; }
/* Ingredientes do produto que virou opcao (ex.: sabor da pizza) - linha
   menor embaixo do nome, cortada em 2 linhas pra nao esticar a lista. */
.vpl-mod-option-ingredientes {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--muted, #6b7280);
  font-weight: 400;
}
.vpl-mod-option-preco { color: var(--muted); white-space: nowrap; font-size: 0.78rem; }
.vpl-mod-option-preco-old { text-decoration: line-through; opacity: 0.6; margin-right: 4px; }
.vpl-mod-erro { color: #c0392b; font-size: 0.8rem; margin: -6px 0 0; }

.vpl-item-editor-title { font-size: 0.88rem; font-weight: 700; color: var(--menu-ink); line-height: 1.35; }

.vpl-editor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.vpl-editor-row label {
  color: #6b7280;
  font-weight: 600;
  min-width: 28px;
  font-size: 0.75rem;
}

.vpl-editor-row input[type="text"],
.vpl-editor-row input[type="number"] {
  flex: 1;
  border: 1px solid #d0d7e6;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.88rem;
}

.vpl-qty-ctrl { display: flex; align-items: center; gap: 4px; }

.vpl-qty-ctrl button {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  border: 1px solid #d0d7e6;
  background: #fff;
  color: #374151;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.1s, border-color 0.1s;
}

.vpl-qty-ctrl button:hover { background: #f0f2f5; border-color: var(--orange); color: var(--orange); }

.vpl-qty-ctrl input {
  width: 64px;
  text-align: center;
  border: 1px solid #d0d7e6;
  border-radius: 7px;
  padding: 6px;
  font-size: 1rem;
  font-weight: 700;
}

.vpl-editor-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 2px; }

.vpl-editor-btns button {
  padding: 9px 22px;
  border-radius: 7px;
  font-size: 0.88rem;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

.vpl-obs-section {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  background: #fff;
}

.vpl-obs-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #6b7280;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.vpl-obs-section textarea {
  width: 100%;
  border: 1px solid #d0d7e6;
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 0.8rem;
  resize: none;
  color: #374151;
  background: #f9fafc;
}

#vpl-confirm-modal,
#vpl-aviso-modal {
  position: fixed !important;
  z-index: 1100 !important;
}

/* Perguntas de impressao (Deseja imprimir...?): Sim laranja, Nao vermelho */
#vpl-confirm-modal.confirm-print #vpl-confirm-sim { background: var(--orange); border-color: var(--orange); color: #fff; }
#vpl-confirm-modal.confirm-print #vpl-confirm-nao { background: #e11d48; border-color: #e11d48; color: #fff; }

.vpl-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 2px solid #e5e7eb;
  flex-shrink: 0;
  background: #f5f7fa;
}

.vpl-total-cell {
  padding: 11px 12px;
  border-right: 1px solid #e5e7eb;
  text-align: center;
}

.vpl-total-cell:last-child { border-right: none; }
.vpl-total-label { font-size: 0.65rem; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.vpl-total-val   { font-size: 0.9rem; font-weight: 700; color: #374151; }
.vpl-total-grand { background: var(--panel); }
.vpl-total-grand .vpl-total-val { font-size: 1rem; color: var(--orange); font-weight: 800; }

.vpl-actions {
  display: flex;
  flex-shrink: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.vpl-action-btn {
  flex: 1;
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 16px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, color 0.12s;
}

.vpl-action-btn:last-child { border-right: none; }
.vpl-action-btn:hover { background: var(--bg); color: var(--orange); }
.vpl-action-icon { font-size: 1.1rem; line-height: 1; }
.vpl-action-label { white-space: nowrap; }
.vpl-action-shortcut { font-size: 1em; font-weight: inherit; letter-spacing: inherit; opacity: 1; }
.vpl-fechar-btn      { background: var(--orange); color: #fff; }
.vpl-fechar-btn:hover { background: var(--orange-dark); color: #fff; }
.vpl-finalizar-btn      { background: var(--menu-ink); color: #fff; }
.vpl-finalizar-btn:hover { background: var(--magenta); color: #fff; }
.vpl-cancelar-item-btn      { background: var(--orange); color: #fff; }
.vpl-cancelar-item-btn:hover { background: var(--orange-dark); color: #fff; }
.vpl-cancelar-btn      { background: #ef4444; color: #fff; }
.vpl-cancelar-btn:hover { background: #dc2626; color: #fff; }
.vpl-produtos-btn      { background: #6b7280; color: #fff; }
.vpl-produtos-btn:hover { background: #4b5563; color: #fff; }

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 1400px) {
  .vpl-right           { width: 420px; min-width: 340px; }
}

@media (max-width: 1200px) {
  .vpl-right           { width: 380px; min-width: 320px; }
  .vpl-product-grid    { grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); }
}

@media (max-width: 1050px) {
  .vpl-right           { width: 340px; min-width: 290px; }
  .vpl-product-grid    { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); }
  .vc2-topbar-item     { padding: 2px 10px; }
}

@media (max-width: 900px) {
  /* Atalhos de teclado (F2/F5/F6/DEL/Espaco) nao fazem sentido no
     celular - nao tem teclado fisico. */
  .vpl-action-shortcut { display: none; }

  .vc2-topbar          { padding: 6px 10px; gap: 0; }
  .vc2-topbar-sep      { height: 26px; }
  .vc2-topbar-item     { padding: 2px 8px; }
  .vc2-bottom-totals   { grid-template-columns: repeat(2, 1fr); }
  .vc2-action-bar      { flex-wrap: wrap; }
  .vc2-action-btn      { flex: 1 1 45%; min-height: 48px; }
  .vc2-section         { margin: 0 8px 8px; }

  /* VPL coluna: produtos em cima, itens embaixo. O rodape (totais + botoes
     Cancelar/Fechar) tem que ficar sempre fixo embaixo — so a lista de
     itens rola por dentro, senao a cada item lancado a pagina toda cresce
     e empurra os botoes pra baixo da tela. */
  .vpl-body            { flex-direction: column; overflow: hidden; }
  .vpl-left            { flex: 1; min-height: 0; max-height: none; border-right: none; border-bottom: 1px solid #d0d7e6; overflow-y: auto; }
  .vpl-right           { width: 100%; min-width: unset; flex: 1; min-height: 0; overflow: hidden; }
  .vpl-items-table-wrap { max-height: none; }
  .vpl-obs-section     { flex-shrink: 0; }
  .vpl-totals          { grid-template-columns: repeat(2, 1fr); }
  .vpl-product-grid    { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  /* Categorias: scroll horizontal por arraste, sem quebra de linha - igual
     o pdv_app. So' isso aplicava so' abaixo de 480px; entre 480 e 900px
     (tablet/celular deitado) as categorias ainda quebravam linha em vez de
     arrastar, dando a impressao de estar "travado". */
  .vpl-categories      { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 8px 12px; gap: 8px; }
  /* Chip do mesmo tamanho/estilo do pdv_app (borda fina + fundo branco
     quando inativo, em vez do maior/sem borda usado no desktop). */
  .vpl-cat-btn         { padding: 10px 18px; border-radius: 20px; font-size: 13px; border: 1.5px solid #e5e7eb; }
  .vpl-cat-btn.active  { border-color: var(--orange-dark); }

  /* Produtos e Itens da Mesa viram 2 telas separadas (nao empilhadas) -
     alterna via botao, nao mostra as duas ao mesmo tempo. */
  .vpl-mobile-switch-btn { box-sizing: border-box; }
  #vpl-voltar-produtos-btn { display: block; width: 100%; box-sizing: border-box; }
  .vpl-mobile-switch-row .vpl-mobile-switch-btn { display: block; }
  .vpl-right { display: none; }

  /* Ver Itens / Cancelar lado a lado, fixos no rodape da tela de Produtos
     (mesma tecnica imune a vh/dvh usada no rodape da tela de Itens). */
  .vpl-mobile-switch-row {
    display: flex;
    gap: 8px;
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    /* Altura livre (nao fixa) - o safe-area-inset-bottom do iPhone (barra
       de gestos) soma em cima do padding normal, em vez de comer espaco
       de dentro de uma altura fixa (isso deixava os botoes espremidos/
       pequenos no iPhone, mas normais no Android que nao tem esse
       respiro). */
    /* env(safe-area-inset-bottom) sozinho as vezes nao basta na pratica
       (barra de gestos do iPhone cobria os botoes mesmo com esse valor
       somado) - soma uma folga fixa maior por cima, nao so o automatico. */
    padding: 10px 10px calc(28px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 50;
  }
  .vpl-mobile-switch-row .vpl-mobile-switch-btn { padding: 14px 12px; }
  .vpl-left { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .vpl-body.vpl-showing-itens .vpl-left { display: none; }
  /* .vpl-right ganha position:fixed via JS (fixVplRightHeight) direto na
     viewport - nao depende mais de altura de nenhum ancestral. Aqui so
     preparamos o layout interno em coluna (header/tabela cresce/rodape). */
  .vpl-body.vpl-showing-itens .vpl-right {
    display: flex;
    flex-direction: column;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    z-index: 40;
    background: #f8fafc;
  }
  .vpl-body.vpl-showing-itens .vpl-items-table-wrap { flex: 1; min-height: 0; max-height: none; }
  .vpl-body.vpl-showing-itens .vpl-totals,
  .vpl-body.vpl-showing-itens .vpl-actions { flex-shrink: 0; }
  /* So mostra o Total (remove a celula de Subtotal) */
  .vpl-body.vpl-showing-itens .vpl-totals { grid-template-columns: 1fr; }
  .vpl-body.vpl-showing-itens .vpl-total-cell:not(.vpl-total-grand) { display: none; }
  /* Cabecalho da tabela (QTD/PRODUTO/UNIT/TOTAL) fixo no topo ao rolar */
  .vpl-body.vpl-showing-itens .vpl-items-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  /* Pagamento responsivo: colapsa duas colunas em uma */
  .vpag-cols                    { grid-template-columns: 1fr; }
  .vpag-col-right               { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
  .vendas-pagamento-formas      { max-height: none; }
  .vpag-metodo                  { flex: 1 1 calc(50% - 4px); }
}

@media (max-width: 820px) {
  .vendas-shell        { margin: -8px; height: calc(100vh - 52px); }
  .vendas-pagamento-view:not(.hidden) { padding: 10px 12px; }
  .vpl-infobar         { flex-wrap: nowrap; overflow-x: auto; gap: 0; }
  .vpl-back-btn        { flex-shrink: 0; }
}

.btn-voltar {
  background: var(--menu-ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.btn-voltar:hover { background: #464c54; }

/* ── Mobile: telefone (≤480px) ─────────────────────── */
@media (max-width: 480px) {
  .vendas-shell { margin: -8px; height: calc(100dvh - 52px); }

  /* VC2: tela de comandas */
  .vc2-topbar { padding: 6px 10px; }
  .vc2-topbar-item { padding: 2px 8px; }
  .vc2-topbar-label { font-size: 0.55rem; }
  /* Ocultar Abertura + Ocioso + separadores (filhos 6,7,8,9) */
  .vc2-topbar > :nth-child(6),
  .vc2-topbar > :nth-child(7),
  .vc2-topbar > :nth-child(8),
  .vc2-topbar > :nth-child(9) { display: none; }
  .vc2-section--cards { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; }
  .vc2-comanda-cards { grid-template-columns: 1fr; max-height: none; overflow-y: visible; flex: unset; gap: 8px; padding: 8px 10px 10px; }
  /* Botões compactos para caber 2 comandas */
  .vc2-comanda-card-head { padding: 6px 9px; }
  .vc2-comanda-open-btn  { padding: 9px 8px; font-size: 0.9rem; }
  .vc2-comanda-fechar-btn { padding: 9px 8px; font-size: 0.85rem; }
  .vc2-comanda-action-btn { padding: 9px 8px; font-size: 0.85rem; }
  .vc2-comanda-card-actions { padding: 5px 8px 4px; gap: 4px; }
  .vc2-comanda-card-actions-row2 { gap: 4px; }
  .vc2-comanda-card-body { padding: 3px 10px 4px; gap: 1px; }
  .vc2-comanda-valor { font-size: 0.82rem; margin-top: 0; }
  .vc2-comanda-card-ver-row { padding: 3px 8px 4px; }
  .vc2-comanda-ver-btn { padding: 3px 6px; font-size: 0.78rem; }
  /* Barra de ações compacta */
  .vc2-action-btn { padding: 10px 4px; min-height: 40px; font-size: 0.65rem; }
  .vc2-section { margin: 0 8px 8px; }

  /* VPL: tela de lançar — rodape fixo no mobile */
  .vpl-infobar { padding: 6px 10px; }
  .vpl-back-btn { padding: 6px 10px; font-size: 0.8rem; }
  .vpl-info-item strong { font-size: 0.8rem; }
  /* Ocultar Atendente e separador anterior (filhos 8 e 9) */
  .vpl-infobar > :nth-child(8),
  .vpl-infobar > :nth-child(9) { display: none; }
  /* O separador flex:1 (filho 9) fica oculto acima - sem ele o botao
     Delivery perde o empurrao automatico e cola no resto da infobar. */
  #dnp-abrir-btn { margin-left: auto; }
  /* Categorias: scroll horizontal, sem quebra de linha */
  .vpl-categories { flex-wrap: nowrap; overflow-x: auto; padding: 8px 10px; gap: 6px; }
  .vpl-product-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* ── Corrige altura quando hospedado no content-stack ─── */
.content-stack:has(> .vpl-shell) {
  padding: 0;
  gap: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  min-height: 0;
  overflow: hidden;
}

/* 100vh no celular inclui a area escondida atras da barra de
   endereco/navegacao do navegador, sobrando espaco vazio embaixo dos
   botoes; 100dvh acompanha a altura real visivel na tela. Precisa vir
   DEPOIS da regra acima (mesma especificidade - o ultimo no arquivo
   vence), senao aquela sempre ganhava e anulava esse ajuste. */
@media (max-width: 600px) {
  .content-stack:has(> .vpl-shell) {
    height: calc(100dvh - 56px - env(safe-area-inset-top, 0px));
  }
}

.vpl-sm-tag { font-size: 11px; color: #666; background: #f0f0f0; padding: 2px 6px; border-radius: 4px; }

/* Modal "Selecione o produto" no celular: colunas Codigo/EAN/Un nao cabem
   numa tela estreita - mostra so' Produto e Venda. !important necessario
   pra vencer o grid-template-columns/display fixo no inline style (gerado
   via JS, ver openSearchModal em venda_balcao.js). */
@media (max-width: 700px) {
  .vpl-sm-header,
  .vpl-sm-row {
    grid-template-columns: 1fr 90px !important;
  }
  .vpl-sm-col-code,
  .vpl-sm-col-ean,
  .vpl-sm-col-un {
    display: none !important;
  }
}

/* ── Layout Mercado (Conf. PDV > Terminais > Layout do PDV) ─────────────────
   So' no balcao (classe .vpl-mercado no .vpl-shell, ver venda_balcao.js).
   Estilo caixa de mercado: a esquerda a busca, Quantidade, Preco unitario, a
   area do produto (logo com a venda vazia) e a grade de botoes; a direita o
   cupom, o resumo e o rodape com Pagar (F5) e o total grande.
   Sem botao Delivery. */
.vpl-merc-painel,
.vpl-merc-resumo { display: none; }
.vpl-mercado .vpl-categories,
.vpl-mercado .vpl-product-grid,
.vpl-mercado #dnp-abrir-btn { display: none !important; }
.vpl-mercado .vpl-left { flex: none; width: 46%; max-width: 620px; background: #fff; }
.vpl-mercado .vpl-right { flex: 1; width: auto; min-width: 0; background: #fff; }
.vpl-mercado .vpl-search-bar input { font-size: 1.05rem; padding-block: 10px; }
.vpl-mercado .vpl-merc-painel { display: flex; flex-direction: column; gap: 14px; padding: 14px; flex: 1; min-height: 0; }
.vpl-merc-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.vpl-merc-campos label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; font-weight: 800; color: var(--orange); }
.vpl-merc-campos input { border: 1px solid #d1d5db; border-radius: 10px; padding: 7px 12px; font-size: 1.35rem; text-align: right; color: #6b7280; background: #fff; width: 100%; box-sizing: border-box; }
.vpl-merc-campos input:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
#vpl-merc-preco { background: #f9fafb; color: #6b7280; }
#vpl-merc-qtd-input { color: #6b7280; font-weight: 700; } /* mesma cor do Preco unitario */
#vpl-merc-preco { font-weight: 700; }
.vpl-merc-ultimo { flex: 1; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; }
.vpl-merc-logo { display: none; width: min(240px, 60%); height: auto; opacity: 0.9; }
/* so a foto do ultimo produto (sem nome/valor: ja estao no cupom); sem foto ou venda vazia: logo */
#vpl-merc-ult-nome, #vpl-merc-ult-det, #vpl-merc-ult-total { display: none !important; }
.vpl-merc-vazio .vpl-merc-logo,
.vpl-merc-sem-foto .vpl-merc-logo { display: block; }
.vpl-merc-vazio #vpl-merc-ult-nome,
.vpl-merc-vazio #vpl-merc-ult-det,
.vpl-merc-vazio #vpl-merc-ult-total { display: none; }
#vpl-merc-ult-img { width: min(280px, 65%); max-height: 260px; object-fit: contain; margin-bottom: 4px; }
.vpl-merc-vazio #vpl-merc-ult-img { display: none; }
#vpl-merc-ult-nome { font-size: 1.5rem; color: #1f2937; line-height: 1.2; }
#vpl-merc-ult-det { font-size: 1.05rem; color: #4b5563; }
#vpl-merc-ult-total { font-size: 1.8rem; color: var(--orange); }
.vpl-mercado .vpl-merc-total { display: none; }
/* grade de botoes (Cancelar, Canc. item, Cliente movidos pra ca): brancos com
   borda, rotulo normal + etiqueta da tecla; vermelho so' no cancelar a venda */
.vpl-merc-rodape { display: none; }
.vpl-mercado .vpl-merc-rodape { display: grid; grid-template-columns: repeat(5, 1fr) 1.6fr; gap: 10px; padding: 8px 14px; background: #fff; border-top: 1px solid #e5e7eb; flex-shrink: 0; }
.vpl-merc-rodape > button,
.vpl-merc-rodape > button.primary {
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px;
  min-width: 0; height: auto; min-height: 46px; margin: 0; padding: 6px 10px; border-radius: 10px; line-height: 1.2; overflow: visible;
  background: #fff; color: #374151; border: 1.5px solid #e5e7eb; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  font-size: 0.86rem; font-weight: 700; letter-spacing: 0; text-transform: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
/* o estilo geral de botao deixa o texto branco no hover/foco: aqui a cor fica fixa */
.vpl-merc-rodape > button:hover,
.vpl-merc-rodape > button:focus,
.vpl-merc-rodape > button:active { background: #f9fafb; border-color: #d1d5db; color: #374151; }
.vpl-merc-rodape > #vpl-eliminar-btn { color: #dc2626; border-color: #fecaca; }
.vpl-merc-rodape > #vpl-eliminar-btn:hover,
.vpl-merc-rodape > #vpl-eliminar-btn:focus,
.vpl-merc-rodape > #vpl-eliminar-btn:active { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.vpl-mb-txt { overflow: hidden; text-overflow: ellipsis; }
.vpl-mb-tecla { font-family: inherit; font-size: 0.72rem; font-weight: 800; color: #6b7280; background: #f3f4f6; border: 1px solid #e5e7eb; border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }
.vpl-merc-rodape > #vpl-eliminar-btn .vpl-mb-tecla { color: #dc2626; background: #fef2f2; border-color: #fecaca; }
/* cupom */
.vpl-mercado .vpl-items-table { font-size: 0.98rem; }
.vpl-mercado .vpl-items-table thead th { font-size: 0.75rem; }
.vpl-mercado .vpl-item-row td { padding-top: 9px; padding-bottom: 9px; }
.vpl-mercado .vpl-item-row:last-child { background: #fff4ef; }
.vpl-mercado .vpl-merc-resumo { display: block; padding: 8px 14px; font-size: 0.85rem; color: #4b5563; border-top: 1px solid #e5e7eb; background: #fff; }
/* coluna da direita: cupom e, embaixo, Total de itens + total grande (os botoes
   ficam na barra de ponta a ponta) */
.vpl-mercado .vpl-right { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr auto; }
.vpl-mercado .vpl-items-header { grid-column: 1 / -1; grid-row: 1; }
.vpl-mercado .vpl-items-table-wrap { grid-column: 1 / -1; grid-row: 2; min-height: 0; }
.vpl-mercado .vpl-merc-resumo { grid-column: 1; grid-row: 3; display: flex; align-items: center; gap: 4px; }
.vpl-mercado .vpl-actions { display: none; }
.vpl-mercado #vpl-finalizar-comanda { display: flex; flex-direction: row; justify-content: center; align-items: center; gap: 10px; width: 100%; height: auto; min-height: 46px; line-height: 1.2; overflow: visible; margin: 0; border: none; border-radius: 10px; background: var(--orange); color: #fff; font-size: 1.05rem; font-weight: 800; letter-spacing: 0; text-transform: none; box-shadow: 0 6px 16px rgba(232, 64, 14, 0.25); }
.vpl-mercado #vpl-finalizar-comanda:hover,
.vpl-mercado #vpl-finalizar-comanda:focus,
.vpl-mercado #vpl-finalizar-comanda:active { background: var(--orange-dark); color: #fff; }
.vpl-mercado #vpl-finalizar-comanda .vpl-mb-tecla { color: #fff; background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.35); }
.vpl-mercado .vpl-totals { grid-column: 2; grid-row: 3; display: flex; justify-content: flex-end; align-items: center; border-top: 1px solid #e5e7eb; background: #fff; padding: 4px 18px; }
.vpl-mercado .vpl-total-cell:not(.vpl-total-grand) { display: none; }
.vpl-mercado .vpl-total-grand { background: transparent; text-align: right; }
.vpl-mercado .vpl-total-grand .vpl-total-label { display: none; }
.vpl-mercado .vpl-total-grand .vpl-total-val { font-size: 2.3rem; font-weight: 900; line-height: 1.1; color: var(--orange); }

@media (max-width: 900px) {
  .vpl-mercado .vpl-body { flex-direction: column; }
  .vpl-mercado .vpl-left { width: 100%; max-width: none; flex: none; overflow: visible; }
  .vpl-mercado .vpl-right { display: grid; }
  .vpl-mercado .vpl-mobile-switch-row,
  .vpl-mercado #vpl-voltar-produtos-btn { display: none !important; }
  .vpl-mercado .vpl-merc-ultimo { display: none; }
  .vpl-mercado .vpl-merc-rodape { grid-template-columns: 1fr 1fr; }
  .vpl-mercado .vpl-merc-painel { flex: none; padding: 10px 12px; }
  .vpl-merc-campos input { font-size: 1.3rem; padding: 8px 10px; }
  .vpl-mercado .vpl-total-grand .vpl-total-val { font-size: 1.8rem; }
}

/* Mercado: Sangria / Suprimento no rodape (abrem a janela do caixa rapido) */
.vpl-merc-rodape > #vpl-merc-sangria { color: #b45309; border-color: #fde68a; }
.vpl-merc-rodape > #vpl-merc-sangria:hover,
.vpl-merc-rodape > #vpl-merc-sangria:focus,
.vpl-merc-rodape > #vpl-merc-sangria:active { background: #fffbeb; border-color: #fcd34d; color: #b45309; }
.vpl-merc-rodape > #vpl-merc-suprimento { color: #047857; border-color: #a7f3d0; }
.vpl-merc-rodape > #vpl-merc-suprimento:hover,
.vpl-merc-rodape > #vpl-merc-suprimento:focus,
.vpl-merc-rodape > #vpl-merc-suprimento:active { background: #ecfdf5; border-color: #6ee7b7; color: #047857; }

/* Balcao sem caixa aberto: tela travada com aviso por cima */
#module-content:has(.vpl-sem-caixa), .vpl-sem-caixa-pai { position: relative; }
.vpl-sem-caixa { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(255, 255, 255, 0.82); }
.vpl-sem-caixa-box { max-width: 360px; width: 100%; text-align: center; background: #fff; border: 1px solid #fecaca; border-radius: 14px; padding: 24px 22px; box-shadow: 0 16px 40px rgba(15, 23, 42, 0.15); }
.vpl-sem-caixa-box h3 { margin: 0 0 6px; color: #dc2626; font-size: 1.25rem; }
.vpl-sem-caixa-box p { margin: 0 0 16px; color: #565d66; }
.vpl-sem-caixa-box button { width: 100%; min-height: 44px; font-size: 1rem; font-weight: 800; }

/* Cliente (F2) e Delivery como icones no topo do balcao (mesmo formato do
   icone de caixa), todos em cinza neutro. */
.vpl-infobar .vpl-topo-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 38px; padding: 0; margin: 0 0 0 8px; border-radius: 10px;
  border: 1.5px solid transparent; box-shadow: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.vpl-infobar .vpl-topo-ico svg { display: block; width: 22px; height: 22px; min-width: 22px; flex: none; }
.vpl-infobar .vpl-topo-ico.hidden { display: none; }
/* sem cores (pedido): cinza neutro; cliente vinculado = cinza escuro */
.vpl-infobar .vpl-topo-ico, .vpl-infobar .vpl-topo-ico:focus { background: #f3f4f6; border-color: #e5e7eb; color: var(--menu-ink, #565d66); }
.vpl-infobar .vpl-topo-ico:hover { background: #e5e7eb; border-color: #d1d5db; color: var(--menu-ink, #565d66); }
.vpl-infobar .vpl-ico-cliente.ativo, .vpl-infobar .vpl-ico-cliente.ativo:hover { background: #565d66; border-color: #565d66; color: #fff; }
.vpl-infobar .cxr-slot { margin-left: 8px; }
