/* =========================================================
   DB PDV · Design System Global v138
   Carregado por último em todas as telas internas.
   Objetivo: manter margens, cards, botões, tabelas e ações no mesmo padrão.
   ========================================================= */
:root{
  --db-std-content:1180px;
  --db-std-gap:18px;
  --db-std-card-bg:#fffdf9;
  --db-std-card-border:rgba(120,85,60,.16);
  --db-std-card-shadow:0 12px 30px rgba(86,54,24,.045);
  --db-std-radius:18px;
  --db-std-text:#211915;
  --db-std-muted:#7a6a60;
  --db-std-orange:#ff6b00;
  --db-std-cream:#fff8ef;
}

body:not(.pdv-mode){overflow-x:hidden!important;background:#fff8ef!important}
body:not(.pdv-mode) .main{min-width:0!important;overflow-x:hidden!important;box-sizing:border-box!important}

/* Área útil central única. A correção real começa aqui. */
body:not(.pdv-mode) .page-head,
body:not(.pdv-mode) [data-db-page-shell],
body:not(.pdv-mode) .toast,
body:not(.pdv-mode) .app-store-footer{
  width:min(var(--db-std-content), calc(100% - 48px))!important;
  max-width:var(--db-std-content)!important;
  margin-left:auto!important;
  margin-right:auto!important;
  box-sizing:border-box!important;
}
body:not(.pdv-mode) .page-head{padding-left:0!important;padding-right:0!important;margin-bottom:16px!important;display:flex!important;align-items:flex-start!important;justify-content:space-between!important;gap:14px!important}
body:not(.pdv-mode) .page-head h1{font-size:28px!important;line-height:1.12!important;font-weight:760!important;letter-spacing:-.045em!important;margin:0!important;color:var(--db-std-text)!important}
body:not(.pdv-mode) .page-head p{font-size:15px!important;line-height:1.35!important;color:var(--db-std-muted)!important;margin:6px 0 0!important}

body:not(.pdv-mode) [data-db-page-shell]{display:grid!important;gap:var(--db-std-gap)!important;min-width:0!important;padding:0!important}
body:not(.pdv-mode) [data-db-page-shell] > *{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
  margin-left:0!important;
  margin-right:0!important;
}

/* Cards/painéis: padrão único sem preencher a tela inteira. */
body:not(.pdv-mode) [data-db-page-shell] .card,
body:not(.pdv-mode) [data-db-page-shell] .list-card,
body:not(.pdv-mode) [data-db-page-shell] .table-card,
body:not(.pdv-mode) [data-db-page-shell] .filter-card,
body:not(.pdv-mode) [data-db-page-shell] .panel,
body:not(.pdv-mode) [data-db-page-shell] .box,
body:not(.pdv-mode) [data-db-page-shell] section,
body:not(.pdv-mode) [data-db-page-shell] article{
  box-sizing:border-box!important;
  max-width:100%!important;
  min-width:0!important;
}
body:not(.pdv-mode) [data-db-page-shell] > .card,
body:not(.pdv-mode) [data-db-page-shell] > .list-card,
body:not(.pdv-mode) [data-db-page-shell] > .table-card,
body:not(.pdv-mode) [data-db-page-shell] > .filter-card,
body:not(.pdv-mode) [data-db-page-shell] > .panel,
body:not(.pdv-mode) [data-db-page-shell] > section,
body:not(.pdv-mode) [data-db-page-shell] > article{
  background:var(--db-std-card-bg)!important;
  border:1px solid var(--db-std-card-border)!important;
  border-radius:var(--db-std-radius)!important;
  box-shadow:var(--db-std-card-shadow)!important;
  padding:22px 24px!important;
  overflow:visible!important;
}
body:not(.pdv-mode) [data-db-page-shell] h2{font-size:21px!important;line-height:1.16!important;font-weight:740!important;letter-spacing:-.035em!important;margin:0 0 8px!important;color:var(--db-std-text)!important}
body:not(.pdv-mode) [data-db-page-shell] h3{font-size:16px!important;line-height:1.2!important;font-weight:700!important;letter-spacing:-.02em!important;color:var(--db-std-text)!important}
body:not(.pdv-mode) [data-db-page-shell] p,
body:not(.pdv-mode) [data-db-page-shell] .muted{color:var(--db-std-muted)!important}

/* Grids e cards de resumo. */
body:not(.pdv-mode) [data-db-page-shell] .metrics,
body:not(.pdv-mode) [data-db-page-shell] .stats,
body:not(.pdv-mode) [data-db-page-shell] .summary,
body:not(.pdv-mode) [data-db-page-shell] .summary-grid,
body:not(.pdv-mode) [data-db-page-shell] .kpi-grid,
body:not(.pdv-mode) [data-db-page-shell] .cards-grid,
body:not(.pdv-mode) [data-db-page-shell] .products-fiscal-cards,
body:not(.pdv-mode) [data-db-page-shell] .label-summary-grid{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr))!important;
  gap:12px!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin-left:0!important;
  margin-right:0!important;
  box-sizing:border-box!important;
}
body:not(.pdv-mode) [data-db-page-shell] .metrics > *,
body:not(.pdv-mode) [data-db-page-shell] .stats > *,
body:not(.pdv-mode) [data-db-page-shell] .summary > *,
body:not(.pdv-mode) [data-db-page-shell] .summary-grid > *,
body:not(.pdv-mode) [data-db-page-shell] .kpi-grid > *,
body:not(.pdv-mode) [data-db-page-shell] .cards-grid > *,
body:not(.pdv-mode) [data-db-page-shell] .products-fiscal-cards > *,
body:not(.pdv-mode) [data-db-page-shell] .label-summary-grid > *{
  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
  border-radius:16px!important;
}

