.table-wrapper {
  overflow-x: auto;
}

.table-wrapper--spaced {
  margin-top: 1.25rem;
}

.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: .65;
  pointer-events: none;
}

.cell-center {
  text-align: center;
  vertical-align: middle;
}

.fw-snap {
  font-weight: 600;
}

.scroll-col,
.lg-scroll-col {
  max-width: none;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: default;
}

.scroll-col *,
.lg-scroll-col * {
  min-width: 0;
  white-space: inherit;
}

.scroll-col::-webkit-scrollbar,
.lg-scroll-col::-webkit-scrollbar {
  height: 0;
}

.scroll-col:hover,
.lg-scroll-col:hover {
  scrollbar-width: none;
}

.scroll-col.is-dragging,
.lg-scroll-col.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.scroll-col.is-scrollable,
.lg-scroll-col.is-scrollable {
  cursor: grab;
}

.scroll-col.is-scrollable.is-dragging,
.lg-scroll-col.is-scrollable.is-dragging {
  cursor: grabbing;
}

.compras-popover-cell,
.estoque-resumo-cobertura,
.compras-popover-cell .scroll-col,
.compras-popover-cell .lg-scroll-col,
.compras-popover-cell .scroll-col *,
.compras-popover-cell .lg-scroll-col * {
  cursor: pointer !important;
}

.compras-popover-cell .scroll-col.is-dragging,
.compras-popover-cell .lg-scroll-col.is-dragging,
.compras-popover-cell .scroll-col.is-dragging *,
.compras-popover-cell .lg-scroll-col.is-dragging * {
  cursor: grabbing !important;
}

.scroll-col:hover::-webkit-scrollbar,
.lg-scroll-col:hover::-webkit-scrollbar {
  height: 0;
}

.pedido-cell,
.pedido-cell *,
.js-popover-pedido,
.js-popover-pedido .scroll-col,
.js-popover-pedido .lg-scroll-col {
  cursor: pointer !important;
}

table.table--estoque,
table.table--compras {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

table.table--estoque th,
table.table--estoque td,
table.table--compras th,
table.table--compras td {
  padding: 10px;
  border-bottom: 1px solid #dee2e6;
  vertical-align: middle;
}

table.table--estoque th,
table.table--compras th {
  background-color: #f1f3f5;
  font-weight: bold;
}

.table--estoque td .scroll-col,
.table--tabela td .scroll-col {
  max-height: 2.8rem;
  overflow: auto;
}

.table--estoque td .lg-scroll-col,
.table--tabela td .lg-scroll-col {
  max-height: 4.2rem;
  overflow: auto;
}

@media (min-width: 1800px) {
  .modal-dialog.budget-modal {
    --bs-modal-width: min(1680px, 92vw);
  }
}

@media (max-width: 992px) {
  .table-wrapper,
  .table-responsive {
    margin-right: -6px;
    margin-left: -6px;
    padding-right: 6px;
    padding-left: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table--tabela {
    min-width: 760px;
  }

  .table--estoque {
    min-width: 980px;
  }

  .table--compras {
    min-width: 760px;
  }

  .table--categorias {
    min-width: 760px;
  }
}

/* Evita o hover fragmentado do Bootstrap quando tabelas viram grids/cards. */
@media (max-width: 768px), (hover: none), (pointer: coarse) {
  table.table-hover > tbody > tr:hover > *,
  table.table-hover > tbody > tr:active > *,
  table.table-hover > tbody > tr:focus-within > * {
    --bs-table-bg-state: transparent;
    background-color: transparent !important;
  }
}

/* Tabelas hierárquicas que viram cards independentes no viewport estreito. */
@media (max-width: 767.98px) {
  .table-responsive-summary-cards-wrapper {
    overflow: visible;
  }

  .table--faturamento-participacao.table--responsive-summary-cards tbody {
    display: grid;
    gap: 12px;
    border-top: 0;
  }

  .table--faturamento-participacao.table--responsive-summary-cards tbody tr:not(.d-none) {
    padding: 14px;
    border: 1px solid var(--theme-border) !important;
    border-radius: 12px;
    background: var(--theme-surface) !important;
    box-shadow: 0 2px 8px var(--theme-shadow);
  }

  .table--faturamento-participacao.table--responsive-summary-cards tbody tr:not(.d-none)::before {
    border-radius: inherit;
  }

  .table--faturamento-participacao.table--responsive-summary-cards tbody tr:not(.d-none):hover::before,
  .table--faturamento-participacao.table--responsive-summary-cards tbody tr:not(.d-none):active::before,
  .table--faturamento-participacao.table--responsive-summary-cards tbody tr:not(.d-none):focus-within::before {
    background: var(--theme-surface-hover);
  }
}
