/* ════════════════════════════════════════════════════════════════════
   Funding tab — KPIs, charts, per-deal & per-ticker tables
   ════════════════════════════════════════════════════════════════════ */

/* The funding chart grid sits the cumulative-P&L and rate charts side by
   side. The default .chart-grid is 3-up; we override to 2-up so each
   chart has roughly half the row width — still wide enough for the
   legend + multi-deal lines while putting both views on one screen. */
.funding-chart-grid {
  grid-template-columns: 1fr 1fr;
}
/* Stack on narrow viewports so neither chart gets squashed. Threshold
   matches the .kpi-grid breakpoint for layout consistency. */
@media (max-width: 1280px) {
  .funding-chart-grid {
    grid-template-columns: 1fr;
  }
}

.funding-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.funding-toolbar #fnd-status.loading { color: var(--status-dev); }
.funding-toolbar #fnd-status.error   { color: var(--loss); }

/* The KPI grid stays 3-up but the typography accents the directional sign:
   funding paid (negative) reads red, received reads green. Same convention
   as the backtest tab so the muscle memory carries over. */
.funding-kpi-grid .kpi-value .pos { color: var(--profit); }
.funding-kpi-grid .kpi-value .neg { color: var(--loss); }

/* Per-deal & per-ticker tables — pick up shared .datatable styling but
   tighten the horizontal padding so the wider hedge-tokens column fits
   without horizontal scroll on the narrower laptop widths we target. */
#fnd-deal-table .num,
#fnd-ticker-table .num,
#fnd-compare-table .num {
  white-space: nowrap;
}

/* Comparison table — flag rows where current funding has dropped below the
   historical average (less favourable for shorts). The amber tint mirrors
   the .deal-card.dirty stale-edit cue so the visual language is consistent
   across the app. */
#fnd-compare-table tr.row-below-hist td {
  background: rgba(249, 156, 0, 0.06);
}
#fnd-compare-table tr.row-below-hist:hover td {
  background: rgba(249, 156, 0, 0.10);
}
.fnd-flag {
  margin-left: 6px;
  font-size: 9px;
  padding: 1px 6px;
  letter-spacing: .04em;
  font-weight: 600;
}

/* Completed deal in the per-deal table — muted row + a small "completed"
   tag in the deal-name column so it's clear the funding number is final. */
#fnd-deal-table tr.fnd-row-completed td {
  color: var(--muted-foreground);
}
#fnd-deal-table tr.fnd-row-completed strong {
  color: var(--muted-foreground);
}

/* Unhedged (0% hedge) rows in both per-deal and per-ticker tables. Listed
   for completeness with greyed text — they have no funding exposure to
   compare. Mirrors the 0% vest-tranche treatment from the Positions tab. */
#fnd-deal-table tr.fnd-row-unhedged td,
#fnd-ticker-table tr.fnd-row-unhedged td {
  color: var(--muted-foreground);
  opacity: .75;
}
#fnd-deal-table tr.fnd-row-unhedged .tag,
#fnd-ticker-table tr.fnd-row-unhedged .tag {
  opacity: .6;
}
.fnd-completed-tag {
  margin-left: 8px;
  font-size: 9px;
  padding: 1px 6px;
  background: var(--surface-tinted);
  color: var(--muted-foreground);
  border: 1px solid var(--border-strong);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
}