/* Formulários, filtros e campos: compactos e sem empurrar lateral. */
body:not(.pdv-mode) [data-db-page-shell] form{max-width:100%!important;box-sizing:border-box!important}
body:not(.pdv-mode) [data-db-page-shell] input,
body:not(.pdv-mode) [data-db-page-shell] select,
body:not(.pdv-mode) [data-db-page-shell] textarea{
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
}
body:not(.pdv-mode) [data-db-page-shell] .filters,
body:not(.pdv-mode) [data-db-page-shell] .filter-row,
body:not(.pdv-mode) [data-db-page-shell] .toolbar,
body:not(.pdv-mode) [data-db-page-shell] .search-card,
body:not(.pdv-mode) [data-db-page-shell] .products-toolbar-refined,
body:not(.pdv-mode) [data-db-page-shell] .labels-search-form{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
}

/* Botões: padrão compacto; evita botões gigantes em filtros. */
body:not(.pdv-mode) .btn,
body:not(.pdv-mode) button.btn,
body:not(.pdv-mode) a.btn,
body:not(.pdv-mode) [data-db-page-shell] button[type="submit"],
body:not(.pdv-mode) [data-db-page-shell] input[type="submit"]{
  min-height:40px!important;
  border-radius:12px!important;
  padding:9px 16px!important;
  font-size:14px!important;
  font-weight:650!important;
  line-height:1.1!important;
  width:auto;
  max-width:100%;
}
body:not(.pdv-mode) [data-db-page-shell] .btn.orange,
body:not(.pdv-mode) [data-db-page-shell] button.orange,
body:not(.pdv-mode) [data-db-page-shell] .orange.btn{background:var(--db-std-orange)!important;color:#fff!important;border-color:rgba(255,107,0,.22)!important}

/* Botão global indevido: algumas telas antigas ainda imprimem “Nova venda”. */
body[data-current-route="catalogo-online"] .page-head > .btn.orange,
body[data-current-route="usuarios"] .page-head > .btn.orange,
body[data-current-route="financeiro"] .page-head > .btn.orange,
body[data-current-route="comissoes"] .page-head > .btn.orange,
body[data-current-route="crm"] .page-head > .btn.orange,
body[data-current-route="ajuda"] .page-head > .btn.orange,
body[data-current-route="auditoria"] .page-head > .btn.orange,
body[data-current-route="etiquetas"] .page-head > .btn.orange,
body[data-current-route="fechamentos-caixa"] .page-head > .btn.orange{display:none!important}

/* Tabelas: sempre dentro do card, com rolagem interna. */
body:not(.pdv-mode) [data-db-page-shell] .table-wrap,
body:not(.pdv-mode) [data-db-page-shell] .table-responsive,
body:not(.pdv-mode) [data-db-page-shell] .table-scroll,
body:not(.pdv-mode) [data-db-page-shell] .products-table-wrap,
body:not(.pdv-mode) [data-db-page-shell] .fiscal-report-table-wrap{
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:visible!important;
  box-sizing:border-box!important;
  border-radius:16px!important;
}
body:not(.pdv-mode) [data-db-page-shell] table{
  width:100%!important;
  max-width:none!important;
  border-collapse:separate!important;
  border-spacing:0!important;
}
body:not(.pdv-mode) [data-db-page-shell] th,
body:not(.pdv-mode) [data-db-page-shell] td{vertical-align:middle!important}
body:not(.pdv-mode) [data-db-page-shell] th{font-size:12px!important;text-transform:uppercase!important;letter-spacing:.025em!important;color:#7b6b61!important;font-weight:750!important}

/* Regras específicas para as telas apontadas no teste visual. */
body[data-current-route="fechamentos-caixa"] [data-db-page-shell] > form,
body[data-current-route="auditoria"] [data-db-page-shell] > form,
body[data-current-route="catalogo-online"] [data-db-page-shell] > form{
  background:var(--db-std-card-bg)!important;
  border:1px solid var(--db-std-card-border)!important;
  border-radius:var(--db-std-radius)!important;
  box-shadow:var(--db-std-card-shadow)!important;
  padding:18px 20px!important;
}
body[data-current-route="fechamentos-caixa"] [data-db-page-shell] > form{
  display:grid!important;
  grid-template-columns:minmax(180px,1fr) minmax(180px,220px) auto auto!important;
  gap:12px!important;
  align-items:end!important;
}
body[data-current-route="fechamentos-caixa"] [data-db-page-shell] > form button[type="submit"]{width:150px!important;justify-self:start!important}
body[data-current-route="fechamentos-caixa"] [data-db-page-shell] > form .btn{width:auto!important}
body[data-current-route="auditoria"] [data-db-page-shell] > form{display:flex!important;flex-wrap:wrap!important;gap:10px!important;align-items:end!important}
body[data-current-route="auditoria"] [data-db-page-shell] > form > *{flex:0 1 auto!important;min-width:0!important}
body[data-current-route="auditoria"] [data-db-page-shell] > form input[type="search"],
body[data-current-route="auditoria"] [data-db-page-shell] > form input[name="q"]{flex:1 1 260px!important}
body[data-current-route="auditoria"] [data-db-page-shell] > form select{flex:0 1 170px!important}
body[data-current-route="auditoria"] [data-db-page-shell] > form button,
body[data-current-route="auditoria"] [data-db-page-shell] > form .btn{flex:0 0 auto!important}

/* Catálogo, financeiro, comissões, CRM e ajuda: heros dentro da largura útil. */
body[data-current-route="catalogo-online"] [data-db-page-shell] > section:first-child,
body[data-current-route="financeiro"] [data-db-page-shell] > section:first-child,
body[data-current-route="comissoes"] [data-db-page-shell] > section:first-child,
body[data-current-route="crm"] [data-db-page-shell] > section:first-child,
body[data-current-route="ajuda"] [data-db-page-shell] > section:first-child,
body[data-current-route="usuarios"] [data-db-page-shell] > section:first-child{
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:14px!important;
  flex-wrap:wrap!important;
}

/* Etiquetas: força todos os blocos dentro da margem definida. */
body[data-current-route="etiquetas"] [data-db-page-shell] .labels-page,
body[data-current-route="etiquetas"] [data-db-page-shell] .labels-shell,
body[data-current-route="etiquetas"] [data-db-page-shell] .labels-card,
body[data-current-route="etiquetas"] [data-db-page-shell] .labels-panel,
body[data-current-route="etiquetas"] [data-db-page-shell] .label-model-card,
body[data-current-route="etiquetas"] [data-db-page-shell] .label-options-card,
body[data-current-route="etiquetas"] [data-db-page-shell] .label-table-card{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin-left:0!important;
  margin-right:0!important;
  box-sizing:border-box!important;
}
body[data-current-route="etiquetas"] [data-db-page-shell] details,
body[data-current-route="etiquetas"] [data-db-page-shell] summary{max-width:100%!important;box-sizing:border-box!important}

/* Menu de ações padrão em três pontos. */
.db-actions-cell,
.generic-actions-cell,
.sales-table td.actions,
td.actions,
td[data-actions-cell]{width:60px!important;min-width:60px!important;text-align:right!important;white-space:nowrap!important;overflow:visible!important}
.db-actions-menu,
.generic-actions-menu,
.sales-actions-menu,
.products-actions-menu,
.nfe-actions-menu,
.db-actions-native{position:relative!important;display:inline-flex!important;justify-content:flex-end!important;align-items:center!important}
.db-actions-trigger,
.generic-actions-trigger,
.sales-actions-trigger,
.products-actions-trigger,
.db-actions-native > summary{
  width:42px!important;min-width:42px!important;height:38px!important;padding:0!important;
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  border-radius:12px!important;border:1px solid rgba(120,85,60,.16)!important;background:#fff8ef!important;color:#211915!important;
  font-size:22px!important;line-height:1!important;box-shadow:0 8px 20px rgba(86,54,24,.06)!important;cursor:pointer!important;
}
.db-actions-dropdown,
.generic-actions-dropdown,
.sales-actions-dropdown,
.products-actions-dropdown,
.nfe-actions-dropdown{
  position:fixed!important;right:auto!important;bottom:auto!important;z-index:2147483000!important;
  display:none!important;gap:6px!important;min-width:198px!important;max-width:min(300px, calc(100vw - 24px))!important;
  padding:8px!important;border:1px solid rgba(15,23,42,.10)!important;border-radius:14px!important;background:#fff!important;box-shadow:0 20px 48px rgba(15,23,42,.22)!important;
}
.db-actions-menu.open .db-actions-dropdown,
.generic-actions-menu.open .generic-actions-dropdown,
.sales-actions-menu.open .sales-actions-dropdown,
.products-actions-menu.open .products-actions-dropdown,
.nfe-actions-menu.open .nfe-actions-dropdown{display:grid!important}
.db-actions-dropdown .btn,
.db-actions-dropdown a,
.db-actions-dropdown button,
.generic-actions-dropdown .btn,
.generic-actions-dropdown a,
.generic-actions-dropdown button,
.sales-actions-dropdown .btn,
.sales-actions-dropdown a,
.sales-actions-dropdown button,
.products-actions-dropdown .btn,
.products-actions-dropdown a,
.products-actions-dropdown button{
  width:100%!important;min-height:34px!important;justify-content:flex-start!important;text-align:left!important;font-size:12px!important;white-space:nowrap!important;padding:8px 10px!important;border-radius:10px!important;
}
.db-actions-dropdown form,
.generic-actions-dropdown form,
.sales-actions-dropdown form,
.products-actions-dropdown form{display:block!important;width:100%!important;margin:0!important}

@media(max-width:980px){
  body:not(.pdv-mode) .page-head,
  body:not(.pdv-mode) [data-db-page-shell],
  body:not(.pdv-mode) .toast,
  body:not(.pdv-mode) .app-store-footer{width:calc(100% - 28px)!important}
  body[data-current-route="fechamentos-caixa"] [data-db-page-shell] > form{grid-template-columns:1fr 1fr!important}
}
@media(max-width:720px){
  body:not(.pdv-mode) .page-head{display:block!important}
  body:not(.pdv-mode) [data-db-page-shell] > .card,
  body:not(.pdv-mode) [data-db-page-shell] > .list-card,
  body:not(.pdv-mode) [data-db-page-shell] > .table-card,
  body:not(.pdv-mode) [data-db-page-shell] > .filter-card,
  body:not(.pdv-mode) [data-db-page-shell] > .panel,
  body:not(.pdv-mode) [data-db-page-shell] > section,
  body:not(.pdv-mode) [data-db-page-shell] > article{padding:16px!important}
  body[data-current-route="fechamentos-caixa"] [data-db-page-shell] > form{grid-template-columns:1fr!important}
  body[data-current-route="fechamentos-caixa"] [data-db-page-shell] > form button[type="submit"]{width:100%!important}
}

/* DB PDV v139 · reforço: toda coluna Ações vira três pontos, inclusive ação única */
body:not(.pdv-mode) [data-db-page-shell] table th:last-child,
body:not(.pdv-mode) [data-db-page-shell] table td:last-child,
body:not(.pdv-mode) [data-db-page-shell] table th.actions,
body:not(.pdv-mode) [data-db-page-shell] table td.actions,
body:not(.pdv-mode) [data-db-page-shell] td[data-actions-cell]{
  text-align:right!important;
}
body:not(.pdv-mode) [data-db-page-shell] td.db-actions-cell{
  width:64px!important;
  min-width:64px!important;
  max-width:84px!important;
  white-space:nowrap!important;
  overflow:visible!important;
  vertical-align:middle!important;
}
body:not(.pdv-mode) .db-actions-menu-v139{position:relative!important;display:inline-flex!important;align-items:center!important;justify-content:flex-end!important}
body:not(.pdv-mode) .db-actions-menu-v139 .db-actions-trigger{
  width:42px!important;
  min-width:42px!important;
  height:38px!important;
  padding:0!important;
  border-radius:12px!important;
  border:1px solid rgba(120,85,60,.18)!important;
  background:#fff8ef!important;
  color:#211915!important;
  box-shadow:0 8px 20px rgba(86,54,24,.06)!important;
  font-size:22px!important;
  line-height:1!important;
  cursor:pointer!important;
}
body:not(.pdv-mode) .db-actions-menu-v139 .db-actions-dropdown{
  position:fixed!important;
  z-index:2147483000!important;
  display:none!important;
  grid-auto-flow:row!important;
  gap:6px!important;
  min-width:198px!important;
  max-width:min(300px, calc(100vw - 24px))!important;
  padding:8px!important;
  border:1px solid rgba(15,23,42,.10)!important;
  border-radius:14px!important;
  background:#fff!important;
  box-shadow:0 20px 48px rgba(15,23,42,.22)!important;
}
body:not(.pdv-mode) .db-actions-menu-v139.open .db-actions-dropdown{display:grid!important}
body:not(.pdv-mode) .db-actions-dropdown .db-action-item,
body:not(.pdv-mode) .db-actions-dropdown a,
body:not(.pdv-mode) .db-actions-dropdown button,
body:not(.pdv-mode) .db-actions-dropdown input[type="submit"]{
  width:100%!important;
  min-height:34px!important;
  justify-content:flex-start!important;
  text-align:left!important;
  font-size:12px!important;
  line-height:1.2!important;
  white-space:nowrap!important;
  padding:8px 10px!important;
  border-radius:10px!important;
}
body:not(.pdv-mode) .db-actions-dropdown form{width:100%!important;margin:0!important;display:block!important}


/* DB PDV v140 · normalização visual final dos menus de ações em três pontos */
body:not(.pdv-mode) [data-db-page-shell] td.dbpdv-uiactions-cell,
body:not(.pdv-mode) [data-db-page-shell] td.db-actions-cell,
body:not(.pdv-mode) [data-db-page-shell] td.actions,
body:not(.pdv-mode) [data-db-page-shell] td[data-actions-cell]{
  width:66px!important;
  min-width:66px!important;
  max-width:78px!important;
  text-align:right!important;
  white-space:nowrap!important;
  overflow:visible!important;
}
body:not(.pdv-mode) .dbpdv-uiactions-menu{
  position:relative!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  vertical-align:middle!important;
}
body:not(.pdv-mode) .dbpdv-uiactions-trigger{
  width:42px!important;
  min-width:42px!important;
  height:38px!important;
  padding:0!important;
  border-radius:12px!important;
  border:1px solid rgba(120,85,60,.18)!important;
  background:#fff8ef!important;
  color:#211915!important;
  box-shadow:0 8px 20px rgba(86,54,24,.06)!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  font-size:22px!important;
  line-height:1!important;
  font-weight:800!important;
  cursor:pointer!important;
}
body:not(.pdv-mode) .dbpdv-uiactions-trigger:hover{border-color:rgba(255,107,0,.38)!important;color:#ff6b00!important}
body:not(.pdv-mode) .dbpdv-uiactions-panel{
  position:fixed!important;
  left:auto;
  top:auto;
  z-index:2147483600!important;
  display:none!important;
  grid-auto-flow:row!important;
  gap:6px!important;
  min-width:198px!important;
  max-width:min(320px, calc(100vw - 24px))!important;
  padding:8px!important;
  border:1px solid rgba(15,23,42,.10)!important;
  border-radius:14px!important;
  background:#fff!important;
  box-shadow:0 20px 48px rgba(15,23,42,.22)!important;
}
body:not(.pdv-mode) .dbpdv-uiactions-menu.is-open .dbpdv-uiactions-panel{display:grid!important}
body:not(.pdv-mode) .dbpdv-uiactions-panel a,
body:not(.pdv-mode) .dbpdv-uiactions-panel button,
body:not(.pdv-mode) .dbpdv-uiactions-panel input[type="submit"],
body:not(.pdv-mode) .dbpdv-uiactions-panel .btn{
  width:100%!important;
  min-height:34px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:8px!important;
  text-align:left!important;
  font-size:12px!important;
  white-space:nowrap!important;
  padding:8px 10px!important;
  border-radius:10px!important;
  box-sizing:border-box!important;
}
body:not(.pdv-mode) .dbpdv-uiactions-panel form{display:block!important;width:100%!important;margin:0!important;padding:0!important}
body:not(.pdv-mode) .dbpdv-action-note{display:inline-flex!important;margin-right:8px!important;color:#7b6b61!important;font-size:12px!important;vertical-align:middle!important}
