/* ============================================================
   Data tables — readable terminal density (not squished)
   Legacy aliases (.table, table:not(.pro)) map to the same system.
   ============================================================ */

/* Horizontal scroll shell — never crush columns */
.table-wrap,
.fd-table-wrap,
.fd-scroll,
.markets-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--fd-border, rgba(255,255,255,0.06));
  border-radius: 10px;
  background: var(--fd-surface, #0f131a);
}

table.pro,
.fd-table,
table.table,
table.data-table,
.fd-pro-table,
table.legacy-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  color: var(--fd-text, #e2e8f0);
}

table.pro th,
.fd-table th,
table.table th,
table.data-table th,
.fd-pro-table th,
table.legacy-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fd-text-dim, #64748b);
  background: var(--fd-rail, #0b0e13);
  position: sticky;
  top: 0;
  z-index: 5;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--fd-border, rgba(255,255,255,0.08));
  white-space: nowrap;
}

table.pro td,
.fd-table td,
table.table td,
table.data-table td,
.fd-pro-table td,
table.legacy-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--fd-border-soft, rgba(255,255,255,0.04));
  vertical-align: middle;
  white-space: nowrap;
}

table.pro td.wrap,
.fd-table td.wrap,
table.table td.wrap {
  white-space: normal;
  min-width: 160px;
  max-width: 320px;
  line-height: 1.4;
}

table.pro tbody tr:hover,
.fd-table tbody tr:hover,
table.table tbody tr:hover,
table.data-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

table.pro .mono,
.fd-table .mono,
table.table .mono {
  font-family: var(--fd-font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-feature-settings: "tnum";
}

table.pro .score-bull,
.fd-table .score-bull,
table.table .score-bull { color: #34d399; font-weight: 600; }
table.pro .score-bear,
.fd-table .score-bear,
table.table .score-bear { color: #fb7185; font-weight: 600; }

.fd-table .num,
table.pro .num,
table.table .num,
table.pro td.num,
.fd-table td.num {
  text-align: right;
  font-family: var(--fd-font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-feature-settings: "tnum";
}

/* Optional denser mode — still readable */
.fd-table.compact th,
.fd-table.compact td,
table.pro.compact th,
table.pro.compact td {
  padding: 8px 12px;
  font-size: 12px;
}

/* Wide tables (tape, movers) */
table.pro.wide,
.fd-table.wide {
  min-width: 900px;
}

/* Mobile: keep scroll, don't shrink below readable */
@media (max-width: 720px) {
  table.pro,
  .fd-table,
  table.table,
  table.data-table {
    min-width: 560px;
    font-size: 12px;
  }
  table.pro th,
  .fd-table th,
  table.table th,
  table.pro td,
  .fd-table td,
  table.table td {
    padding: 10px 12px;
  }
}

/* Legacy native tables used by ui_table_native (earn / fd-tbl) */
table.earn,
table.fd-tbl {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
table.earn th,
table.fd-tbl th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fd-text-dim, #64748b);
  background: var(--fd-rail, #0b0e13);
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--fd-border, rgba(255,255,255,0.08));
  white-space: nowrap;
}
table.earn td,
table.fd-tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--fd-border-soft, rgba(255,255,255,0.04));
  vertical-align: middle;
  white-space: nowrap;
}
table.earn tbody tr:hover td,
table.fd-tbl tbody tr:hover td {
  background: rgba(255,255,255,0.03);
}
table.earn .mono,
table.fd-tbl .mono {
  font-family: var(--fd-font-mono, ui-monospace, monospace);
  font-feature-settings: "tnum";
}

/* Div-based list tables (ui_table) */
.fd-dtable {
  border: 1px solid var(--fd-border, rgba(255,255,255,0.06));
  border-radius: 10px;
  background: var(--fd-surface, #0f131a);
  overflow: hidden;
}
.fd-dtable-head {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  padding: 12px 14px;
  background: var(--fd-rail, #0b0e13);
  border-bottom: 1px solid var(--fd-border, rgba(255,255,255,0.08));
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fd-text-dim, #64748b);
}
.fd-dtable-body .fd-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--fd-border-soft, rgba(255,255,255,0.04));
  text-decoration: none;
  color: inherit;
  align-items: center;
}
.fd-dtable-body .fd-row:hover {
  background: rgba(255,255,255,0.03);
}
.fd-dtable-body .fd-row:last-child {
  border-bottom: none;
}

/* Stat strip (bullish/neutral/bearish counts etc.) */
.fd-stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.fd-stat-strip .fd-metric,
.fd-stat-strip .surface {
  padding: 12px 14px;
}

/* Tape overview summary tiles (Bullish / Neutral / Bearish / Avg Score) */
.fd-tape-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.fd-tape-summary-tile {
  background: linear-gradient(180deg, rgba(20,25,32,.9), rgba(15,19,26,.95));
  border: 1px solid var(--fd-border, rgba(255,255,255,0.06));
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 88px;
}
.fd-tape-summary-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fd-text-dim, #64748b);
  margin-bottom: 6px;
}
.fd-tape-summary-value {
  font-family: var(--fd-font-mono, ui-monospace, monospace);
  font-size: 24px;
  font-weight: 700;
  font-feature-settings: "tnum";
  line-height: 1.15;
  color: var(--fd-text, #e2e8f0);
}
.fd-tape-summary-bull .fd-tape-summary-value { color: #34d399; }
.fd-tape-summary-bear .fd-tape-summary-value { color: #fb7185; }
.fd-tape-summary-sub {
  font-size: 11px;
  color: var(--fd-text-dim, #64748b);
  margin-top: 4px;
}
.fd-tape-summary-bar {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
.fd-tape-summary-bar-fill {
  height: 100%;
  border-radius: 2px;
}
.fd-tape-summary-bar-fill.bull { background: #10b981; }
.fd-tape-summary-bar-fill.bear { background: #f43f5e; }
.fd-tape-summary-bar-fill.neutral { background: #64748b; }
.fd-text-accent { color: var(--fd-accent-bright, #e0b83a); }
