File size: 18,186 Bytes
ee446e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
/* Backtesting page β€” header, run bar, folded configuration, results workbench. */

/* ── Page header and tabs ──
   The title and the tab control share one compact row: no explanation line,
   no gap under the title. The row wraps only when the tabs cannot fit beside
   the title, which the phone width forces. */
.backtest-page-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-xs) var(--space-md);
	margin-bottom: var(--space-sm);
	padding-bottom: var(--space-xs);
}

.backtest-page-header .page-header__title {
	margin: 0;
}

/* A compact segmented control rather than three stretched buttons: the tabs
   are sections of one page, so they read as one control. The active tab is the
   accent fill; the rest stay quiet until hovered. */
.backtest-tabs {
	display: inline-flex;
	max-width: 100%;
	gap: var(--radius-sm);
	padding: var(--space-2xs);
	margin: 0;
	background: var(--bg-surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	overflow-x: auto;
}

.backtest-tab {
	min-height: var(--tab-height);
	padding: 0 var(--space-md);
	background: transparent;
	border: 0;
	border-radius: var(--radius-sm);
	color: var(--text-muted);
	font-family: var(--font-sans);
	font-size: var(--tab-font-size);
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
	transition: background var(--transition-fast), color var(--transition-fast);
}

.backtest-tab:hover {
	background: var(--overlay-1);
	color: var(--text);
}

.backtest-tab:focus-visible {
	outline: var(--radius-sm) solid var(--accent);
	outline-offset: var(--radius-sm);
}

.backtest-tab.active {
	background: var(--accent);
	color: var(--on-accent);
}

/* ── Layout ──
   One column everywhere: the run bar, then the workbench. The configuration
   is folded under the run bar instead of holding a column of its own, which is
   what leaves the page's height to the table and its chart. */
.bt-layout {
	display: grid;
	gap: var(--space-md);
	min-width: 0;
}

.bt-side {
	display: grid;
	gap: var(--space-sm);
	min-width: 0;
}

.bt-main {
	display: grid;
	gap: var(--space-md);

	/* The results table is wider than its column and scrolls inside it; without
	   this the track is forced out to the table's min-content width. */
	min-width: 0;
}

/* The viewport the run tab spends outside the workbench: the page-wrapper's
   top and bottom padding, the header row (title and tabs) and the run bar with
   its gap. Measured at 1440x900, where the workbench starts at y=115 and the
   wrapper closes 32px below it. It is the default height only: a drag on the
   seam stores --bt-chart-height, which wins over this. */
.backtest-tab-panel--backtest {
	--bt-run-chrome: 147px;
}

/* ── Run bar ──
   The whole run in one wrapping line: what Start would replay (signal, window,
   universe), the Edit control that unfolds the configuration, the run's state
   and its controls. It is built from the fields themselves, so it can only ever
   say what Start would run. */
.bt-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm) var(--space-md);
	padding: var(--space-sm) var(--space-md);
	background: var(--bg-surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
}

.bt-summary__items {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	gap: var(--space-xs) var(--space-md);
	margin: 0;
	min-width: 0;
}

.bt-summary__item {
	display: flex;
	align-items: baseline;
	gap: var(--space-xs);
	min-width: 0;
}

.bt-summary__item dt {
	font-size: var(--font-xs);
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
}

.bt-summary__item dd {
	margin: 0;
	min-width: 0;
	font-size: var(--font-sm);
	color: var(--text);
	overflow-wrap: anywhere;
}

/* The run's state and its controls, at the bar's trailing edge. */
.bt-actionbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm) var(--space-md);
	margin-left: auto;
}

.bt-status {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	margin: 0;
	min-width: 0;
	font-size: var(--font-sm);
	color: var(--text-secondary);
}

.bt-status::before {
	content: "";
	flex: 0 0 auto;
	width: var(--space-sm);
	height: var(--space-sm);
	border-radius: 50%;
	background: var(--text-dim);
}

.bt-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
}

.bt-alert-row {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
}

.bt-alert-row .select-field {
	flex: 1;
	min-width: 0;
}

