/* AlgoPuzzle builder backtest (Team BUILDER) - the Backtest panel inside index_1.html
   plus the header "Build | Backtest" switch, the "Backtest first?" link and the apply toast.

   Ported from the approved prototype (F:\algopuzzle-backtest-demo\web\styles.css).
   Self-contained on purpose: everything is scoped under .ap-bt (panel) or an
   .ap-bt-* class (header pieces), so nothing here can restyle the builder or its
   precompiled Tailwind classes. Tokens fall back to the prototype's values when the
   panel is not inside the shared assets/ui/tokens.css scope (.ap-ui) - the panel root carries .ap-ui, the header pieces and the toast use the fallbacks. */

/* ---------- tokens ---------- */
.ap-bt, .ap-bt-switch, .ap-bt-first, .ap-bt-toast, .ap-bt-hint {
  --bt-bg: var(--bg, #030712);
  --bt-surface: var(--surface, #0a101c);
  --bt-surface-2: var(--surface-2, #111827);
  --bt-border: var(--border, #1f2937);
  --bt-border-strong: var(--border-strong, #374151);
  --bt-text: var(--text, #f3f4f6);
  --bt-text-2: var(--text-2, #d1d5db);
  --bt-muted: var(--muted, #9ca3af);
  --bt-accent: var(--accent, #10b981);
  --bt-accent-hover: var(--accent-hover, #34d399);
  --bt-on-accent: var(--on-accent, #03140d);
  --bt-pos: var(--pos, #4cbf8a);
  --bt-neg: var(--neg, #ef6b6b);
  --bt-warn: var(--warn, #fbbf24);
  --bt-focus: var(--focus, #6ee7b7);
  --bt-font: var(--font, "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  --bt-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bt-fs-sm: 14px;
  --bt-fs: 16px;
  --bt-fs-lg: 18px;
  --bt-fs-h2: 20px;
  --bt-fs-h1: 28px;
  --bt-fs-num: 28px;
  --bt-lh: 1.6;
  --bt-lh-tight: 1.25;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --bt-radius: 8px;
  --bt-content: 1120px;
  --bt-column: 720px;
  --bt-gutter: 24px;
}

/* ---------- header: Build | Backtest switch ----------
   The page's primary mode control (owner, 2026-10-05: "definitely bigger and
   more visible"): 44 px tall, icon + label, the active mode filled emerald.
   Sits immediately left of the export buttons, set off by a divider. */
.ap-bt-switch {
  display: inline-grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; flex-shrink: 0;
  height: 44px; border-radius: 10px; background: #111827; border: 1px solid #374151;
  margin-right: 6px; position: relative;
}
.ap-bt-switch::after { /* divider between the mode switch and the exports */
  content: ""; position: absolute; right: -10px; top: 6px; bottom: 6px; width: 1px; background: #1f2937;
}
.ap-bt-switch button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; background: transparent; color: #d1d5db; cursor: pointer;
  font-size: 15px; font-weight: 600; line-height: 1; padding: 0 14px; border-radius: 7px; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.ap-bt-switch-icon { width: 18px; height: 18px; flex-shrink: 0; }
.ap-bt-switch button:hover:not([aria-checked="true"]) { background: #1f2937; color: #f9fafb; }
.ap-bt-switch button[aria-checked="true"] { background: var(--bt-accent); color: var(--bt-on-accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); cursor: default; }
.ap-bt-switch button:focus-visible, .ap-bt-first:focus-visible, .ap-bt-toast button:focus-visible, .ap-bt-hint button:focus-visible { outline: 2px solid var(--bt-focus); outline-offset: 2px; }
/* "Backtest first?" sits just under the export buttons, over the top edge of
   the canvas, so it costs the (already full) header row no width. */
.ap-bt-exports { position: relative; }
.ap-bt-first {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  background: rgba(3, 7, 18, .72); border: 0; border-radius: 4px; padding: 1px 4px; cursor: pointer; white-space: nowrap;
  font-family: inherit; font-size: 12px; font-weight: 500; line-height: 1.5; color: var(--bt-muted); text-decoration: underline; text-decoration-color: var(--bt-border-strong); text-underline-offset: 3px;
}
.ap-bt-first:hover { color: var(--bt-text); text-decoration-color: var(--bt-text); }
body.ap-bt-on .ap-bt-first { display: none; }
/* Room for the switch in one header row on 1280-1535 px screens: the
   self-explanatory New / Save / How to run? buttons go icon-only (their titles
   still name them, as on phones) and the "MVP" tag is dropped. */
@media (min-width: 640px) and (max-width: 1535px) {
  #openHowToRunBtn > span, #newStrategyBtn > span, #saveStrategyBtn > span { display: none; }
  #mvpBadge { display: none !important; }
  #statusMsg:empty { display: none; } /* an empty status line still costs a flex gap */
}
/* Phones: the mode switch fills the export row (left of the icon-only exports). */
@media (max-width: 639px) {
  .ap-bt-exports { flex: 1 1 100%; margin-left: 0 !important; padding-left: 0 !important; }
  .ap-bt-switch { flex: 1 1 auto; margin-right: 4px; }
  .ap-bt-switch::after { display: none; }
  .ap-bt-switch button { font-size: 14px; padding: 0 8px; gap: 6px; }
  .ap-bt-first { display: none; }
}

/* ---------- one-time "New" hint pointing at Backtest ---------- */
.ap-bt-hint {
  position: fixed; z-index: 75; width: 280px; max-width: calc(100vw - 24px);
  padding: 12px 36px 12px 14px; border-radius: 10px; border: 1px solid var(--bt-accent);
  background: #0b1220; color: var(--bt-text); box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  font: 400 14px/1.45 var(--bt-font);
}
.ap-bt-hint[hidden] { display: none; }
.ap-bt-hint::before { /* arrow up to the Backtest segment */
  content: ""; position: absolute; top: -7px; left: var(--ax, 40px); width: 12px; height: 12px; margin-left: -6px;
  background: #0b1220; border-left: 1px solid var(--bt-accent); border-top: 1px solid var(--bt-accent); transform: rotate(45deg);
}
.ap-bt-hint b { color: var(--bt-accent-hover); font-weight: 700; }
.ap-bt-hint .ap-bt-hint-try {
  margin-top: 8px; background: var(--bt-accent); color: var(--bt-on-accent); border: 0; border-radius: 6px;
  min-height: 32px; padding: 0 12px; font: 600 13px/1 var(--bt-font); cursor: pointer;
}
.ap-bt-hint .ap-bt-hint-x {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 6px;
  background: transparent; color: var(--bt-muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.ap-bt-hint .ap-bt-hint-x:hover { background: #1f2937; color: var(--bt-text); }

/* ---------- toast (shown in Build after "Apply to canvas") ---------- */
.ap-bt-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px; border: 1px solid var(--bt-border-strong); border-radius: var(--bt-radius);
  background: var(--bt-surface-2); color: var(--bt-text); font: 500 14px/1.4 var(--bt-font);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
}
.ap-bt-toast[hidden] { display: none; }
.ap-bt-toast button {
  background: transparent; border: 1px solid var(--bt-border-strong); color: var(--bt-text); border-radius: 6px;
  min-height: 32px; padding: 0 12px; font: 600 13px/1 var(--bt-font); cursor: pointer; white-space: nowrap;
}
.ap-bt-toast button:hover { background: var(--bt-bg); }

/* ---------- panel ---------- */
.ap-bt {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  background: var(--bt-bg); color: var(--bt-text-2);
  font-family: var(--bt-font); font-size: var(--bt-fs); line-height: var(--bt-lh);
  -webkit-font-smoothing: antialiased; color-scheme: dark; z-index: 5;
}
.ap-bt[hidden] { display: none !important; }
.ap-bt *, .ap-bt *::before, .ap-bt *::after { box-sizing: border-box; }
.ap-bt h1, .ap-bt h2, .ap-bt h3, .ap-bt h4, .ap-bt p, .ap-bt ul, .ap-bt dl, .ap-bt dd { margin: 0; }
.ap-bt button, .ap-bt input, .ap-bt select, .ap-bt textarea { font: inherit; color: inherit; font-feature-settings: inherit; }
.ap-bt strong { color: var(--bt-text); font-weight: 600; }
.ap-bt [hidden] { display: none !important; }
.ap-bt input, .ap-bt .bt-headline, .ap-bt .bt-trades, .ap-bt .bt-stats, .ap-bt .bt-pager, .ap-bt .bt-count, .ap-bt .bt-progress {
  font-feature-settings: "tnum" 1; font-variant-numeric: tabular-nums;
}
.ap-bt :focus-visible { outline: 2px solid var(--bt-focus); outline-offset: 2px; border-radius: 4px; }

.ap-bt .bt-wrap { max-width: calc(var(--bt-content) + 2 * var(--bt-gutter)); margin: 0 auto; padding: 0 var(--bt-gutter) var(--s7); }
.ap-bt .bt-muted { color: var(--bt-muted); }
.ap-bt .bt-small { font-size: var(--bt-fs-sm); }
.ap-bt .bt-err { color: var(--bt-neg); }
.ap-bt .bt-pos { color: var(--bt-pos); }
.ap-bt .bt-neg { color: var(--bt-neg); }
.ap-bt .bt-short { display: none; }
.ap-bt .bt-footnote { margin-top: var(--s7); padding-top: var(--s4); border-top: 1px solid var(--bt-border); font-size: var(--bt-fs-sm); color: var(--bt-muted); }

/* intro */
.ap-bt .bt-intro { max-width: var(--bt-column); padding: var(--s6) 0 var(--s5); }
.ap-bt.bt-has-result .bt-intro { padding-bottom: var(--s4); }
.ap-bt.bt-has-result .bt-lead, .ap-bt.bt-has-result .bt-intro-meta, .ap-bt.bt-has-result .bt-how { display: none !important; }
.ap-bt .bt-h1 { font-size: var(--bt-fs-h1); line-height: var(--bt-lh-tight); font-weight: 700; color: var(--bt-text); letter-spacing: -0.02em; }
.ap-bt .bt-lead { margin-top: var(--s3); font-size: var(--bt-fs-lg); color: var(--bt-text-2); }
.ap-bt .bt-intro-meta { margin-top: var(--s4); font-size: var(--bt-fs-sm); color: var(--bt-muted); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: baseline; }
.ap-bt .bt-how { margin-top: var(--s4); padding: var(--s4) var(--s5); border: 1px solid var(--bt-border); border-radius: var(--bt-radius); background: var(--bt-surface); font-size: var(--bt-fs-sm); }
.ap-bt .bt-how ul { padding-left: var(--s5); display: grid; gap: var(--s2); }

/* buttons & links */
.ap-bt .bt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5);
  border-radius: var(--bt-radius); border: 1px solid transparent;
  font-weight: 600; font-size: var(--bt-fs); cursor: pointer; white-space: nowrap;
}
.ap-bt .bt-btn-primary { background: var(--bt-accent); color: var(--bt-on-accent); }
.ap-bt .bt-btn-primary:hover:not(:disabled) { background: var(--bt-accent-hover); }
.ap-bt .bt-btn-primary:disabled { background: var(--bt-surface-2); color: var(--bt-muted); cursor: not-allowed; }
.ap-bt .bt-btn-secondary { background: transparent; border-color: var(--bt-border-strong); color: var(--bt-text); min-height: 40px; padding: 0 var(--s4); font-weight: 500; font-size: var(--bt-fs-sm); }
.ap-bt .bt-btn-secondary:hover:not(:disabled) { background: var(--bt-surface-2); }
.ap-bt .bt-btn-sm { min-height: 32px; padding: 0 var(--s3); font-size: var(--bt-fs-sm); }
.ap-bt .bt-btn-sm:disabled { opacity: .45; cursor: not-allowed; }
.ap-bt .bt-link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--bt-text); text-decoration: underline; text-decoration-color: var(--bt-border-strong); text-underline-offset: 3px; font-size: inherit; }
.ap-bt .bt-link:hover { text-decoration-color: var(--bt-text); }

/* setup */
.ap-bt .bt-setup { max-width: var(--bt-column); }
.ap-bt .bt-setup.is-collapsed { display: none; }
.ap-bt .bt-setup-form { display: grid; gap: var(--s5); }
.ap-bt .bt-form-step { display: grid; gap: var(--s3); scroll-margin-top: var(--s4); }
.ap-bt .bt-section-title { font-size: var(--bt-fs-h2); line-height: var(--bt-lh-tight); font-weight: 600; color: var(--bt-text); }
.ap-bt .bt-field { display: grid; gap: var(--s2); min-width: 0; }
.ap-bt .bt-label { font-size: var(--bt-fs-sm); font-weight: 500; color: var(--bt-text); }
.ap-bt .bt-help { font-size: var(--bt-fs-sm); color: var(--bt-muted); line-height: 1.5; }
.ap-bt .bt-help.bt-err { color: var(--bt-neg); }
.ap-bt .bt-label-note { margin-left: var(--s1); font-weight: 400; color: var(--bt-muted); }
.ap-bt select, .ap-bt input[type=number], .ap-bt input[type=date] {
  width: 100%; min-height: 44px;
  background: var(--bt-surface-2); border: 1px solid var(--bt-border-strong); border-radius: var(--bt-radius);
  color: var(--bt-text); padding: var(--s2) var(--s3);
}
.ap-bt select:focus, .ap-bt input:focus { outline: none; border-color: var(--bt-focus); }
.ap-bt select option { background: var(--bt-surface-2); color: var(--bt-text); }
.ap-bt input[type=number] { -moz-appearance: textfield; }
.ap-bt input::-webkit-outer-spin-button, .ap-bt input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ap-bt input[aria-invalid="true"] { border-color: var(--bt-neg); }
.ap-bt .bt-input-affix { display: flex; align-items: center; background: var(--bt-surface-2); border: 1px solid var(--bt-border-strong); border-radius: var(--bt-radius); }
.ap-bt .bt-input-affix:focus-within { border-color: var(--bt-focus); }
.ap-bt .bt-input-affix input { border: 0; background: transparent; min-width: 0; flex: 1; text-align: right; }
.ap-bt .bt-input-affix .bt-affix { color: var(--bt-muted); padding: 0 var(--s3); font-size: var(--bt-fs-sm); }
.ap-bt .bt-input-affix .bt-affix:first-child { padding-right: 0; }
.ap-bt .bt-input-affix .bt-affix:last-child { padding-left: 0; }
.ap-bt .bt-input-affix input:first-child { padding-right: var(--s2); }

.ap-bt .bt-summary { padding: var(--s4) var(--s5); border: 1px solid var(--bt-border); border-radius: var(--bt-radius); background: var(--bt-surface); }
.ap-bt .bt-summary-text { color: var(--bt-text); }
.ap-bt .bt-summary-meta { margin-top: var(--s2); font-size: var(--bt-fs-sm); color: var(--bt-muted); display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); justify-content: space-between; }

.ap-bt .bt-settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); align-items: start; }
.ap-bt .bt-settings .bt-field-period { grid-column: 1 / -1; }
.ap-bt .bt-field-narrow { max-width: 220px; }

.ap-bt .bt-seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--bt-border-strong); border-radius: var(--bt-radius); padding: 3px; gap: 3px; min-height: 44px; }
.ap-bt .bt-seg button { border: 0; background: transparent; border-radius: 5px; cursor: pointer; font-size: var(--bt-fs-sm); color: var(--bt-muted); padding: 0 var(--s2); white-space: nowrap; }
.ap-bt .bt-seg button[aria-checked="true"] { background: var(--bt-surface-2); color: var(--bt-text); font-weight: 500; box-shadow: inset 0 0 0 1px var(--bt-border-strong); }
.ap-bt .bt-seg button:disabled { opacity: .4; cursor: not-allowed; }
.ap-bt .bt-seg--period { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 520px; }
.ap-bt .bt-seg--sm { grid-template-columns: auto auto; min-height: 32px; padding: 2px; gap: 2px; }
.ap-bt .bt-seg--sm button { min-width: 36px; font-size: var(--bt-fs-sm); padding: 0 var(--s3); }
.ap-bt .bt-period-custom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s4); max-width: 520px; }
.ap-bt .bt-period-range { color: var(--bt-text-2); }
.ap-bt .bt-period-note { color: var(--bt-muted); }

.ap-bt .bt-more { border-top: 1px solid var(--bt-border); border-bottom: 1px solid var(--bt-border); }
.ap-bt .bt-more summary { cursor: pointer; padding: var(--s4) 0; font-size: var(--bt-fs-sm); font-weight: 500; color: var(--bt-text); list-style: none; display: flex; align-items: center; gap: var(--s2); }
.ap-bt .bt-more summary::-webkit-details-marker { display: none; }
.ap-bt .bt-more summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--bt-muted); border-bottom: 1.5px solid var(--bt-muted); transform: rotate(-45deg); transition: transform .15s; margin-right: var(--s1); }
.ap-bt .bt-more[open] summary::before { transform: rotate(45deg); }
.ap-bt .bt-more-body { display: grid; gap: var(--s5); padding: var(--s2) 0 var(--s5); }
.ap-bt .bt-row-actions { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); align-items: center; margin-top: var(--s1); }
.ap-bt .bt-run-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); }

/* steps */
.ap-bt .bt-steps { margin-bottom: var(--s5); }
.ap-bt .bt-steps ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.ap-bt .bt-steps li { display: flex; align-items: center; gap: var(--s2); }
.ap-bt .bt-steps li + li::before { content: ""; width: 24px; height: 1px; background: var(--bt-border-strong); }
.ap-bt .bt-step {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s2) 0 0;
  background: none; border: 0; cursor: pointer; color: var(--bt-muted); font-size: var(--bt-fs-sm); font-weight: 500; border-radius: 6px;
}
.ap-bt .bt-step-n {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--bt-border-strong); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.ap-bt .bt-step:hover:not(:disabled) .bt-step-l { color: var(--bt-text); text-decoration: underline; text-decoration-color: var(--bt-border-strong); text-underline-offset: 3px; }
.ap-bt .bt-step.is-done { color: var(--bt-text-2); }
.ap-bt .bt-step.is-current { color: var(--bt-text); font-weight: 600; cursor: default; }
.ap-bt .bt-step.is-current .bt-step-l { text-decoration: none !important; }
.ap-bt .bt-step.is-current .bt-step-n { background: var(--bt-text); border-color: var(--bt-text); color: var(--bt-bg); }
.ap-bt .bt-step:disabled { cursor: default; opacity: .7; }

/* loading */
.ap-bt .bt-progress { max-width: var(--bt-column); margin-top: var(--s6); }
.ap-bt .bt-progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); font-size: var(--bt-fs-sm); color: var(--bt-muted); }
.ap-bt .bt-bar { margin-top: var(--s2); height: 2px; background: var(--bt-border); border-radius: 2px; overflow: hidden; }
.ap-bt .bt-bar span { display: block; height: 100%; width: 0; background: var(--bt-text-2); transition: width .2s linear; }

