/* =========================================================
   Backtesting styles. Built on the app's own tokens (styles.css):
   black backgrounds, electric blue for primary actions and active
   controls, green and red only for profit and loss.
   ========================================================= */

/* ---------- Small shared pieces ---------- */
.bt-q { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-2); color: var(--muted); font: 700 10px/1 var(--font); cursor: help; vertical-align: 1px; margin-left: 2px; text-transform: none; letter-spacing: 0; }
.bt-q:hover, .bt-q:focus { color: var(--blue-lt); border-color: var(--blue); outline: none; }
.bt-q:hover::after, .bt-q:focus::after { content: attr(data-tip); position: absolute; z-index: 80; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 260px; padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--card-3); border: 1px solid var(--border-2); color: var(--text); font: 500 12.5px/1.45 var(--font); text-align: left; white-space: normal; box-shadow: 0 12px 30px -10px rgba(0,0,0,.8); pointer-events: none; }
.bt-warn { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 5px; font-size: 13px; color: var(--text-2); }
.bt-warn li::marker { color: var(--warn); }

/* ---------- Sessions home ---------- */
.bt-guide { display: flex; gap: var(--s-4); align-items: flex-start; padding: var(--s-4) var(--s-5); border: 1px solid var(--blue-soft); background: var(--blue-softer); border-radius: var(--r-lg); }
.bt-guide ol { list-style: none; counter-reset: g; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); flex: 1; }
.bt-guide li { counter-increment: g; display: grid; gap: 2px; padding-left: 34px; position: relative; font-size: 13px; color: var(--text-2); }
.bt-guide li::before { content: counter(g); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--blue); color: #fff; font: 700 12px/24px var(--font); text-align: center; }
.bt-guide b { color: var(--text); font-size: 14px; }
.bt-filters { gap: 8px; }
.bt-filters input[type=search] { width: 200px; min-height: 36px; padding: 6px 12px; }
.bt-filters select { width: auto; min-height: 36px; padding: 6px 30px 6px 12px; font-size: 13.5px; }
.bt-sessions td { vertical-align: middle; }
.bt-nm b { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.bt-nm small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.bt-howto p { margin: 0 0 10px; }

/* ---------- New Backtest setup ---------- */
.bt-stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.bt-stepper li { display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 99px; border: 1px solid var(--border); background: var(--card); color: var(--muted); font-weight: 700; font-size: 13px; }
.bt-stepper li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--card-3); font: 700 11.5px var(--font); }
.bt-stepper li span svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 3; }
.bt-stepper li.on { color: var(--text); border-color: var(--blue); }
.bt-stepper li.on span { background: var(--blue); color: #fff; }
.bt-stepper li.done { color: var(--text-2); }
.bt-stepper li.done span { background: var(--blue-soft); color: var(--blue-lt); }
.bt-setup { display: grid; gap: 0; }
.bt-mkts { flex-wrap: wrap; }
.bt-insts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.bt-inst { display: grid; gap: 4px; justify-items: start; text-align: left; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card-2); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, background .15s; min-width: 0; }
.bt-inst:hover { border-color: var(--border-2); }
.bt-inst.on { border-color: var(--blue); background: var(--blue-softer); box-shadow: inset 0 0 0 1px var(--blue); }
.bt-inst .row { width: 100%; }
.bt-inst b { font-family: var(--mono); font-size: 14.5px; }
.bt-inst .t2 { font-size: 12.5px; }
.bt-inst .pill { white-space: normal; text-align: left; }
.bt-inst.nodata { opacity: .72; }
.bt-srcbox { margin-top: var(--s-4); padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); }
.bt-src { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card-2); cursor: pointer; }
.bt-src.on { border-color: var(--blue); background: var(--blue-softer); }
.bt-src input { margin-top: 3px; accent-color: var(--blue); width: 16px; height: 16px; flex: none; }
.bt-src b { display: block; font-size: 14px; }
.bt-src small { display: block; color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.bt-foot { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.bt-foot .grow { flex: 1; }
.bt-adv { margin-top: var(--s-4); }
.bt-adv .form { padding-top: 6px; }
.bt-go { min-width: 190px; }

/* ---------- Results ---------- */
.bt-rstats .stat .v { font-size: 20px; }
.bt-ff { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.bt-ai { max-width: none; background: var(--card-2); border: 1px solid var(--border); }
.bt-ai p, .bt-ai ul { max-width: 78ch; }

/* =========================================================
   Trading workspace (full screen)
   ========================================================= */
body.bt-full { overflow: hidden; }
body.bt-full .side, body.bt-full .head, body.bt-full .tabbar, body.bt-full .install { display: none !important; }
body.bt-full main { margin: 0 !important; padding: 0 !important; max-width: none; }
body.bt-full .page { animation: none; display: block; }
.bt-ws { position: fixed; inset: 0; z-index: 20; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--bg);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.bt-ws-err { display: block; padding-inline: 16px; }

/* Top bar */
.bt-top { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--sidebar); min-width: 0; }
.bt-back { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--card); color: var(--text-2); border-radius: var(--r-sm); padding: 6px 10px; font: 700 13px var(--font); cursor: pointer; flex: none; }
.bt-back:hover { color: var(--text); border-color: var(--border-2); }
.bt-back svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.bt-ttl { display: grid; min-width: 0; flex: 0 1 auto; }
.bt-name { border: 0; background: none; color: var(--text); font: 700 15px var(--font); padding: 0; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.bt-name:hover { color: var(--blue-lt); }
.bt-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-kpis { display: flex; gap: 18px; margin-left: auto; min-width: 0; }
.bt-kpis div { display: grid; line-height: 1.2; }
.bt-kpis span { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.bt-kpis b { font: 600 13.5px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bt-save { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; flex: none; }
.bt-save svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.4; }
.bt-save.saved svg { color: var(--gain); }
.bt-save.saving .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-hi); animation: pulse 1s infinite alternate; }
.bt-save.error { color: var(--loss); }
@keyframes pulse { to { opacity: .3; } }
.bt-ib { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--card); color: var(--text-2); cursor: pointer; flex: none; }
.bt-ib.sm { width: 28px; height: 28px; }
.bt-ib:hover { color: var(--text); border-color: var(--border-2); }
.bt-ib svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.menuwrap { position: relative; }
.bt-menu { position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; min-width: 240px; padding: 6px; background: var(--card-2); border: 1px solid var(--border-2); border-radius: var(--r-md); box-shadow: 0 18px 40px -12px rgba(0,0,0,.85); display: grid; gap: 1px; }
.bt-menu.right { left: auto; right: 0; }
.bt-menu { z-index: 60; overscroll-behavior: contain; }
.bt-step { display: flex; gap: 6px; align-items: stretch; }
.bt-step input { flex: 1; min-width: 0; text-align: center; font: 600 15px var(--mono); }
.bt-step .btn { flex: none; width: 44px; padding: 0; font-size: 20px; font-weight: 600; justify-content: center; touch-action: manipulation; }
.bt-irow { display: flex; align-items: center; gap: 4px; }
.bt-irow > label:first-child { flex: 1; }
.bt-menu label.bt-col { position: relative; flex: none; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; cursor: pointer; }
.bt-col input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.bt-col i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); box-shadow: 0 0 0 1px rgba(0,0,0,.4); pointer-events: none; }
.bt-pal { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; justify-content: center; padding-top: 4px; }
.bt-swb { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; padding: 0; touch-action: manipulation; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.bt-swb[aria-pressed="true"] { border-color: #fff; }
.bt-tb.lbl span { display: inline !important; }
.bt-menu h4 { margin: 6px 8px 3px; font: 700 10.5px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bt-menu label, .bt-menu button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); border: 0; background: none; color: var(--text); font: 600 13.5px var(--font); cursor: pointer; text-align: left; width: 100%; }
.bt-menu label:hover, .bt-menu button:hover { background: var(--card-3); }
.bt-menu label.off { color: var(--muted); cursor: not-allowed; }
.bt-menu label small { color: var(--muted); font-weight: 500; }
.bt-menu input { accent-color: var(--blue); width: 15px; height: 15px; margin: 0; flex: none; }
.bt-menu .sw { width: 14px; height: 3px; border-radius: 2px; flex: none; }
.bt-menu button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; color: var(--muted); }
.bt-menu button.danger { color: var(--loss); }
.bt-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }
.bt-mnote { margin: 6px 8px 4px; font-size: 11.5px; color: var(--muted); }

