/* BTick — Backtesting suite (Backtests in the top bar).
   Sessions filtered by time, strategy, pair, timeframe and status. */

/* Backtesting is a whole-window suite, not a modal over the chart. */
.bs-overlay {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: stretch; justify-content: stretch;
  padding: 0; background: var(--bg, #f6f8fb);
}
.bs-shell {
  width: 100%; height: 100%; max-height: none;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg, #f6f8fb); color: var(--text, #101828);
  border: 0; border-radius: 0; box-shadow: none;
  font-size: 12px;
}
body.suite-open { overflow: hidden; }
body.suite-open .topbar,
body.suite-open .workspace { visibility: hidden; }
.bs-suite { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--bg2, #eef1f6); }
.bs-suite button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 6px;
  font-size: 11px; font-weight: 700; color: var(--muted, #667085); cursor: pointer;
}
.bs-suite button.on { background: var(--panel, #fff); color: var(--text, #101828); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); cursor: default; }
.bs-head {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; background: var(--panel, #fff);
  border-bottom: 1px solid var(--border, #dfe3ea);
}
.bs-head h2 { margin: 0; font-size: 15px; letter-spacing: 0.01em; }
.bs-sub { margin: 1px 0 0; font-size: 10.5px; color: var(--muted, #667085); }
.bs-spacer { flex: 1 1 auto; }
.bs-icon {
  width: 27px; height: 27px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border, #dfe3ea); border-radius: 6px;
  background: var(--panel, #fff); color: var(--muted, #667085); cursor: pointer; font-size: 13px;
}
.bs-icon:hover { color: var(--text, #101828); border-color: var(--accent, #6366f1); }

.bs-btn {
  height: 26px; padding: 0 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border, #dfe3ea); background: var(--panel, #fff);
  color: var(--text, #101828); font-size: 11px; font-weight: 600;
}
.bs-btn:hover { border-color: var(--accent, #6366f1); }
.bs-btn.primary { background: var(--accent, #6366f1); border-color: var(--accent, #6366f1); color: #fff; }
.bs-btn.ghost { color: var(--muted, #667085); }
.bs-btn.danger { color: #b42318; }
.bs-btn.xs { height: 21px; padding: 0 7px; font-size: 10px; }
.bs-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.bs-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px;
  padding: 9px 16px; background: var(--panel, #fff);
  border-bottom: 1px solid var(--border, #dfe3ea);
}
.bs-field { display: flex; flex-direction: column; gap: 2px; }
.bs-field label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #667085); }
.bs-field select, .bs-field input {
  height: 25px; min-width: 84px; padding: 0 6px;
  border: 1px solid var(--border, #dfe3ea); border-radius: 6px;
  background: var(--panel, #fff); color: var(--text, #101828); font-size: 11px;
}
.bs-field input.bs-search { min-width: 160px; }
.bs-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.bs-chips { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.bs-chip {
  font-size: 9.5px; padding: 2px 8px; border-radius: 9px;
  background: var(--accent-soft, rgba(99, 102, 241, 0.13)); color: var(--accent-dark, #4338ca);
}

.bs-body { flex: 1 1 auto; overflow: auto; padding: 14px 16px 22px; }
.bs-grid { display: grid; gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1180px) { .bs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bs-card {
  background: var(--panel, #fff); border: 1px solid var(--border, #dfe3ea);
  border-radius: 10px; padding: 10px 12px; min-width: 0;
}
.bs-kpi label { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #667085); }
.bs-kpi b { display: block; font-size: 17px; font-weight: 700; line-height: 1.35; }
.bs-kpi small { display: block; font-size: 9.5px; color: var(--muted, #667085); }
.bs-chart-card { margin-top: 10px; }
.bs-canvas { display: block; width: 100%; height: 204px; }
.bs-canvas.short { height: 96px; margin: 8px 0 4px; }

.bs-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bs-card-head h3 { margin: 0; font-size: 11.5px; letter-spacing: 0.01em; }
.bs-hint { font-size: 9.5px; color: var(--muted, #667085); }
.bs-h4 { margin: 12px 0 5px; font-size: 10.5px; }

.bs-split {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 10px; margin-top: 10px; align-items: start;
}
@media (max-width: 1180px) { .bs-split { grid-template-columns: minmax(0, 1fr); } }
.bs-table-wrap { overflow: auto; max-height: 430px; }
.bs-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.bs-table th {
  text-align: left; font-weight: 600; color: var(--muted, #667085);
  border-bottom: 1px solid var(--border, #dfe3ea); padding: 5px 5px; white-space: nowrap;
  position: sticky; top: 0; background: var(--panel, #fff);
}
.bs-table td { padding: 5px; border-bottom: 1px solid var(--border, #dfe3ea); vertical-align: top; }
.bs-table tr[data-bs-row] { cursor: pointer; }
.bs-table tr[data-bs-row]:hover td { background: var(--bg2, #eef1f6); }
.bs-table tr.sel td { background: var(--accent-soft, rgba(99, 102, 241, 0.12)); }
.bs-table td.num, .bs-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bs-table.compact td, .bs-table.compact th { padding: 3px 4px; font-size: 10px; }
.bs-table tr:last-child td { border-bottom: 0; }
.bs-none { text-align: center !important; color: var(--muted, #667085); padding: 18px 6px !important; }
.bs-link { border: 0; background: none; padding: 0; color: var(--accent, #6366f1); cursor: pointer; font-size: inherit; font-weight: 600; }
.bs-row-actions { white-space: nowrap; text-align: right; }
.bs-row-actions .bs-btn { margin-left: 3px; }

.bs-status { font-size: 8.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
.bs-status.live { background: rgba(8, 153, 129, 0.16); color: #067a67; }
.bs-status.paused { background: rgba(245, 158, 11, 0.18); color: #92400e; }
.bs-status.done { background: rgba(99, 102, 241, 0.16); color: #4338ca; }
.bs-status.running { background: rgba(8, 153, 129, 0.22); color: #067a67; }
body.dark .bs-status.paused { color: #fcd34d; }
body.dark .bs-status.done { color: #c7d2fe; }

.bs-detail-card { position: relative; }
.bs-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; margin: 4px 0 8px; }
.bs-detail-grid label { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted, #667085); }
.bs-detail-grid b { display: block; font-size: 11.5px; font-weight: 700; }
.bs-detail-grid small { display: block; font-size: 9.5px; color: var(--muted, #667085); }
.detail-actions { margin-left: 0; }

.bs-empty { padding: 46px 15px; text-align: center; color: var(--muted, #667085); font-size: 12px; }
.bs-empty b { color: var(--text, #101828); font-size: 13px; }
.bs-empty p { max-width: 520px; margin: 8px auto 14px; line-height: 1.6; }

.bs-modal-back {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 14, 24, 0.45);
}
.bs-modal {
  width: min(460px, 92vw); padding: 14px 16px;
  background: var(--panel, #fff); color: var(--text, #101828);
  border: 1px solid var(--border, #dfe3ea); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.bs-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.bs-form .bs-field:first-child, .bs-form .bs-field:nth-child(2) { grid-column: span 2; }
.bs-form input { height: 27px; width: 100%; padding: 0 7px; border: 1px solid var(--border, #dfe3ea); border-radius: 6px; background: var(--panel, #fff); color: var(--text, #101828); font-size: 11px; }
.bs-modal .bs-actions { margin-left: 0; justify-content: flex-end; margin-top: 10px; }

/* Time spent backtesting: today / week / month / all time + 14-day trend */
.bs-activity { margin-bottom: 10px; }
.bs-activity-grid { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .bs-activity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bs-activity-stat label { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #667085); }
.bs-activity-stat b { display: block; font-size: 17px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; }
.bs-activity-stat small { display: block; font-size: 9.5px; color: var(--muted, #667085); }
.bs-activity-foot { display: flex; align-items: flex-end; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border, #e6e9ef); }
.bs-days { display: flex; align-items: flex-end; gap: 3px; height: 46px; flex: 1; min-width: 0; }
.bs-day { flex: 1; min-width: 3px; max-width: 26px; border-radius: 2px 2px 0 0; background: var(--accent-soft, rgba(99, 102, 241, 0.35)); }
.bs-day:hover { background: var(--accent, #6366f1); }
