/* Canonical ERP table system
   Ordinary record lists fit their pane. Dense editor grids may scroll. */
:root {
  --table-font-size: var(--font-size-table);
  --table-heading-size: var(--font-size-table-heading);
  --table-header-height: 48px;
  --table-row-height: 48px;
  --table-cell-x: 12px;
  --table-cell-y: 10px;
  --table-radius: var(--radius-card);
  --table-frame-width: 2px;
  --table-grid-width: 1.5px;
  --table-action-column-width: 12%;
}

.table-scroll,
.inventory-table-wrap,
.po-picker-table-wrap,
.erp-table-scroll,
.card > div:has(> .data-table) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

/* One element owns every table outline. This prevents the mixed square,
   double-border, and partially rounded tables created by legacy wrappers. */
.erp-table-frame {
  border: var(--table-frame-width) solid var(--table-frame);
  border-radius: var(--table-radius);
  background: var(--table-row);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
}

.erp-table-frame > .data-table,
.erp-table-frame > table.data-table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.card.has-table-frame {
  border: var(--table-frame-width) solid var(--table-frame);
  border-radius: var(--table-radius);
  overflow: hidden;
}

.card.has-table-frame > .card-hdr {
  border-bottom: var(--table-grid-width) solid var(--table-grid);
  border-radius: 0;
}

.table-section-title,
.app-layout .table-section-title,
.app-layout .card-hdr .table-section-title {
  color: #2F3B4A;
  font-family: var(--font-body);
  font-size: var(--table-heading-size);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .45px;
  text-transform: uppercase;
}

.card.has-table-frame > .erp-table-frame {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.data-table {
  width: 100%;
  max-width: 100%;
  margin: 0;
  table-layout: fixed;
  /* The wrapper owns rounding; collapsing the cell grid keeps fractional
     1.5px rules inside the declared table width at every viewport. */
  border-collapse: collapse;
  border-spacing: 0;
  background: var(--table-row);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--table-font-size);
}

/* The table layer owns the final readable type scale. Earlier compatibility
   selectors are intentionally neutralized here instead of patched per page. */
.app-layout .data-table,
.app-layout .data-table[style*="font-size"] {
  font-size: var(--table-font-size);
}