/* Main area */
.bt-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.bt-chartcol { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #070B12; }
.bt-tools { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.bt-tools .grow { flex: 1; }
.bt-draw { display: flex; align-items: center; gap: 4px; flex: none; }
.bt-tfs { display: flex; gap: 1px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; flex: none; }
.bt-tfs button { border: 0; background: none; color: var(--muted); font: 600 12px var(--mono); padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.bt-tfs button:hover { color: var(--text); }
.bt-tfs button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.bt-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; flex: none; }
.bt-tb { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2); font: 700 12.5px var(--font); cursor: pointer; flex: none; white-space: nowrap; }
.bt-tb.icon { width: 32px; padding: 0; justify-content: center; }
.bt-tb:hover { background: var(--card-2); color: var(--text); }
.bt-tb[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue-lt); }
.bt-tb svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bt-stage { position: relative; flex: 1; min-height: 0; }
/* The chart sits in its own layer, so the drawing layer (and its taps) is always on top of every chart canvas. */
.bt-stage { isolation: isolate; }
#bt-chart { position: absolute; inset: 0; z-index: 1; isolation: isolate; }
#bt-ov { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#bt-ov.active { pointer-events: auto; cursor: crosshair; }
.bt-legend { position: absolute; z-index: 6; top: 8px; left: 10px; display: grid; gap: 2px; pointer-events: none; font-size: 12px; }
.bt-legend .l1 { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.bt-legend .l1 span { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.bt-legend .l2, .bt-legend .l3 { display: flex; gap: 10px; flex-wrap: wrap; font-family: var(--mono); color: var(--muted); }
.bt-legend b { font-weight: 600; }
.bt-selbar { position: absolute; z-index: 7; top: 8px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 16px); flex-wrap: wrap; justify-content: center; display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; background: var(--card-2); border: 1px solid var(--border-2); border-radius: var(--r-md); font-size: 13px; font-weight: 700; box-shadow: 0 10px 24px -10px rgba(0,0,0,.8); white-space: nowrap; }
.bt-selbar svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.bt-hint { position: absolute; z-index: 7; left: 10px; bottom: 36px; max-width: min(520px, calc(100% - 20px)); padding: 7px 10px; background: rgba(18,25,35,.94); border: 1px solid var(--border-2); border-radius: var(--r-sm); font-size: 12.5px; color: var(--text-2); }
.bt-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; margin-left: 4px; }
.bt-x:hover { color: var(--text); }
.bt-end { position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; gap: 8px; justify-items: center; text-align: center; width: min(380px, calc(100% - 32px)); padding: 18px; background: var(--card); border: 1px solid var(--blue); border-radius: var(--r-lg); box-shadow: 0 30px 60px -20px rgba(0,0,0,.9); font-size: 13.5px; color: var(--text-2); }
.bt-end b { color: var(--text); font-size: 15px; }
.bt-rsi { height: 110px; position: relative; border-top: 1px solid var(--border); flex: none; }
#bt-rsi { position: absolute; inset: 0; }
.bt-attr { position: absolute; z-index: 6; right: 76px; bottom: 34px; font-size: 10.5px; color: var(--muted); text-decoration: none; opacity: .75; }
.bt-attr:hover { color: var(--text-2); opacity: 1; }

