/* Comercial / PDV — protótipo visual (mesmo respiro Patrimônio / Energia) */
:is(
  #comercialDashboardSection,
  #comercialPdvSection,
  #comercialMesasSection,
  #comercialPedidosSection,
  #comercialCozinhaSection,
  #comercialPagamentosSection,
  #comercialFechamentoSection,
  #comercialClientesSection,
  #comercialHistoricoSection,
  #comercialRelatoriosSection,
  #comercialConfiguracoesSection,
  #comercialFiscalSection
) {
  padding: 0.25rem 0.35rem 2rem;
  box-sizing: border-box;
}

.cpdv-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0 0.35rem;
}
.cpdv-section-head h2 { margin: 0; }
.cpdv-section-head .subtle-text { margin: 0.35rem 0 0; }

.cpdv-page-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1400px;
  padding: 0 0.15rem;
  box-sizing: border-box;
}

.cpdv-aviso-proto {
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #6d4c00;
  font-size: 0.9rem;
}
.cpdv-aviso-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.cpdv-aviso-bar .cpdv-aviso-proto {
  margin: 0;
  flex: 1 1 280px;
}
.cpdv-offline-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #ffe0b2;
  color: #e65100;
  font-size: 0.8rem;
  font-weight: 700;
}
.cpdv-offline-badge[hidden],
#cpdvSyncOfflineBtn[hidden] {
  display: none !important;
}
.cpdv-offline-alert {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 100000;
  width: min(680px, calc(100vw - 24px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 0.9rem;
  border: 2px solid #e65100;
  border-radius: 12px;
  background: #fff3e0;
  color: #5d2700;
  box-shadow: 0 8px 28px rgba(93, 39, 0, 0.3);
}
.cpdv-offline-alert__icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e65100;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
}
.cpdv-offline-alert__texto {
  flex: 1;
  display: grid;
  gap: 0.15rem;
}
.cpdv-offline-alert__texto strong {
  font-size: 1rem;
}
.cpdv-offline-alert__texto span {
  font-size: 0.85rem;
  line-height: 1.35;
}
.cpdv-offline-alert__fechar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #e65100;
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}
.cpdv-offline-alert__fechar:hover,
.cpdv-offline-alert__fechar:focus-visible {
  background: #bf360c;
  outline: 2px solid #fff;
  outline-offset: -4px;
}

