/* Risk tab — delta-neutral exposure monitor + ADL queue.
   Reuses CEX page primitives (.cex-filter-bar, .card-title-row) so the
   page chrome matches the rest of the funds/CEX surfaces. */

/* ── Top bento row ───────────────────────────────────────────────────
   Four KPI tiles in a responsive grid. Bigger than the .cex-kpi tile
   chrome so the headline number reads as a hero — risk monitoring is
   what brought the user to this page, the bentos shouldn't be a
   footnote. */
.risk-bentos {
  display: grid;
  /* Force exactly four columns so the eight bentos lay out cleanly as
     two rows. Reflows to 2-col below 900px and stacked below 560px so
     no bento gets crushed under its label. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 900px) {
  .risk-bentos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .risk-bentos { grid-template-columns: 1fr; }
}
.risk-bento {
  position: relative;
  background: var(--surface-tinted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 92px;
  overflow: hidden;
}

/* Background glyph — vertically centered on the right with breathing
   room either side so it reads as a decorative anchor rather than a
   clipped edge artefact. Used today on the Hedge Coverage bento (δ
   for delta-neutrality); the class is generic so additional bentos can
   pick up themed glyphs later. Serif italic so the Greek letter forms
   render with proper typographic curves (the squiggly lowercase δ)
   rather than the geometric sans-serif default. */
.risk-bento-bg-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
  opacity: 0.14;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  font-family: 'Georgia', 'Times New Roman', 'Times', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 64px;
  line-height: 1;
}
/* SVG variant — Lucide-style line icons. Same anchor + size; opacity
   slightly higher because line icons read fainter than filled glyphs. */
.risk-bento-bg-icon--svg {
  opacity: 0.10;
  font-size: 0;
}
/* Lift the content above the bg-icon stacking context without touching
   the icon's own absolute positioning — previously this rule applied to
   the SVG too, demoting it from `absolute` to `relative` and re-claiming
   layout height. */
.risk-bento > *:not(.risk-bento-bg-icon) { position: relative; z-index: 1; }
/* Net-delta directional watermark — one arrow-down-up glyph whose two
   arrows scale to the live exposure sign. paintBentos sets data-tone on
   the bento; long grows the up arrow and shrinks the down arrow (each by
   25%), short does the reverse. Neutral and the pre-load empty tone leave
   both arrows equal. fill-box origin keeps each arrow scaling about its
   own centre so neither drifts off-position. */
.risk-delta-arrow {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 200ms ease;
}
.risk-bento--delta[data-tone="long"]  .risk-delta-arrow--up   { transform: scale(1.25); }
.risk-bento--delta[data-tone="long"]  .risk-delta-arrow--down { transform: scale(0.75); }
.risk-bento--delta[data-tone="short"] .risk-delta-arrow--down { transform: scale(1.25); }
.risk-bento--delta[data-tone="short"] .risk-delta-arrow--up   { transform: scale(0.75); }
.risk-bento-label {
  font-size: 10px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.risk-bento-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.1;
}
.risk-bento-value.pos { color: var(--profit); }
.risk-bento-value.neg { color: var(--loss); }

/* Inline hero + secondary metric — used on the Net delta bento where
   the % of NAV reads as a parenthetical to the right of the headline
   dollar figure. baseline aligns the mono numbers so the carets and
   digits sit cleanly on one row. */
.risk-bento-value-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.risk-bento-value-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
}
.risk-bento-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.risk-bento-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--input);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}
.risk-bento-pill strong {
  color: var(--foreground);
  font-family: var(--font-mono);
  margin-left: 4px;
}
.risk-bento-pill--long {
  border-color: rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}