.bt-alert-summary {
	font-size: var(--font-xs);
	margin-top: var(--space-xs);
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.bt-alert-summary--selected {
	color: var(--text-secondary);
}

.bt-alert-summary--empty {
	color: var(--text-dim);
	font-style: italic;
}

.bt-run-live {
	font-size: var(--font-xs);
	margin-top: var(--space-xs);
	color: var(--text-dim);
}

.bt-run-live a {
	color: var(--accent);
	text-decoration: none;
}

.bt-run-live a:hover {
	text-decoration: underline;
}

/* Warnings and the candidate summary sit under the run bar, one per row. */
.bt-notices {
	display: grid;
	gap: var(--space-sm);
}

.bt-notices:empty {
	display: none;
}

/* The editor host only wraps the alert editor section: it contributes no box
   of its own, so a closed editor adds no gap above the workbench and an open
   one takes its own row. */
.bt-alert-editor-host {
	display: contents;
}

.bt-progress {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.bt-status-message {
	color: inherit;
	font-size: var(--font-sm);
}

/* Phone-only sort control (see .bt-sort-by in the phone block below). */
.bt-sort-by {
	display: none;
}

/* ── Configuration ──
   Three groups read top to bottom: the signal, the session window, the
   universe. Folded behind the run bar's Edit control at every width: the
   script sets .is-collapsible on the bar's wrapper, and without the script the
   panel stays in view so the page still works. On desktop the groups sit side
   by side, so an open panel costs one row of fields rather than a column. */
.bt-controls {
	display: grid;
	gap: var(--space-md);
	padding: var(--space-md);
	background: var(--bg-surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
}

.bt-side.is-collapsible:not(.is-open) .bt-controls {
	display: none;
}

.bt-controls__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
}

.bt-controls__title {
	margin: 0;
	font-size: var(--font-md);
	font-weight: 600;
	color: var(--text);
}

.bt-group {
	display: grid;
	gap: var(--space-sm);
	min-width: 0;
}

/* The groups are fieldsets (native grouping for their legend); reset the UA box so they
   lay out exactly as the old divs did. */
fieldset.bt-group {
	border: 0;
	margin: 0;
	padding: 0;
}

legend.bt-group__legend {
	float: none;
	padding: 0;
	width: auto;
}

/* A small caption over each group, the same treatment as a field label on the
   Reports tab, so the three groups read as sections rather than loose fields. */
.bt-group__legend {
	margin: 0;
	font-size: var(--font-xs);
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
}

.bt-group__fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-md);
	align-items: end;
}

.bt-group__fields--universe {
	grid-template-columns: minmax(0, 1fr);
	align-items: start;
}

.bt-field {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	min-width: 0;
	font-size: var(--font-sm);
	color: var(--text-secondary);
}

.bt-field input,
.bt-field select,
.bt-field textarea {
	width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

/* ── Workbench ──
   The rows and the chart they produced share one box: stacked on a narrow
   reading, side by side on desktop, where a single height makes the chart
   visible beside the table instead of below it. The seam under the chart
   resizes both (features/backtest/backtest-page.ts writes the property). */
.bt-workbench {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-md);
	min-width: 0;
}

/* ── Results ──
   A table with a sticky header. Stacked under the chart, the body scrolls
   inside its own height cap, so the header stays in view and the chart keeps
   its place below. */
.bt-results {
	max-height: 60vh;
	overflow: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
}

.bt-results-table {
	width: 100%;
	font-size: var(--font-md);
}