.cpdv-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}
.cpdv-card {
  background: linear-gradient(145deg, #fff 0%, #f5f8fc 100%);
  border: var(--card-border, 2px solid #000);
  border-radius: 14px;
  padding: 1.05rem 1.15rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.cpdv-card span { display: block; font-size: 0.78rem; color: #607d8b; margin-bottom: 0.3rem; }
.cpdv-card strong { font-size: 1.2rem; color: #1565c0; }

.cpdv-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.15rem;
}
.cpdv-chart-box {
  background: var(--card-bg, #fff);
  border: var(--card-border, 2px solid #000);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  min-height: 220px;
}
.cpdv-chart-box h4 { margin: 0 0 0.75rem; font-size: 0.95rem; }
.cpdv-chart-box canvas { max-height: 200px; width: 100% !important; }

:is(
  #comercialDashboardSection,
  #comercialPdvSection,
  #comercialMesasSection,
  #comercialPedidosSection,
  #comercialCozinhaSection,
  #comercialPagamentosSection,
  #comercialFechamentoSection,
  #comercialClientesSection,
  #comercialHistoricoSection,
  #comercialRelatoriosSection,
  #comercialConfiguracoesSection,
  #comercialFiscalSection
) .table-card {
  margin-bottom: 0;
  border-radius: 14px;
}
:is(
  #comercialDashboardSection,
  #comercialPdvSection,
  #comercialMesasSection,
  #comercialPedidosSection,
  #comercialCozinhaSection,
  #comercialPagamentosSection,
  #comercialFechamentoSection,
  #comercialClientesSection,
  #comercialHistoricoSection,
  #comercialRelatoriosSection,
  #comercialConfiguracoesSection,
  #comercialFiscalSection
) .table-card > header { padding: 1rem 1.35rem; }

.cpdv-form-body { padding: 1.2rem 1.35rem 1.4rem; box-sizing: border-box; }
.cpdv-form-body .filters-grid { gap: 1rem 1.15rem; }
.cpdv-form-body .btn,
.cpdv-section-head .btn,
.cpdv-actions .btn {
  min-height: 2.5rem;
  min-width: auto;
  width: auto;
  max-width: max-content;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
}
.cpdv-form-body .filters-grid > label:has(> .btn) {
  width: max-content;
  align-self: end;
}

.cpdv-pdv-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.15rem;
  align-items: start;
}
.cpdv-pdv-cats { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.85rem; }
.cpdv-chip {
  border: 1px solid #c5cae9;
  background: #fff;
  color: #3949ab;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.cpdv-chip.active { background: #3949ab; color: #fff; border-color: #3949ab; }
.cpdv-prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.cpdv-prod {
  border: var(--card-border, 2px solid #000);
  border-radius: 12px;
  padding: 0.75rem;
  background: var(--card-bg, #fff);
  cursor: pointer;
  text-align: left;
}
.cpdv-prod:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.cpdv-prod--off { opacity: 0.45; cursor: not-allowed; }
.cpdv-prod--warn { box-shadow: inset 0 0 0 2px #f59e0b; }
.cpdv-prod__aviso { display: block; font-size: 0.72rem; color: #b45309; margin-top: 0.25rem; line-height: 1.2; }
.cpdv-prod__nome { font-weight: 700; font-size: 0.88rem; margin: 0 0 0.25rem; }
.cpdv-prod__preco { color: #1565c0; font-weight: 700; }
.cpdv-prod__fav { font-size: 0.75rem; color: #f57f17; }
.cpdv-cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #eceff1;
  font-size: 0.88rem;
}
.cpdv-cart-totais { margin-top: 0.75rem; display: grid; gap: 0.35rem; font-size: 0.9rem; }
.cpdv-cart-totais .total { font-size: 1.15rem; font-weight: 800; color: #1a237e; }
.cpdv-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.85rem; }

/* Caixa principal com a mesma linguagem visual do PDV local */
#comercialPdvSection {
  --cpdv-local-bg: #f4f1ea;
  --cpdv-local-card: #fffdf8;
  --cpdv-local-line: #d7d0c4;
  --cpdv-local-ink: #1f2933;
  --cpdv-local-muted: #6b7280;
  --cpdv-local-accent: #0f766e;
  color: var(--cpdv-local-ink);
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, #efe7d8 0, transparent 38%),
    linear-gradient(180deg, #f7f3eb, #efe8dc);
  padding: 0.45rem 0.75rem 1rem;
}
#comercialPdvSection .cpdv-page-wrap {
  max-width: 1500px;
  gap: 0.9rem;
}
.cpdv-local-shell {
  display: grid;
  gap: 0.9rem;
}
.cpdv-local-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.cpdv-local-toolbar > div {
  display: grid;
  gap: 0.15rem;
}
.cpdv-local-toolbar > div > strong {
  font-size: 1.05rem;
}
.cpdv-local-toolbar > div > small {
  color: var(--cpdv-local-muted);
}
.cpdv-local-toolbar-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 0.6rem;
  flex: 1 1 420px;
}
.cpdv-local-unidade {
  width: min(340px, 100%);
  margin: 0;
  color: var(--cpdv-local-ink);
}
.cpdv-local-toolbar-actions #cpdvVoltarSistema {
  flex: 0 0 auto;
  min-height: 2.45rem;
  border-radius: 10px;
}
#comercialPdvSection input,
#comercialPdvSection select {
  border: 1px solid var(--cpdv-local-line);
  border-radius: 10px;
  background: #fff;
  color: var(--cpdv-local-ink);
}
#comercialPdvSection .cpdv-pdv-layout {
  grid-template-columns: minmax(0, 1.3fr) minmax(330px, 0.9fr);
  gap: 1rem;
}
#comercialPdvSection .cpdv-local-panel {
  overflow: hidden;
  border: 1px solid var(--cpdv-local-line);
  border-radius: 14px;
  background: var(--cpdv-local-card);
  box-shadow: none;
}
#comercialPdvSection .cpdv-local-panel > header {
  padding: 1rem 1rem 0;
  border: 0;
  background: transparent;
}
#comercialPdvSection .cpdv-local-panel > header h3 {
  color: var(--cpdv-local-ink);
  font-size: 1.05rem;
}
#comercialPdvSection .cpdv-form-body {
  padding: 1rem;
}
.cpdv-local-search {
  margin-bottom: 0.75rem;
}
#comercialPdvSection .cpdv-pdv-cats {
  margin-bottom: 0.8rem;
}
#comercialPdvSection .cpdv-chip {
  border-color: var(--cpdv-local-line);
  background: #fff;
  color: var(--cpdv-local-ink);
}
#comercialPdvSection .cpdv-chip.active {
  border-color: var(--cpdv-local-accent);
  background: var(--cpdv-local-accent);
  color: #fff;
}
#comercialPdvSection .cpdv-prod-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}
#comercialPdvSection .cpdv-prod {
  min-height: 86px;
  border: 1px solid var(--cpdv-local-line);
  border-radius: 12px;
  background: #fff;
  color: var(--cpdv-local-ink);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