/* notices */
.ap-bt .bt-results { margin-top: var(--s6); }
.ap-bt .bt-notice { max-width: var(--bt-column); padding: var(--s5); border: 1px solid var(--bt-border); border-radius: var(--bt-radius); background: var(--bt-surface); display: grid; gap: var(--s3); justify-items: start; }
.ap-bt .bt-notice-title { font-size: var(--bt-fs-lg); line-height: var(--bt-lh-tight); font-weight: 600; color: var(--bt-text); }
.ap-bt .bt-notice-warn { border-left: 3px solid var(--bt-warn); }
.ap-bt .bt-notice-error { border-left: 3px solid var(--bt-neg); }
.ap-bt .bt-plain-list { padding-left: var(--s5); display: grid; gap: var(--s2); }

/* result head + headline numbers */
.ap-bt .bt-res-head { display: grid; gap: var(--s2); scroll-margin-top: var(--s4); }
.ap-bt .bt-res-head-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s3) var(--s5); }
.ap-bt .bt-res-title { font-size: 24px; line-height: var(--bt-lh-tight); font-weight: 600; color: var(--bt-text); letter-spacing: -0.01em; }
.ap-bt .bt-res-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.ap-bt .bt-res-rule { max-width: 820px; color: var(--bt-text); font-size: var(--bt-fs-lg); line-height: 1.5; }
.ap-bt .bt-res-meta { font-size: var(--bt-fs-sm); color: var(--bt-muted); }
.ap-bt .bt-res-meta strong { font-weight: 500; color: var(--bt-text-2); }
.ap-bt .bt-res-tag { display: inline-block; vertical-align: middle; margin-left: var(--s2); padding: 0 8px; border: 1px solid var(--bt-border-strong); border-radius: 4px; font-size: 12px; line-height: 20px; font-weight: 500; color: var(--bt-muted); letter-spacing: 0; }