.risk-bento-pill--long strong { color: #f59e0b; }
.risk-bento-pill--short {
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}
.risk-bento-pill--short strong { color: #38bdf8; }
.risk-bento[data-tone="long"]    { border-top: 2px solid #f59e0b; }
.risk-bento[data-tone="short"]   { border-top: 2px solid #38bdf8; }
.risk-bento[data-tone="neutral"] { border-top: 2px solid var(--profit); }

/* Hero + icon row layout. Hero number takes its natural width on the
   left; the icon strip aligns to the right so the bento reads as a
   single horizontal axis ("number · evidence"). */
.risk-bento-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.risk-bento-icons {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}
.risk-bento-icons .risk-bento-icon {
  width: 20px;
  height: 20px;
}
/* Light overlap so a row of 4-5 tokens reads as a stack rather than a
   tight grid — mirrors the convention other dashboards use for
   "involved tickers" chip rows. */
.risk-bento-icons .risk-bento-icon + .risk-bento-icon {
  margin-left: -6px;
  box-shadow: 0 0 0 1px var(--surface-tinted);
}
.risk-bento-icon-more {
  margin-left: 2px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
}

/* Compact venue logo — the rounded-square brand mark sized down to sit
   inline with small text. Used in bento subheaders, the leverage chips
   and the funding-risk section. The `.tdd-cex-logo-wrap` co-class lifts
   specificity above the 24px base regardless of stylesheet order. */
.risk-bento-venue-logo.tdd-cex-logo-wrap {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: middle;
}

/* Effective leverage subheader — one chip per credential: venue logo +
   that account's collateral-based multiple, highest-first. flex-wrap is
   a safety net; the JS caps the chip count so the row stays one line. */
#risk-bento-leverage-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 10px;
}
.risk-lev-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.risk-lev-more {
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  cursor: help;
}

/* ── Per-ticker delta exposure grid ───────────────────────────────────
   Responsive card grid — each card is one ticker. Card surfaces:
     • header: ticker chip + strategy badge
     • a single horizontal bar split into matched + unhedged-overhang
     • long/short/net stats grid
     • venue chips for the contributing legs */
.risk-exposure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.risk-exposure-card {
  background: var(--surface-tinted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.risk-exposure-card[data-bias="long"]    { border-left: 3px solid #f59e0b; }
.risk-exposure-card[data-bias="short"]   { border-left: 3px solid #38bdf8; }
.risk-exposure-card[data-bias="neutral"] { border-left: 3px solid var(--profit); }
.risk-exposure-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.risk-exposure-ticker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--foreground);
}
.risk-exposure-ticker .ticker-icon {
  width: 18px;
  height: 18px;
}
.risk-exposure-strategy {
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--input);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}
.risk-exposure-strategy--basis   { color: oklch(0.72 0.10 200); border-color: oklch(0.72 0.10 200 / 0.4); }
.risk-exposure-strategy--otc_arb { color: oklch(0.65 0.15 275); border-color: oklch(0.65 0.15 275 / 0.4); }
.risk-exposure-strategy--collateral { color: oklch(0.76 0.13 78); border-color: oklch(0.76 0.13 78 / 0.4); }

/* The hedge bar — matched portion in a neutral tone, unhedged overhang
   colored by directional bias. Sizes via flex so the two segments stay
   proportional at any card width. */
.risk-exposure-bar {
  display: flex;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--input);
}
.risk-exposure-bar-matched {
  background: var(--profit);
  opacity: 0.65;
}
.risk-exposure-bar-unhedged--long    { background: #f59e0b; }
.risk-exposure-bar-unhedged--short   { background: #38bdf8; }
.risk-exposure-bar-unhedged--neutral { background: transparent; }

.risk-exposure-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.risk-exposure-stat {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.risk-exposure-stat-label {
  font-size: 9px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.risk-exposure-stat-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.2;
}
.risk-exposure-stat-sub {
  font-size: 9px;
  line-height: 1.1;
  color: var(--muted-foreground);
}
.risk-exposure-delta--long    { color: #f59e0b; }
.risk-exposure-delta--short   { color: #38bdf8; }
.risk-exposure-delta--neutral { color: var(--profit); }

.risk-exposure-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.risk-exposure-venues {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.risk-venue-chip {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}
.risk-exposure-coverage-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-foreground);
  white-space: nowrap;
  cursor: help;
}

/* Legend in the directional-exposure card title row. Small dots matched
   to the bar colors so the user can decode the tone scheme at a glance. */
.risk-bias-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--muted-foreground);
}
.risk-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.risk-legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.risk-legend-dot--neutral { background: var(--profit); }
.risk-legend-dot--long    { background: #f59e0b; }
.risk-legend-dot--short   { background: #38bdf8; }

/* Right-hand controls in the directional-exposure header — the BTC
   share-class carve-out toggle sits beside the bias legend. Wraps below
   the title on narrow widths (card-title-row is flex-wrap). */
.risk-exposure-controls {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.risk-carveout-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.risk-carveout-label { white-space: nowrap; }
/* "net of BTC class" chip on the BTC card head when the carve-out is on. */
.risk-exposure-carve-note {
  font-size: 10px;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
  cursor: help;
}

/* ── ADL queue filter chip group ──────────────────────────────────── */
.risk-adl-filter {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── ADL queue table (unchanged from before, scoped to this file) ── */
#risk-adl-table td.pos { color: var(--profit); }
#risk-adl-table td.neg { color: var(--loss); }
#risk-adl-table .side-long {
  color: var(--profit);
  font-weight: 600;
  text-transform: lowercase;
}
#risk-adl-table .side-short {
  color: var(--loss);
  font-weight: 600;
  text-transform: lowercase;
}
#risk-adl-table .risk-rank {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--foreground);
}
#risk-adl-table .risk-rank-max {
  color: var(--muted-foreground);
  font-weight: 400;
}
#risk-adl-table .risk-rank--high { color: #f59e0b; }
#risk-adl-table .risk-rank--crit { color: var(--loss); }
#risk-adl-table .risk-rank-na,
#risk-adl-table .risk-rank-err {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-foreground);
  font-style: italic;
}
#risk-adl-table .risk-rank-err { color: var(--loss); font-style: normal; }

#risk-adl-table .risk-queue {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 0;
}
#risk-adl-table .risk-queue-pip {
  width: 10px;
  height: 12px;
  border-radius: 2px;
  background: var(--input);
  border: 1px solid var(--border);
  box-sizing: border-box;
  transition: background 120ms ease, border-color 120ms ease;
}
#risk-adl-table .risk-queue-pip.is-lit { background: var(--muted-foreground); border-color: var(--muted-foreground); }
#risk-adl-table .risk-queue--low  .risk-queue-pip.is-lit { background: var(--profit); border-color: var(--profit); }
#risk-adl-table .risk-queue--mid  .risk-queue-pip.is-lit { background: #fbbf24; border-color: #fbbf24; }
#risk-adl-table .risk-queue--high .risk-queue-pip.is-lit { background: #f59e0b; border-color: #f59e0b; }
#risk-adl-table .risk-queue--crit .risk-queue-pip.is-lit { background: var(--loss);  border-color: var(--loss);  }
#risk-adl-table .risk-queue-na {
  font-size: 11px;
  color: var(--muted-foreground);
  font-style: italic;
}

#risk-adl-table .risk-warn,
#risk-margin-table .risk-warn {
  color: var(--loss);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#risk-adl-table .risk-warn-mid,
#risk-margin-table .risk-warn-mid {
  color: #f59e0b;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#risk-adl-table .risk-ok,
#risk-margin-table .risk-ok {
  color: var(--profit);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#risk-adl-table td:first-child .tdd-cex-logo-wrap {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-right: 0;
}
#risk-adl-table td:first-child > * { vertical-align: middle; }
#risk-adl-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
#risk-adl-table th.sortable:hover { color: var(--foreground); }
/* Sort direction carat — same affordance the /cex timeline-day table
   uses via `[data-sort-dir]` + pseudo-element, so the click-to-sort
   interaction feels identical across pages. */
