/* Shared table surface for server-rendered component-pilot pages.
   These tokens are the one standard for ordinary data tables.  Dense chart
   matrices and heatmaps opt out in their own scoped styles. */
:root {
  --sp-table-cell-x: 16px;
  --sp-table-cell-y: 12px;
  --sp-table-font-size: 14px;
  --sp-table-line-height: 1.65;
  --sp-table-heading-line-height: 1.4;
  --sp-table-cell-align: top;
  --sp-table-heading-bg: #fafafa;
  --sp-table-heading-fg: #52525b;
  --sp-table-cell-fg: #09090b;
  --sp-table-line: #e4e4e7;
}
body#sp-app[data-ui="components"] table:not([role="presentation"]) thead tr { border-bottom:1px solid #e4e4e7!important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) {
  border-collapse: collapse !important; border-spacing: 0 !important;
  background: #fff !important; color: var(--sp-table-cell-fg) !important; font-size: var(--sp-table-font-size) !important;
}
body#sp-app[data-ui="components"] table:not([role="presentation"]) th,
body#sp-app[data-ui="components"] table:not([role="presentation"]) td {
  font-size: var(--sp-table-font-size) !important; line-height: var(--sp-table-line-height) !important;
}
body#sp-app[data-ui="components"] table:not([role="presentation"]) thead th {
  height: 44px !important; padding: var(--sp-table-cell-y) var(--sp-table-cell-x) !important;
  background: var(--sp-table-heading-bg) !important; color: var(--sp-table-heading-fg) !important;
  border-bottom: 1px solid var(--sp-table-line) !important; font-weight: 500 !important;
  line-height: var(--sp-table-heading-line-height) !important; vertical-align: middle !important;
  white-space: nowrap; text-align: left;
}
body#sp-app[data-ui="components"] table:not([role="presentation"]) tbody td,
body#sp-app[data-ui="components"] table:not([role="presentation"]) tfoot td,
body#sp-app[data-ui="components"] table:not([role="presentation"]) tbody th,
body#sp-app[data-ui="components"] table:not([role="presentation"]) tfoot th {
  padding: var(--sp-table-cell-y) var(--sp-table-cell-x) !important; background: #fff !important;
  color: var(--sp-table-cell-fg) !important; border-bottom: 1px solid var(--sp-table-line) !important;
  vertical-align: var(--sp-table-cell-align) !important;
}
body#sp-app[data-ui="components"] table:not([role="presentation"]) tbody tr:last-child > th,
body#sp-app[data-ui="components"] table:not([role="presentation"]) tbody tr:last-child > td,
body#sp-app[data-ui="components"] table:not([role="presentation"]) tfoot tr:last-child > th,
body#sp-app[data-ui="components"] table:not([role="presentation"]) tfoot tr:last-child > td { border-bottom: 0 !important; }
/* Lifecycle and financial semantic exceptions. */
body#sp-app[data-ui="components"] table:not([role="presentation"]) tr.us-expired > td,
body#sp-app[data-ui="components"] table:not([role="presentation"]) tr.us-expired > th { color: #71717a !important; text-decoration: line-through; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) tr.us-expired > td.us-reason { text-decoration: none; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) tr.us-entry-verified > td,
body#sp-app[data-ui="components"] table:not([role="presentation"]) tr.us-entry-verified > th { font-weight: 700; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) .sp-status--up,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .status-up { color: #dc2626 !important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) .sp-status--down,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .status-down,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .sp-down,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .down,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .negative,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .text-primary { color: #2563eb !important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) .sp-up,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .up,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .positive,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .text-danger,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .semi-up,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .trend-up,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .gor-up { color: #dc2626 !important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) .semi-down,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .trend-down,
body#sp-app[data-ui="components"] table:not([role="presentation"]) .gor-down { color: #2563eb !important; }
/* Preserve existing inline semantic declarations used by market/sector tables. */
body#sp-app[data-ui="components"] table:not([role="presentation"]) td[style*="color:var(--sp-up)"],
body#sp-app[data-ui="components"] table:not([role="presentation"]) td[style*="color: var(--sp-up)"] { color: #dc2626 !important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) td[style*="color:var(--sp-down)"],
body#sp-app[data-ui="components"] table:not([role="presentation"]) td[style*="color: var(--sp-down)"] { color: #2563eb !important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) :is(.sp-badge,.us-badge,.us-rec-badge,.badge,.sp-chip) {
  font-size: 12px !important; line-height: 1.35 !important; border-radius: 6px !important;
}
/* Explicit numeric semantics, not inference from displayed strings. */
body#sp-app[data-ui="components"] table:not([role="presentation"]) :is(th,td):is(.num,.numeric-column,.text-end) {
  text-align: right !important; font-variant-numeric: tabular-nums;
}
body#sp-app[data-ui="components"] table:not([role="presentation"]) :is(th,td).text-center { text-align: center !important; }
/* Preserve compact data visualizations; enlarge only small textual metadata. */
body#sp-app[data-ui="components"] table:not([role="presentation"]) :is(span,small,a,div,b):is(
  [style*="font-size:9px"],[style*="font-size: 9px"],
  [style*="font-size:10px"],[style*="font-size: 10px"],
  [style*="font-size:11px"],[style*="font-size: 11px"]
),
body#sp-app[data-ui="components"] table:not([role="presentation"]) :is(.gor-stock,.gor-signal,.gor-state,.gor-company small) {
  font-size: 12px !important; line-height: 1.5 !important;
}
body#sp-app[data-ui="components"] table:not([role="presentation"]) :is(.gor-stock,.gor-state) { border-radius: 6px !important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) .gor-stock { font-size: 14px !important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) :is(.mw-legend,.sc-code) { font-size: 12px !important; color: #52525b !important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) :is(.text-muted,.gor-muted,.stock-code) { color: #52525b !important; }
/* These cells carry source-provided risk colors, not ordinary numeric direction. */
body#sp-app[data-ui="components"] table:not([role="presentation"]) td.fred-signal-value { color: var(--fred-signal-color) !important; }
body#sp-app[data-ui="components"] table:not([role="presentation"]) td.fred-stale { color: #b42318 !important; }
