/* Pendle Boros tab — brand row, sub-view nav, scanner/whale tables,
   calculator layout, drill-down drawer. Reuses the shared component skins
   (cards/kpi/tables/hint) and the global .pos/.neg/.tag conventions. */

/* ── Brand row ─────────────────────────────────────────────────────────── */

.boros-brand-card { padding: 16px 24px; }

.boros-brand-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.boros-brand-link { display: block; line-height: 0; }

/* Theme-swapped logo — same two-asset pattern as the sidebar helmet. The
   dark variant (white marks) shows on the dark theme; light variant
   (#111 marks) on light. */
.boros-logo { height: 34px; width: auto; display: block; }
.boros-logo-on-light { display: none; }
:root[data-theme="light"] .boros-logo-on-dark { display: none; }
:root[data-theme="light"] .boros-logo-on-light { display: block; }

.boros-brand-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#boros-stale-pill .boros-stale-text { color: var(--chart-3); }

.boros-subnav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}

.boros-subtab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font: 500 12px var(--font-mono);
  padding: 6px 14px;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.boros-subtab:hover { color: var(--foreground); }
.boros-subtab.active {
  color: var(--foreground);
  background: var(--muted);
  border-color: var(--border-strong);
}

.boros-view { margin-top: 0; }

/* ── KPI strip ─────────────────────────────────────────────────────────── */

.boros-kpis { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }

.boros-kpi-click { cursor: pointer; transition: border-color .15s ease; }
.boros-kpi-click:hover { border-color: var(--ring); }

/* ── Toolbars / controls ───────────────────────────────────────────────── */

.boros-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0 14px;
}

.boros-ctl {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.boros-ctl select,
.boros-ctl input {
  min-width: 110px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.boros-ctl-wide select { max-width: 520px; min-width: 280px; }

.boros-toolbar-note { font-size: 11px; align-self: center; }

.boros-btn {
  appearance: none;
  background: var(--secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--foreground);
  font: 500 11px var(--font-mono);
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.boros-btn:hover { border-color: var(--ring); }

/* ── Tables ────────────────────────────────────────────────────────────── */

.boros-loading,
.boros-empty {
  padding: 26px 8px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-family: var(--font-mono);
}

.boros-dim { color: var(--muted-foreground); }

.boros-mkt-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.boros-mkt-name { display: inline-flex; flex-direction: column; gap: 1px; }
.boros-mkt-sub {
  font-size: 10px;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
}

.boros-group-row td {
  background: var(--surface-elevated);
  color: var(--muted-foreground);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}

.boros-mkt-row,
.boros-lb-row { cursor: pointer; }
.boros-lb-row.is-selected td { background: var(--surface-elevated); }

th.boros-sortable { cursor: pointer; user-select: none; }
th.boros-sortable:hover { color: var(--foreground); }

.boros-leg { display: block; white-space: nowrap; line-height: 1.9; }
.boros-big { font-size: 15px; }

/* Locked-spread tables (wallet inspector + spread-runner scan). Multi-line
   stacked cells read cleaner top-aligned; figures must never wrap mid-number. */
.boros-nowrap { white-space: nowrap; }
.boros-spread-table td { vertical-align: top; }

/* One leg per line: venue logo · side pill · entry-implied rate · YU size. The
   rate sits in a fixed box so both legs' rates — and the sizes after them —
   line up across the two stacked rows. */
.boros-spread-leg {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  line-height: 1.75;
}
.boros-spread-leg .boros-leg-rate {
  min-width: 3.4em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.boros-spread-leg .boros-leg-size {
  color: var(--muted-foreground);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* P&L cell: net headline over the mark/funding split, pinned to one line so
   "mark … · fund …" never breaks across rows. */
.boros-pnl-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.boros-pnl-sub { white-space: nowrap; font-size: 10px; color: var(--muted-foreground); }

.boros-venue-txt {
  display: inline-flex;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: 500 10px var(--font-mono);
  color: var(--muted-foreground);
  text-transform: capitalize;
}

.boros-tx { text-decoration: none; color: var(--muted-foreground); }
.boros-tx:hover { color: var(--foreground); }

/* Venue funding matrix cells. Boros-listed feeds get the accent dot and are
   clickable into the drill-down; row extremes (max/min funding) carry a
   subtle tint since their difference IS the cross-venue spread. */
.boros-vf-table td { vertical-align: top; }
.boros-vf-cell { position: relative; }
.boros-vf-cell.is-boros { cursor: pointer; }
.boros-vf-cell.is-boros::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--chart-1);
}
.boros-vf-cell.is-boros:hover { background: var(--hover-tint, var(--surface-elevated)); }
.boros-vf-cell.is-edge { background: var(--surface-elevated); }
.boros-vf-errs { margin-top: 8px; }

/* ── Whales ────────────────────────────────────────────────────────────── */

.boros-whales-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(480px, 1.25fr);
  gap: 24px;
  align-items: start;
}
.boros-whales-grid > .card { margin-bottom: 0; }
.boros-whales-grid + .card { margin-top: 24px; }
@media (max-width: 1200px) {
  .boros-whales-grid { grid-template-columns: 1fr; }
}

.boros-addr { font-family: var(--font-mono); font-size: 12px; }

.boros-star {
  appearance: none;
  background: none;
  border: none;
  color: var(--muted-foreground);
  opacity: .45;
  cursor: pointer;
  font-size: 13px;
  padding: 0 4px;
}
.boros-star:hover { opacity: .9; }
.boros-star.is-on { color: var(--chart-3); opacity: 1; }

/* Leaderboard "open positions only" filter checkbox — sits inline with the
   scope selects in the toolbar. */
.boros-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  font: 500 12px var(--font-mono);
  color: var(--muted-foreground);
  cursor: pointer;
  white-space: nowrap;
}
.boros-check input { cursor: pointer; margin: 0; }
.boros-check:hover { color: var(--foreground); }

/* Spread Runner scan — per-row "spread" flag on the leaderboard and the
   scanned-count note above the runner table. */
.boros-spread-flag { color: var(--chart-1); font-weight: 600; }
.boros-scan-note { margin: 2px 2px 10px; font-size: 11px; line-height: 1.4; }

.boros-wallet-input-row { display: flex; gap: 8px; flex: 1 1 320px; }
.boros-wallet-input-row input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
}