#risk-adl-table thead th.sortable[data-sort-dir]::after {
  display: inline-block;
  margin-left: 3px;
  font-size: 9px;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1;
  color: var(--foreground);
}
#risk-adl-table thead th.sortable[data-sort-dir="asc"]::after  { content: '▲'; }
#risk-adl-table thead th.sortable[data-sort-dir="desc"]::after { content: '▼'; }

/* Synthetic liq + liq-distance tones. Originally scoped to
   #risk-adl-table only; widened to also cover #liveov-table so the
   shared liq engine (public/js/core/liq-engine.js) renders the same
   visual signal on the Positions breakdown's Liq Price column. The
   class names keep the `risk-` prefix for historical continuity even
   though they're cross-page now — `liq-` would be more accurate but
   touching every call site to rename is more churn than it's worth. */
.risk-liq-synthetic {
  border-bottom: 1px dotted var(--muted-foreground);
  cursor: help;
}
/* "Far" synthetic — math is correct but the absolute price isn't
   meaningful, so mute the cell so it doesn't draw the eye away from
   the rows that actually matter. */
.risk-liq-synthetic--far {
  color: var(--muted-foreground);
}

/* Liq distance tones — same scale the bento liq tone uses so the
   highlighted column rows and the "Closest to liq" card share a
   visual language. */