.ap-bt .bt-headline { margin-top: var(--s5); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--bt-border); border-radius: var(--bt-radius); background: var(--bt-surface); }
.ap-bt .bt-headline > div { padding: var(--s4) var(--s5); min-width: 0; }
.ap-bt .bt-headline > div + div { border-left: 1px solid var(--bt-border); }
.ap-bt .bt-headline dt { font-size: var(--bt-fs-sm); color: var(--bt-muted); }
.ap-bt .bt-headline dd { margin-top: var(--s1); font-size: var(--bt-fs-num); line-height: var(--bt-lh-tight); font-weight: 600; color: var(--bt-text); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-bt .bt-headline dd.bt-pos { color: var(--bt-pos); }
.ap-bt .bt-headline dd.bt-neg { color: var(--bt-neg); }
.ap-bt .bt-headline .bt-sub { white-space: normal; margin-top: var(--s1); font-size: var(--bt-fs-sm); color: var(--bt-muted); font-weight: 400; letter-spacing: 0; }
.ap-bt .bt-headline .bt-was { margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--bt-muted); letter-spacing: 0; white-space: normal; }

.ap-bt .bt-verdict { margin-top: var(--s6); max-width: var(--bt-column); color: var(--bt-text); font-size: var(--bt-fs-lg); line-height: 1.5; }
.ap-bt .bt-accuracy { margin-top: var(--s2); max-width: 820px; font-size: var(--bt-fs-sm); color: var(--bt-muted); }
.ap-bt .bt-callout { margin-top: var(--s3); max-width: 820px; font-size: var(--bt-fs-sm); color: var(--bt-text-2); padding-left: var(--s3); border-left: 2px solid var(--bt-warn); }

