/* App-wide responsive containment — loaded last */

.pos-main,
.pos-main > *,
.bq-app,
.si-app,
.bq-reports-app,
.mern-page,
.pf-page,
.pf-form,
.pf-layout,
.pf-main,
.pf-sidebar,
.bq-panel,
.pc-catalog-page,
.cat-form,
.inv-page {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

img,
video,
canvas,
svg {
  max-width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .form-actions,
.form-grid .span-2 {
  grid-column: 1 / -1;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
}

@media (max-width: 1024px) {
  table.bq-table-responsive,
  table.bq-table-responsive.pc-catalog-table,
  table.bq-table-responsive.inv-table,
  table.bq-table-responsive.cat-table,
  table.bq-table-responsive.si-items-table,
  .cat-page table.pc-catalog-table,
  .inv-table {
    min-width: 0 !important;
    width: 100% !important;
  }

  .pc-table-scroll:has(.bq-table-responsive),
  .bq-table-wrap:has(.bq-table-responsive),
  .bq-table-wrap--actions:has(.bq-table-responsive) {
    overflow: visible;
  }
}

@media (max-width: 768px) {
  .form-grid,
  .bq-form-grid,
  .mern-form-grid,
  .mern-row2,
  .mern-split,
  .bq-board-2,
  .bq-stat-grid {
    grid-template-columns: 1fr !important;
  }

  .bq-topbar,
  .bq-page-header.bq-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .bq-topbar-actions {
    margin-left: 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .bq-topbar-actions .pos-chip-btn,
  .bq-topbar-actions a.pos-chip-btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    min-height: 40px;
  }

  .bq-filter-bar,
  .bq-documents-filter-bar,
  .pc-catalog-toolbar,
  .inv-move-filters,
  .mern-toolbar,
  .mern-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .bq-filter-bar .pos-chip-btn,
  .pc-catalog-toolbar .pos-chip-btn,
  .form-actions .pos-input-btn,
  .form-actions .pos-chip-btn {
    width: 100%;
    justify-content: center;
  }

  .pc-search-field,
  .pc-search-field .bq-form-control,
  .mern-toolbar .pos-input,
  .inv-move-filters .bq-form-control {
    width: 100%;
    min-width: 0;
  }

  .bq-panel,
  .pf-card,
  .pc-catalog-panel {
    overflow-x: hidden;
  }

  .bq-row-actions,
  .cat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .bq-row-actions .pos-chip-btn,
  .cat-actions .pos-chip-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .bq-topbar-actions .pos-chip-btn,
  .bq-topbar-actions a.pos-chip-btn {
    flex-basis: 100%;
  }

  .bq-workspace-bar {
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) {
  .bq-module-nav,
  .bq-quote-module-nav,
  .pos-modules-strip {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .pos-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .pos-category-thumb,
  .pos-product-card-thumb,
  .pc-col-image,
  .pc-thumb,
  .inv-thumb {
    display: none !important;
  }
}

@media (max-width: 420px) {
  .pos-product-grid {
    grid-template-columns: 1fr !important;
  }
}
