/* DEV table normalization, 2026-11-05. Load after danfer-polish.css.
   Intentionally excludes the approved Resumen and all dialog/form tables.
   Specificity is needed for the legacy !important premium/refresh layers. */
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) {
  min-width: 0;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overscroll-behavior-x: contain;
  scrollbar-width: auto;
  scrollbar-color: #8196b2 transparent;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) > table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: auto !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) > table > :is(thead,tbody) > tr > :is(th,td) {
  box-sizing: border-box;
  width: auto !important;
  min-width: 0 !important;
  max-width: 32ch !important;
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  box-shadow: none !important;
  padding: 8px 12px !important;
  vertical-align: middle !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  line-height: 1.4 !important;
  border-color: var(--dfp-line) !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) > table > thead > tr > th {
  height: 40px;
  font-size: 11px !important;
  letter-spacing: .035em !important;
  color: var(--dfp-muted) !important;
  background: var(--dfp-soft) !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) > table > tbody > tr > td {
  height: 52px;
  font-size: 13px !important;
  color: var(--dfp-ink) !important;
  background: var(--dfp-surface) !important;
  font-variant-numeric: tabular-nums;
  transition: background-color 140ms ease;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) > table > tbody > tr:nth-child(even) > td {
  background: var(--dfp-soft) !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) > table > tbody > tr:is(:hover,:focus-within) > td {
  background: color-mix(in srgb, var(--dfp-surface) 91%, #729cce) !important;
}
/* Shrink only known action columns. Never infer actions from every last cell. */
/* Match the legacy :has() selector as well as its specificity, then undo it.
   The header is reset even when a readonly row has no available action. */
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) .table-wrap table:has(tbody td:last-child button) thead th:last-child,
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) .table-wrap table tbody td:last-child:has(button),
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)):has(.users-row) .users-table :is(th,td):last-child {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  box-shadow: none !important;
  min-width: 0 !important;
  width: 1% !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) .table-wrap table:has(tbody td:last-child button) thead th:last-child {
  background: var(--dfp-soft) !important;
  color: var(--dfp-muted) !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(td.row-action,td:has(> .users-actions),td:has(> .row-action-group),td:has(> .inventory-admin-row-actions),td:has(> .inventory-monthly-row-actions)) {
  width: 1% !important;
  white-space: nowrap !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.row-action-group,.users-actions,.inventory-admin-row-actions,.inventory-monthly-row-actions) {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  width: max-content !important;
  min-width: 0 !important;
  max-width: 184px !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) :is(button,a.row-action-button,a.button-link) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 184px !important;
  height: auto !important;
  min-height: 32px !important;
  padding: 6px 9px !important;
  margin: 0 !important;
  border-radius: 7px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  flex: 0 0 auto;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) :is(strong,small) {
  line-height: 1.4 !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) strong {
  font-size: 13px !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) small {
  font-size: 12px !important;
}
/* Legacy .cell-main clamps to two lines. Data must remain fully readable
   at narrow widths: allow the row to grow instead of hiding the remainder. */
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) .cell-main {
  display: block !important;
  overflow: visible !important;
  -webkit-line-clamp: unset !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
/* Let descriptive cells wrap at a readable measure instead of expanding forever. */
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.users-person,.users-identity,.users-access,.users-date) {
  min-width: 0 !important;
}
html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.users-identity,.users-person) span {
  overflow-wrap: anywhere;
}
@media (max-width: 800px) {
  html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) > table {
    min-width: 640px !important;
  }
  html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) .users-table-wrap > table {
    min-width: 760px !important;
  }
  html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.kvp-table-wrap) > table:has(thead tr > th:nth-child(9)) {
    min-width: 960px !important;
  }
  html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) :is(button,a.row-action-button,a.button-link) {
    min-height: 44px !important;
    padding: 8px 10px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  html body #appView #moduleContent:not(:has(.danfer-dashboard-layout)) :is(.table-wrap,.users-table-wrap,.kvp-table-wrap) :is(td,button,a) {
    transition: none !important;
  }
}