.boros-chiprow { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.boros-chip {
  appearance: none;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-foreground);
  font: 500 11px var(--font-mono);
  padding: 3px 10px;
  cursor: pointer;
}
.boros-chip:hover { color: var(--foreground); border-color: var(--ring); }
.boros-chip.is-active { color: var(--foreground); border-color: var(--ring); }
.boros-chip-x {
  appearance: none;
  background: none;
  border: 0;
  color: var(--muted-foreground);
  cursor: pointer;
  font: 600 12px var(--font-mono);
  padding: 0 0 0 5px;
  line-height: 1;
}
.boros-chip-x:hover { color: var(--destructive-foreground); }
.boros-input-bad { border-color: var(--destructive-foreground) !important; }

/* Collateral planner */
.boros-kpi-accent { border-color: var(--ring); }
.boros-plan-note { margin: 12px 2px; line-height: 1.5; }
.boros-plan-sizing-table { margin-top: 12px; }

.boros-wallet-totals {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}

/* Let the (?) explainer popovers in table headers escape the horizontal-scroll
   wrapper. `.table-scroll` is overflow-x:auto, which forces overflow-y to auto
   too, cropping a downward popover when the table is short (the spread table is
   often a single row). The whales + book views hold only narrow tables (≤9
   cols) that don't need horizontal scroll on desktop, so let them overflow;
   the wide scanner/overview tables keep their scroll. Mobile hints are a fixed
   bottom-sheet (hint.css) that already escapes any clip, so scope to desktop. */
@media (min-width: 721px) {
  #boros-view-whales .table-scroll,
  #boros-view-book .table-scroll {
    overflow: visible;
  }
}

/* Matured (closed) positions fold into one expandable summary row. */
.boros-pos-toggle td {
  cursor: pointer;
  user-select: none;
  background: var(--surface-elevated);
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 7px 12px;
}
.boros-pos-toggle:hover td { color: var(--foreground); }
.boros-caret { display: inline-block; width: 1.1em; color: var(--muted-foreground); }

.boros-margin-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin: 18px 0 8px;
}

.boros-tape-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1100px) {
  .boros-tape-grid { grid-template-columns: 1fr; }
}

/* ── Calculator ────────────────────────────────────────────────────────── */

.boros-calc-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 6px;
}
@media (max-width: 1200px) {
  .boros-calc-grid { grid-template-columns: 1fr; }
}

