/* Backtest Lab (public/btlab.js) - uses the Pulse theme tokens */
/* "Backtest this scan" bar shown above each scan screen */
.bt-jump { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin: 0 0 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); font-size: 13px; color: var(--foreground); }
.bt-jump-ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); flex: none; }
.bt-jump-txt { flex: 1 1 260px; color: var(--muted-foreground); }
.bt-jump-txt b { color: var(--foreground); font-weight: 600; }
.bt-jump select { height: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--background); color: var(--foreground); padding: 0 8px; font-size: 12.5px; max-width: 260px; }
.bt-jump button { height: 32px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--foreground); color: var(--background); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.bt-jump button:hover { opacity: .88; }
#tab-btlab-view { --bt-up: var(--bullish, #15803D); --bt-dn: var(--bearish, #DC2626); --bt-mu: var(--muted-foreground); --bt-bd: var(--border); --bt-card: var(--card); --bt-ac: var(--primary); color: var(--foreground); }
#tab-btlab-view .bt-up { color: var(--bt-up); }
#tab-btlab-view .bt-dn { color: var(--bt-dn); }
#tab-btlab-view .bt-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
#tab-btlab-view .bt-eyebrow { font: 600 11px/1 'Geist Mono', ui-monospace, monospace; letter-spacing: .08em; color: var(--bt-mu); margin-bottom: 8px; }
#tab-btlab-view .bt-title { font: 400 30px/1.15 'Instrument Serif', Georgia, serif; margin: 0 0 6px; letter-spacing: -.01em; }
#tab-btlab-view .bt-sub { max-width: 720px; font-size: 13.5px; line-height: 1.55; color: var(--bt-mu); margin: 0; }
#tab-btlab-view .bt-data { min-width: 260px; padding: 12px 14px; border: 1px solid var(--bt-bd); border-radius: 14px; background: var(--bt-card); font-size: 12.5px; }
#tab-btlab-view .bt-data-main { font-family: 'Geist Mono', ui-monospace, monospace; }
#tab-btlab-view .bt-data-sub { color: var(--bt-mu); margin: 4px 0 6px; font-size: 11.5px; }
#tab-btlab-view .bt-prog { height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--bt-ac) 14%, transparent); overflow: hidden; margin-bottom: 6px; }
#tab-btlab-view .bt-prog span { display: block; height: 100%; background: var(--bt-ac); transition: width .4s; }

#tab-btlab-view .bt-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { #tab-btlab-view .bt-grid { grid-template-columns: 1fr; } }
#tab-btlab-view .bt-panel { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; border: 1px solid var(--bt-bd); border-radius: 18px; background: var(--bt-card); padding: 6px 16px 16px; scrollbar-width: thin; }
@media (max-width: 1100px) { #tab-btlab-view .bt-panel { position: static; max-height: none; } }
#tab-btlab-view .bt-panel section { padding: 12px 0; border-bottom: 1px solid var(--bt-bd); }
#tab-btlab-view .bt-panel h4 { font: 600 11px/1 'Geist Mono', ui-monospace, monospace; letter-spacing: .07em; text-transform: uppercase; color: var(--bt-mu); margin: 4px 0 10px; }
#tab-btlab-view .bt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; font-size: 13px; }
#tab-btlab-view .bt-row.bt-full .bt-ctl, #tab-btlab-view .bt-row.bt-full select { width: 100%; }
#tab-btlab-view .bt-lbl { display: flex; flex-direction: column; line-height: 1.25; }
#tab-btlab-view .bt-lbl em { font-style: normal; font-size: 10.5px; color: var(--bt-mu); }
#tab-btlab-view .bt-ctl { display: flex; align-items: center; gap: 6px; }
#tab-btlab-view .bt-ctl i { font-style: normal; font-size: 11px; color: var(--bt-mu); white-space: nowrap; }
#tab-btlab-view select, #tab-btlab-view input[type=number], #tab-btlab-view input[type=date] {
  height: 30px; border: 1px solid var(--bt-bd); border-radius: 8px; background: var(--background); color: var(--foreground); font: 13px 'Geist Mono', ui-monospace, monospace; padding: 0 8px; }