/* chart cards */
.ap-bt .bt-chart-card { margin-top: var(--s6); border: 1px solid var(--bt-border); border-radius: var(--bt-radius); background: var(--bt-surface); padding: var(--s4) var(--s4) var(--s3); }
.ap-bt .bt-chart-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s1) var(--s4); padding: 0 var(--s2) var(--s3); }
.ap-bt .bt-card-title { font-size: var(--bt-fs); font-weight: 600; color: var(--bt-text); }
.ap-bt .bt-chart-card--equity { margin-top: var(--s5); }
.ap-bt .bt-chart-card--equity .bt-card-title { font-size: var(--bt-fs-lg); }
.ap-bt .bt-chart-card--price { scroll-margin-top: var(--s4); }
.ap-bt .bt-iso-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-left: auto; }
.ap-bt .bt-iso-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--s3);
  border: 1px solid var(--bt-border-strong); border-radius: 999px; background: var(--bt-surface-2);
  font-size: var(--bt-fs-sm); color: var(--bt-text); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ap-bt .bt-iso-pill b { font-weight: 600; }
.ap-bt .bt-iso-pill--win { border-color: rgba(76, 191, 138, .55); background: rgba(76, 191, 138, .12); }
.ap-bt .bt-iso-pill--win b, .ap-bt .bt-iso-pill--win .bt-iso-why { color: var(--bt-pos); }
.ap-bt .bt-iso-pill--loss { border-color: rgba(239, 107, 107, .55); background: rgba(239, 107, 107, .12); }
.ap-bt .bt-iso-pill--loss b, .ap-bt .bt-iso-pill--loss .bt-iso-why { color: var(--bt-neg); }
.ap-bt .bt-iso-n { font-weight: 600; }
.ap-bt .bt-iso-dot { color: var(--bt-muted); }
.ap-bt .bt-iso-btns { display: inline-flex; gap: var(--s2); }
.ap-bt .bt-chart-hint, .ap-bt .bt-chart-key { padding: 0 var(--s2) var(--s3); font-size: var(--bt-fs-sm); color: var(--bt-muted); line-height: 1.5; }
.ap-bt .bt-chart-key { padding-bottom: var(--s1); display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); color: var(--bt-text-2); }
.ap-bt .bt-key-i { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ap-bt .bt-key-sym { font-size: 11px; line-height: 1; }
.ap-bt .bt-key-line { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.ap-bt .bt-key-zone { display: inline-block; width: 14px; height: 10px; border-radius: 1px; border-top: 2px solid transparent; }
.ap-bt .bt-key-note { color: var(--bt-muted); white-space: normal; }
.ap-bt .bt-chart-host { position: relative; width: 100%; min-width: 0; }
.ap-bt .bt-chart-host--price { height: 460px; }
.ap-bt .bt-chart-host--equity { height: 380px; }
.ap-bt .bt-chart-host.is-placeholder { height: 140px; }
.ap-bt .bt-chart-placeholder {
  height: 100%; display: grid; place-items: center; text-align: center; padding: var(--s5);
  border: 1px dashed var(--bt-border); border-radius: var(--bt-radius); color: var(--bt-muted); font-size: var(--bt-fs-sm);
}

/* tabs */
.ap-bt .bt-tabs { margin-top: var(--s7); display: flex; gap: var(--s5); border-bottom: 1px solid var(--bt-border); overflow-x: auto; }
.ap-bt .bt-tabs button {
  background: none; border: 0; cursor: pointer; padding: var(--s3) 0; margin-bottom: -1px;
  font-size: var(--bt-fs); font-weight: 500; color: var(--bt-muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.ap-bt .bt-tabs button:hover { color: var(--bt-text); }
.ap-bt .bt-tabs button[aria-selected="true"] { color: var(--bt-text); border-bottom-color: var(--bt-text); }
.ap-bt .bt-count { display: inline-block; min-width: 22px; margin-left: var(--s1); padding: 0 6px; border-radius: 10px; background: var(--bt-surface-2); font-size: 12px; line-height: 20px; text-align: center; color: var(--bt-muted); font-weight: 500; }
.ap-bt .bt-tab-panel { padding-top: var(--s5); }
.ap-bt .bt-panel-hint { margin-bottom: var(--s3); }

/* trades table */
.ap-bt .bt-table-scroll { overflow-x: auto; border: 1px solid var(--bt-border); border-radius: var(--bt-radius); background: var(--bt-surface); }
.ap-bt table.bt-trades { width: 100%; border-collapse: collapse; font-size: var(--bt-fs-sm); white-space: nowrap; }
.ap-bt .bt-trades th { text-align: left; font-weight: 500; color: var(--bt-muted); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--bt-border); background: var(--bt-surface); }
.ap-bt .bt-trades td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--bt-border); color: var(--bt-text-2); }
.ap-bt .bt-trades tbody tr:last-child td { border-bottom: 0; }
.ap-bt .bt-trades .bt-num { text-align: right; }
.ap-bt .bt-trades tbody tr { cursor: pointer; }
.ap-bt .bt-trades tbody tr:hover td { background: rgba(255,255,255,.025); }
.ap-bt .bt-trades tbody tr.is-active td { background: var(--bt-surface-2); color: var(--bt-text); }
.ap-bt .bt-trades tbody tr.out-win td:first-child { box-shadow: inset 2px 0 0 var(--bt-pos); }
.ap-bt .bt-trades tbody tr.out-loss td:first-child { box-shadow: inset 2px 0 0 var(--bt-neg); }
.ap-bt .bt-trades tbody tr.is-active td:first-child { box-shadow: inset 4px 0 0 var(--bt-text-2); }
.ap-bt .bt-trades tbody tr.is-active.out-win td:first-child { box-shadow: inset 4px 0 0 var(--bt-pos); }
.ap-bt .bt-trades tbody tr.is-active.out-loss td:first-child { box-shadow: inset 4px 0 0 var(--bt-neg); }
.ap-bt .bt-reason { display: inline-block; padding: 0 8px; border-radius: 4px; font-size: 12px; line-height: 20px; font-weight: 500; color: var(--bt-muted); background: rgba(156, 163, 175, .12); }
.ap-bt .bt-reason-tp { color: var(--bt-pos); background: rgba(76, 191, 138, .12); }
.ap-bt .bt-reason-sl { color: var(--bt-neg); background: rgba(239, 107, 107, .12); }
.ap-bt .bt-trades .bt-idx { color: var(--bt-muted); }
.ap-bt .bt-trades tbody tr td.bt-pos { color: var(--bt-pos); }
.ap-bt .bt-trades tbody tr td.bt-neg { color: var(--bt-neg); }
.ap-bt .bt-trades .bt-empty-trades { text-align: center; color: var(--bt-muted); padding: var(--s6) var(--s4); white-space: normal; cursor: default; }
.ap-bt .bt-pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s3); margin-top: var(--s3); font-size: var(--bt-fs-sm); color: var(--bt-muted); }
.ap-bt .bt-pager-btns { display: flex; gap: var(--s2); }
.ap-bt .bt-pager button { min-height: 36px; }
.ap-bt .bt-pager button:disabled { opacity: .4; cursor: not-allowed; }