#comercialPdvSection .cpdv-prod:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(31, 41, 51, 0.08);
}
#comercialPdvSection .cpdv-prod:active {
  transform: scale(0.98);
}
#comercialPdvSection .cpdv-prod__preco {
  color: var(--cpdv-local-accent);
}
.cpdv-local-cart {
  position: sticky;
  top: 0.6rem;
}
.cpdv-local-hint {
  margin: 0 0 0.55rem;
  color: var(--cpdv-local-muted);
  font-size: 0.78rem;
}
.cpdv-conta-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--cpdv-local-line);
  border-radius: 10px;
  background: #f0fdfa;
  color: var(--cpdv-local-accent);
  cursor: pointer;
}
.cpdv-conta-check input {
  width: 18px !important;
  height: 18px;
  margin: 0;
  accent-color: var(--cpdv-local-accent);
}
.cpdv-conta-check span {
  font-weight: 800;
}
.cpdv-conta-rapida {
  margin-bottom: 0.65rem;
  padding: 0.7rem;
  border: 1px solid #99d5cc;
  border-radius: 10px;
  background: #f0fdfa;
}
.cpdv-conta-rapida label {
  margin-bottom: 0.35rem;
}
.cpdv-local-cart-list {
  min-height: 68px;
  max-height: 35vh;
  overflow: auto;
}
#comercialPdvSection .cpdv-cart-item {
  border-bottom: 1px dashed var(--cpdv-local-line);
  padding: 0.6rem 0;
}
#comercialPdvSection .cpdv-cart-item span {
  color: var(--cpdv-local-muted);
}
#comercialPdvSection .cpdv-cart-totais {
  gap: 0.45rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--cpdv-local-line);
}
#comercialPdvSection .cpdv-cart-totais > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
#comercialPdvSection .cpdv-cart-totais .total {
  margin-top: 0.2rem;
  color: var(--cpdv-local-ink);
  font-size: 1.3rem;
}
#comercialPdvSection .cpdv-actions .btn {
  border-radius: 10px;
}
#comercialPdvSection #cpdvPagarBtn {
  flex: 1 1 100%;
  order: -1;
  justify-content: center;
  min-height: 2.8rem;
  max-width: none;
  background: var(--cpdv-local-accent);
}
#comercialPdvSection .cpdv-aviso-proto {
  border-color: #f0d59d;
  background: #fff8e8;
}