.risk-liqd--mid  { color: #fbbf24; }
.risk-liqd--high { color: #f59e0b; font-weight: 600; }
.risk-liqd--crit { color: var(--loss); font-weight: 600; }

#risk-asof { margin-left: auto; }

/* ── Account margin table ─────────────────────────────────────────── */
#risk-margin-table td:first-child .tdd-cex-logo-wrap {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-right: 0;
}
#risk-margin-table td:first-child > * { vertical-align: middle; }
#risk-margin-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
#risk-margin-table th.sortable:hover { color: var(--foreground); }
#risk-margin-table thead th.sortable[data-sort-dir]::after {
  display: inline-block;
  margin-left: 3px;
  font-size: 9px;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1;
  color: var(--foreground);
}
#risk-margin-table thead th.sortable[data-sort-dir="asc"]::after  { content: '▲'; }
#risk-margin-table thead th.sortable[data-sort-dir="desc"]::after { content: '▼'; }

/* MM-ratio tones — same scale as the per-position liq-distance column
   so the two surfaces read consistently. Healthy under 10%, mid 10-25%,
   high 25-50%, critical past 50% (50% MM ratio is "halfway to liq"). */
/* Uniform weight across all tones — color carries the severity signal,
   no bold/font-weight changes so every row reads at the same hierarchy.
   Matches the Perp Risk table's treatment of liq-distance tones. */
#risk-margin-table .risk-margin--low  { color: var(--profit); }
#risk-margin-table .risk-margin--mid  { color: #fbbf24; }
#risk-margin-table .risk-margin--high { color: #f59e0b; }
#risk-margin-table .risk-margin--crit { color: var(--loss); }
/* Synthetic cell — dotted underline marker like the synthetic liq
   price in the Perp Risk table; reinforces that the value is derived
   rather than directly venue-reported. */
#risk-margin-table .risk-margin-synthetic {
  border-bottom: 1px dotted var(--muted-foreground);
  cursor: help;
}

/* ── Funding-risk section ─────────────────────────────────────────────
   Under Directional exposure: book stat tiles, the daily-P&L
   distribution chart (Chart.js) + per-venue grid side by side, and a
   collapsible per-position table. .pos / .neg are scoped here so the
   section can use the bare classes without colliding with the per-table
   tone rules elsewhere. */
#risk-funding-section .pos { color: var(--profit); }
#risk-funding-section .neg { color: var(--loss); }

.risk-fr-explainer {
  margin-bottom: 12px;
  line-height: 1.5;
  max-width: 78ch;
}