.data-table th,
.data-table td {
  height: var(--table-row-height);
  padding: var(--table-cell-y) var(--table-cell-x);
  border-right: var(--table-grid-width) solid var(--table-grid);
  border-bottom: var(--table-grid-width) solid var(--table-grid);
  vertical-align: middle;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th {
  height: var(--table-header-height);
  padding-block: 8px;
  background: var(--table-header);
  color: #2F3B4A;
  font-size: var(--table-heading-size);
  font-weight: 800;
  letter-spacing: .45px;
  text-align: left;
  text-transform: uppercase;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.app-layout .data-table th {
  font-size: var(--table-heading-size);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.app-layout .data-table td,
.app-layout .data-table td[style*="font-size"],
.app-layout .data-table td.mono,
.app-layout .data-table .mono {
  font-size: var(--table-font-size);
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: 0;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:nth-child(even) td {
  background: var(--table-row-alt);
}

.data-table tbody tr.is-record-row:hover td,
.data-table tbody tr.is-record-row:focus-visible td {
  background: var(--table-hover);
}

.data-table tbody tr.is-record-row {
  cursor: pointer;
}

.data-table tbody tr.is-record-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.data-table td[colspan] {
  white-space: normal;
}

.data-table .mono,
.data-table td.mono {
  font-family: var(--font-mono);
  font-size: var(--table-font-size);
  font-variant-numeric: tabular-nums;
}

.data-table .text-right,
.data-table [data-col="money"],
.data-table [data-col="quantity"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .text-center {
  text-align: center;
}

/* Action columns have one application-wide width. The table normalizer marks
   both generated and authored colgroups, so module-specific percentages do
   not drift apart again. */
.data-table col[data-col="action"],
.data-table th[data-col="action"],
.data-table td[data-col="action"] {
  width: var(--table-action-column-width);
}

.data-table th[data-col="action"],
.data-table td[data-col="action"] {
  padding-inline: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.quote-fit-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.card > .quote-fit-table {
  overflow-x: hidden;
}

.data-table .table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
}

.data-table .btn,
.data-table .btn-sm,
.data-table .btn-xs,
.data-table .btn-icon {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 13px;
  line-height: 1;
}

.data-table td[data-col="action"] .btn,
.data-table td[data-col="action"] .btn-icon {
  flex: 0 0 auto;
}

.data-table .form-control,
.data-table .tbl-input,
.data-table .tbl-select {
  min-width: 0;
  min-height: 30px;
  padding: 4px 7px;
  font-size: var(--font-size-table);
}

/* Work-center names need enough room for machine and process descriptors.
   The percentage contract preserves that room without forcing page overflow. */
.work-center-table col.work-center-name-col { width: 28%; }
.work-center-table col.work-center-rate-col { width: 13%; }
.work-center-table col.work-center-total-col { width: 15%; }
.work-center-table col.work-center-active-col { width: 10%; }

.work-center-table .work-center-name-input,
.work-center-table .work-center-rate-input {
  width: 100%;
  max-width: 100%;
}

.work-center-table .work-center-rate-input {
  font-family: var(--font-mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .empty-state,
.data-table tbody td.table-empty {
  color: var(--text-dim);
  font-size: var(--table-font-size);
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
}

/* Every record list uses the same one-row empty footprint as Accounting.
   Empty content changes; table geometry does not. */
.data-table tbody tr:only-child > td[colspan].table-empty {
  height: var(--table-row-height);
  padding: var(--table-cell-y) var(--table-cell-x);
  vertical-align: middle;
}

.sortable {
  cursor: pointer;
}

.sortable:hover {
  color: var(--text);
  background: var(--accent-soft);
}

/* Customer invoices */
.invoice-list-table col.invoice-number-col { width: 8%; }
.invoice-list-table col.invoice-quote-col { width: 7%; }
.invoice-list-table col.invoice-customer-col { width: 18%; }
.invoice-list-table col.invoice-date-col { width: 9%; }
.invoice-list-table col.invoice-money-col { width: 9%; }
.invoice-list-table col.invoice-status-col { width: 10%; }
.invoice-list-table th:nth-child(n+6):nth-child(-n+8),
.invoice-list-table td:nth-child(n+6):nth-child(-n+8) { text-align: right; }

/* Sales quotes */
.quote-db-table col.quote-number-col { width: 11%; }
.quote-db-table col.quote-customer-col { width: 21%; }
.quote-db-table col.quote-date-col { width: 11%; }
.quote-db-table col.quote-valid-col { width: 11%; }
.quote-db-table col.quote-status-col { width: 10%; }
.quote-db-table col.quote-total-col { width: 12%; }
.quote-db-table col.quote-ship-col { width: 11%; }
.quote-db-table th:nth-child(6),
.quote-db-table td:nth-child(6) { text-align: right; }
.quote-db-table th:last-child,
.quote-db-table td:last-child { text-align: right; }

@media (min-width: 901px) and (max-width: 1400px) {
  .quote-db-table col.quote-number-col { width: 10%; }
  .quote-db-table col.quote-customer-col { width: 21%; }
  .quote-db-table col.quote-date-col { width: 10%; }
  .quote-db-table col.quote-valid-col { width: 10%; }
  .quote-db-table col.quote-status-col { width: 9%; }
  .quote-db-table col.quote-total-col { width: 12%; }
  .quote-db-table col.quote-ship-col { width: 10%; }
}

/* Customer detail quote history keeps the workflow note beside the badge. */
.customer-quote-history-table col.quote-col { width: 12%; }
.customer-quote-history-table col.date-col { width: 14%; }
.customer-quote-history-table col.parts-col { width: 13%; }
.customer-quote-history-table col.total-col { width: 16%; }
.customer-quote-history-table col.status-col { width: 22%; }
@media (min-width: 901px) and (max-width: 1400px) {
  .customer-quote-history-table col.quote-col { width: 10%; }
  .customer-quote-history-table col.date-col { width: 12%; }
  .customer-quote-history-table col.parts-col { width: 10%; }
  .customer-quote-history-table col.total-col { width: 16%; }
  .customer-quote-history-table col.status-col { width: 25%; }
}
.customer-quote-history-table th:nth-child(4),
.customer-quote-history-table td:nth-child(4) { text-align: right; }
.quote-history-status { display:flex; align-items:center; gap:8px; min-width:0; white-space:nowrap; }
.quote-history-status small { color:var(--text-muted); font-size:var(--font-size-meta); }
.quote-history-status .quote-history-invoice-needed { color:var(--accent); font-weight:700; }

/* Customer contacts use the canonical table system instead of legacy
   orange-accent contact cards. */
.customer-contact-table-host { width:100%; max-width:100%; min-width:0; overflow-x:auto; }
.customer-contact-table-host .table-loading { min-height:var(--table-row-height); padding:var(--table-cell-y) var(--table-cell-x); color:var(--text-dim); font-size:var(--table-font-size); display:flex; align-items:center; justify-content:center; }
.customer-contact-table col.contact-name-col { width:20%; }
.customer-contact-table col.contact-role-col { width:14%; }
.customer-contact-table col.contact-email-col { width:24%; }
.customer-contact-table col.contact-phone-col { width:18%; }
.customer-contact-table col.contact-primary-col { width:12%; }
.customer-contact-table th:last-child,
.customer-contact-table td:last-child { text-align:center; }

/* Invoice line editing shows the customer's part number as the primary ID. */
.invoice-line-table col.invoice-part-col { width: 19%; }
.invoice-line-table col.invoice-description-col { width: 33%; }
.invoice-line-table col.invoice-qty-col { width: 8%; }
.invoice-line-table col.invoice-price-col { width: 14%; }
.invoice-line-table col.invoice-extended-col { width: 14%; }
.invoice-line-table col.invoice-action-col { width: var(--table-action-column-width); }
.invoice-line-table .tbl-input { width:100%; min-width:0; }
.invoice-line-table .invoice-line-number { text-align:right; font-family:var(--font-mono); }
.invoice-line-table tbody td { vertical-align:middle; }
.invoice-line-table .invoice-line-control-cell { padding-top:var(--table-cell-y); padding-bottom:var(--table-cell-y); }
.invoice-line-table .invoice-line-control-cell .tbl-input { height:34px; min-height:34px; margin:0; }
.invoice-line-table .invoice-line-id-input { font-family:var(--font-mono); color:var(--text); }

.oldest-invoice-link { display:inline-grid; gap:2px; padding:0; border:0; background:transparent; color:var(--accent); text-align:left; cursor:pointer; }
.oldest-invoice-link small { color:var(--text-muted); font-family:var(--font-body); font-size:var(--font-size-meta); }

/* Customer payment allocation uses the same table and summary geometry as
   the accounting workspaces, while still allowing unapplied customer credit. */
.customer-payment-modal .modal-body { display:grid; gap:12px; }
.customer-payment-modal .form-row,
.customer-payment-modal .form-group { margin-bottom:0; }
.payment-application-list { min-height:var(--table-row-height); }
.payment-application-empty { min-height:var(--table-row-height); display:flex; align-items:center; justify-content:center; color:var(--text-dim); font-size:var(--table-font-size); border:var(--table-frame-width) solid var(--table-frame); border-radius:var(--table-radius); }
.payment-application-table col.payment-document-col { width:28%; }
.payment-application-table col.payment-date-col { width:22%; }
.payment-application-table col.payment-balance-col { width:25%; }
.payment-application-table col.payment-apply-col { width:25%; }
.payment-application-table .cp-apply { width:100%; min-width:0; font-family:var(--font-mono); }
.payment-summary-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.payment-summary-grid .info-cell { min-width:0; }
.payment-row-button { width:100%; color:var(--text); text-align:left; font:inherit; cursor:pointer; }
.payment-row-button:hover { border-color:var(--accent); box-shadow:var(--shadow-md); }
.payment-row-button > span:first-child { display:grid; gap:3px; min-width:0; }
.payment-row-button strong { color:var(--navy); font-size:var(--font-size-body); }
.payment-row-button small { color:var(--text-muted); font-size:var(--font-size-meta); }
.payment-row-view { color:var(--accent); font-weight:700; white-space:nowrap; }
.customer-payment-detail-modal { width:min(900px,calc(100vw - 32px)); max-width:900px; }
.customer-payment-detail-modal .modal-body { display:grid; gap:12px; }
.payment-detail-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.payment-detail-info { grid-template-columns:repeat(4,minmax(0,1fr)); gap:0; margin:0; padding:12px 14px; border:var(--table-frame-width) solid var(--table-frame); border-radius:var(--table-radius); }
.payment-detail-info .detail-field { display:grid; grid-template-columns:1fr; align-content:start; gap:5px; min-width:0; margin:0; padding:4px 14px; border:0; border-right:1px solid var(--border); }
.payment-detail-info .detail-field:first-child { padding-left:4px; }
.payment-detail-info .detail-field:last-child { padding-right:4px; border-right:0; }
.payment-detail-info .detail-field > span { font-size:var(--font-size-label); font-weight:700; text-transform:uppercase; }
.payment-detail-info .detail-field > strong { font-size:var(--font-size-control); line-height:1.3; }
.payment-detail-applications { margin:0; }
.payment-detail-notes { padding:10px 0 0; }
.payment-attachment-upload { display:flex; align-items:center; justify-content:flex-end; gap:8px; min-width:0; }
.payment-attachment-upload input { width:min(300px,42vw); font-size:var(--font-size-meta); }
.payment-detail-attachments .card-body { padding:0; }
.payment-attachment-list { display:grid; }
.payment-attachment-row { display:grid; grid-template-columns:46px minmax(0,1fr) auto; align-items:center; gap:10px; min-height:58px; padding:8px 12px; border-bottom:1px solid var(--border); }
.payment-attachment-row:last-child { border-bottom:0; }
.payment-attachment-icon { display:grid; place-items:center; width:40px; height:32px; border:1px solid var(--border); border-radius:var(--radius); color:var(--accent); font-size:var(--font-size-meta); font-weight:800; }
.payment-attachment-name { display:grid; gap:2px; min-width:0; }
.payment-attachment-name strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.payment-attachment-name small { color:var(--text-muted); }
.payment-attachment-actions { display:flex; align-items:center; gap:6px; white-space:nowrap; }
.payment-attachment-empty { min-height:54px; }
.payment-attachment-help { padding:7px 12px; border-top:1px solid var(--border); color:var(--text-muted); font-size:var(--font-size-meta); }

/* Shipment tracking keeps commercial promise dates separate from actual
   fulfillment events and uses the same fixed table/action geometry. */
.shipment-list-card { margin-top:0; }
.shipment-table col.shipment-number-col { width:9%; }
.shipment-table col.shipment-customer-col { width:15%; }
.shipment-table col.shipment-link-col { width:12%; }
.shipment-table col.shipment-date-col { width:10%; }
.shipment-table col.shipment-carrier-col { width:9%; }
.shipment-table col.shipment-tracking-col { width:12%; }
.shipment-table col.shipment-status-col { width:9%; }
.shipment-table a { color:var(--accent); font-weight:700; text-decoration:none; }
.shipment-customer-actions { display:flex; justify-content:flex-end; margin-bottom:10px; }
.badge.shipment-status-planned { background:var(--panel-alt); color:var(--text-muted); }
.badge.shipment-status-ready { background:#FFF6D9; color:#755600; }
.badge.shipment-status-shipped { background:#E6F0FF; color:#174C8F; }
.badge.shipment-status-delivered { background:#E8F7EE; color:#17683A; }
.badge.shipment-status-exception { background:#FDECEC; color:#A12A2A; }
.badge.shipment-status-cancelled { background:var(--panel-alt); color:var(--text-muted); text-decoration:line-through; }
.shipment-modal .form-row { align-items:start; }

.outside-service-table th:nth-child(6),.outside-service-table td:nth-child(6),
.outside-service-table th:nth-child(7),.outside-service-table td:nth-child(7) { text-align:right; }
.outside-overdue { display:block; margin-top:3px; color:var(--red); font-size:var(--font-size-meta); font-weight:800; }
.badge.outside-status-planned { background:var(--panel-alt); color:var(--text-muted); }
.badge.outside-status-sent,.badge.outside-status-at-vendor { background:#E6F0FF; color:#174C8F; }
.badge.outside-status-partially-returned { background:#FFF6D9; color:#755600; }
.badge.outside-status-returned { background:#E8F7EE; color:#17683A; }
.badge.outside-status-canceled { background:var(--panel-alt); color:var(--text-muted); text-decoration:line-through; }
@media (max-width: 720px) {
  .payment-summary-grid,
  .payment-detail-summary,
  .payment-detail-info { grid-template-columns:1fr; }
  .payment-detail-info .detail-field { padding:8px 4px; border-right:0; border-bottom:1px solid var(--border); }
  .payment-detail-info .detail-field:last-child { border-bottom:0; }
  .payment-detail-attachments .card-hdr { align-items:flex-start; flex-direction:column; }
  .payment-attachment-upload { width:100%; justify-content:flex-start; }
  .payment-attachment-upload input { width:100%; }
  .payment-attachment-row { grid-template-columns:40px minmax(0,1fr); }
  .payment-attachment-actions { grid-column:1 / -1; justify-content:flex-end; }
}

/* Purchase orders */
.po-table col.po-number-col { width: 12%; }
.po-table col.vendor-col { width: 18%; }
.po-table col.status-col { width: 16%; }
.po-table col.date-col { width: 10%; }
.po-table col.total-col { width: 9%; }
.po-table col.received-col { width: 9%; }
.po-table col.created-by-col { width: 8%; }

/* Vendor master: explicit columns reserve enough space for the row action. */
.vendor-master-table col.vendor-name-col { width: 21%; }
.vendor-master-table col.vendor-type-col { width: 12%; }
.vendor-master-table col.vendor-contact-col { width: 17%; }
.vendor-master-table col.vendor-phone-col { width: 15%; }
.vendor-master-table col.vendor-location-col { width: 17%; }
.vendor-master-table col.vendor-status-col { width: 8%; }
.vendor-master-table th:last-child,
.vendor-master-table td:last-child { text-align: center; }

/* Inventory item master */
.inventory-table .item-number-cell,
.inventory-table .item-desc-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inventory-table th:last-child,
.inventory-table td:last-child { text-align: right; }
.inventory-table .inv-status-badge,
.inventory-table .po-status,
.inventory-table .badge { white-space: nowrap; }
.item-master-table col.item-number-col { width: 20%; }
.item-master-table col.item-description-col { width: 21%; }
.item-master-table col.item-category-col { width: 10%; }
.item-master-table col.item-uom-col { width: 6%; }
.item-master-table col.item-quantity-col { width: 7%; }
.item-master-table col.item-location-col { width: 9%; }
.item-master-table col.item-cost-col { width: 7%; }

.compact-uom { display: none; }

/* At a laptop-width workspace, keep the task-critical columns legible.
   Category, source quote, and audit/receipt summaries remain on their
   record details; the underlying fields and filters are unchanged. */
@media (min-width: 901px) and (max-width: 1400px) {
  .po-table, .item-master-table, .invoice-list-table { --table-cell-x: 8px; }

  .po-table col.received-col,
  .po-table col.created-by-col,
  .po-table .po-received-cell,
  .po-table .po-created-cell,
  .item-master-table col.item-category-col,
  .item-master-table col.item-uom-col,
  .item-master-table .item-category-cell,
  .item-master-table .item-uom-cell,
  .invoice-list-table col.invoice-quote-col,
  .invoice-list-table th:nth-child(2), .invoice-list-table td:nth-child(2),
  .invoice-list-table col.invoice-money-col:nth-child(7),
  .invoice-list-table th:nth-child(7), .invoice-list-table td:nth-child(7) {
    display: none;
  }

  .po-table col.po-number-col { width: 17%; }
  .po-table col.vendor-col { width: 19%; }
  .po-table col.status-col { width: 19%; }
  .po-table col.date-col { width: 13%; }
  .po-table col.total-col { width: 10%; }

  .item-master-table col.item-number-col { width: 22%; }
  .item-master-table col.item-description-col { width: 23%; }
  .item-master-table col.item-quantity-col { width: 10%; }
  .item-master-table col.item-location-col { width: 11%; }
  .item-master-table col.item-cost-col { width: 9%; }
  .item-master-table .compact-uom { display: inline; font: inherit; color: var(--text-muted); }

  .invoice-list-table col.invoice-number-col { width: 12%; }
  .invoice-list-table col.invoice-customer-col { width: 17%; }
  .invoice-list-table col.invoice-date-col { width: 12%; }
  .invoice-list-table col.invoice-money-col { width: 11%; }
  .invoice-list-table col.invoice-money-col:nth-child(8) { width: 12%; }
  .invoice-list-table col.invoice-status-col { width: 10%; }
  .invoice-list-table th:nth-child(n+6):nth-child(-n+8),
  .invoice-list-table td:nth-child(n+6):nth-child(-n+8) { text-align: right; }
}

/* Item detail history uses content-weighted columns, with numbers right-aligned. */
.item-receipt-table col.receipt-date-col { width: 14%; }
.item-receipt-table col.receipt-vendor-col { width: 28%; }
.item-receipt-table col.receipt-qty-col { width: 10%; }
.item-receipt-table col.receipt-uom-col { width: 10%; }
.item-receipt-table col.receipt-cost-col { width: 19%; }
.item-receipt-table col.receipt-effective-col { width: 19%; }
.item-adjustment-table col.adjust-date-col { width: 13%; }
.item-adjustment-table col.adjust-type-col { width: 14%; }
.item-adjustment-table col.adjust-qty-col { width: 9%; }
.item-adjustment-table col.adjust-uom-col { width: 8%; }
.item-adjustment-table col.adjust-source-col { width: 13%; }
.item-adjustment-table col.adjust-notes-col { width: 16%; }
.item-adjustment-table col.adjust-user-col { width: 9%; }

/* Inventory ledger */
.inventory-ledger-table col.ledger-date-col { width: 12%; }
.inventory-ledger-table col.ledger-item-col { width: 20%; }
.inventory-ledger-table col.ledger-type-col { width: 10%; }
.inventory-ledger-table col.ledger-quantity-col { width: 7%; }
.inventory-ledger-table col.ledger-source-col { width: 13%; }
.inventory-ledger-table col.ledger-user-col { width: 10%; }
.inventory-ledger-table col.ledger-notes-col { width: 14%; }

/* Receiving and stock history */
.receiving-history-table th:nth-child(1),
.receiving-history-table td:nth-child(1) { width: 12%; }
.receiving-history-table th:nth-child(2),
.receiving-history-table td:nth-child(2) { width: 20%; }
.receiving-history-table th:nth-child(3),
.receiving-history-table td:nth-child(3) { width: 22%; }
.receiving-history-table th:nth-child(4),
.receiving-history-table td:nth-child(4) { width: 10%; text-align: right; }
.receiving-history-table th:nth-child(5),
.receiving-history-table td:nth-child(5) { width: 8%; }
.receiving-history-table th:nth-child(6),
.receiving-history-table td:nth-child(6) { width: 14%; }
.receiving-history-table th:nth-child(7),
.receiving-history-table td:nth-child(7) { width: 14%; }

.stock-level-table col.stock-number-col { width: 13%; }
.stock-level-table col.stock-description-col { width: 21%; }
.stock-level-table col.stock-type-col { width: 10%; }
.stock-level-table col.stock-vendor-col { width: 13%; }
.stock-level-table col.stock-quantity-col { width: 7%; }
.stock-level-table col.stock-uom-col { width: 5%; }
.stock-level-table col.stock-reorder-col { width: 7%; }
.stock-level-table col.stock-location-col { width: 9%; }
.stock-level-table col.stock-cost-col { width: 7%; }
.stock-level-table col.stock-status-col { width: 7%; }

/* User administration */
.users-table col.username-col { width: 20%; }
.users-table col.display-col { width: 24%; }
.users-table col.role-col { width: 15%; }
.users-table col.created-col { width: 18%; }

/* Dense editor grids: scrolling is intentional because inputs need usable widths. */
.po-line-table { width: 100%; min-width: 0; }
.po-line-table col.po-line-type-col { width: 24%; }
.po-line-table col.po-line-description-col { width: 28%; }
.po-line-table col.po-line-qty-col { width: 9%; }
.po-line-table col.po-line-uom-col { width: 8%; }
.po-line-table col.po-line-cost-col { width: 10%; }
.po-line-table col.po-line-total-col { width: 9%; }
.po-line-table th:last-child,
.po-line-table td:last-child { text-align:center; }

.routing-table { width:100%; min-width:0; table-layout:fixed; --table-cell-x:6px; }
.routing-table col.seq-col { width: 7%; }
.routing-table col.work-center-col { width: 16%; }
.routing-table col.operation-col { width: 16%; }
.routing-table col.hours-col { width: 7%; }
.routing-table col.rate-col { width: 9%; }
.routing-table col.cost-col { width: 8%; }
.routing-table col.notes-col { width: 8%; }
.routing-table col.action-col { width: 6%; }
.routing-table .tbl-input,
.routing-table .tbl-select { width:100%; min-width:0; }
.routing-table .routing-number-input { font-family:var(--font-mono); text-align:right; }
.routing-table .btn-icon { min-width:24px; padding:4px; }
.routing-table th:nth-child(n+6):nth-child(-n+9) { text-align:right; }

.receive-lines-table col.receive-item-col { width: 46%; }
.receive-lines-table col.receive-qty-col { width: 17%; }
.receive-lines-table col.receive-input-col { width: 20%; }
.receive-lines-table th:nth-child(n+2),
.receive-lines-table td:nth-child(n+2) { text-align: right; }
.receive-lines-table .form-control { width: 100%; text-align: right; }
.receive-lines-table .receive-item-name { font-weight: 700; }

.vendor-bill-data-table col.bill-vendor-col { width: 24%; }
.vendor-bill-data-table col.bill-date-col { width: 14%; }
.vendor-bill-data-table col.bill-status-col { width: 12%; }
.vendor-bill-data-table col.bill-po-col { width: 18%; }
.vendor-bill-data-table col.bill-category-col { width: 18%; }
.vendor-bill-payment-table col.payment-date-col { width: 20%; }
.vendor-bill-payment-table col.payment-method-col { width: 22%; }
.vendor-bill-payment-table col.payment-reference-col { width: 38%; }
.vendor-bill-payment-table col.payment-applied-col { width: 20%; }
.vendor-bill-activity-table col.activity-event-col { width: 28%; }
.vendor-bill-activity-table col.activity-date-col { width: 24%; }
.vendor-bill-activity-table col.activity-reference-col { width: 48%; }

.outside-services-table col.vendor-col { width: 18%; }
.outside-services-table col.service-col { width: 25%; }
.outside-services-table col.cost-col { width: 11%; }
.outside-services-table col.qty-col { width: 7%; }
.outside-services-table col.total-col { width: 11%; }
.outside-services-table col.lead-col { width: 23%; }

.outside-services-table th,
.outside-services-table td,
.part-cost-table th,
.part-cost-table td { padding-inline: 8px; }

.outside-services-table th:last-child,
.outside-services-table td:last-child { padding-inline: 4px; text-align: center; }

.quote-cell-stack { display: grid; gap: 4px; min-width: 0; }

.part-cost-table col.part-col { width: 10%; }
.part-cost-table col.name-col { width: 14%; }
.part-cost-table col.qty-col { width: 5%; }
.part-cost-table col.material-col { width: 9%; }
.part-cost-table col.scrap-col { width: 5%; }
.part-cost-table col.labor-col { width: 11%; }
.part-cost-table col.outside-col { width: 9%; }
.part-cost-table col.direct-col { width: 11%; }
.part-cost-table col.preprofit-col { width: 13%; }
.part-cost-table col.price-col { width: 13%; }
.part-cost-table th:nth-child(4),
.part-cost-table th:nth-child(n+6),
.summary-outside-table th:nth-child(n+4) { text-align:right; }
.summary-outside-table col.part-col { width: 14%; }
.summary-outside-table col.service-col { width: 24%; }
.summary-outside-table col.vendor-col { width: 23%; }
.summary-outside-table col.each-col { width: 14%; }
.summary-outside-table col.qty-col { width: 8%; }
.summary-outside-table col.total-col { width: 17%; }

.po-picker-table { min-width: 760px; }
.po-picker-table th:nth-child(1) { width: 38%; }
.po-picker-table th:nth-child(2) { width: 14%; }
.po-picker-table th:nth-child(3) { width: 17%; }
.po-picker-table th:nth-child(4) { width: 11%; }
.po-picker-table th:nth-child(5) { width: 12%; }
.po-picker-table th:nth-child(6) { width: 8%; }
.po-picker-table th:last-child,
.po-picker-table td:last-child { min-width: 88px; text-align: center; }

.po-vendor-picker-table { min-width: 780px; }
.po-vendor-picker-table th:nth-child(1) { width: 25%; }
.po-vendor-picker-table th:nth-child(2) { width: 17%; }
.po-vendor-picker-table th:nth-child(3) { width: 17%; }
.po-vendor-picker-table th:nth-child(4) { width: 20%; }
.po-vendor-picker-table th:nth-child(5) { width: 11%; }
.po-vendor-picker-table th:nth-child(6) { width: 10%; }

@media (max-width: 900px) {
  :root {
    --table-font-size: var(--font-size-meta);
    --table-cell-x: 8px;
  }

  .po-table,
  .item-master-table,
  .vendor-master-table,
  .invoice-list-table,
  .quote-db-table,
  .inventory-ledger-table,
  .stock-level-table {
    min-width: 860px;
  }

  .quote-db-table {
    min-width: 1040px;
  }

  .item-master-table {
    min-width: 1120px;
  }

  .item-adjustment-table {
    min-width: 900px;
  }
}