/* details */
.ap-bt .bt-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--s6); }
.ap-bt .bt-stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); padding: var(--s3) 0; border-bottom: 1px solid var(--bt-border); min-width: 0; }
.ap-bt .bt-stats dt { color: var(--bt-muted); font-size: var(--bt-fs-sm); }
.ap-bt .bt-stats dd { color: var(--bt-text); font-size: var(--bt-fs-sm); font-weight: 500; text-align: right; }
.ap-bt .bt-stats dd.bt-pos { color: var(--bt-pos); }
.ap-bt .bt-stats dd.bt-neg { color: var(--bt-neg); }
.ap-bt .bt-stats--compact { grid-template-columns: 1fr; max-width: var(--bt-column); }
.ap-bt .bt-stats--compact dd { font-weight: 400; color: var(--bt-text-2); overflow-wrap: anywhere; }
.ap-bt .bt-details-block { margin-top: var(--s6); display: grid; gap: var(--s3); max-width: 820px; }
.ap-bt .bt-details-block .bt-plain-list { font-size: var(--bt-fs-sm); }

/* adjust strategy */
.ap-bt .bt-adjust { margin-top: var(--s4); }
.ap-bt .bt-adjust-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); }
.ap-bt .bt-adjust-compare { font-size: var(--bt-fs-sm); color: var(--bt-muted); font-variant-numeric: tabular-nums; }
.ap-bt .bt-adjust-compare b { font-weight: 600; color: var(--bt-text); }
.ap-bt .bt-adjust-compare b.bt-pos { color: var(--bt-pos); }
.ap-bt .bt-adjust-compare b.bt-neg { color: var(--bt-neg); }
.ap-bt .bt-adjust-status { font-size: var(--bt-fs-sm); color: var(--bt-muted); }
.ap-bt .bt-adjust-status.is-err { color: var(--bt-neg); }
.ap-bt .bt-adjust-panel { margin-top: var(--s3); padding: var(--s4) var(--s5); border: 1px solid var(--bt-border); border-radius: var(--bt-radius); background: var(--bt-surface); display: grid; gap: var(--s3); }
.ap-bt .bt-adjust-lead { font-size: var(--bt-fs-sm); color: var(--bt-muted); }
.ap-bt .bt-ed-rule + .bt-ed-rule { margin-top: var(--s3); }
.ap-bt .bt-ed-rule-h { font-size: var(--bt-fs-sm); font-weight: 600; color: var(--bt-text); padding-top: var(--s2); }
.ap-bt .bt-ed-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: var(--s3); align-items: start; padding: var(--s2) 0; border-top: 1px solid var(--bt-border); }
.ap-bt .bt-ed-rule .bt-ed-row:first-of-type { border-top: 0; }
.ap-bt .bt-ed-label { font-size: var(--bt-fs-sm); color: var(--bt-muted); padding-top: 8px; }
.ap-bt .bt-ed-ctrl { display: grid; gap: var(--s1); min-width: 0; }
.ap-bt .bt-ed-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-width: 0; }
.ap-bt .bt-ed-group { display: inline-flex; align-items: center; gap: 3px; }
.ap-bt .bt-ed-t { font-size: 15px; color: var(--bt-text-2); }
.ap-bt .bt-ed-fixed { color: var(--bt-text); }
.ap-bt .bt-ed-muted { color: var(--bt-muted); }
.ap-bt .bt-ed-p { font-size: 15px; color: var(--bt-muted); }
.ap-bt .bt-ed-join { font-size: 12px; color: var(--bt-muted); padding-left: 2px; }
.ap-bt .bt-adjust-panel input.bt-ed-num { width: 76px; min-height: 36px; padding: 4px 8px; font-size: 15px; text-align: right; }
.ap-bt .bt-adjust-panel select.bt-ed-sel { width: auto; max-width: 100%; min-height: 36px; padding: 4px 8px; font-size: 15px; cursor: pointer; }
.ap-bt .bt-seg--dir { display: inline-grid; grid-template-columns: auto auto; }
.ap-bt .bt-seg--dir button { min-width: 52px; }
.ap-bt .bt-seg--syms { display: inline-grid; grid-auto-flow: column; margin-left: auto; }
.ap-bt .bt-seg--syms[hidden] { display: none; }
.ap-bt .bt-seg--syms button { min-width: 64px; }
.ap-bt .bt-adjust-foot { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); padding-top: var(--s1); }
.ap-bt #bt-stateDone .bt-headline, .ap-bt #bt-stateDone .bt-chart-card, .ap-bt #bt-stateDone .bt-verdict { transition: opacity .2s; }
.ap-bt #bt-stateDone.is-updating .bt-headline, .ap-bt #bt-stateDone.is-updating .bt-chart-card, .ap-bt #bt-stateDone.is-updating .bt-verdict { opacity: .55; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .ap-bt .bt-headline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-bt .bt-headline > div:nth-child(3) { border-left: 0; }
  .ap-bt .bt-headline > div:nth-child(n+3) { border-top: 1px solid var(--bt-border); }
  .ap-bt .bt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .ap-bt .bt-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
  .ap-bt .bt-stats { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .ap-bt { --bt-gutter: 16px; --bt-fs-h1: 22px; --bt-fs-num: 22px; }
  .ap-bt .bt-intro { padding: var(--s4) 0; }
  .ap-bt .bt-lead { font-size: var(--bt-fs-sm); margin-top: var(--s2); }
  .ap-bt .bt-intro-meta { margin-top: var(--s2); }
  .ap-bt .bt-modenote { display: none; }
  .ap-bt .bt-help-long { display: none; }
  .ap-bt .bt-long { display: none; }
  .ap-bt .bt-short { display: inline; }
  .ap-bt .bt-steps { margin-bottom: var(--s4); }
  .ap-bt .bt-steps li + li::before { width: 12px; }
  .ap-bt .bt-form-step { gap: var(--s2); }
  .ap-bt .bt-setup-form { gap: var(--s4); }
  .ap-bt .bt-summary { padding: var(--s3) var(--s4); }
  .ap-bt .bt-summary-text { font-size: 15px; line-height: 1.5; }
  .ap-bt .bt-res-title { font-size: 20px; }
  .ap-bt .bt-res-rule { font-size: var(--bt-fs); }
  .ap-bt .bt-res-head-top { display: contents; }
  .ap-bt .bt-res-actions { width: 100%; order: 5; margin-top: var(--s1); }
  .ap-bt .bt-res-actions .bt-btn { flex: 1; }
  .ap-bt .bt-chart-card--equity .bt-card-title { font-size: var(--bt-fs); }
  .ap-bt .bt-chart-card-head { flex-wrap: nowrap; }
  .ap-bt #bt-priceMeta { display: none; }
  .ap-bt .bt-chart-card-head--price { flex-wrap: wrap; }
  .ap-bt .bt-iso-bar { flex: 1 1 100%; margin-left: 0; gap: var(--s2); }
  .ap-bt .bt-iso-pill { width: 100%; justify-content: center; white-space: normal; flex-wrap: wrap; padding: var(--s1) var(--s3); }
  .ap-bt .bt-iso-btns { width: 100%; }
  .ap-bt .bt-iso-btns .bt-btn { flex: 1 1 auto; min-height: 40px; padding: 0 var(--s2); }
  .ap-bt .bt-iso-btns .bt-btn-primary { flex-grow: 2; }
  .ap-bt .bt-chart-hint, .ap-bt .bt-chart-key { padding-left: var(--s1); padding-right: var(--s1); }
  .ap-bt .bt-headline > div { padding: var(--s3) var(--s4); }
  .ap-bt .bt-chart-card { padding: var(--s3) var(--s2) var(--s2); }
  .ap-bt .bt-chart-host--price { height: 360px; }
  .ap-bt .bt-chart-host--equity { height: 340px; }
  .ap-bt .bt-col-price, .ap-bt .bt-col-opt, .ap-bt .bt-col-lots { display: none; }
  .ap-bt .bt-trades th, .ap-bt .bt-trades td { padding: var(--s3) var(--s2); }
  .ap-bt .bt-trades th:first-child, .ap-bt .bt-trades td:first-child { padding-left: var(--s3); }
  .ap-bt .bt-trades th:last-child, .ap-bt .bt-trades td:last-child { padding-right: var(--s3); }
  .ap-bt .bt-run-row .bt-btn-primary { width: 100%; }
  .ap-bt .bt-tabs { gap: var(--s4); }
  .ap-bt .bt-field-narrow { max-width: none; }
  .ap-bt .bt-seg--period button { padding: 0 2px; }
  .ap-bt .bt-adjust-bar .bt-btn { width: 100%; }
  .ap-bt .bt-adjust-panel { padding: var(--s3); }
  .ap-bt .bt-adjust-panel input.bt-ed-num, .ap-bt .bt-adjust-panel select.bt-ed-sel { font-size: 16px; }
  .ap-bt .bt-ed-row { grid-template-columns: 1fr; gap: var(--s1); }
  .ap-bt .bt-ed-label { padding-top: 0; }
  .ap-bt .bt-adjust-foot .bt-btn { flex: 1 1 auto; min-height: 40px; }
}

