/* ── 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(--purple);
  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-back-btn:hover { background: #4a1160; }

.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;
}

.vpl-search-bar {
  display: flex;
  gap: 0;
  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;
  background: #f5f7fa;
}

.vpl-search-bar button {
  background: var(--orange);
  border: none;
  color: #fff;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.1s;
}

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

.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;
  text-transform: uppercase;
  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(255, 61, 16, 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-right {
  width: 400px;
  min-width: 340px;
  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(255, 61, 16, 0.06); }
.vpl-item-row:hover td       { background: var(--bg); }
.vpl-item-row.selected:hover td { background: rgba(255, 61, 16, 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;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vpl-item-editor-title { font-size: 0.88rem; font-weight: 700; color: var(--purple); 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;
}

.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-fechar-btn      { background: var(--orange); color: #fff; }
.vpl-fechar-btn:hover { background: var(--orange-dark); color: #fff; }
.vpl-finalizar-btn      { background: var(--purple); color: #fff; }
.vpl-finalizar-btn:hover { background: var(--magenta); color: #fff; }

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

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

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

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

@media (max-width: 900px) {
  .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, rodape fixo embaixo */
  .vpl-body            { flex-direction: column; overflow: hidden; }
  .vpl-left            { flex: 0 0 auto; min-height: 240px; max-height: 45vh; border-right: none; border-bottom: 1px solid #d0d7e6; overflow: hidden; }
  .vpl-right           { width: 100%; min-width: unset; flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
  .vpl-items-table-wrap { flex: 1; min-height: 0; overflow-y: auto; max-height: none; }
  .vpl-obs-section     { flex-shrink: 0; }
  .vpl-totals          { grid-template-columns: repeat(2, 1fr); flex-shrink: 0; }
  .vpl-actions         { flex-shrink: 0; }
  .vpl-product-grid    { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }

  /* 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(--purple);
  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: #4a1160; }

/* ── 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-left { max-height: 38vh; min-height: 180px; }
  .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; }
  /* 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 - 68px);
  min-height: 0;
  overflow: hidden;
}
