/* performance.css — page-specific styles for the Model Dashboard page.
   Loaded AFTER style.css + index.css (cascade preserved from the former inline block). */

/* page-title/page-subtitle now provided by the shared .hero.hero-slim band (index.css) */

/* Headline stats */
.headline-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 700px) { .headline-stats { grid-template-columns: repeat(2, 1fr); } }
.hl-stat {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 16px; text-align: center;
}
.hl-stat.featured { border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.05); }
.hl-val { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.hl-val.green { color: var(--green); }
.hl-val.amber { color: var(--amber); }
.hl-val.white { color: #f1f5f9; }
.hl-lbl { font-size: 9px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-4); }
.hl-sub { font-size: 10px; color: var(--text-4); margin-top: 4px; }

/* Risk & validation strip — spans the headline grid, below the outcome tiles.
   Surfaces beat-close %, ROI 95% CI, max drawdown, longest losing streak. */
.hl-risk-strip {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 10px 0;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 6px; margin-top: 2px;
}
.hl-risk-strip .hri {
  flex: 1; min-width: 130px; text-align: center;
  display: flex; flex-direction: column; gap: 3px;
  border-right: 1px solid var(--border);
}
.hl-risk-strip .hri:last-child { border-right: none; }
.hri-lbl { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-4); }
.hri-val { font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: var(--text-2); }
@media (max-width: 600px) {
  .hl-risk-strip .hri { flex: 1 1 50%; min-width: 0; }
  .hl-risk-strip .hri:nth-child(2) { border-right: none; }
}

/* Two-col grid */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
.card-title { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); margin-bottom: 4px; }
.card-sub { font-size: 10px; color: var(--text-4); margin-bottom: 14px; }
/* Model validation cards */
.val-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .val-grid { grid-template-columns: 1fr; } }
.val-card { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.val-label { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-4); margin-bottom: 8px; }
.val-big { font-family: var(--font-display); font-size: 26px; font-weight: 800; line-height: 1; color: var(--text-1); margin-bottom: 8px; }
.val-big.green { color: var(--green); } .val-big.red { color: var(--red); }
.val-big .val-vs { font-size: 13px; font-weight: 600; color: var(--text-4); }
.val-sub { font-size: 10.5px; line-height: 1.5; color: var(--text-4); }

/* Two-col stats (team + pitcher grid) */
.two-col-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 700px) { .two-col-stats { grid-template-columns: 1fr; } }
/* Team + Pitcher dashboards each already split into two cards (best | underperforming).
   Stacking the two sections keeps it to 2 comfortable tables per row instead of 4
   cramped ones that overflow the page to the right. */
#team-pitcher-section { grid-template-columns: 1fr; }

/* Bankroll chart */
.bankroll-chart-wrap { position: relative; }
.bankroll-meta { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--text-4); margin-top: 8px; font-family: var(--font-mono); }

/* Comparison table */
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th { font-size: 8.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-4); padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.compare-table td { padding: 10px 10px; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 12px; color: var(--text-3); }
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr.our-model td { background: rgba(34,197,94,0.05); }
.strategy-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.strategy-badge.model { color: var(--green); }
.strategy-badge.naive { color: var(--text-4); }
.est-tag { font-size: 8px; color: var(--text-4); background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 3px; padding: 1px 4px; margin-left: 4px; vertical-align: middle; }

/* CLV display */
.clv-big { text-align: center; padding: 16px 0 8px; }
.clv-big-num { font-family: var(--font-display); font-size: 48px; font-weight: 700; line-height: 1; }
.clv-big-lbl { font-size: 10px; color: var(--text-4); margin-top: 6px; }
/* clv-chart — SVG (zero-centered); reset legacy flex/height from style.css
   (.clv-chart there sets height:80px, which clipped the SVG+legend and made
   the legend overlap the caption below it) */
.clv-chart { display: block; height: auto; padding-top: 0; }

/* Monthly chart — SVG (zero-centered); legacy flex classes removed */

/* Edge bar chart */
.edge-bar-row { margin-bottom: 9px; }
.edge-bar-row:last-child { margin-bottom: 0; }