/* ---------- Monte Carlo tab + balance-chart shortcut (2026-10-17) ---------- */
.ap-bt .bt-warn { color: var(--bt-warn); }
.ap-bt .bt-linkbtn { border: 0; background: none; padding: 0; color: var(--bt-accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ap-bt .bt-linkbtn:hover { color: var(--bt-accent-hover); }

/* shortcut under the balance chart */
.ap-bt .bt-mc-line { margin: var(--s3) var(--s2) var(--s1); padding-top: var(--s3); border-top: 1px solid var(--bt-border); font-size: var(--bt-fs-sm); color: var(--bt-text-2); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); }
.ap-bt .bt-mc-line[hidden] { display: none; }
.ap-bt .bt-mc-line p { flex: 1 1 320px; }
.ap-bt .bt-mc-line strong { color: var(--bt-text); }
.ap-bt .bt-mc-switch { order: 2; display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; color: var(--bt-text); min-height: 36px; white-space: nowrap; }
.ap-bt .bt-mc-switch input { width: 18px; height: 18px; margin: 0; accent-color: var(--bt-accent); }

/* tab */
.ap-bt .bt-mc { display: grid; gap: var(--s5); }
.ap-bt .bt-mc[hidden] { display: none; }
.ap-bt .bt-mc-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3) var(--s5); }
.ap-bt .bt-mc-lead { color: var(--bt-muted); font-size: var(--bt-fs-sm); }
.ap-bt .bt-mc-lead strong { color: var(--bt-text-2); font-weight: 600; }
.ap-bt .bt-mc-opts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); }
.ap-bt .bt-mc-method { min-height: 36px; }
.ap-bt .bt-mc-method button { padding: 0 var(--s3); }
.ap-bt .bt-mc-mini { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--bt-fs-sm); color: var(--bt-muted); }
.ap-bt .bt-mc-mini select {
  min-height: 36px; padding: 0 var(--s2); background: var(--bt-surface-2); color: var(--bt-text);
  border: 1px solid var(--bt-border-strong); border-radius: 6px; font: inherit; font-size: var(--bt-fs-sm);
}
.ap-bt .bt-mc-mini select:focus-visible { outline: 2px solid var(--bt-focus); outline-offset: 1px; }

