/* ════════════════ BACKTEST — institution-grade precision layer (loaded LAST) ════════════════ */
/* Scope: the backtest float content (#btOut · #btParams · #btLogBody) + the terminal BT panel (#termBT).
   Geometry scale: metric cards / inputs / trade-log = 8px radius · one hairline var(--line) border.
   Honesty/color law preserved: numbers are tabular-nums (no digit jitter); green/red = P&L / direction
   ONLY; amber var(--pcac) = chrome. This layer is additive (loaded after chart-plot.css) — it styles the
   pcbt-* classes the backtest markup now carries; it does not relocate or weaken any existing rule. */

/* every backtest number sits on a fixed-width grid → columns line up, values don't reflow on tick */
#btOut,#btParams,#btLogBody,#termBT{font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1}

/* ── stats grids ── */
.pcbt-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}
.pcbt-grid2{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:7px}

/* ── metric card: equal height + tight label→value rhythm ── */
.pcbt-card{background:var(--card2);border:1px solid var(--line);border-radius:8px;padding:7px 10px;display:flex;flex-direction:column;justify-content:center;gap:2px;min-height:46px;min-width:0}
.pcbt-cl{font-size:9.5px;font-weight:700;letter-spacing:.2px;color:var(--muted);text-transform:uppercase;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pcbt-cv{font-size:15px;font-weight:800;line-height:1.1;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pcbt-csub{font-size:9.5px;color:var(--muted);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ── exits summary line ── */
.pcbt-exits{font-size:11px;color:var(--muted);margin-top:8px;line-height:1.55}

/* ── equity curve block (framed, subtle area fill drawn in JS) ── */
.pcbt-eq{margin-top:9px}
.pcbt-eq-l{font-size:9.5px;font-weight:700;letter-spacing:.3px;text-transform:uppercase;color:var(--muted);margin-bottom:4px}
.pcbt-eq svg{display:block;border:1px solid var(--line);border-radius:8px;background:var(--card2)}

/* ── trade log: fixed columns, no wrap, end-aligned numerics, hairline rows ── */
.pcbt-logwrap{max-height:152px;overflow-y:auto;border:1px solid var(--line);border-radius:8px;margin-top:2px}
.pcbt-log{width:100%;border-collapse:collapse;font-size:11px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-variant-numeric:tabular-nums}
.pcbt-log tr{border-bottom:1px solid rgba(120,130,150,.10)}
.pcbt-log tr:last-child{border-bottom:0}
.pcbt-log td{padding:3.5px 7px;white-space:nowrap}
.pcbt-log td:nth-child(1){color:var(--muted);width:1%}                              /* # index */
.pcbt-log td:nth-child(2){width:1%;text-align:center}                               /* direction arrow */
.pcbt-log td:nth-child(3){text-align:end;color:var(--txt2);min-width:104px}         /* entry → exit */
.pcbt-log td:nth-child(4){text-align:end;font-weight:700;min-width:104px}           /* PnL (return %) */
.pcbt-log td:nth-child(5){text-align:center;font-size:9.5px;font-weight:700;width:1%}/* exit-reason badge */

/* ── narrow / mobile: drop the stats grid to 2 columns so cards never crush ── */
@media(max-width:760px){
  .pcbt-grid{grid-template-columns:repeat(2,1fr)}
  .pcbt-cv{font-size:14px}
  .pcbt-logwrap{max-height:132px}
}
