/* ════════════════════════════════════════════════════════════════════
   Datatable — used on overview/positions/tranche/backtest tabs
   ════════════════════════════════════════════════════════════════════ */

table.datatable { width: 100%; border-collapse: collapse; font-size: 13px; }
.datatable thead th {
  text-align: left;
  color: var(--muted-foreground); font-weight: 500;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(22,22,22,.6);
  background: transparent;
  /* Headers never wrap — pre-nowrap, the auto-layout algorithm could
     squeeze a column when row content (e.g. long deal names) ate the
     horizontal budget, forcing "Prorated Discount" onto two lines.
     Keeping headers single-line stabilises the layout across funds:
     with this rule, column min-width is at least the header width, and
     wider rows push the table beyond 100% (handled by .table-scroll
     wrappers below). */
  white-space: nowrap;
}
.datatable tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(22,22,22,.4);
  font-family: var(--font-mono);
}
.datatable tbody tr { transition: background .12s; }
.datatable tbody tr:hover { background: var(--hover-tint); }
.datatable th.num, .datatable td.num {
  text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono);
}
.datatable.compact td, .datatable.compact th { padding: 6px 10px; font-size: 12px; }

/* Horizontal-scroll wrapper for wide datatables. With nowrap headers a
   table that exceeds its container's width is rare but real (e.g. the
   Positions per-deal table at 16 columns on a 1280px viewport with
   long deal names). Wrap the table in a .table-scroll div and the
   overflow scrolls horizontally inside the card, instead of pushing
   the entire page sideways or compressing column widths inconsistently
   across funds. */
.table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  /* Negative margin + matching padding so the scrollbar/edges line up
     with the card padding rather than appearing inset. */
}

/* Tranche-row tone: in-MtM rows render as default foreground, post-MtM
   rows pick up the discount-amber. The data attribute is set in JS. */
.row-mtm td  { color: var(--foreground); }
.row-disc td { color: var(--chart-3); }

/* Per-ticker aggregate (Overview tab) — 14 columns. Default 12px cell
   padding pushed the rightmost Cumulative P&L column off the card edge
   on standard 1440-1500px viewports, truncating values like "+$706,xxx"
   to "+$706". Tighten x-padding and shrink the header font so the table
   fits without horizontal scrolling. First/last cells keep a 10px gutter
   so the ticker badge and Cumulative number don't kiss the card edge. */
#ticker-table thead th { padding: 10px 5px; font-size: 10px; letter-spacing: .04em; }
#ticker-table tbody td { padding: 8px 5px; font-size: 12px; }
#ticker-table thead th:first-child,
#ticker-table tbody td:first-child { padding-left: 10px; }
#ticker-table thead th:last-child,
#ticker-table tbody td:last-child { padding-right: 10px; }
/* Squeeze the ticker badge so the first column doesn't dominate. */
#ticker-table tbody td:first-child .tag { padding: 1px 6px; font-size: 11px; }

/* Sum/total row at the bottom of an aggregate datatable. Slight tint +
   thicker top border so the eye reads it as a footer rather than just
   another row, and we suppress the hover highlight so it doesn't look
   clickable. */
.datatable tbody tr.total-row { background: var(--surface-tinted); }
.datatable tbody tr.total-row:hover { background: var(--surface-tinted); }
.datatable tbody tr.total-row td {
  border-top: 1px solid var(--border-strong, rgba(22,22,22,.7));
  border-bottom: none;
  font-weight: 500;
}