.ap-bt .bt-mc-verdict { max-width: 820px; padding: var(--s3) var(--s4); border-left: 3px solid var(--bt-accent); background: var(--bt-surface); border-radius: 0 var(--bt-radius) var(--bt-radius) 0; color: var(--bt-text-2); font-size: var(--bt-fs); line-height: 1.55; }
.ap-bt .bt-mc-verdict.is-warn { border-left-color: var(--bt-warn); }
.ap-bt .bt-mc-verdict b { color: var(--bt-text); font-weight: 600; }

.ap-bt .bt-mc-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--bt-border); border-radius: var(--bt-radius); background: var(--bt-surface); }
.ap-bt .bt-mc-tiles > div { padding: var(--s3) var(--s4); min-width: 0; }
.ap-bt .bt-mc-tiles > div + div { border-left: 1px solid var(--bt-border); }
.ap-bt .bt-mc-tiles dt { font-size: 13px; color: var(--bt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-bt .bt-mc-tiles dd { margin-top: 2px; font-size: 22px; line-height: var(--bt-lh-tight); font-weight: 600; color: var(--bt-text); font-variant-numeric: tabular-nums; }
.ap-bt .bt-mc-tiles dd.bt-pos { color: var(--bt-pos); }
.ap-bt .bt-mc-tiles dd.bt-neg { color: var(--bt-neg); }
.ap-bt .bt-mc-tiles dd.bt-warn { color: var(--bt-warn); }
.ap-bt .bt-mc-tiles dd.bt-mc-sub { margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--bt-muted); }

.ap-bt .bt-mc-card { margin-top: 0; }
.ap-bt .bt-mc-legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); font-size: 13px; color: var(--bt-muted); }
.ap-bt .bt-mc-legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.ap-bt .bt-mc-k90 { background: rgba(16, 185, 129, .16); }
.ap-bt .bt-mc-k50 { background: rgba(16, 185, 129, .36); }
.ap-bt .bt-mc-legend i.bt-mc-kmed { height: 2px; vertical-align: 3px; background: var(--bt-focus); }
.ap-bt .bt-mc-legend i.bt-mc-kact { height: 2px; vertical-align: 3px; background: var(--bt-text); }
.ap-bt .bt-mc-chart { padding: 0 var(--s1); }
.ap-bt .bt-mc-svg { width: 100%; height: auto; display: block; }
.ap-bt .bt-mc-axis-note { text-align: right; font-size: 12px; color: var(--bt-muted); padding: 0 var(--s1); }
.ap-bt .bt-mc-ax { fill: var(--bt-muted); font-size: 12px; font-family: var(--bt-font); font-variant-numeric: tabular-nums; }
.ap-bt .bt-mc-grid { stroke: var(--bt-border); }
.ap-bt .bt-mc-start { stroke: var(--bt-border-strong); stroke-dasharray: 4 4; }
.ap-bt .bt-mc-b90 { fill: rgba(16, 185, 129, .12); }
.ap-bt .bt-mc-b50 { fill: rgba(16, 185, 129, .24); }
.ap-bt .bt-mc-med { fill: none; stroke: var(--bt-focus); stroke-width: 1.5; stroke-linejoin: round; opacity: .85; }
.ap-bt .bt-mc-act { fill: none; stroke: var(--bt-text); stroke-width: 1.75; stroke-linejoin: round; }

@media (max-width: 760px) {
  .ap-bt .bt-mc-mini select { font-size: 16px; }
  .ap-bt .bt-mc-tiles { grid-template-columns: 1fr 1fr; }
  .ap-bt .bt-mc-tiles > div:nth-child(3) { border-left: 0; }
  .ap-bt .bt-mc-tiles > div:nth-child(n+3) { border-top: 1px solid var(--bt-border); }
  .ap-bt .bt-mc-tiles dd { font-size: 20px; }
  .ap-bt .bt-mc-verdict { font-size: var(--bt-fs-sm); }
  .ap-bt .bt-chart-card-head .bt-mc-legend { width: 100%; }
}
.ap-bt .bt-tabs { overflow-y: hidden; }
.ap-bt .bt-tabs .ap-new-badge { vertical-align: 1px; }
.ap-bt .bt-mc-card .bt-chart-card-head { flex-wrap: wrap; }
.ap-bt .bt-mc-mini { white-space: nowrap; }
.ap-bt .bt-mc-note { font-size: 13px; color: var(--bt-muted); }