#tab-btlab-view input[type=number] { width: 88px; text-align: right; }
#tab-btlab-view select { max-width: 200px; }
#tab-btlab-view #btScan { max-width: none; width: 100%; font-family: inherit; font-weight: 500; }
#tab-btlab-view .bt-doc { font-size: 11.5px; line-height: 1.5; color: var(--bt-mu); margin: 6px 0 8px; }
#tab-btlab-view [data-when].bt-off { display: none; }
#tab-btlab-view .bt-exit { border: 1px solid var(--bt-bd); border-radius: 12px; padding: 2px 10px; margin-bottom: 8px; }
#tab-btlab-view .bt-exit b { font-weight: 600; }
#tab-btlab-view .bt-switch { position: relative; width: 34px; height: 20px; flex: none; cursor: pointer; }
#tab-btlab-view .bt-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
#tab-btlab-view .bt-switch span { position: absolute; inset: 0; border-radius: 20px; background: color-mix(in srgb, var(--foreground) 16%, transparent); transition: .2s; }
#tab-btlab-view .bt-switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
#tab-btlab-view .bt-switch input:checked + span { background: var(--bt-ac); }
#tab-btlab-view .bt-switch input:checked + span::after { transform: translateX(14px); }
#tab-btlab-view .bt-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
#tab-btlab-view .bt-presets button, #tab-btlab-view .bt-tabs button { border: 1px solid var(--bt-bd); background: transparent; color: var(--foreground); border-radius: 999px; padding: 4px 10px; font-size: 11.5px; cursor: pointer; }
#tab-btlab-view .bt-presets button:hover, #tab-btlab-view .bt-tabs button:hover { border-color: var(--bt-ac); color: var(--bt-ac); }
#tab-btlab-view .bt-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
#tab-btlab-view .bt-tabs button.on { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
#tab-btlab-view .bt-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
#tab-btlab-view .bt-go { height: 40px; border-radius: 999px; border: 0; background: var(--foreground); color: var(--background); font-weight: 600; cursor: pointer; }
#tab-btlab-view .bt-ghost { height: 36px; border-radius: 999px; border: 1px solid var(--bt-bd); background: transparent; color: var(--foreground); cursor: pointer; font-weight: 500; }
#tab-btlab-view .bt-go:disabled, #tab-btlab-view .bt-ghost:disabled { opacity: .5; cursor: wait; }
#tab-btlab-view .bt-link { border: 0; background: none; color: var(--bt-ac); font-size: 12px; cursor: pointer; padding: 0; }
#tab-btlab-view .bt-link:disabled { color: var(--bt-mu); cursor: default; }

#tab-btlab-view .bt-main { min-width: 0; }
#tab-btlab-view .bt-empty { border: 1px dashed var(--bt-bd); border-radius: 18px; padding: 60px 24px; text-align: center; color: var(--bt-mu); font-size: 14px; }
#tab-btlab-view .bt-empty-ico { font-size: 28px; margin-bottom: 8px; color: var(--bt-ac); }
#tab-btlab-view .bt-busy { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px solid var(--bt-bd); border-radius: 14px; background: var(--bt-card); margin-bottom: 14px; font-size: 13px; }
#tab-btlab-view .bt-busy[hidden], #tab-btlab-view .bt-empty[hidden] { display: none; }
#tab-btlab-view .bt-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--bt-ac) 25%, transparent); border-top-color: var(--bt-ac); animation: btspin .8s linear infinite; }
@keyframes btspin { to { transform: rotate(360deg); } }
#tab-btlab-view .bt-err { padding: 14px 16px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--bt-dn) 40%, transparent); color: var(--bt-dn); font-size: 13px; }