/* Backtest rows */
.roi-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.roi-year { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--text-2); width: 56px; flex-shrink: 0; }
.roi-bar-wrap { flex: 1; height: 8px; background: rgba(255,255,255,0.05); border-radius: 100px; overflow: hidden; }
.roi-fill { height: 100%; border-radius: 100px; }
.roi-fill.pos { background: linear-gradient(90deg,#22c55e,#4ade80); }
.roi-fill.neg { background: linear-gradient(90deg,#ef4444,#f87171); }
.roi-pct { font-family: var(--font-display); font-size: 13px; font-weight: 700; width: 50px; text-align: right; flex-shrink: 0; }
.roi-pct.pos { color: var(--green); }
.roi-pct.neg { color: var(--red); }
.roi-meta { font-size: 10px; color: var(--text-4); }

.backtest-note { font-size: 10px; color: var(--text-4); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); line-height: 1.5; }

/* Edge table — used by pitcher/team stats */
.edge-table { width: 100%; border-collapse: collapse; }
.edge-table th { font-size: 8.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-4); padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.edge-table td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 12px; color: var(--text-3); }
/* Numeric columns (W–L "4–2", Win%, ROI, Units) must never wrap; only the first
   column (Team/Pitcher name) may wrap. Fixes the "4–2" break at the en-dash. */
.edge-table th:not(:first-child), .edge-table td:not(:first-child) { white-space: nowrap; }
.edge-table tr:last-child td { border-bottom: none; }
.edge-table tr:hover td { background: rgba(255,255,255,0.02); }

.pnl-pos { color: var(--green); font-weight: 600; }
.pnl-neg { color: var(--red);   font-weight: 600; }

/* Run Line section */
.rl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 700px) { .rl-grid { grid-template-columns: repeat(2, 1fr); } }
.rl-stat { background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.2); border-radius: 10px; padding: 14px 12px; text-align: center; }
.rl-val { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.rl-lbl { font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-4); }
.rl-sub { font-size: 10px; color: var(--text-4); margin-top: 3px; }
.rl-side-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.rl-side-card { flex: 1; min-width: 120px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.rl-side-title { font-size: 10px; font-weight: 700; color: var(--text-3); margin-bottom: 6px; letter-spacing: 0.06em; }
.rl-side-row-inner { display: flex; justify-content: space-between; font-size: 10px; margin-bottom: 3px; }
.rl-side-row-inner span:last-child { font-family: var(--font-mono); font-weight: 600; }

/* Rolling win rate chart */
.rolling-chart-wrap { position: relative; }

/* Daily P&L bar chart */
.calendar-wrap { display: block; }

/* Calibration chart */
.calib-wrap { display: flex; align-items: flex-end; gap: 10px; height: 110px; margin-top: 8px; }
.calib-col { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; }
.calib-bar-wrap { width: 100%; display: flex; flex-direction: row; align-items: flex-end; justify-content: center; height: 80px; gap: 3px; }
.calib-bar { width: 45%; border-radius: 3px 3px 0 0; transition: height 0.3s; }
.calib-actual { background: var(--green); }
.calib-ideal  { background: rgba(255,255,255,0.12); border-radius: 3px; }
.calib-lbl    { font-size: 9px; color: var(--text-4); text-align: center; }
.calib-pct    { font-size: 9px; font-weight: 600; color: var(--text-2); }
.calib-n      { font-size: 8px; color: var(--text-4); }

/* Key insight callout */
.insight-box {
  margin-bottom: 20px; padding: 14px 18px;
  background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.25);
  border-radius: 10px; border-left: 3px solid rgba(34,197,94,0.5);
}
.insight-box .ib-head { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); margin-bottom: 6px; }
.insight-box .ib-body { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.insight-box .ib-body strong { color: #f1f5f9; }

/* Collapsible sections */
.collapsible-trigger { cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-size: 8.5px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-4); padding: 8px 0; margin-bottom: 0; }
.collapsible-trigger:hover { color: var(--text-3); }
.coll-arrow { transition: transform 0.2s; font-size: 11px; }
.collapsible-section.open .coll-arrow { transform: rotate(180deg); }
.collapsible-content { display: none; padding-top: 12px; }
.collapsible-section.open .collapsible-content { display: block; }

/* Naive comparison callout */
.naive-callout { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.naive-pill { flex: 1; min-width: 120px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; text-align: center; }
.naive-pill-val { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.naive-pill-lbl { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-4); }

/* Backtest stat pills — dashed amber border marks them as hypothetical/out-of-sample
   (vs. solid-bordered live pills), so they can't be mistaken for 2026 live results */
.bt-pill { border-style: dashed; border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.04); }

/* Wide data tables scroll horizontally on small screens instead of squishing/clipping */
@media (max-width: 640px) {
  .compare-table, .edge-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}