.cpdv-conta-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.cpdv-conta-lista {
  display: grid;
  gap: 0.45rem;
  max-height: 360px;
  overflow: auto;
}
.cpdv-conta-item {
  display: grid;
  gap: 0.15rem;
  text-align: left;
  border: 1px solid #d7d0c4;
  border-radius: 10px;
  background: #fff;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
}
.cpdv-conta-item strong { font-size: 0.92rem; }
.cpdv-conta-item span { color: #6b7280; font-size: 0.8rem; }
.cpdv-conta-item.is-off { opacity: 0.55; }
.cpdv-conta-hist {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0.85rem;
  background: #fafafa;
  min-height: 180px;
}
.cpdv-conta-hist-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
@media (max-width: 900px) {
  .cpdv-conta-layout { grid-template-columns: 1fr; }
}

.cpdv-mesas-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 400px);
  gap: 1rem;
  align-items: start;
}
.cpdv-mesa-painel-wrap {
  position: sticky;
  top: 0.5rem;
  border: 1px solid #cfd8dc;
  border-radius: 10px;
  background: #fff;
  padding: 0.75rem;
  max-height: calc(100vh - 140px);
  overflow: auto;
}
.cpdv-mesa-painel-head h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.cpdv-mesa-painel-meta { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 0.5rem; }
.cpdv-mesa-itens { max-height: 200px; overflow: auto; margin-bottom: 0.5rem; }
.cpdv-mesa--selected { outline: 3px solid #1565c0; outline-offset: 2px; }
.cpdv-prod-grid--mesa { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: 260px; overflow: auto; margin-top: 0.5rem; }
.cpdv-prod--sm { padding: 0.4rem; font-size: 0.75rem; min-height: 52px; }
.cpdv-mesa-painel-empty { padding: 1.5rem 0.5rem; text-align: center; }

.cpdv-mesas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
}
.cpdv-mesa {
  border: 2px solid #000;
  border-radius: 14px;
  padding: 0.9rem;
  cursor: pointer;
  background: #fff;
  min-height: 130px;
}
.cpdv-mesa:hover { transform: translateY(-2px); }
.cpdv-mesa h4 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.cpdv-mesa small { display: block; color: #607d8b; font-size: 0.78rem; line-height: 1.35; }
.cpdv-mesa--livre { background: #efebe9; border-color: #8d6e63; }
.cpdv-mesa--ocupada { background: #ffebee; border-color: #e53935; }
.cpdv-mesa--reservada { background: #e3f2fd; border-color: #1e88e5; }
.cpdv-mesa--aguardando_pedido { background: #fff3e0; border-color: #fb8c00; }
.cpdv-mesa--em_producao { background: #fff8e1; border-color: #f9a825; }
.cpdv-mesa--aguardando_pagamento { background: #f3e5f5; border-color: #8e24aa; }
.cpdv-mesa--limpeza { background: #e0f7fa; border-color: #00acc1; }
.cpdv-mesa--bloqueada { background: #eceff1; border-color: #78909c; opacity: 0.75; }

.cpdv-kds {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  align-items: start;
}
.cpdv-kds-col {
  background: #f5f7fa;
  border-radius: 14px;
  padding: 0.75rem;
  border: 1px solid #e0e6ef;
  min-height: 320px;
}
.cpdv-kds-col h3 { margin: 0 0 0.65rem; font-size: 0.95rem; }
.cpdv-kds-card {
  background: #fff;
  border: 2px solid #000;
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
}
.cpdv-kds-card--cozinha { border-left: 5px solid #ef6c00; }
.cpdv-kds-card--bar { border-left: 5px solid #1565c0; }
.cpdv-kds-card--sobremesa { border-left: 5px solid #8e24aa; }
.cpdv-kds-card strong { display: block; margin-bottom: 0.25rem; }
.cpdv-prio {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #ffebee;
  color: #c62828;
}

.cpdv-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e8eaf6;
  color: #3949ab;
}
.cpdv-badge--warn { background: #fff3e0; color: #ef6c00; }
.cpdv-badge--ok { background: #e8f5e9; color: #2e7d32; }
.cpdv-badge--danger { background: #ffebee; color: #c62828; }
.cpdv-badge--muted { background: #eceff1; color: #546e7a; }

.cpdv-rel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.cpdv-rel-card {
  border: var(--card-border, 2px solid #000);
  border-radius: 14px;
  padding: 1.1rem;
  background: var(--card-bg, #fff);
}
.cpdv-rel-card h4 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.cpdv-rel-card p { margin: 0 0 0.75rem; font-size: 0.82rem; color: #607d8b; }

.cpdv-cfg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}
.cpdv-cfg-card {
  border: var(--card-border, 2px solid #000);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  background: var(--card-bg, #fff);
}
.cpdv-cfg-card h4 { margin: 0 0 0.5rem; }
.cpdv-cfg-card ul { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; color: #546e7a; }
.cpdv-cfg-checks { display: grid; gap: 0.65rem; margin: 0.75rem 0 1rem; }
.cpdv-cfg-checks label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; cursor: pointer; }
.cpdv-cfg-pix { list-style: none; margin: 0.5rem 0 1rem; padding: 0; display: grid; gap: 0.45rem; }
.cpdv-cfg-pix-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0.7rem; border: 1px solid #cfd8dc; border-radius: 8px; background: #fafafa; }
.cpdv-cfg-pix-item div { display: grid; gap: 0.15rem; }
.cpdv-cfg-pix-item small { color: #607d8b; font-size: 0.8rem; }
.cpdv-cfg-pix-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.65rem 0.85rem; margin-bottom: 0.5rem; }
.cpdv-cfg-pix-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.86rem; font-weight: 600; }
.cpdv-cfg-pix-form input,
.cpdv-cfg-pix-form select { font-weight: 400; }
.cpdv-cfg-pix-padrao { flex-direction: row !important; align-items: center; gap: 0.45rem !important; }
.cpdv-pix-qr { display: grid; grid-template-columns: 180px 1fr; gap: 0.85rem; align-items: center; padding: 0.75rem; border: 1px solid #a5d6a7; border-radius: 10px; background: #e8f5e9; }
.cpdv-pix-qr__box { width: 180px; min-height: 180px; display: grid; place-items: center; background: #fff; border-radius: 8px; border: 1px solid #c8e6c9; padding: 0.35rem; }
.cpdv-pix-qr__box img { display: block; width: 180px; height: 180px; }
.cpdv-pix-qr__meta { display: grid; gap: 0.35rem; }
.cpdv-pix-qr__titulo { margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: #2e7d32; font-weight: 700; }
.cpdv-pix-qr__valor { margin: 0; font-size: 1.25rem; font-weight: 700; color: #1b5e20; }
.cpdv-pix-qr__benef { margin: 0 0 0.35rem; font-size: 0.86rem; color: #455a64; }
@media (max-width: 640px) {
  .cpdv-pix-qr { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
.cpdv-cfg-bandeira-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.45rem 0.65rem; border: 1px solid #cfd8dc; border-radius: 8px; background: #fafafa; }
.cpdv-cfg-bandeira-add { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; align-items: center; }
.cpdv-cfg-bandeira-add input { flex: 1; min-width: 180px; }
.cpdv-pgto-hint { margin: 0; font-size: 0.82rem; color: #607d8b; line-height: 1.35; }
.cpdv-pgto-encargos { display: grid; gap: 0.5rem; margin: 0.75rem 0; padding: 0.75rem; border: 1px solid #90caf9; border-radius: 10px; background: #e3f2fd; }
.cpdv-pgto-encargos__titulo { margin: 0 0 0.25rem; font-size: 0.82rem; font-weight: 600; color: #1565c0; text-transform: uppercase; letter-spacing: 0.03em; }
.cpdv-pgto-encargo--on { font-weight: 500; }
.cpdv-pgto-encargo { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.cpdv-pgto-encargo__val { margin-left: auto; font-weight: 600; color: #1565c0; }
.cpdv-cfg-encargos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 0.75rem 0 1rem; }
.cpdv-cfg-encargo { border: 1px solid #cfd8dc; border-radius: 10px; padding: 0.85rem 1rem; display: grid; gap: 0.55rem; }
.cpdv-cfg-encargo legend { font-weight: 600; padding: 0 0.25rem; }
.cpdv-req { color: #c62828; font-weight: 700; }

.cpdv-fiscal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.cpdv-fiscal-card {
  border: 2px dashed #b0bec5;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  color: #78909c;
  background: #fafafa;
  opacity: 0.85;
}
.cpdv-fiscal-card strong { display: block; margin-bottom: 0.35rem; color: #546e7a; }

.cpdv-garcom-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 0.5rem;
}

#cpdvModal .modal { max-width: 640px; width: 96%; }
#cpdvModal.cpdv-modal--pgto .modal {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
#cpdvModal.cpdv-modal--pgto .modal header {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 1.1rem 1.35rem 0.65rem;
}
#cpdvModal .cpdv-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0;
  padding: 1rem 1.35rem 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 71, 171, 0.02);
}
#cpdvModal.cpdv-modal--pgto .cpdv-modal-actions {
  flex-shrink: 0;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem 0.7rem;
}
#cpdvModal.cpdv-modal--pgto .cpdv-modal-actions__btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}
#cpdvModal.cpdv-modal--pgto .cpdv-modal-actions .btn,
#cpdvModal.cpdv-modal--pgto .cpdv-modal-actions__btns .btn {
  flex: 0 0 auto;
  min-height: 0;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 8px;
  box-shadow: none;
  justify-content: center;
}
#cpdvModal.cpdv-modal--pgto .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
}

/* —— Tela de pagamento —— */
.cpdv-pgto {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem 1.35rem 1.25rem;
}
.cpdv-pgto-alerta {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  font-size: 0.88rem;
  color: #5d4037;
}
.cpdv-pgto-hero {
  text-align: center;
  padding: 1.1rem 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 71, 171, 0.08), rgba(21, 101, 192, 0.04));
  border: 1px solid rgba(0, 71, 171, 0.12);
}
.cpdv-pgto-hero__label {
  display: block;
  font-size: 0.82rem;
  color: #607d8b;
  margin-bottom: 0.25rem;
}
.cpdv-pgto-hero__valor {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: #0d47a1;
  line-height: 1.1;
}
.cpdv-pgto-hero__meta {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: #78909c;
}
.cpdv-pgto-resumo {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #fafbfc;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.cpdv-pgto-resumo h4 {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  color: #37474f;
}
.cpdv-pgto-resumo__lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.86rem;
}
.cpdv-pgto-resumo__lista li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: #455a64;
}
.cpdv-pgto-resumo__lista li span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cpdv-pgto-resumo__mais {
  font-style: italic;
  color: #90a4ae;
}
.cpdv-pgto-resumo__ajustes {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: #607d8b;
}
.cpdv-pgto-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.cpdv-pgto-grid {
  display: grid;
  gap: 0.75rem 0.85rem;
}
.cpdv-pgto-grid[hidden] {
  display: none !important;
}
.cpdv-pgto-grid--2 {
  grid-template-columns: 1fr 1fr;
}
.cpdv-pgto-field.is-inactive,
.cpdv-pgto-field.is-inactive input,
.cpdv-pgto-field.is-inactive select {
  opacity: 0.55;
  pointer-events: none;
}
.cpdv-pgto-field.is-inactive input,
.cpdv-pgto-field.is-inactive select {
  background: #eceff1;
  color: #78909c;
}
.cpdv-pgto-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: #263238;
}
.cpdv-pgto-field--full {
  grid-column: 1 / -1;
}
.cpdv-pgto-field small {
  font-weight: 400;
  color: #90a4ae;
}
.cpdv-pgto-field input,
.cpdv-pgto-field select {
  font-weight: 400;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid #c5cdd6;
  border-radius: 10px;
  background: #fff;
}
.cpdv-pgto-field input:focus,
.cpdv-pgto-field select:focus {
  outline: none;
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
.cpdv-pgto-nota {
  padding: 0.95rem 1rem;
  border-radius: 12px;
  border: 2px solid #f9a825;
  background: #fff8e1;
}
.cpdv-pgto-nota__titulo {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a237e;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cpdv-pgto-nota__opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.cpdv-pgto-nota__opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.7rem 0.5rem;
  border-radius: 10px;
  border: 1px solid #c5cae9;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: #1a237e;
}
.cpdv-pgto-nota__opt:has(input:checked) {
  border-color: #1565c0;
  background: #e3f2fd;
  box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.18);
}
.cpdv-pgto-nota__opt input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex-shrink: 0;
}
.cpdv-pgto-nota small {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: #607d8b;
  line-height: 1.4;
  font-weight: 400;
}
.cpdv-pgto-nota__label {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  cursor: pointer;
  margin: 0;
  font-weight: 400;
}
.cpdv-pgto-nota__label input {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}
.cpdv-pgto-nota__label strong {
  display: block;
  font-size: 0.92rem;
  color: #1a237e;
  margin-bottom: 0.15rem;
}
.cpdv-pgto-nota__label small {
  display: block;
  font-size: 0.78rem;
  color: #607d8b;
  line-height: 1.4;
  font-weight: 400;
}
.cpdv-pgto-mesa {
  margin-top: 0.75rem;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.cpdv-pgto-mesa__title {
  margin: 0;
  font-size: 0.92rem;
  color: #37474f;
}
.cpdv-pgto-mesa__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cpdv-pgto-mesa__actions .btn {
  flex: 1 1 8rem;
  min-height: 2.5rem;
  justify-content: center;
}

@media (max-width: 480px) {
  .cpdv-pgto-grid--2 {
    grid-template-columns: 1fr;
  }
  .cpdv-pgto-hero__valor {
    font-size: 1.65rem;
  }
}

@media (max-width: 1024px) {
  .cpdv-pdv-layout { grid-template-columns: 1fr; }
  .cpdv-local-cart { position: static; }
  .cpdv-kds { grid-template-columns: 1fr 1fr; }
}
.cpdv-mesa-painel-empty { padding: 1.5rem 0.5rem; text-align: center; }

/* Modo foco PDV / mesas — oculta topbar (desktop) */
body.cpdv-pdv-fullscreen #sidebar,
body.cpdv-pdv-fullscreen .sidebar-backdrop,
body.cpdv-pdv-fullscreen .topbar {
  display: none !important;
}
body.cpdv-pdv-fullscreen .main-content {
  width: 100%;
  max-width: none;
}
body.cpdv-pdv-fullscreen .content {
  padding: 4px;
}
@media (min-width: 1025px) {
  body.cpdv-focus-mode .topbar {
    display: none !important;
  }
  body.cpdv-focus-mode.cpdv-topbar-expanded .topbar {
    display: flex !important;
  }
  body.cpdv-focus-mode .content {
    padding-top: 10px;
  }
}
@media (max-width: 1024px) {
  body.cpdv-focus-mode .cpdv-topbar-reveal {
    display: none !important;
  }
}
body.cpdv-focus-mode #comercialPdvSection .cpdv-aviso-proto,
body.cpdv-focus-mode #comercialMesasSection .cpdv-aviso-proto {
  margin-top: 0;
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
}
.cpdv-topbar-reveal {
  position: fixed;
  top: 6px;
  left: calc(var(--sidebar-width, 240px) + 8px);
  z-index: 1100;
  width: 30px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #b0bec5;
  background: #ffffff;
  color: #37474f;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}
.cpdv-topbar-reveal:hover {
  background: #eceff1;
}
body.cpdv-topbar-expanded .cpdv-topbar-reveal {
  top: 62px;
}
@media (max-width: 1024px) {
  .cpdv-topbar-reveal {
    left: 8px !important;
    top: 6px;
  }
  body.cpdv-topbar-expanded .cpdv-topbar-reveal {
    top: 56px;
  }
}

@media (max-width: 900px) {
  .cpdv-mesas-layout { grid-template-columns: 1fr; }
  .cpdv-mesa-painel-wrap { position: static; max-height: none; }
}
@media (max-width: 700px) {
  .cpdv-local-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .cpdv-local-unidade,
  .cpdv-local-toolbar-actions #cpdvVoltarSistema {
    width: 100%;
    max-width: none;
  }
  .cpdv-kds { grid-template-columns: 1fr; }
  .cpdv-mesas-grid { grid-template-columns: 1fr 1fr; }
  .cpdv-section-head .btn,
  .cpdv-form-body .btn,
  .cpdv-actions .btn { max-width: none; }
}

.cpdv-aviso-proto--ok {
  background: #e8f5e9;
  border-color: #a5d6a7;
  color: #1b5e20;
}

.cpdv-fiscal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.75rem;
}

.cpdv-fiscal-panel {
  min-height: 120px;
}

.cpdv-fiscal-embed {
  margin-top: 0.25rem;
}

.cpdv-fiscal-cards {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 1rem;
}

.cpdv-fiscal-card {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 10px;
  background: #fafafa;
}

.cpdv-fiscal-card span {
  display: block;
  font-size: 0.8rem;
  color: #555;
  margin-bottom: 0.25rem;
}

.cpdv-fiscal-checklist {
  margin: 0 0 1rem 1.15rem;
  line-height: 1.5;
  font-size: 0.92rem;
}

.cpdv-fiscal-warn {
  color: #9a4a00;
  font-size: 0.9rem;
}

#comercialHistoricoSection,
#comercialHistoricoSection .cpdv-page-wrap,
#comercialHistoricoSection .table-card,
#comercialHistoricoSection .cpdv-hist-card-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
#comercialHistoricoSection {
  overflow-x: hidden;
}
#comercialHistoricoSection .cpdv-hist-card-wrap {
  overflow: hidden;
}

.cpdv-hist-cards {
  display: grid;
  gap: 12px;
  padding: 12px;
}
.cpdv-hist-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #d7d0c4);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.cpdv-hist-card__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.92rem;
}
.cpdv-hist-card__row span {
  flex: 0 0 36%;
  max-width: 7.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted, #607d8b);
  padding-top: 0.15rem;
}
.cpdv-hist-card__row strong {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.cpdv-hist-card__acoes {
  display: flex !important;
  flex-wrap: wrap;
  gap: 0.4rem;
  width: 100%;
  margin: 0.7rem 0 0;
}
.cpdv-hist-card__acoes .btn {
  flex: 1 1 calc(50% - 0.4rem);
  min-height: 2.7rem;
  max-width: none !important;
  width: auto;
  justify-content: center;
}
.cpdv-hist-empty-msg {
  margin: 0;
  padding: 1rem 0.25rem;
  text-align: center;
}

/* Celular e janela estreita: só os cards. */
#comercialHistoricoSection .cpdv-hist-table {
  display: none !important;
}

@media (min-width: 1181px) {
  #comercialHistoricoSection .cpdv-hist-cards {
    display: none !important;
  }
  #comercialHistoricoSection .cpdv-hist-table {
    display: block !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #comercialHistoricoSection .cpdv-hist-table table {
    width: 100%;
    min-width: 0;
  }
  #comercialHistoricoSection .cpdv-hist-table .cpdv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
  }
  #comercialHistoricoSection .cpdv-hist-table .cpdv-actions .btn {
    max-width: none;
  }
}

@media (max-width: 1180px) {
  #comercialHistoricoSection {
    padding: 0.1rem 0 1.4rem;
  }
  #comercialHistoricoSection .cpdv-section-head {
    padding: 0 0.1rem 0.25rem;
    margin-bottom: 0.65rem;
  }
  #comercialHistoricoSection .cpdv-section-head h2 {
    font-size: 1.15rem;
    line-height: 1.25;
  }
  #comercialHistoricoSection .cpdv-section-head .subtle-text {
    font-size: 0.8rem;
  }
  #comercialHistoricoSection .table-card > header {
    padding: 0.8rem 1rem;
  }
  #comercialHistoricoSection .cpdv-aviso-proto {
    font-size: 0.82rem;
    padding: 0.7rem 0.85rem;
  }
}