#tab-btlab-view .bt-card { border: 1px solid var(--bt-bd); border-radius: 18px; background: var(--bt-card); padding: 16px 18px; margin-bottom: 14px; min-width: 0; }
#tab-btlab-view .bt-card h4 { font-size: 13.5px; font-weight: 600; margin: 0 0 10px; }
#tab-btlab-view .bt-card h4.bt-mt { margin-top: 18px; }
#tab-btlab-view .bt-cardhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
#tab-btlab-view .bt-cardhead h4 { margin: 0; }
#tab-btlab-view .bt-scanhead { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
#tab-btlab-view .bt-scanhead h3 { font: 400 24px/1.2 'Instrument Serif', Georgia, serif; margin: 0 0 4px; }
#tab-btlab-view .bt-scanhead p { margin: 0; font-size: 12px; color: var(--bt-mu); font-family: 'Geist Mono', ui-monospace, monospace; }
#tab-btlab-view .bt-rules { display: flex; flex-wrap: wrap; gap: 6px; max-width: 460px; justify-content: flex-end; }
#tab-btlab-view .bt-rules span { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--foreground) 6%, transparent); }
#tab-btlab-view .bt-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 760px) { #tab-btlab-view .bt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#tab-btlab-view .bt-kpi { border: 1px solid var(--bt-bd); border-radius: 16px; background: var(--bt-card); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#tab-btlab-view .bt-kpi span { font-size: 11.5px; color: var(--bt-mu); }
#tab-btlab-view .bt-kpi b { font: 600 22px/1.1 'Geist Mono', ui-monospace, monospace; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-btlab-view .bt-kpi b span { font-size: inherit; }
#tab-btlab-view .bt-kpi em { font-style: normal; font-size: 11px; color: var(--bt-mu); font-family: 'Geist Mono', ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-btlab-view .bt-chart { height: 320px; width: 100%; }
#tab-btlab-view .bt-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--bt-mu); margin-top: 8px; }
#tab-btlab-view .bt-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
#tab-btlab-view .bt-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1440px) { #tab-btlab-view .bt-two { grid-template-columns: 1fr; } }
#tab-btlab-view .bt-kpi b.bt-split { font-size: 16px; white-space: normal; line-height: 1.3; }
#tab-btlab-view .bt-note { font-size: 11.5px; color: var(--bt-mu); margin: -4px 0 10px; line-height: 1.5; }
#tab-btlab-view .bt-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
#tab-btlab-view .bt-mini div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--bt-bd); font-size: 12.5px; }
#tab-btlab-view .bt-mini b { font-family: 'Geist Mono', ui-monospace, monospace; font-weight: 600; }
#tab-btlab-view .bt-scroll { overflow-x: auto; }
#tab-btlab-view .bt-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#tab-btlab-view .bt-table th { text-align: left; font-weight: 500; font-size: 11px; color: var(--bt-mu); padding: 6px 8px; border-bottom: 1px solid var(--bt-bd); white-space: nowrap; }
#tab-btlab-view .bt-table td { padding: 7px 8px; border-bottom: 1px solid color-mix(in srgb, var(--bt-bd) 70%, transparent); white-space: nowrap; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 12px; }
#tab-btlab-view .bt-table td:first-child { font-family: inherit; }
#tab-btlab-view .bt-table td small { color: var(--bt-mu); }
#tab-btlab-view .bt-table a { color: var(--foreground); font-weight: 600; cursor: pointer; text-decoration: none; border-bottom: 1px dotted var(--bt-mu); }
#tab-btlab-view .bt-table a:hover { color: var(--bt-ac); }
#tab-btlab-view .bt-trades th[data-sort] { cursor: pointer; user-select: none; }
#tab-btlab-view .bt-reason { font-family: inherit !important; color: var(--bt-mu); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
#tab-btlab-view .bt-compare tbody tr { cursor: pointer; }
#tab-btlab-view .bt-compare tbody tr:hover td { background: color-mix(in srgb, var(--bt-ac) 6%, transparent); }
#tab-btlab-view .bt-grp { display: block; font-size: 10px; color: var(--bt-mu); letter-spacing: .03em; }
#tab-btlab-view .bt-pager { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; font-size: 12px; color: var(--bt-mu); }
#tab-btlab-view .bt-pager button { border: 1px solid var(--bt-bd); background: transparent; color: var(--foreground); border-radius: 999px; padding: 3px 10px; margin: 0 6px; cursor: pointer; }
#tab-btlab-view .bt-months { width: 100%; border-collapse: separate; border-spacing: 3px; font: 11px 'Geist Mono', ui-monospace, monospace; }
#tab-btlab-view .bt-months th { font-weight: 500; color: var(--bt-mu); padding: 2px; text-align: center; }
#tab-btlab-view .bt-months td { text-align: center; padding: 6px 2px; border-radius: 6px; white-space: nowrap; }
#tab-btlab-view .bt-months td:last-child { padding-left: 8px; text-align: right; }
#tab-btlab-view .bt-foot { font-size: 11px; color: var(--bt-mu); line-height: 1.55; margin: 18px 0 6px; max-width: 980px; }