/* Monte Carlo chart: interactive (2026-10-17) */
.ap-bt .bt-mc-chart { position: relative; padding: 0; touch-action: pan-y; }
.ap-bt .bt-mc-chart-ctl { display: flex; align-items: center; gap: var(--s4); }
.ap-bt .bt-mc-chart-ctl .bt-mc-switch { font-size: var(--bt-fs-sm); color: var(--bt-text-2); min-height: 32px; }
.ap-bt .bt-mc-chart-ctl .bt-seg { min-height: 34px; }
.ap-bt .bt-mc-legend--chart { padding: 0 var(--s2) var(--s3); }
.ap-bt .bt-mc-hint-hover { margin-left: auto; font-size: 12px; color: var(--bt-muted); }
.ap-bt .bt-mc-g-top { stop-color: #10b981; stop-opacity: .20; }
.ap-bt .bt-mc-g-bot { stop-color: #10b981; stop-opacity: .08; }
.ap-bt .bt-mc-b90 { fill: url(#bt-mc-g90); }
.ap-bt .bt-mc-b50 { fill: rgba(16, 185, 129, .22); }
.ap-bt .bt-mc-sample { fill: none; stroke: var(--bt-text-2); stroke-width: 1; opacity: .16; }
.ap-bt .bt-mc-med { stroke-width: 2; opacity: 1; }
.ap-bt .bt-mc-act { stroke-width: 2; }
.ap-bt .bt-mc-ax-unit { font-size: 11px; }
.ap-bt .bt-mc-badge-band rect { fill: var(--bt-surface-2); stroke: var(--bt-border-strong); }
.ap-bt .bt-mc-badge-band text { fill: var(--bt-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ap-bt .bt-mc-badge-med rect { fill: var(--bt-focus); }
.ap-bt .bt-mc-badge-med text { fill: #03140d; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ap-bt .bt-mc-badge-act rect { fill: var(--bt-text); }
.ap-bt .bt-mc-badge-act text { fill: #0b0e13; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ap-bt .bt-mc-hit { fill: transparent; cursor: crosshair; }
.ap-bt .bt-mc-cross { stroke: var(--bt-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.ap-bt .bt-mc-dot-med { fill: var(--bt-focus); stroke: var(--bt-surface); stroke-width: 2; }
.ap-bt .bt-mc-dot-act { fill: var(--bt-text); stroke: var(--bt-surface); stroke-width: 2; }
.ap-bt .bt-mc-tip { position: absolute; z-index: 2; pointer-events: none; min-width: 210px; padding: var(--s2) var(--s3); background: var(--bt-surface-2); border: 1px solid var(--bt-border-strong); border-radius: var(--bt-radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .45); font-size: 12px; color: var(--bt-text-2); display: grid; gap: 4px; }
.ap-bt .bt-mc-tip[hidden] { display: none; }
.ap-bt .bt-mc-tip-h { font-weight: 600; color: var(--bt-text); font-size: 13px; margin-bottom: 2px; }
.ap-bt .bt-mc-tip-r { display: flex; justify-content: space-between; gap: var(--s4); }
.ap-bt .bt-mc-tip-r i { display: inline-block; width: 10px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.ap-bt .bt-mc-tip-r i.bt-mc-kact, .ap-bt .bt-mc-tip-r i.bt-mc-kmed { height: 2px; vertical-align: 3px; }
.ap-bt .bt-mc-tip-r b { color: var(--bt-text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 760px) {
  .ap-bt .bt-mc-hint-hover { display: none; }
  .ap-bt .bt-mc-card .bt-card-title { width: 100%; }
}
.ap-bt .bt-mc-tip-r i.bt-mc-kmed { background: var(--bt-focus); }
.ap-bt .bt-mc-tip-r i.bt-mc-kact { background: var(--bt-text); }

/* Monte Carlo statistics table (2026-10-17) */
.ap-bt .bt-mc-table-wrap { overflow-x: auto; margin: 0 var(--s2); border: 1px solid var(--bt-border); border-radius: var(--bt-radius); }
.ap-bt .bt-mc-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--bt-fs-sm); font-variant-numeric: tabular-nums; }
.ap-bt .bt-mc-table th, .ap-bt .bt-mc-table td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--bt-border); }
.ap-bt .bt-mc-table tbody tr:last-child th, .ap-bt .bt-mc-table tbody tr:last-child td { border-bottom: 0; }
.ap-bt .bt-mc-table thead th { font-size: 12px; font-weight: 500; color: var(--bt-muted); background: var(--bt-surface-2); }
.ap-bt .bt-mc-table th[scope="row"], .ap-bt .bt-mc-table thead th:first-child { text-align: left; position: sticky; left: 0; z-index: 1; }
.ap-bt .bt-mc-table th[scope="row"] { background: var(--bt-surface); color: var(--bt-text); font-weight: 500; border-right: 1px solid var(--bt-border); }
.ap-bt .bt-mc-table thead th:first-child { border-right: 1px solid var(--bt-border); }
.ap-bt .bt-mc-dir { display: block; font-size: 11px; font-weight: 400; color: var(--bt-muted); }
.ap-bt .bt-mc-table td { color: var(--bt-text-2); }
.ap-bt .bt-mc-table .bt-mc-col-bt { color: var(--bt-text); font-weight: 600; border-right: 1px solid var(--bt-border); }
.ap-bt .bt-mc-table thead .bt-mc-col-bt { color: var(--bt-text); }
.ap-bt .bt-mc-table .bt-mc-col-med { background: rgba(16, 185, 129, .07); color: var(--bt-text); font-weight: 600; }
.ap-bt .bt-mc-table thead .bt-mc-col-med { color: var(--bt-focus); background: rgba(16, 185, 129, .12); }
.ap-bt .bt-mc-table tbody tr:hover td, .ap-bt .bt-mc-table tbody tr:hover th { background-color: rgba(255, 255, 255, .03); }
.ap-bt .bt-mc-table-note { padding: var(--s3) var(--s2) var(--s1); max-width: 860px; }
.ap-bt .bt-mc > * { min-width: 0; }