.bt-results-table th,
.bt-results-table td {
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

/* Numbers read down a column when they share one alignment. */
.bt-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* The empty state is a block of prose, not a sentence in a cell: it has to
   wrap, so the cell's nowrap is lifted for it alone. */
.bt-results-table .bt-empty-row td {
	white-space: normal;
	border-bottom: 0;
}

/* Shared empty-state copy for the results table and the chart area: a heading
   that says what is missing and a line that says what to do next. */
.bt-empty {
	max-width: 56ch;
	padding: var(--space-lg) var(--space-md);
}

.bt-empty__title {
	margin: 0 0 var(--space-xs);
	color: var(--text);
	font-size: var(--font-md);
	font-weight: 600;
}

.bt-empty__body {
	margin: 0;
	color: var(--text-muted);
	font-size: var(--font-sm);
	line-height: 1.5;
}

.bt-row {
	cursor: pointer;
}

.bt-row:hover {
	background: var(--bg-input);
}

.bt-row--active {
	background: var(--bg-input);
}

/* The accent bar sits on the first cell: a box-shadow on the row itself does
   not paint in every browser, and a cell does. */
.bt-row--active td:first-child {
	box-shadow: inset var(--radius-sm) 0 0 var(--accent);
}

.bt-row--clickable:hover {
	background: var(--bg-input);
}

.bt-row--clickable:focus-visible {
	outline: var(--radius-sm) solid var(--accent);
	outline-offset: -2px;
}

.bt-alert--up {
	color: var(--success);
}

.bt-alert--down {
	color: var(--danger);
}

/* ── Chart ── */
.bt-chart {
	/* stock-chart-card[fill] sets height:100% on itself β€” without an explicit
	   (not min-) height here that resolves to 0 and the canvas never renders. */
	height: var(--bt-chart-height, var(--chart-height-default));
	position: relative;
}

/* Before a row is opened there is no symbol to chart. The card keeps its box
   (visibility, not display, so the chart's size is settled when it appears) and
   the prompt fills the same box, so the empty state takes the chart's place. */
.bt-chart.is-empty stock-chart-card {
	visibility: hidden;
}

.bt-chart-empty {
	display: none;
}

.bt-chart.is-empty .bt-chart-empty {
	position: absolute;
	inset: 0 0 var(--space-md);
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	background: var(--bg-surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
}

.bt-chart.is-empty .bt-empty {
	margin: 0 auto;
}

/* The close control only exists for the phone sheet (see the phone block). */
.bt-chart__close {
	display: none;
}

/* Bottom-edge seam: the seam belongs to the chart's own bottom edge, so
   dragging it down makes the workbench taller. */
.bt-chart > .panel-resize-handle--row {
	top: auto;
	bottom: 0;
}

/* ── Research tab: the study's own full-height layout ──
   Research moved in from its own page, so it is a tab here; the active one is
   in ?tab= (see features/backtest/tabs.ts). The study fills the viewport on a
   page of its own, but hosted it sits below this tab bar inside the page
   wrapper, so it declares the chrome above it. The Trades panel already does
   the same for its own full-height layout, and research.css reads this
   variable, defaulting to 0px so the study still fills a bare viewport. */
.backtest-tab-panel--research {
	--research-layout-offset: calc(var(--space-xxl) * 2 + var(--space-xl) + var(--space-lg));
}

/* ── Tablet and phone touches ──
   Below the desktop cut the workbench is stacked, so the chart keeps its own
   height and the table keeps its cap. Controls grow to the touch minimum. */
@media (width <= 1024px) {
	.bt-summary .btn,
	.bt-controls .btn,
	.bt-side .input-field,
	.bt-side .select-field,
	.bt-side .modal-input,
	.bt-side .filter-textarea {
		min-height: var(--touch-min);
	}
}

/* Desktop: the workbench gives the rows the wider half and the chart the
   rest, both on one height, and the configuration opens as one row of three
   groups rather than a column. */
@media (width > 1024px) {
	.bt-workbench {
		grid-template-columns: minmax(0, 1.15fr) minmax(var(--chart-min-width), 1fr);
		grid-template-rows: minmax(0, 1fr);

		/* The workbench takes the page's free height, so the chart is as tall as
		   the viewport allows; a drag on the seam replaces that with the stored
		   size. */
		height: var(--bt-chart-height, calc(var(--viewport-h) - var(--bt-run-chrome)));
	}

	/* The row owns the height, so both panes take it and scroll inside it. */
	.bt-results {
		height: 100%;
		max-height: none;
		min-height: 0;
	}

	.bt-chart {
		height: 100%;
		min-height: 0;
	}

	.bt-controls {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		align-items: start;
		gap: var(--space-lg);
	}

	.bt-controls__head {
		grid-column: 1 / -1;
	}
}

/* intentional breakpoint: the redesign's phone edge (600px, not the 480 phone token) */
@media (width <= 600px) {
	/* One column with the results as cards. The configuration is a full-screen
	   sheet opened from the run bar; the run controls and the status are
	   pinned to the bottom of the viewport. The page reserves room for them so
	   the last card is never under the bar. */
	.bt-layout {
		padding-bottom: calc(var(--touch-min) * 2 + var(--space-lg));
	}

	#bt-config-toggle {
		min-height: var(--touch-min);
		min-width: var(--touch-min);
	}

	.bt-actionbar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: var(--z-5);
		display: flex;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: var(--space-xs);
		margin-left: 0;
		padding: var(--space-sm) var(--space-md) calc(var(--space-sm) + var(--safe-b));
		background: var(--bg-surface);
		border-top: 1px solid var(--border);
	}

	.bt-status {
		justify-content: flex-start;
		font-size: var(--font-sm);
	}

	.bt-actions {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: var(--space-xs);
	}

	.bt-actions .btn {
		width: 100%;
		min-height: var(--touch-min);
		padding: 0 var(--space-xs);
	}

	/* The configuration sheet covers the page and sits above the run bar. */
	.bt-controls {
		position: fixed;
		inset: 0;
		z-index: var(--z-50);
		overflow-y: auto;

		/* The floating nav toggle sits in the top-left corner above the sheet, so
		   the sheet's own head starts clear of it. */
		padding: calc(var(--nav-float-size) + var(--space-md)) var(--space-md) var(--space-md);
		border: 0;
		border-radius: 0;
	}

	.bt-controls .btn,
	.bt-controls .input-field,
	.bt-controls .select-field,
	.bt-controls .modal-input,
	.bt-controls .filter-textarea {
		min-height: var(--touch-min);
	}

	.bt-group__fields,
	.bt-group__fields--universe {
		grid-template-columns: minmax(0, 1fr);
	}

	/* The results are cards: symbol and signal on the first line, price and time
	   on the second, the four volume metrics on the third. The table header is
	   gone, so each metric carries its own label (data-label). */
	.bt-results {
		max-height: none;
		overflow: visible;
		border: 0;
	}

	.bt-results-table,
	.bt-results-table tbody {
		display: block;
		width: 100%;
	}

	.bt-results-table thead {
		display: none;
	}

	.bt-sort-by {
		display: flex;
		align-items: center;
		gap: var(--space-sm);
		margin-bottom: var(--space-sm);
	}

	.bt-sort-by__label {
		font-size: 0.8125rem;
		color: var(--text-muted, inherit);
	}

	.bt-results-table tbody tr.bt-row {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		grid-template-areas: "sym sym sig sig" "price price time time" "dv dvp v5 v5p";
		gap: var(--space-xs) var(--space-sm);
		min-height: var(--touch-min);
		margin-bottom: var(--space-sm);
		padding: var(--space-sm) var(--space-md);
		background: var(--bg-surface);
		border: 1px solid var(--border);
		border-radius: var(--radius-xl);
	}

	.bt-results-table tbody tr.bt-row--active {
		border-color: var(--accent);
	}

	.bt-results-table tbody tr.bt-row td {
		display: block;
		min-width: 0;
		padding: 0;
		border: 0;
		text-align: left;
		white-space: normal;
		overflow-wrap: anywhere;
	}

	.bt-results-table tbody tr.bt-row td[data-label]::before {
		content: attr(data-label);
		display: block;
		font-size: var(--font-xxs);
		color: var(--text-muted);
		text-transform: uppercase;
		letter-spacing: 0.05em;
	}

	.bt-col--symbol {
		grid-area: sym;
		font-weight: 600;
	}

	.bt-col--signal {
		grid-area: sig;
		text-align: right;
	}

	.bt-col--price {
		grid-area: price;
	}

	.bt-col--time {
		grid-area: time;
		text-align: right;
		color: var(--text-muted);
	}

	.bt-col--dvol {
		grid-area: dv;
	}

	.bt-col--dvol-pct {
		grid-area: dvp;
	}

	.bt-col--v5 {
		grid-area: v5;
	}

	.bt-col--v5-pct {
		grid-area: v5p;
	}

	.bt-results-table .bt-empty-row,
	.bt-results-table .bt-empty-row td {
		display: block;
	}

	/* The chart is a full-screen sheet opened by a card. Close hides it again;
	   the card is kept, so opening another one is instant. */
	.bt-chart {
		display: none;
	}

	.bt-chart--open {
		display: flex;
		flex-direction: column;
		position: fixed;
		inset: 0;
		z-index: var(--z-50);
		height: auto;
		padding: var(--space-sm) var(--space-sm) calc(var(--space-sm) + var(--safe-b));
		background: var(--bg-surface);
	}

	.bt-chart__close {
		display: block;
		align-self: flex-end;
		min-height: var(--touch-min);
		margin-bottom: var(--space-xs);
	}

	.bt-chart--open stock-chart-card {
		flex: 1 1 0;
		min-height: 0;
		height: auto;
	}

	.bt-chart--open > .panel-resize-handle--row {
		display: none;
	}

	.backtest-tabs .btn,
	[id^="backtest-tab-btn-"] {
		min-height: var(--touch-min);
	}
}