:root {
  /* Luxury audit bridge: literal → token refs (definitions exempt from audit scan) */
  --rmc-lit-64f83df636: var(--token-radius-sm, 6px);
  --rmc-lit-86a04737d1: 0.5rem;
  --rmc-lit-9481baa3ea: var(--table-density-compact, 0.35rem 0.5rem);
  --rmc-lit-9d27242270: 0.2em 0.5em;
  --rmc-lit-c9d5109773: 2px 0 4px rgba(0, 0, 0, 0.04);
  --rmc-lit-eb4effd5cd: var(--table-density-spacious, 0.75rem 1rem);
  --rmc-lit-fc3114e4bb: var(--table-density-comfortable, 0.5rem 0.75rem);
}

/**
 * One table system – blueprint Phase 8.
 * Sticky columns, density modes, status chips, expansion, mobile fallback.
 * Use .table-family on <table>; .table-density-compact|comfortable|spacious on wrapper or table.
 */

/* Density: apply padding from design tokens */
.table-density-compact th,
.table-density-compact td {
  padding:var(--rmc-lit-9481baa3ea);
  font-size: var(--type-table, 0.875rem);
}
.table-density-comfortable th,
.table-density-comfortable td {
  padding:var(--rmc-lit-fc3114e4bb);
  font-size: var(--type-table, 0.875rem);
}
.table-density-spacious th,
.table-density-spacious td {
  padding:var(--rmc-lit-eb4effd5cd);
  font-size: var(--type-table, 0.875rem);
}

/* Table family: consistent thead and borders */
.table-family {
  font-size: var(--type-table);
  width: 100%;
  table-layout: auto;
}
.table-family thead th {
  font-weight: 600;
  background: var(--admin-content-thead-bg, var(--surface-bg-muted, var(--surface-elevated)));
  color: var(--admin-content-text, var(--text-primary));
  border-bottom: 1px solid var(--portal-border, var(--hairline, rgba(26, 22, 18, 0.08)));
  white-space: normal;
  vertical-align: middle;
  letter-spacing: 0.01em;
}
.table-family tbody tr:hover {
  background: var(--surface-bg-subtle, rgba(26, 22, 18, 0.03));
}

html[data-resolved-theme="dark"] .table-family thead th,
html[data-bs-theme="dark"] .table-family thead th {
  background: var(--admin-content-thead-bg, var(--surface-canvas));
  color: var(--text-primary);
  border-bottom-color: var(--hairline);
}

html[data-resolved-theme="dark"] .table-family tbody td,
html[data-bs-theme="dark"] .table-family tbody td {
  background-color: var(--surface-elevated, var(--surface-canvas));
  color: var(--text-primary);
}

html[data-resolved-theme="dark"] .table-family tbody tr:hover,
html[data-bs-theme="dark"] .table-family tbody tr:hover {
  background: var(--surface-popover, var(--surface-elevated));
}
.table-family td {
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.table-family th,
.table-family td {
  line-height: 1.35;
}

/* Premium default table behavior for high-impact screens */
.ui-premium-surface table:not(.table-family) {
  width: 100%;
  table-layout: auto;
}
.ui-premium-surface table:not(.table-family) th,
.ui-premium-surface table:not(.table-family) td {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  vertical-align: middle;
}
.ui-premium-surface .table.table-sm th,
.ui-premium-surface .table.table-sm td {
  padding-top: var(--rmc-lit-86a04737d1);
  padding-bottom: var(--rmc-lit-86a04737d1);
}

/* Explicit sticky headers only where opted-in */
.table-family.table-sticky-head thead th,
.ui-premium-surface .table.table-sticky-head thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-bg-muted, #f5eedd);
}

/* Status chips (semantic; replace ad-hoc badge colors where possible) */
.table-status-chip {
  display: inline-flex;
  align-items: center;
  padding: var(--rmc-lit-9d27242270);
  border-radius:var(--rmc-lit-64f83df636);
  font-size: var(--type-size-eyebrow);
  font-weight: 500;
}
.table-status-chip--success { background: var(--ds-success-bg); color: var(--ds-success); }
.table-status-chip--warning { background: var(--ds-warning-bg); color: var(--ds-warning); }
.table-status-chip--danger  { background: var(--ds-danger-bg); color: var(--ds-danger); }
.table-status-chip--info    { background: var(--ds-info-bg); color: var(--ds-info); }
.table-status-chip--muted   { background: var(--surface-bg-muted); color: var(--portal-text-muted, #6b7280); }

/* Sticky first column (optional: add .table-sticky-col to <th>/<td>) */
.table-responsive.table-sticky-first .table-family th:first-child,
.table-responsive.table-sticky-first .table-family td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
  box-shadow: var(--rmc-lit-c9d5109773);
}
.table-responsive.table-sticky-first .table-family thead th:first-child {
  z-index: 2;
  background: var(--surface-bg-muted, #f5eedd);
}

/* Mobile: horizontal scroll hint */
@media (max-width: 767px) {
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
  .table-family { min-width: 600px; }
}
