/*
 * Default table alignment:
 * - Headers always remain centered.
 * - Body cells are centered by default.
 * - Existing per-column alignment controls can override body cells only.
 */

/* Headers are permanently centered. */
.table-scroll thead th,
.table-scroll thead th[data-column-id],
.table-scroll thead th.row-number,
.table-scroll thead th.row-actions-column {
  text-align: center !important;
  vertical-align: middle !important;
}

.table-scroll thead th > * {
  text-align: center !important;
  justify-content: center !important;
  margin-left: auto;
  margin-right: auto;
}

/*
 * Low-specificity defaults allow the existing alignment option,
 * classes, data attributes, or inline styles to override body cells.
 */
:where(
  .table-scroll tbody td:not(.row-actions-column)
) {
  text-align: center;
  vertical-align: middle;
}

/* Inputs and dropdowns follow their table-cell alignment. */
:where(
  .table-scroll tbody td
  input:not([type="checkbox"]),
  .table-scroll tbody td
  textarea,
  .table-scroll tbody td
  select,
  .table-scroll tbody td
  .cell-input,
  .table-scroll tbody td
  .cell-select
) {
  text-align: inherit;
  text-align-last: inherit;
}

/* Center special cell components by default. */
:where(
  .table-scroll tbody
  .edited-by-cell,
  .table-scroll tbody
  .checkbox-datetime-cell,
  .table-scroll tbody
  .link-cell,
  .table-scroll tbody
  .countdown-view
) {
  text-align: inherit;
  justify-content: center;
}

/* Keep checkbox cells centered. */
:where(
  .table-scroll tbody
  .cell-checkbox
) {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