.boros-calc-headline {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.boros-calc-headline-label {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.boros-calc-headline-value {
  font-size: 30px;
  font-weight: 650;
  font-family: var(--font-mono);
  margin: 4px 0 2px;
}
.boros-calc-headline.pos .boros-calc-headline-value { color: var(--profit); }
.boros-calc-headline.neg .boros-calc-headline-value { color: var(--loss); }

.boros-calc-lines { margin-bottom: 14px; }
.boros-calc-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px;
  font-size: 12px;
  font-family: var(--font-mono);
  border-bottom: 1px dashed var(--border);
}
.boros-calc-line span { color: var(--muted-foreground); }
.boros-calc-line-total { border-bottom: 1px solid var(--border-strong); }

.boros-calc-liq {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px 6px;
  margin-bottom: 12px;
}
.boros-calc-liq-head {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 4px;
}
.boros-calc-liq .boros-calc-line:last-child { border-bottom: none; }

.boros-calc-foot { line-height: 1.6; }

/* ── Drill-down drawer ─────────────────────────────────────────────────── */

.boros-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 94vw);
  background: var(--card);
  border-left: 1px solid var(--border-strong);
  box-shadow: -18px 0 48px rgba(0, 0, 0, .35);
  z-index: 90;
  display: flex;
  flex-direction: column;
}

.boros-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.boros-drawer-title {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.boros-drawer-close {
  appearance: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted-foreground);
  width: 26px;
  height: 26px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.boros-drawer-close:hover { color: var(--foreground); border-color: var(--ring); }

.boros-drawer-body {
  padding: 14px 18px 22px;
  overflow-y: auto;
}

.boros-detail-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.boros-detail-tfrow { display: flex; gap: 4px; margin-bottom: 6px; }
.boros-tf { padding: 3px 10px; font-size: 11px; }

.boros-detail-chartwrap {
  position: relative;
  height: 300px;
  margin-bottom: 16px;
}

/* Calculator backtest chart (Price It tab). */
.boros-calc-backtest { margin-top: 2px; }
.boros-bt-caption {
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 12px;
  color: var(--muted-foreground);
}
.boros-bt-caption b { color: var(--foreground); font-weight: 600; }
.boros-bt-stats {
  margin-top: 6px;
  font-size: 12px;
  color: var(--foreground);
}
.boros-bt-chartwrap {
  position: relative;
  height: 340px;
}

/* ── Stress Backtest tab ── */
.boros-bt-form { margin-top: 2px; }
.boros-ctl-check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.boros-ctl-check input { width: auto; }
.boros-btn-inline { margin-left: 8px; }

.boros-bt-verdict { display: flex; flex-direction: column; gap: 14px; }
.boros-bt-headline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.boros-bt-headline.good { border-color: color-mix(in srgb, var(--chart-2) 45%, var(--border)); }
.boros-bt-headline.bad { border-color: color-mix(in srgb, var(--loss) 55%, var(--border)); }
.boros-bt-subnote { line-height: 1.5; }
.boros-bt-afford { display: flex; flex-direction: column; gap: 4px; }
.boros-bt-warn {
  line-height: 1.5;
  color: var(--foreground);
  padding: 8px 10px;
  border-left: 2px solid var(--loss);
  background: color-mix(in srgb, var(--loss) 8%, transparent);
  border-radius: 0 6px 6px 0;
}
.boros-bt-warn b { color: var(--foreground); font-weight: 600; }
.boros-bt-chartwrap-sm { height: 220px; }
.boros-bt-collat-head {
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
  margin-top: 4px;
}
.boros-bt-collat-head .boros-mkt-sub { font-weight: 400; display: block; margin-top: 2px; }
.boros-bt-venuestrip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
}
.boros-bt-venuestrip .boros-chiprow { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.boros-bt-venuestrip .boros-chip.is-active { border-color: var(--ring); font-weight: 600; }

/* Entry-date slider */
.boros-bt-entry-card { padding-top: 12px; padding-bottom: 12px; }
.boros-bt-entry-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.boros-bt-entry-ctl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 320px;
  min-width: 260px;
}
.boros-bt-entry-head { font-size: 13px; color: var(--foreground); }
.boros-bt-entry-head b { font-weight: 600; }
.boros-bt-entry-ctl input[type="range"] { width: 100%; accent-color: var(--ring); cursor: pointer; }
.boros-bt-entry-btns { display: inline-flex; gap: 6px; }

/* The drawer is ≤760px wide — two data-dense tables side by side clipped the
   settlements columns off the right edge, so always stack them vertically. */
.boros-detail-tables {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