/* Book stat tiles. */
.risk-fr-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 760px) {
  .risk-fr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.risk-fr-tile {
  background: var(--surface-tinted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.risk-fr-tile-label {
  font-size: 10px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.risk-fr-tile-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.15;
}
.risk-fr-tile-sub {
  font-size: 10px;
  color: var(--muted-foreground);
}

/* Sub-block headings. */
.risk-fr-block-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}
.risk-fr-block-title[title] { cursor: help; }

/* Distribution chart + by-venue grid, side by side. */
.risk-fr-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}
.risk-fr-split > * { min-width: 0; }
@media (max-width: 860px) {
  .risk-fr-split { grid-template-columns: 1fr; }
}
.risk-fr-block--venues { display: flex; flex-direction: column; }

/* Chart head — distribution title + bin-width slider on one row. */
.risk-fr-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.risk-fr-chart-head .risk-fr-block-title { margin-bottom: 0; }

/* Chart.js distribution chart — the .chart-wrap class (charts.css)
   supplies the Spartan watermark + relative positioning; this just
   sets the height the responsive canvas sizes to. */
.risk-fr-chart-wrap { height: 224px; }
.risk-fr-hist-caption {
  font-size: 11px;
  color: var(--muted-foreground);
  margin-top: 8px;
}

/* By-venue cards — a 2-col grid that fills the height of the chart
   column beside it. */
.risk-fr-venues {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 10px;
  flex: 1;
}
/* Venue cards — same treatment as the overview's equity-by-venue tiles:
   a per-venue brand-colour accent bar + a gradient tint fading from it.
   `--cex-color` is set inline per card from CEX_META. */
.risk-fr-venue {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cex-color, transparent) 10%, transparent) 0, transparent 65%),
    var(--surface-elevated, var(--surface-tinted));
  padding: 11px 12px 10px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.risk-fr-venue::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--cex-color, var(--border));
}
.risk-fr-venue-head {
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--foreground);
}
.risk-fr-venue-meta {
  font-size: 10px;
  color: var(--muted-foreground);
}
.risk-fr-venue-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--muted-foreground);
}
.risk-fr-venue-row:first-of-type { margin-top: auto; }

/* Collapsible per-position table. */
.risk-fr-positions { margin-top: 18px; }
.risk-fr-positions-summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  user-select: none;
  padding: 4px 0;
}
.risk-fr-positions-summary:hover { color: var(--foreground); }
.risk-fr-positions[open] .risk-fr-positions-summary { margin-bottom: 8px; }

/* By-position table — rides the shared .datatable chrome. */
.risk-fr-table .side-short { color: var(--loss); font-weight: 600; text-transform: lowercase; }
.risk-fr-table .side-long  { color: var(--profit); font-weight: 600; text-transform: lowercase; }
.risk-fr-table td:first-child > * { vertical-align: middle; }

.risk-fr-warn {
  margin-top: 12px;
  font-size: 11px;
  color: #f59e0b;
}

/* ── Liquidation ladder ───────────────────────────────────────────────
   Hero summary across the top (4 KPI tiles), then a stacked horizontal
   bar showing how the book converts to cash by horizon, then a legend
   row, then the detailed table. Shares the .card chrome with the rest
   of the risk sections. */
.risk-ladder-asof { white-space: nowrap; }

.risk-ladder-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}
@media (max-width: 760px) {
  .risk-ladder-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.risk-ladder-summary-item {
  background: var(--surface-tinted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.risk-ladder-summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}
.risk-ladder-summary-value {
  font-family: 'Geist Mono', monospace;
  font-size: 20px;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.1;
}
.risk-ladder-summary-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--muted-foreground);
}

.risk-ladder-chart-wrap {
  position: relative;
  height: 90px;
  margin-bottom: 14px;
}

.risk-ladder-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-bottom: 14px;
  font-size: 11px;
  color: var(--muted-foreground);
}
.risk-ladder-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.risk-ladder-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* Table chrome — first column is the horizon pill, source spans
   wider, amount/cumulative/pct right-aligned via .num. */
.risk-ladder-table .risk-ladder-horizon {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-tinted);
  border: 1px solid var(--border);
  color: var(--foreground);
}
.risk-ladder-table td.muted-row { color: var(--muted-foreground); }
.risk-ladder-table td.illiquid-row {
  color: var(--loss);
  font-weight: 600;
}
.risk-ladder-table .risk-ladder-assumption {
  font-size: 11px;
  color: var(--muted-foreground);
  max-width: 420px;
  white-space: normal;
  line-height: 1.4;
}