/* Replay controls */
.bt-replay { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); background: var(--sidebar); flex-wrap: wrap; }
.bt-rb { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card); color: var(--text); font: 700 13px var(--font); cursor: pointer; }
.bt-rb:hover:not(:disabled) { border-color: var(--border-2); background: var(--card-2); }
.bt-rb:disabled { opacity: .4; cursor: not-allowed; }
.bt-rb.wide { padding: 0 12px; }
.bt-rb.play { background: var(--blue); border-color: var(--blue); color: #fff; min-width: 44px; }
.bt-rb.play:hover:not(:disabled) { background: var(--blue-hi); }
.bt-rb svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bt-rb.play svg, .bt-rb[data-act="btNext"] svg path:first-child, .bt-rb[data-act="btBack"] svg path:first-child { fill: currentColor; stroke: none; }
.bt-speeds { display: flex; gap: 1px; padding: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); }
.bt-speeds button { border: 0; background: none; color: var(--muted); font: 600 12px var(--mono); padding: 5px 7px; border-radius: 6px; cursor: pointer; }
.bt-speeds button[aria-pressed="true"] { background: var(--card-3); color: var(--text); }
.bt-speeds button:disabled { opacity: .4; }
.bt-prog { flex: 1 1 140px; min-width: 120px; display: grid; gap: 4px; }
.bt-bar { height: 5px; border-radius: 3px; background: var(--card-3); overflow: hidden; }
.bt-bar i { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 3px; }
.bt-prog span { font-size: 11.5px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.bt-jump { display: flex; gap: 4px; align-items: center; }
.bt-jump input { min-height: 34px; height: 34px; padding: 4px 8px; font: 600 12.5px var(--mono); width: 196px; background: #F5F7FA; color: #000; -webkit-text-fill-color: #000; color-scheme: light; border-color: #C9D1E0; opacity: 1; }
.bt-jump input::-webkit-datetime-edit, .bt-jump input::-webkit-date-and-time-value { color: #000; -webkit-text-fill-color: #000; text-align: left; }
.bt-jump input::-webkit-calendar-picker-indicator { filter: none; opacity: .8; }

/* Order panel */
.bt-side { border-left: 1px solid var(--border); background: var(--card); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.bt-side > * { flex-shrink: 0; }
.bt-quote { display: grid; grid-template-columns: 1fr auto 1fr; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.bt-sellb, .bt-buyb { display: grid; gap: 3px; padding: 10px 12px; border: 0; cursor: pointer; text-align: left; font: inherit; color: var(--text); transition: filter .12s; }
.bt-sellb { background: rgba(239, 68, 68,.14); }
.bt-buyb { background: rgba(34,197,94,.13); text-align: right; justify-items: end; }
.bt-sellb small { color: var(--loss); font: 800 11.5px var(--font); letter-spacing: .08em; }
.bt-buyb small { color: var(--gain); font: 800 11.5px var(--font); letter-spacing: .08em; }
.bt-sellb:hover:not(:disabled), .bt-buyb:hover:not(:disabled) { filter: brightness(1.25); }
.bt-sellb.on { box-shadow: inset 0 -3px 0 var(--loss); } .bt-buyb.on { box-shadow: inset 0 -3px 0 var(--gain); }
.bt-sellb:disabled, .bt-buyb:disabled { opacity: .45; cursor: not-allowed; }
.bt-quote .px { font: 500 13px/26px var(--mono); white-space: nowrap; }
.bt-quote .px b { font-size: 22px; font-weight: 600; }
.bt-quote .px sup { font-size: 11px; }
.bt-spr { display: grid; place-items: center; padding: 0 7px; background: var(--bg); color: var(--muted); font: 600 11px var(--mono); border-inline: 1px solid var(--border); }
.bt-help { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.bt-ticket { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--card-2); }
.bt-ticket.buy { border-color: rgba(34,197,94,.45); } .bt-ticket.sell { border-color: rgba(239, 68, 68,.45); }
.bt-ticket .seg { display: flex; } .bt-ticket .seg button { flex: 1; }
.bt-ticket .field { gap: 4px; }
.bt-ticket input[type=number] { min-height: 38px; padding: 7px 10px; font: 600 14px var(--mono); }
.bt-chk { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-2); cursor: pointer; }
.bt-chk input { accent-color: var(--blue); width: 15px; height: 15px; margin: 0; }
.bt-ro { font: 500 11.5px var(--mono); color: var(--muted); }
.bt-rs { display: flex; gap: 4px; margin-top: 2px; }
.bt-rs button { flex: 1; border: 1px solid var(--border); background: var(--card); color: var(--text-2); border-radius: 6px; padding: 4px 0; font: 600 12px var(--mono); cursor: pointer; }
.bt-rs button:hover { border-color: var(--blue); color: var(--blue-lt); }
.bt-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.bt-sum div { background: var(--card); padding: 7px 9px; }
.bt-sum dt { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bt-sum dd { margin: 2px 0 0; font: 600 13px var(--mono); }
.bt-err { margin: 0; min-height: 0; font-size: 12.5px; font-weight: 600; color: var(--warn); }
.bt-err:empty { display: none; }
.bt-ticket .place { width: 100%; min-height: 44px; border: 0; border-radius: var(--r-md); color: #fff; font: 800 14.5px var(--font); cursor: pointer; }
.bt-ticket .place.buy { background: #16A34A; } .bt-ticket .place.sell { background: #DC3B3B; }
.bt-ticket .place:hover:not(:disabled) { filter: brightness(1.1); }
.bt-ticket .place:disabled { opacity: .4; cursor: not-allowed; }
.bt-acct { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.bt-acct div { background: var(--bg); padding: 8px 10px; }
.bt-acct div > span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bt-acct b { font: 600 13px var(--mono); }
#bt-mini { display: grid; gap: 6px; }
.bt-pos { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); font-size: 12.5px; }
.bt-pos .num { font-family: var(--mono); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Bottom panel */
.bt-dock { --bt-dock: 230px; height: var(--bt-dock); display: flex; flex-direction: column; border-top: 1px solid var(--border); background: var(--card); min-height: 0; position: relative; }
.bt-dock.collapsed { height: auto; }
.bt-dock.collapsed .bt-dockbody, .bt-dock.collapsed .bt-grip { display: none; }
.bt-grip { position: absolute; top: -4px; left: 0; right: 0; height: 8px; cursor: ns-resize; z-index: 6; }
.bt-grip:hover { background: linear-gradient(transparent 3px, var(--blue) 3px, var(--blue) 5px, transparent 5px); }
.bt-tabs { display: flex; align-items: center; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--border); min-height: 40px; overflow-x: auto; flex: none; }
.bt-tabs .grow { flex: 1; }
.bt-tab { border: 0; background: none; color: var(--muted); font: 700 13px var(--font); padding: 11px 10px 10px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.bt-tab:hover { color: var(--text); }
.bt-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--blue); }
.bt-tab .cnt { margin-left: 6px; padding: 1px 6px; border-radius: 99px; background: var(--card-3); font: 600 11px var(--mono); color: var(--text-2); }
.bt-dockbody { flex: 1; overflow: auto; min-height: 0; }
.bt-dockbody th { position: sticky; top: 0; z-index: 1; padding: 8px 12px; }
.bt-dockbody td { padding: 8px 12px; font-size: 13px; }
.bt-empty { margin: 0; padding: 18px 14px; color: var(--muted); font-size: 13px; }
.bt-mstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--border); border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.bt-mstats div { background: var(--card); padding: 10px 12px; }
.bt-mstats div > span:first-child { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bt-mstats b { font: 600 15px var(--mono); white-space: nowrap; }
.bt-brk th, .bt-brk td { padding: 7px 5px; font-size: 12px; }
.bt-brk th { letter-spacing: .04em; }
.bt-brk td:first-child { white-space: normal; }
.bt-mstats small { font-size: 11px; color: var(--muted); font-weight: 500; }
.bt-keys { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.bt-keys .kbd { min-width: 64px; text-align: center; display: inline-block; }

/* ---------- Responsive ---------- */
/* ---------- Prop firm challenge ---------- */
.bt-chal { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); }
.bt-chal.on { border-color: rgba(8, 123, 255,.55); box-shadow: inset 0 0 0 1px rgba(8, 123, 255,.12); }
.bt-chal h3 { margin: 0; font-size: 15px; }
.bt-chgs { display: grid; gap: 6px; margin-top: 12px; }
.bt-chgs > .label { margin-top: 4px; }
.bt-chtabs { display: flex; flex-wrap: wrap; gap: 6px; }
.bt-chtab { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--card); color: var(--text-2); font: 600 13px var(--font, inherit); cursor: pointer; touch-action: manipulation; white-space: nowrap; }
.bt-chtab[aria-selected="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.bt-chprogs { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 6px; }
.bt-chnote { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--blue); background: rgba(8, 123, 255,.06); border-radius: 0 var(--r-md) var(--r-md) 0; font-size: 13px; color: var(--text-2); display: grid; gap: 4px; }
.bt-chnote b { color: var(--text); } .bt-chnote p { margin: 0; } .bt-chnote small { font-size: 12px; color: var(--muted); }
.bt-chnote small.warn-t { color: var(--warn); }
.bt-chps { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin-top: 12px; }
.bt-chp { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--border-2); background: var(--card); color: var(--text-2); cursor: pointer; font: inherit; touch-action: manipulation; }
.bt-chp b { color: var(--text); font-size: 13.5px; }
.bt-chp small { font-size: 12px; color: var(--muted); }
.bt-chp[aria-pressed="true"] { border-color: var(--blue); background: rgba(8, 123, 255,.12); }
.bt-chsz { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.bt-chsz .flabel { margin: 0; }
.bt-chsum { margin-top: 14px; padding: 12px 14px; border: 1px solid rgba(8, 123, 255,.5); border-radius: var(--r-md); background: rgba(8, 123, 255,.07); }
.bt-chsum b { display: inline-flex; align-items: center; gap: 8px; }
.bt-chsum b svg, .bt-chside b svg, .bt-chname svg { width: 16px; height: 16px; stroke: var(--blue-lt, #19B5FF); fill: none; stroke-width: 2; flex: none; }
.bt-chsum p { margin: 6px 0 0; font-size: 13px; color: var(--text-2); }
.bt-ch1 { display: grid; gap: 8px; }
.bt-ch1 > p { margin: 0; }
.bt-ch1 .bt-chgs { margin-top: 0; }
.bt-chtag { color: var(--blue-lt, #19B5FF); }
.bt-chbar { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--card); font-size: 12.5px; }
.bt-chbar.paused { background: rgba(245, 158, 11,.10); }
.bt-chbar.failed { background: rgba(239, 68, 68,.10); } .bt-chbar.passed { background: rgba(34,197,94,.10); }
.bt-chname { display: inline-flex; align-items: center; gap: 6px; }
.bt-chm { display: inline-flex; align-items: baseline; gap: 6px; }
.bt-chm small { color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.bt-chm b { font: 600 12.5px var(--mono); }
.bt-chm .bt-chmeter { width: 54px; align-self: center; }
.bt-chmeter { display: block; height: 5px; border-radius: 3px; background: var(--card-3, #243041); overflow: hidden; }
.bt-chmeter > i { display: block; height: 100%; background: var(--gain); border-radius: 3px; transition: width .2s; }
.bt-chmeter.blue > i { background: var(--blue); } .bt-chmeter.warn-t > i { background: var(--warn); } .bt-chmeter.loss > i { background: var(--loss); }
.bt-chside { display: grid; gap: 10px; padding: 12px; border: 1px solid rgba(8, 123, 255,.45); border-radius: var(--r-md); background: var(--bg); font-size: 13px; }
.bt-chside.failed { border-color: var(--loss); } .bt-chside.passed { border-color: var(--gain); }
.bt-chside > .row b { display: inline-flex; align-items: center; gap: 6px; }
.bt-chrow { display: grid; gap: 5px; color: var(--text-2); }
.bt-chrow b { font: 600 12.5px var(--mono); color: var(--text); }
.bt-chrow b.gain { color: var(--gain); } .bt-chrow b.loss { color: var(--loss); } .bt-chrow b.warn-t { color: var(--warn); }
.bt-chrow small { font-size: 11.5px; color: var(--muted); }
.bt-end.pass { border-color: var(--gain); } .bt-end.fail { border-color: var(--loss); }
.bt-endic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(34,197,94,.15); }
.bt-end.fail .bt-endic { background: rgba(239, 68, 68,.15); }
.bt-endic svg { width: 22px; height: 22px; fill: none; stroke-width: 2.4; stroke: var(--gain); }
.bt-end.fail .bt-endic svg { stroke: var(--loss); }
.bt-chres h2 { display: inline-flex; align-items: center; gap: 8px; }
.bt-chres h2 svg { width: 20px; height: 20px; fill: none; stroke-width: 2.4; stroke: var(--blue); }
.bt-chres.passed { border-color: var(--gain); } .bt-chres.passed h2 svg { stroke: var(--gain); }
.bt-chres.failed { border-color: var(--loss); } .bt-chres.failed h2 svg { stroke: var(--loss); }
@media (max-width: 900px) { .bt-chbar { gap: 4px 12px; padding: 5px 10px; } .bt-chm .bt-chmeter { display: none; } }
@media (max-width: 1280px) { .bt-kpis .bt-k-opt { display: none; } .bt-jump input { width: 168px; } }
@media (max-width: 1100px) { .bt-main { grid-template-columns: minmax(0, 1fr) 270px; } .bt-name { max-width: 200px; } .bt-tb span { display: none; } }
@media (max-width: 900px) {
  body.bt-full { overflow: auto; }
  .bt-ws { position: fixed; display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-left: max(0px, env(safe-area-inset-left, 0px)); padding-right: max(0px, env(safe-area-inset-right, 0px)); }
  .bt-top { flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; position: sticky; top: 0; z-index: 10; }
  .bt-ttl { flex: 1 1 140px; }
  .bt-kpis { order: 5; width: 100%; margin: 0; justify-content: space-between; }
  .bt-kpis .bt-k-opt { display: grid; }
  .bt-exit { display: none; }
  .bt-main { display: block; }
  .bt-chartcol { min-height: 0; }
  .bt-tools { flex-wrap: wrap; gap: 6px; padding: 6px 8px; overflow: visible; }
  .bt-tools > .bt-sep { display: none; }
  .bt-tfs { order: -2; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .bt-tfs::-webkit-scrollbar { display: none; }
  .bt-tfs button { flex: 1 0 auto; }
  .bt-draw { order: -1; width: 100%; justify-content: space-between; overflow-x: auto; padding: 2px 0; border-top: 1px solid var(--border); padding-top: 6px; }
  .bt-draw { gap: 0; }
  .bt-draw .bt-tb.icon { width: 26px; height: 34px; }
  .bt-draw .bt-tb.icon svg { width: 16px; height: 16px; }
  .bt-jump input:placeholder-shown, .bt-jump input:not(:focus):invalid { color: #333; -webkit-text-fill-color: #333; }
  .bt-stage { flex: none; height: 54vh; min-height: 300px; }
  .bt-replay { justify-content: center; }
  .bt-prog { order: 9; flex-basis: 100%; }
  .bt-jump { order: 10; width: 100%; } .bt-jump input { flex: 1; width: auto; }
  .bt-side { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  .bt-dock, .bt-dock.collapsed { height: auto; }
  .bt-grip { display: none; }
  .bt-dockbody { max-height: 60vh; }
  .bt-mstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-guide { flex-direction: column; }
  .bt-guide ol { grid-template-columns: 1fr; }
  .bt-filters input[type=search] { width: 100%; flex: 1 1 160px; }
}
@media (max-width: 520px) {
  .bt-kpis { gap: 10px; } .bt-kpis b { font-size: 12.5px; } .bt-kpis .bt-k-time { display: none; }
  .bt-save span { display: none; }
  .bt-foot { flex-wrap: wrap; } .bt-foot .btn.primary { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .bt-save.saving .dot { animation: none; } }

.bt-more { margin-top: 12px; }
.bt-more summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--text-2); list-style: none; }
.bt-more summary::-webkit-details-marker { display: none; }
.bt-more summary::before { content: "+ "; color: var(--blue-lt); font-family: var(--mono); }
.bt-more[open] summary::before { content: "− "; }
.bt-srcbox h3 { margin: 0; }
.linklike { border: 0; background: none; padding: 0; color: var(--blue-lt); font: inherit; text-decoration: underline; cursor: pointer; }
.bt-inst .pill svg { margin-right: 2px; }

/* No double-tap delay on any workspace control */
.bt-ws button, .bt-ws a, .bt-ws label { touch-action: manipulation; }
.bt-menu label.bt-o-tz { justify-content: space-between; cursor: default; }
.bt-menu label.bt-o-tz select { width: auto; height: 34px; padding: 4px 30px 4px 10px; font-size: 13px; }
