/* Common SELQON table format for ERP screens. */
@media screen {
  body.globalrf-ui main#main-content table {
    --sq-table-bg: #ffffff;
    --sq-table-alt: #f3f4f1;
    --sq-table-hover: #edf0eb;
    --sq-table-selected: #f6edcf;
    --sq-table-ink: #252a27;
    --sq-table-muted: #59615b;
    --sq-table-link: #715200;
    --sq-table-line: #dce1da;
    --sq-table-head: #eef1ec;
    --sq-table-head-ink: #252a27;
    --sq-table-accent: #c2a557;
    --sq-table-positive: #17623a;
    --sq-table-negative: #9b2525;
    --sq-table-focus: #896300;
    color: var(--sq-table-ink);
    background-color: var(--sq-table-bg);
    font-variant-numeric: tabular-nums;
    --muted: var(--sq-table-muted);
    --text-secondary: var(--sq-table-muted);
  }

  body.globalrf-ui main#main-content :where(table > tbody > tr) {
    --sq-row-bg: var(--sq-table-bg);
  }
  body.globalrf-ui main#main-content :where(table > tbody > tr:nth-child(even)) {
    --sq-row-bg: var(--sq-table-alt);
  }
  body.globalrf-ui main#main-content :where(table > tbody > tr:hover, table > tbody > tr:focus-within) {
    --sq-row-bg: var(--sq-table-hover);
  }
  body.globalrf-ui main#main-content :where(table > tbody > tr:is([aria-selected="true"], .selected, .vx-selected, :has(input[type="checkbox"]:checked))) {
    --sq-row-bg: var(--sq-table-selected);
  }

  /* Cells are opaque so fixed columns remain legible when scrolled. */
  html body.globalrf-ui main#main-content table > :is(thead, tbody, tfoot) > tr > :is(th, td) {
    padding: 8px 10px !important;
    vertical-align: middle !important;
    text-align: start;
    font-size: 12px !important;
    line-height: 1.35 !important;
    border-bottom: 1px solid var(--sq-table-line) !important;
  }
  html body.globalrf-ui main#main-content table > thead > tr > :is(th, td) {
    color: var(--sq-table-head-ink) !important;
    background: var(--sq-table-head) !important;
    border-bottom: 1px solid var(--sq-table-accent) !important;
    font-weight: 650 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
  }
  html body.globalrf-ui main#main-content table > tbody > tr > :is(th, td) {
    color: var(--sq-table-ink) !important;
    background: var(--sq-row-bg) !important;
  }
  html body.globalrf-ui main#main-content table > tfoot > tr > :is(th, td) {
    color: var(--sq-table-ink) !important;
    background: var(--sq-table-alt) !important;
  }
  html body.globalrf-ui main#main-content table :is(th, td):is(.number, .numeric, .num, .ps-number) {
    text-align: end;
  }
  html body.globalrf-ui main#main-content table :is(th, td).selection-cell {
    text-align: center;
  }
  html body.globalrf-ui main#main-content table > thead :is(a, small, strong, span, label) {
    color: var(--sq-table-head-ink);
  }
  html body.globalrf-ui main#main-content table :is(tbody, tfoot) :is(small, .muted, .table-secondary, .table-subtext, .table-subline, .hash-value, .compact-rates) {
    color: var(--sq-table-muted);
  }
  html body.globalrf-ui main#main-content table :is(tbody, tfoot) strong {
    color: inherit;
  }
  html body.globalrf-ui main#main-content table :is(tbody, tfoot) a:not(.primary-button, .secondary-button, .danger-button, .icon-button) {
    color: var(--sq-table-link);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  html body.globalrf-ui main#main-content table :is(tbody, tfoot) .positive { color: var(--sq-table-positive) !important; }
  html body.globalrf-ui main#main-content table :is(tbody, tfoot) .negative-value { color: var(--sq-table-negative) !important; }
  body.globalrf-ui main#main-content :where(table) :where(.status:not([class*="status-"]),.document-status,.partner-table-status,.count-badge,.tc-pill,.pc-tag) {
    color: #594400; background-color: #fff7db;
  }
  /* Preserve the meaning and contrast of status badges. */
  body.globalrf-ui main#main-content :where(table) :where(.status-badge,.asset-status,.compliance-status,.due-neutral,.status-draft,.status-retired) {
    color: #475569; background-color: #eef1f5;
  }
  body.globalrf-ui main#main-content :where(table) :where(.status-chip,.status-ready,.collection-advanced,.due-today,.import-status-warning,.asset-status-assigned,.asset-status-on_route,.asset-status-open,.asset-status-maintenance,.asset-status-upcoming,.status-stopped,.tyre-status-repair,.tyre-status-retread,.tyre-status-inspection,.compliance-status-review_required,.compliance-status-missing_data) {
    color: #6b5100; background-color: #fff7db;
  }
  body.globalrf-ui main#main-content :where(table) :where(.status-posted,.status-active,.purchase-status-paid,.collection-collected,.collection-cash_paid,.due-collected,.import-status-ready,.import-status-imported,.vacation-status-approved,.disciplinary-status-signed,.ppe-status-received,.asset-status-available,.asset-status-valid,.asset-status-completed,.employee-status-active,.status-moving,.tyre-status-mounted,.compliance-status-likely_not_applies,.compliance-status-not_applicable) {
    color: #17623a; background-color: #e9f7ef;
  }
  body.globalrf-ui main#main-content :where(table) :where(.status-error,.purchase-status-pending,.collection-pending,.due-overdue,.import-status-error,.vacation-status-rejected,.disciplinary-status-closed_unsigned,.disciplinary-status-overdue_unread,.ppe-status-rejected,.asset-status-workshop,.asset-status-out_of_service,.asset-status-expired,.asset-status-in_progress,.employee-status-inactive,.status-no_signal,.tyre-status-retired,.tyre-status-discarded,.tyre-status-missing,.compliance-status-likely_applies) {
    color: #922b2b; background-color: #fdeaea;
  }
  body.globalrf-ui main#main-content :where(table) :where(.ppe-status-read,.due-pending,.tyre-status-available,.tyre-status-reusable) {
    color: #245b8a; background-color: #eaf3fb;
  }
  body.globalrf-ui main#main-content :where(table) :where(.status-badge,.asset-status,.compliance-status,.document-status,.status-chip,.collection-badge) :where(small,strong,span) {
    color: inherit;
  }
  body.globalrf-ui main#main-content :where(table) :where(.text-warning) { color: var(--sq-table-link) !important; }
  body.globalrf-ui main#main-content :where(table) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]),select,textarea) {
    color: var(--sq-table-ink); background-color: var(--sq-table-bg); border-color: var(--sq-table-line);
  }
  body.globalrf-ui main#main-content :where(table) :where(input,textarea)::placeholder { color: var(--sq-table-muted); opacity: 1; }
  body.globalrf-ui main#main-content :where(table > tbody,table > tfoot) :where(label,.secondary-button) {
    color: var(--sq-table-ink);
  }
  body.globalrf-ui main#main-content :where(table) :where(.secondary-button) { background-color: var(--sq-table-bg); border-color: var(--sq-table-line); }
  body.globalrf-ui main#main-content :where(table) :where(a,button,input,select,textarea):focus-visible {
    outline-color: var(--sq-table-focus);
  }
}
