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
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
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
/* Google Fonts β€” single source of truth for the whole app's font stack.
   Barlow Condensed (headings via --font-heading), Inter (body via --font-sans),
   JetBrains Mono (Level 2 tape via --l2-font-mono). Pages no longer carry
   their own <link>; loading common.css loads the fonts. */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@700;900&family=Inter:wght@400;600;700&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* Breakpoint tokens (static/CONVENTIONS.md, "Breakpoint tokens").
   A custom property cannot appear inside @media, so the widths are literal
   numbers and this block is the one place they are named:
     --bp-phone:   480px   @media (width <= 480px)
     --bp-tablet:  768px   @media (width <= 768px)
   New and touched media queries use only these two widths. The other legacy
   widths (600, 640, 900, 1024, ...) stay until the rule that carries them is
   rewritten. */

/* stylelint-disable color-no-hex -- this is the token definition block itself */
:root {
	/* ── Colors: TradingView Dark Theme
	   Paleta exactamente de TradingView
	*/

	/* Accent - TV style.

	   Three colours have six live names. Every duplicate below is now an
	   ALIAS rather than a second hex, so there is one value per colour and a
	   reader can see that --danger and --negative cannot drift apart:
	     #d1d4dc  --accent  --primary  --text  --text-primary
	     #089981  --positive  --success
	     #f23645  --negative  --danger
	   The alias pairs are the TradingView spellings kept for the chart library
	   and for the older call sites; --success-hover / --danger-hover keep their
	   own values because a hover is a different colour, not an alias. */
	--primary:       var(--accent);
	--primary-hover: #e1e3e8;
	--secondary:     #787b86;
	--secondary-hover: #9a9ea6;
	--danger:        var(--negative);
	--danger-hover:  #f65b68;
	--success:       #065f46;
	--success-hover: #0ab08f;
	--warning:       #a65b00;
	--warning-rgb:   240 185 11;
	--chart-marker: #fff;
	--premarket-band: rgb(255 187 0 / 8%);

	/* Drawing-tool chrome. The horizontal line, the trend line and the
	   selected-drawing highlight used to borrow --info, --corporate and
	   --warning, and the last two are #f59e0b against #f0b90b: one shade apart,
	   so selecting an amber trend line left it looking unselected. Tool chrome
	   gets its own three colours here; no semantic token changes, and the
	   semantic tokens keep every non-drawing use they already had. */
	--draw-hline: #2962ff;
	--draw-trend: #f59e0b;
	--draw-selected: #22d3ee;
	--postmarket-band: rgb(41 98 255 / 8%);
	--warning-text:  #d97706;  /* darker amber for text on dark bg (vs. bright --warning used for accents) */

	/* ── The ambers, and which one you want ─────────────────────────────────
	   Four amber tokens with no selection rule is how --corporate ended up
	   holding Tailwind's amber-500 (#f59e0b) in a TradingView palette:
	     --warning      #f0b90b  a FILLED amber (badge fill, chart marker)
	     --warning-text #d97706  amber TEXT on a dark surface
	     --catalyst     #e3b341  an event that is news before it is a trade
	     --corporate    deleted: #f59e0b, one shade from --warning, with one
	                          reader (a corporate-action highlight) whose meaning
	                          is --catalyst. --corporate-rgb had no reader at all.
	   --draw-trend keeps #f59e0b: that one IS a drawing tool's own colour and
	   the reason it exists is to NOT look like --warning. */
	--info:          #2962ff;

	/* Surfaces - TV dark palette */
	--bg:            #0e0f15;
	--bg-elevated:   #191a24;
	--bg-secondary:  #232432;
	--bg-tertiary:   #232432;
	--bg-input:      #191a24;
	--surface:       #191a24;
	--bg-surface:    var(--surface);
	--surface-raised: #232432;
	--bg-primary:    var(--bg-elevated);

	/* Text - research palette */
	--text:          #e6e6ea;
	--text-primary:  var(--text);
	--text-secondary: #93939e;

	/* Borders - research palette */
	--border:        #2e2f41;

	/* A focus ring is a non-text indicator: WCAG 2.1 SC 1.4.11 asks 3:1
	   against the adjacent colour. At #3d3d52 it measured 1.81:1 on --bg,
	   so a keyboard user could not see where the ring was. #6b6b8a is
	   3.73:1 -- above the floor, still native to the border family. */
	--border-focus:  #6b6b8a;

	/* Muted is the tier most text actually lands on, and it sits on cards as
	   often as on the page: at #828694 it read 4.38:1 on --surface. Lifted to
	   the nearest value that clears 4.5:1 on all four dark surfaces (5.92 /
	   5.25 / 4.75 / 4.72). --text-dim stays below it β€” dim is for axis
	   labels and placeholder meta, and its own debt row in check-contrast.py
	   is where that finding is tracked. */
	--text-muted:    #9094a2;
	--text-dim:      #88909c;
	--text-disabled: #363a45;

	/* Borders - TV subtle (unified to research palette) */

	/* Semantic colors - TV bright */
	--accent:        #e6e6ea;
	--positive:      #55c465;
	--positive-rgb:  85 196 101;
	--negative:      #e15447;
	--negative-rgb:  225 84 71;
	--catalyst:      #e3b341;
	--catalyst-rgb:  227 179 65;
	--black:         #000;
	--black-rgb:     0 0 0;

	/* Ink for text sitting on a solid fill. --on-accent is the one owner:
	   --on-primary, --on-success and --l2-bg-contrast used to spell the same
	   #131722, which is how a fifth name (--text-on-accent, P0.1) managed to
	   look plausible. --on-danger is the same ink and always was a bad
	   default: white on --danger measured 3.90:1 while this reads 4.59:1.
	   The light island below re-declares it white, because its --danger is
	   dark and white is the only ink that reaches AA there. */
	--on-accent:     #131722;
	--on-danger:     #131722;

	/* Status text ON a status tint. The fill above stays at the TradingView
	   value the chart palette is built on; at 12% over a card that green
	   reads 3.86:1, under AA for the 12px type .badge uses. These are the
	   same hues lifted until they clear 4.5:1 on every surface a tint can
	   land on, at the 12% resting tint AND the 20% a hover deepens it to
	   (.reversal-btn.active:hover and its neighbours) β€” worst case 4.6. */
	--positive-text: #0abc9e;
	--negative-text: #f67c85;
	--info-text:     #789dff;

	/* Semantic backgrounds - TV style */
	--positive-bg:   rgb(8 153 129 / 12%);
	--negative-bg:   rgb(243 54 69 / 12%);
	--warning-bg:    rgb(240 185 11 / 12%);
	--catalyst-bg:   rgb(227 179 65 / 13%);
	--info-bg:       rgb(41 98 255 / 12%);
	--accent-bg:     rgb(209 212 220 / 6%);

	/* ── Border radius ── */
	--radius-sm: 2px;
	--radius-md: 4px;
	--radius-lg: 6px;
	--radius-xl: 8px;
	--radius-none: 0;
	--radius-round: 50%;

	/* ── Spacing ── */
	--touch-target-size: 36px; /* dense touch target: the compact minimum on phones */
	--aside-width: 380px; /* a side panel next to the main column */
	--chart-stage-height: 420px; /* a chart card that stands alone in a column */
	--space-2xs: 2px;
	--space-xs:  4px;
	--space-xs-plus: 6px;
	--space-sm-plus: 12px;
	--space-sm:  8px;
	--space-md:  16px;
	--space-lg:  24px;
	--space-xl:  32px;
	--space-xxl: 48px;

	/* ── Font scale ── */
	--font-xs:   0.6875rem;
	--font-xxs:  0.625rem; /* 10px β€” micro labels */
	--font-sm:   0.75rem;
	--font-md:   0.8125rem;
	--font-lg:   0.9375rem;
	--font-xl:   1.0625rem;
	--font-xxl:  1.25rem;
	--font-xxxl: 1.5rem;
	--font-display: 1.75rem; /* off-scale display size, Wave 4.3 */
	--font-hero: 2.25rem; /* off-scale hero size, Wave 4.3 */

	/* 14px, the one step the scale has no name for: --font-md is 13 and
	   --font-lg is 15. Named for its first two readers, the "x" on a tab close
	   and on a filter row (.analyze-tab-close, .filter-remove); the third is
	   the phone-layout P&L chip in the trades calendar, which bumps to 14px for
	   legibility in a full-width row and owes the scale a step of its own
	   (Wave 4.3). It was called --font-base, which is a misnomer twice over:
	   nothing in this app sets a base font size, so the real base is 16px. */
	--font-icon: 0.875rem;

	/* ── Z-Index Scale ──
	   One owner per layer, documented so a new z-index can be placed
	   instead of invented. Pick the row that matches the element's ROLE,
	   never a number between rows.

	   | Capa  | Token                | Elementos                                          |
	   |-------|----------------------|----------------------------------------------------|
	   | 1     | --z-1                | thead sticky, celdas fijas de tabla                |
	   | 2     | --z-2                | leyenda de chart (session label / ohlc)            |
	   | 5     | --z-5                | resize handle, hijos flotantes de panel docked    |
	   | 10    | --z-10               | botΓ³n de fullscreen chart, botones de panel docked |
	   | 50    | --z-50               | scrim de panel overlay de chart, bottom-sheet      |
	   | 100   | --z-100              | sheet de trades, popovers de chart                 |
	   | 199   | --z-199              | (reservado, sin owner hoy                          |
	   | 200   | --z-200              | scrim del drawer de navegaciΓ³n                     |
	   | 500   | --z-500              | sidebar de navegaciΓ³n                             |
	   | 1000  | --z-1000             | modal overlay, alerts panel, fullscreen chart     |
	   | 1001  | calc(--z-1000 + 1)   | tooltip flotante                                  |
	   | 10000 | --z-max              | chat modal, diΓ‘logos flotantes                    |

	   Nota: el botΓ³n de menΓΊ flotante (#nav-toggle-float) NO vive en
	   --z-1000 β€” se bajΓ³ a --z-200 para que el modal sea owner del
	   corner superior izquierdo cuando estΓ‘ abierto. */
	--z-1:     1;
	--z-2:     2;
	--z-5:     5;
	--z-10:    10;
	--z-50:    50;
	--z-100:  100;
	--z-199:  199;
	--z-200:  200;
	--z-500:  500;
	--z-1000: 1000;
	--z-max:  10000;

	/* ── Transitions ── */

	/* The motion scale: five steps, nothing between them. A duration that is
	   not one of these is a decision nobody drew. Keyframe periods are NOT on
	   this scale β€” a loop's period is how often it repeats, not how long a
	   thing takes to move. */
	--transition-instant: 0.08s ease;
	--transition-fast:  0.1s ease;
	--transition-base:  0.15s ease;
	--transition-slow:  0.25s ease;
	--transition-slower: 0.4s ease;

	/* ── Fonts ── */
	--font-sans: inter, -apple-system, blinkmacsystemfont, "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
	--font-mono: "JetBrains Mono", "Consolas", "Lucida Console", "Monaco", monospace;
	--font-heading: "Barlow Condensed", var(--font-sans);

	/* ── Shadows ── */
	--shadow-sm: 0 1px 3px color-mix(in srgb, var(--black) 40%, transparent);
	--shadow-md: 0 4px 12px color-mix(in srgb, var(--black) 50%, transparent);
	--shadow-lg: 0 8px 24px color-mix(in srgb, var(--black) 60%, transparent);

	/* Named translucent tints (theme-independent alpha colours) */
	--scrim-60: rgb(0 0 0 / 60%);
	--scrim-25: rgb(0 0 0 / 25%);
	--shade-4: rgb(0 0 0 / 4%);
	--shade-7: rgb(0 0 0 / 7%);
	--shade-10: rgb(0 0 0 / 10%);
	--shade-14: rgb(0 0 0 / 14%);
	--ink-scrim-70: rgb(10 10 10 / 70%);
	--neutral-15: rgb(102 102 102 / 15%);
	--neutral-12: rgb(120 123 134 / 12%);
	--neutral-20: rgb(120 123 134 / 20%);
	--info-18: rgb(0 168 255 / 18%);
	--info-10: rgb(27 79 189 / 10%);
	--warning-18: rgb(255 193 7 / 18%);
	--warning-10: rgb(122 92 0 / 10%);
	--positive-10: rgb(10 106 82 / 10%);
	--negative-10: rgb(161 29 44 / 10%);

	/* ── Overlay scale ── white overlays on dark surfaces (hover / zebra / dividers) */
	--overlay-1: rgb(255 255 255 / 3%);
	--overlay-2: rgb(255 255 255 / 6%);
	--overlay-3: rgb(255 255 255 / 8%);
	--overlay-4: rgb(255 255 255 / 12%);

	/* Info channel for rgba() usage (matches --info #2962ff) */
	--info-rgb: 41 98 255;

	/* Glass surface for dialogs (matches --bg-elevated #1e222d at 0.85) */
	--glass-bg: rgb(30 34 45 / 85%);
	--glass-border: rgb(255 255 255 / 8%);

	/* ── Level 2 Trading Terminal tokens ──
	   Aliases of the global app tokens: the Level 2 / Time & Sales panel
	   shares the application's palette instead of carrying its own. */
	--l2-text: var(--text);
	--l2-bg: var(--bg-elevated);
	--l2-accent: var(--accent);
	--l2-accent-hover: var(--primary-hover);
	--l2-bid: var(--positive);
	--l2-ask: var(--negative);
	--l2-panel: var(--bg-elevated);
	--l2-panel-border: var(--border);
	--l2-border-width: 1px;

	/* Level 2 font stack: same mono as the rest of the app */
	--l2-font-mono: var(--font-mono);

	/* ── Layout tokens (panel widths, toolbar, chart, header) ── */
	--control-height: 26px;

	/* ── Inline SVG icons ──────────────────────────────────────────────────
	   One stroke for every inline icon, at either grid: 1.6 reads the same at
	   a 24px nav icon and an 11px chart-card one, which is why the tree had
	   four values for what is one decision. `stroke-width` is a presentation
	   ATTRIBUTE in the markup and an attribute cannot read a custom property,
	   so the rule that owns it is `svg[stroke="currentColor"]` below and the
	   attribute is simply absent. */
	--icon-stroke: 1.6;
	--icon-size: 20px; /* the CSS-sized 24-grid icons: nav links, toolbar buttons */
	--spinner-size: 24px; /* .spinner ring box */
	--nav-float-size: 44px; /* #nav-toggle-float: the touch minimum; the 20px glyph sits inside the padding */
	--panel-width-md: 380px;
	--panel-width-xl: 700px;
	--chart-min-width: 360px;

	/* Offset subtracted from 100dvh so .trades-layout fills the viewport's
	   free vertical space. Trades has no page header: only the page-wrapper's
	   top padding (space-sm = 8px) and bottom padding (space-xl = 32px). */
	--trades-layout-offset: 40px;
	--dash-card-min: 380px;
	--split-card-min: 400px;
	--split-card-min-mobile: 280px;
	--presets-card-min: 14em;

	/* ── Semantic height/width tokens (dashboard/backtest magic numbers) ── */
	--chart-height-default: 420px;
	--picker-list-height: 220px;

	/* ── Dialog widths: three sizes, no more. A dialog that does not fit one
	   of them needs its layout built to fit one of them; the two exceptions
	   (the risk calculator, the chat panel) carry the reason inline. ── */
	--dialog-width-sm: 480px;
	--dialog-width-md: 640px;
	--dialog-width-lg: 780px;

	/* ── Viewport ──
	   One place that knows how tall "the whole screen" is, so pages don't
	   each spell out the vh/dvh pair. The vh line is the fallback for
	   browsers without dvh. */
	--viewport-h: 100vh;
	/* stylelint-disable-next-line declaration-block-no-duplicate-custom-properties -- the vh line above IS the fallback; a browser without dvh drops this one and keeps it */
	--viewport-h: 100dvh;
	--safe-b: env(safe-area-inset-bottom, 0px);

	
	/* ── Touch ── */
	--touch-min: 44px;

	/* Floor for controls on tablet/phone widths: under the 44px touch target,
	   but well above the compact desktop size. */
	--touch-compact: 40px;

	/* The responsive audit's floor for a tap target (scripts/responsive-audit.mjs):
	   below the 44px touch minimum, but a target a thumb can still hit. Used
	   where a small glyph button or a sort header cannot take the full minimum. */
	--touch-floor: 28px;

	/* Phone height of the scan day chart (scan.css, width <= 480px). 40dvh put
	   the first results row at y=642 at 390x844, with the results header at
	   y=565; 36dvh brings the table header and the first six rows onto the
	   first screen. Measured during the mobile UI rebuild (MOB-16 step 2). */
	--scan-chart-phone-height: 36dvh;

	/* ── Shared control, tab and table geometry ──
	   One value per property. A component that needs a different size names
	   its own modifier and sets it from these tokens, never a literal. */
	--control-font-size: var(--font-sm);
	--tab-height: 28px;
	--tab-font-size: var(--font-sm);
	--toolbar-height: 36px;
	--page-title-size: var(--font-lg);
	--card-title-margin: var(--space-sm);

	/* Focus ring: one 2px ring and offset for every :focus-visible outline. */
	--focus-ring-width: 2px;
	--focus-ring-offset: 2px;

	/* ── Data density ── */
	--table-cell-pad-y: 6px;
	--table-cell-pad-x: var(--space-sm);
	--table-font-size: var(--font-sm);

	/* ── Native control theming ──
	   The app is dark end to end, but the UA form-control palette is light
	   unless the document opts in. Stated once here so the 28 number
	   inputs, the 10 date inputs, 7 radios, 4 checkboxes, 2 time inputs,
	   the file input and the scrollbars all render dark instead of each
	   stylesheet patching its own control. */
	color-scheme: dark;
	accent-color: var(--accent);
}
/* stylelint-enable color-no-hex */

* {
	box-sizing: border-box;
}

/* ── Native form-control surfaces ──────────────────
   The date picker glyph is the one control the UA still draws with its own
   light artwork on a dark field. Stated once for every date input instead
   of the single stylesheet that used to carry it.

   Number inputs keep their native steppers: the Backtest and Scanner PDF
   offset fields are stepped through them, and `color-scheme: dark` above is
   what themes them, so there is nothing to suppress. */
input[type="date"]::-webkit-calendar-picker-indicator {
	cursor: pointer;
}

body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	min-height: var(--viewport-h);
	line-height: 1.5;  /* Better readability */

	--sidebar-w: 56px;

	padding-left: var(--sidebar-w);

	/* The content offset and the sidebar it clears are the same measurement
	   in two places: --sidebar-w drives this padding-left and nav.main-nav's
	   width. The nav animates its width (below), so without a matching
	   transition here the two disagree for the length of the animation and
	   the sidebar's right edge sweeps across the content. */
	transition: padding-left var(--transition-base);
}

/* dvh fallback for full-viewport elements */
@supports (height: 100dvh) {
	.modal-overlay { height: 100dvh; }
}

.container {
	width: 100%;
	max-width: 1600px;
	margin: 0 auto;
	padding: 0 var(--space-md);
}

.page-wrapper {
	max-width: 1600px;
	margin: 0 auto;
	width: 100%;
	padding: var(--space-sm) var(--space-md) var(--space-xl);
}

/* ── Vertical Sidebar ────────────────────────────────
   Fixed on the left edge, full height. Collapsed by default (icons only,
   56px) to maximize content width; toggled expanded (200px) via the hamburger.
   `--sidebar-w` lives on <body> so body-left padding and nav width stay in
   sync; .sidebar-expanded widens both. */
body.sidebar-expanded {
	--sidebar-w: 200px;
}

nav.main-nav {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: var(--sidebar-w);
	display: flex;
	flex-direction: column;
	background: var(--bg);
	border-right: 1px solid var(--border);
	z-index: var(--z-500);

	/* Pairs with body's padding-left transition above: the two must animate
	   over the same duration or the seam is visible mid-toggle. */
	transition: width var(--transition-base);
	overflow: hidden;
}

/* Floating hamburger for mobile drawers β€” hidden on desktop */
#nav-toggle-float {
	display: none;
}

/* Sidebar toggle row + brand */
.sidebar-toggle-wrap {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	padding: var(--space-sm);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.nav-brand {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	white-space: nowrap;
	flex: 1;
	min-width: 0;
}

.nav-brand-mark {
	font-family: var(--font-heading);

	/* 900 is the one weight that stays: the heading face is Barlow
	   Condensed, loaded at 700 and 900 only, so this is a real cut of the
	   brand face rather than a stray in a 400/600/700 stack. */
	font-weight: 900;
	font-size: var(--font-xl);
	color: var(--accent);
	letter-spacing: 0.05em;
	white-space: nowrap;
}

.nav-brand-label {
	white-space: nowrap;
}

/* Nav links: vertical stack, flex to fill */
.nav-links {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	flex: 1;
	padding: var(--space-sm);
	overflow: hidden auto;
	scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

nav.main-nav a,
nav.main-nav .nav-search-btn {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	font-family: var(--font-sans);
	font-size: var(--font-sm);
	font-weight: 600;
	text-decoration: none;
	color: var(--text-muted);
	padding: var(--space-sm);
	border-radius: var(--radius-md);
	transition: all var(--transition-fast);
	white-space: nowrap;
	flex-shrink: 0;
	width: 100%;
	border: none;
	background: none;
	cursor: pointer;
}

nav.main-nav a:hover,
nav.main-nav .nav-search-btn:hover {
	color: var(--text);
	background: var(--border);
}

nav.main-nav a.active {
	background: var(--accent);
	color: var(--bg);
}

nav.main-nav a svg,
nav.main-nav .nav-search-btn svg {
	width: var(--icon-size);
	height: var(--icon-size);
	flex-shrink: 0;
}

/* The one place an inline icon's stroke is written. Scoped by the attribute
   every stroked icon already carries, so a filled icon (fill="currentColor",
   no stroke) is untouched and no class has to be invented. The chart-card
   shadow root repeats this rule inside its own scope β€” a shadow tree does not
   inherit the document's selectors, only its variables. */
svg[stroke="currentColor"] {
	stroke-width: var(--icon-stroke);
}

/* Labels: hidden while collapsed, shown when expanded */
.nav-label,
.nav-brand-label {
	font-size: var(--font-sm);
	font-weight: 600;
	white-space: nowrap;
	transition: opacity var(--transition-fast);
}

body:not(.sidebar-expanded) .nav-label,
body:not(.sidebar-expanded) .nav-brand-label {
	display: none;
}

body:not(.sidebar-expanded) .nav-brand {
	display: none;
}

/* Watchlist badge in nav β€” hidden by default, shown only with .has-items */
nav.main-nav a .nav-badge {
	display: none;
}

nav.main-nav a .nav-badge.has-items {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	margin-left: var(--space-xs);
	border-radius: var(--radius-round);
	background: var(--accent);
	color: var(--bg);
	font-size: var(--font-xs);
	font-weight: 700;
	line-height: 1;
	vertical-align: middle;
}

nav.main-nav a.active .nav-badge.has-items {
	background: var(--bg);
	color: var(--accent);
}

nav.main-nav .nav-actions {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	padding: var(--space-sm);
	border-top: 1px solid var(--border);
	flex-shrink: 0;
}

nav.main-nav .nav-toggle {
	display: flex;
	background: none;
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	padding: var(--space-sm);
	border-radius: var(--radius-md);
	transition: all var(--transition-fast);
	flex-shrink: 0;
}

nav.main-nav .nav-toggle:hover {
	color: var(--text);
	background: var(--border);
}

nav.main-nav .nav-toggle svg {
	width: var(--icon-size);
	height: var(--icon-size);
	display: block;
}

.control-panel {
	/* Surface from .surface (this file); the rule owns the panel's spacing. */
	padding: var(--space-md);
	margin-bottom: var(--space-md);
}

/* Control Panel Modifiers (BEM-lite) */
.control-panel--compact {
	padding: var(--space-sm);
	margin-bottom: var(--space-sm);
}

/* Unified Control Panel BEM Structure */
.control-panel__main {
	display: flex;
	gap: var(--space-sm);
	flex-wrap: wrap;
	align-items: center;
	position: relative;
}

.control-panel__secondary {
	display: flex;
	gap: var(--space-sm);
	flex-wrap: wrap;
	align-items: center;
	padding-top: var(--space-sm);
	margin-top: var(--space-sm);
	border-top: 1px solid var(--border);
}

.control-panel__secondary.hidden {
	display: none;
}

.control-panel__toggle {
	background: transparent;
	border: 1px solid var(--border);
	color: var(--text-muted);
	padding: var(--space-2xs) var(--space-sm);
	font-size: var(--font-xs);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all var(--transition-fast);
	margin-left: auto;
}

.control-panel__toggle:hover {
	border-color: var(--accent);
	color: var(--text);
}

.control-panel__toggle.active {
	background: var(--accent);
	color: var(--bg);
	border-color: var(--accent);
}

/* ── Panel resize seams (shared by every page) ─────────────────────────
   The drag handle a `features/shared/splitter.ts` binding rides on: a 10px
   hit area over a 1px rule that only appears on hover, drag or focus.
   Positioning stays per page β€” the seam sits wherever that page's layout
   puts it (the splitter's size variable is the one offset both the panel
   and the handle read). `--resize-offset` is the shared offset hook: when
   a page sets it, the handle rides that distance from the container's
   edge; when it is absent or invalid, `auto` leaves the handle at its
   static position, which is what a seam that has not been dragged yet
   needs. */
.panel-resize-handle {
	position: absolute;
	inset-block: 0;
	width: 10px;
	margin-left: -5px;
	cursor: col-resize;
	touch-action: none;
	z-index: var(--z-10);
}

.panel-resize-handle::after {
	content: "";
	position: absolute;
	inset-block: 0;
	left: 50%;
	width: 1px;
	margin-left: -0.5px;
	background: var(--border);
	opacity: 0;
	transition: opacity var(--transition-base);
}

/* The row-seam twin of the handle above: same affordance, riding a
   horizontal seam. One class with the axis flipped, so the visual contract
   (10px of grab area, touch-action off, a focus ring) cannot drift. */
.panel-resize-handle--row {
	inset-block: auto;
	inset-inline: 0;
	top: var(--resize-offset, auto);
	width: auto;
	height: 10px;
	margin-left: 0;
	margin-top: -5px;
	cursor: row-resize;
}

.panel-resize-handle--row::after {
	inset-block: auto;
	inset-inline: 0;
	top: 50%;
	left: 0;
	width: auto;
	height: 1px;
	margin-left: 0;
	margin-top: -0.5px;
}

.panel-resize-handle:hover::after,
.panel-resize-handle.dragging::after,
.panel-resize-handle:focus-visible::after {
	background: var(--accent);
	opacity: 1;
}

.panel-resize-handle:focus-visible {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: -2px;
}

.input-row,
.filter-row,
.action-row {
	display: flex;
	gap: var(--space-sm);
	flex-wrap: wrap;
	align-items: center;
}

.input-row > *,
.filter-row > *,
.action-row > * {
	flex-shrink: 0;
}

.input-group {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.input-label {
	font-family: var(--font-sans);
	font-size: var(--font-xs);
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

.input-field,
.select-field,
.filter-textarea,
.modal-input {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	font-family: var(--font-sans);
	font-size: var(--control-font-size);
	color: var(--text);
	transition: border-color var(--transition-fast);
	min-width: 150px;
}

.filter-textarea,
.modal-input {
	padding: var(--space-sm) var(--space-md);
}

/* One control height for the single-line fields: the text centres in it. */
.input-field,
.select-field {
	height: var(--control-height);
	padding: 0 var(--space-md);
}

/* The compact geometry (filter rows, inline selectors, toolbar fields), so a
   page that wants a short field asks for it instead of writing padding. */
.input-field--sm,
.select-field--sm {
	height: var(--control-height);
	padding: 0 var(--space-sm);
}

.modal-input--sm {
	padding: var(--space-xs) var(--space-sm);
	font-size: var(--control-font-size);
}

.input-field--upper {
	text-transform: uppercase;
}

.input-field:focus,
.select-field:focus,
.filter-textarea:focus,
.modal-input:focus {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
	border-color: var(--accent);
}

.input-field::placeholder,
.filter-textarea::placeholder,
.modal-input::placeholder {
	color: var(--text-muted);
	opacity: 0.5;
}

.filter-textarea {
	flex: 1;
	min-height: var(--touch-min);
	max-height: 150px;
	resize: vertical;
}

/* One height and one font size for every button; .btn is the only button shape. */
.btn {
	font-family: var(--font-sans);
	font-weight: 600;
	font-size: var(--control-font-size);
	height: var(--control-height);
	padding: 0 var(--space-md);
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	cursor: pointer;
	transition: all var(--transition-fast);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	white-space: nowrap;
	background: var(--bg);
	color: var(--text);
}

.btn:hover {
	background: var(--border);
	color: var(--text);
}

.btn:active {
	transform: scale(0.98);
}

.btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.btn-primary {
	background: var(--primary);
	color: var(--bg);
	border-color: var(--primary);
}

.btn-primary:hover {
	background: var(--primary-hover);
	border-color: var(--primary-hover);
}

.btn-secondary {
	background: var(--bg-elevated);
	color: var(--secondary);
	border-color: var(--border);
}

.btn-secondary:hover {
	background: var(--border);
	color: var(--text);
}

.btn-danger {
	background: var(--danger);
	color: var(--bg);
	border-color: var(--danger);
}

.btn-danger:hover {
	background: var(--danger-hover);
	border-color: var(--danger-hover);
}

/* ── Icon button (unified β€” was duplicated per-page in dashboard.css/backtest.css) ── */
.btn-icon {
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	cursor: pointer;
	line-height: 1;
	color: var(--text-secondary);
	transition: all var(--transition-fast);
}

.btn-icon:hover {
	background: var(--bg-input);
	color: var(--text-primary);
}

.tf-selector {
	display: flex;
	gap: var(--space-xs);
	background: var(--bg);
	padding: var(--space-xs);
	border-radius: var(--radius-md);
}

@media (width <= 768px) {
	.tf-selector {
		overflow-x: auto;
		scrollbar-width: none;
		flex-wrap: nowrap;
	}
	.tf-selector::-webkit-scrollbar { display: none; }

	.tf-selector .tf-btn {
		flex-shrink: 0;
	}
}

/* Segment buttons share the tab height, font and padding; the bordered
   strip is the only thing that tells them apart from .tab. */
.tf-selector .tf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--tab-height);
	font-family: var(--font-sans);
	background: var(--bg);
	border: 1px solid var(--border);
	color: var(--text-muted);
	padding: 0 var(--space-md);
	font-size: var(--tab-font-size);
	font-weight: 600;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all var(--transition-base);
}

.tf-selector .tf-btn:hover {
	border-color: var(--accent);
	color: var(--text);
}

.tf-selector .tf-btn.active {
	background: var(--accent);
	color: var(--bg);
	border-color: var(--accent);
}

.view-toggle {
	display: flex;
	gap: var(--space-2xs);
	background: var(--bg);
	padding: var(--space-2xs);
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
}

.view-toggle .view-btn {
	font-family: var(--font-sans);
	background: transparent;
	border: none;
	color: var(--text-muted);
	min-height: var(--control-height);
	padding: 0 var(--space-sm);
	font-size: var(--font-xs);
	font-weight: 600;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all var(--transition-base);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.view-toggle .view-btn:hover {
	color: var(--text);
}

.view-toggle .view-btn.active {
	background: var(--accent);
	color: var(--bg);
}

/* ── Tab bars: .tabs / .tab / .tab--active ──────────────────────────────────
   One tab button for the whole app. The row is `.tabs` and it scrolls when
   its tabs do not fit (eleven At Risk tabs overflow any phone), so the page
   never has to. Everything else about a tab bar β€” where it sits, whether it
   carries a border-bottom, how wide the pane below it is β€” stays the page's;
   only the button is shared. A page that needs a different button wants a
   different component, not a fifth spelling of this one. */
.tabs {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	min-width: 0;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
}

/* In a control panel the tab row takes the free width and scrolls, so the
   action beside it (Refresh) stays on the same line instead of wrapping. */
.control-panel__main > .tabs {
	flex: 1 1 0;
}

.tabs::-webkit-scrollbar {
	display: none;
}

.tab {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	min-height: var(--tab-height);
	scroll-snap-align: center;
	font-family: var(--font-sans);
	font-size: var(--tab-font-size);
	font-weight: 600;
	background: transparent;
	border: 0;
	border-radius: var(--radius-sm);
	color: var(--text-secondary);
	padding: 0 var(--space-md);
	white-space: nowrap;
	cursor: pointer;
	transition: background var(--transition-fast),
		color var(--transition-fast);
}

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

/* The selected chip every other selector in the tree already uses (nav
   a.active, .control-panel__toggle.active, .tf-btn.active): accent surface,
   background-coloured text for the contrast. */
.tab--active,
.tab--active:hover {
	background: var(--accent);
	color: var(--bg);
}

.results-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
	gap: var(--space-md);
}

.grid-layout {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
	gap: var(--space-md);
}

.list-layout {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);

	/* Was declared a second time ~1,700 lines down, in the horizontal-scroll
	   group. Both rules are one class with the same specificity, so the
	   split bought nothing and only let the two halves drift apart. */
	overflow-x: auto;
}

.status {
	font-family: var(--font-sans);
	font-size: var(--font-sm);
	color: var(--text-muted);
	padding: var(--space-lg);
	text-align: center;
}

/* ── State cards: .state + one variant ─────────────────────────────────────
   The one box for "nothing is here yet", "still fetching" and "that failed".
   Only three variants, deliberately: a fourth state means a component that
   happened to arrive in this shape, and it should keep its own class.

   `.status-empty` / `.status-loading` / `.status-error` are the same rule:
   discover-page.ts is PROTECTED and still writes them. Delete the aliases
   when that file is released. */
.state,
.status-empty,
.status-loading,
.status-error {
	padding: var(--space-xl) var(--space-md);
	text-align: center;
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	background: var(--bg-elevated);
	color: var(--text-muted);
	font-size: var(--font-sm);
}

.state--loading,
.state--empty {
	color: var(--text-muted);
}

.state--error,
.status-error {
	color: var(--negative);
	border-color: var(--negative);
}

.state--spaced {
	margin: var(--space-md) 0;
}

/* Generic loading/error placeholders (promoted from reverse-splits page) */
.loading-state {
	text-align: center;
	padding: var(--space-xxl) var(--space-md);
	color: var(--text-muted);
	font-size: var(--font-md);
}

.card-title {
	font-weight: 600;
	font-size: var(--font-lg);
	margin-bottom: var(--card-title-margin);
}

.card-subtitle {
	font-family: var(--font-sans);
	font-size: var(--font-xs);
	color: var(--text-muted);
}

.metric-label {
	font-family: var(--font-sans);
	font-size: var(--font-xs);
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
	margin-bottom: var(--space-xs);
}

.metric-value {
	font-family: var(--font-sans);
	font-size: var(--font-md);
	font-weight: 700;
	color: var(--text);
}

.metric-value.positive {
	color: var(--positive);
}

.metric-value.negative {
	color: var(--negative);
}

.metric-value.accent {
	color: var(--accent);
}

.badge {
	display: inline-block;
	padding: 3px var(--space-sm);
	border-radius: var(--radius-md);
	font-size: var(--font-sm);
	font-weight: 600;
	text-transform: uppercase;
}

/* The tier modifiers are the whole contract: geometry lives on `.badge`, a
   modifier carries colour and nothing else. `--sm` is the only size variant,
   for the families whose chips were a step smaller than the default. */
.badge--sm {
	padding: var(--space-2xs) var(--space-sm);
	font-size: var(--font-xs);
}

.badge--positive {
	background: var(--positive-bg);
	color: var(--positive-text);
}

.badge--negative {
	background: var(--negative-bg);
	color: var(--negative-text);
}

.badge--neutral {
	background: var(--neutral-15);
	color: var(--text-muted);
}

.badge--info {
	background: var(--info-bg);
	color: var(--info-text);
}

/* Symbol flags β€” emoji badges rendered next to a symbol. */
.symbol-flag {
	display: inline-block;
	margin-left: var(--space-xs);
	font-size: var(--font-sm);
	cursor: help;
}

.symbol-flag-more {
	color: var(--text-muted);
	font-weight: 600;
}

.modal-overlay {
	position: fixed;
	inset: 0;
	background: color-mix(in srgb, var(--black) 80%, transparent);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: var(--z-1000);
}

.modal-overlay.hidden {
	display: none;
}

body.modal-open {
	overflow: hidden;
}

.modal-content {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: var(--space-lg);
	width: var(--dialog-width-sm);
	max-width: 95vw;
	max-height: 85vh;
	max-height: 85dvh;
	overflow-y: auto;
}

/* The width belongs here, not on a page's own dialog class: a dialog that
   picks its width by hand is how 350/420/520/560/640/780/980 got into the
   tree in the first place. sm is the default, so only the other two are
   opt-in. */
.modal-content--md {
	width: var(--dialog-width-md);
}

.modal-content--lg {
	width: var(--dialog-width-lg);
}

/* Symbol Flags dialog β€” list view management */
.symbol-flags-dialog {
	display: flex;
	flex-direction: column;
}

.symbol-flags-dialog__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--space-md);
}

.symbol-flags-dialog__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}

.symbol-flags-dialog__error {
	padding: var(--space-xl);
	text-align: center;
	color: var(--text-muted);
}

.symbol-flags-dialog__empty {
	padding: var(--space-xxl) var(--space-md);
	text-align: center;
}

.symbol-flags-dialog__empty p {
	color: var(--text-muted);
	margin-bottom: var(--space-md);
}

.symbol-flags-dialog__new-btn {
	margin: 0 auto;
}

.symbol-flags-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.symbol-flags-row {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	padding: var(--space-sm) 0;
	border-bottom: 1px solid var(--border);
}

.symbol-flags-row:last-child {
	border-bottom: none;
}

.symbol-flags-row__drag {
	width: 1.25em;
	height: 1.25em;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: grab;
	color: var(--text-dim);
	font-size: var(--font-sm);
	flex-shrink: 0;
}

.symbol-flags-row__move-btns {
	display: none;
	flex-direction: column;
	width: 1.25em;
	height: 1.25em;
	justify-content: center;
	gap: 0;
}

.symbol-flags-row__move-up,
.symbol-flags-row__move-down {
	width: 1.25em;
	height: 0.875em;
	padding: 0;
	font-size: var(--font-xs);
}

.symbol-flags-row__emoji {
	font-size: var(--font-lg);
	width: 1.5em;
	text-align: center;
	flex-shrink: 0;
}

.symbol-flags-row__name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.symbol-flags-row__summary {
	color: var(--text-muted);
	font-size: var(--font-sm);
	min-width: 100px;
	text-align: right;
	flex-shrink: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.symbol-flags-toggle {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-round);
	width: 52px;
	height: var(--control-height);
	position: relative;
	background: var(--border);
	cursor: pointer;
	padding: 0;
	transition: all var(--transition-fast);
	flex-shrink: 0;
}

.symbol-flags-toggle--on {
	background: color-mix(in srgb, var(--positive) 20%, transparent);
	border-color: var(--positive);
}

.symbol-flags-toggle__track {
	position: absolute;
	top: 3px;
	left: 3px;
	width: var(--icon-size);
	height: var(--icon-size);
	border-radius: var(--radius-round);
	background: var(--text);
	transition: transform var(--transition-fast);
}

.symbol-flags-toggle--on .symbol-flags-toggle__track {
	/* A 26px slide distance, not a control height: --control-height has the same
	   value but names a control, so it is not reused here. */
	transform: translateX(26px);
}

.symbol-flags-toggle__label {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: var(--font-xxs);
	font-weight: 600;
	color: var(--text-dim);
}

.symbol-flags-toggle--on .symbol-flags-toggle__label {
	color: var(--positive);
}

.symbol-flags-row__actions {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	flex-shrink: 0;
}

.symbol-flags-row__edit,
.symbol-flags-row__duplicate,
.symbol-flags-row__delete {
	width: 1.5em;
	height: 1.5em;
	padding: 0;
	font-size: var(--font-sm);
}

.symbol-flags-row__confirm {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
}

.symbol-flags-row__confirm-text {
	color: var(--text-muted);
	font-size: var(--font-xs);
}

.symbol-flags-row__confirm-yes,
.symbol-flags-row__confirm-no {
	width: 1.75em;
	height: 1.5em;
	padding: 0;
	font-size: var(--font-xs);
}

.symbol-flags-row--drag-over {
	background: var(--overlay-2);
}

.symbol-flags-row--dragging {
	opacity: 0.5;
}

/* Narrow/touch: hide drag handle, show move buttons */
@media (width <= 768px) {
	.symbol-flags-row__drag {
		display: none;
	}

	.symbol-flags-row__move-btns {
		display: flex;
	}
}

/* Full-screen below dialog width */

/* Card-density scale: every content grid walks down one step at each of
   the 4 documented breakpoints (lg/md/sm/xs) so 1440β†’1280β†’1024β†’768β†’480
   stays homogeneous instead of each page inventing its own 1400/900/700/etc.
   Families that already use min(Npx,100%) own their own --*-card-min token;
   the generic fallback (.results-grid/.grid-layout) keeps its 340β†’320 steps
   as the lowest-density tier. */
@media (width <= 1400px) {
	.results-grid,
	.grid-layout {
		grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
	}
}

@media (width <= 1024px) {
	.dash-grid,
	.split-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(var(--dash-card-min), 100%), 1fr));
	}

	/* .action-row stacks a column earlier than the other two row patterns:
	   the buttons inside it are long enough that a row of them wraps into
	   an unreadable two-line mess on a tablet. It lives here, with the
	   class, instead of being re-declared in the page that first needed it. */
	.action-row {
		flex-direction: column;
		align-items: stretch;
	}
}

@media (width <= 768px) {
	.results-grid,
	.grid-layout {
		grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
	}

	.dash-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(var(--dash-card-min), 100%), 1fr));
	}

	.split-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(var(--split-card-min-mobile), 100%), 1fr));
	}

	.presets-panel {
		grid-template-columns: repeat(auto-fill, minmax(min(var(--presets-card-min), 100%), 1fr));
	}

	.input-row,
	.filter-row {
		flex-direction: column;
		align-items: stretch;
	}

	.input-row > *,
	.filter-row > * {
		flex-shrink: 1;
	}

	.input-field,
	.select-field,
	.modal-input {
		width: 100%;
	}

	.input-field,
	.modal-input {
		min-width: 0;
	}

	.inspector-metrics {
		grid-template-columns: repeat(2, 1fr);
	}

	.modal-content {
		width: 100%;
		max-width: 95vw;
		margin: 0 var(--space-sm);
	}

	/* Cards stacked instead of side-by-side */
	.split-charts {
		grid-template-columns: 1fr;
	}

	.split-charts stock-chart-card:first-child {
		border-right: none;
		border-bottom: 1px solid var(--border);
	}

	/* Mobile touch targets: controls meant to be tapped need β‰₯ ~36px
	   hit area. The compact paddings above are desktop-optimized. */
	.control-panel__toggle {
		padding: 7px var(--space-sm);
	}

	.unified-chart-action-btn {
		min-width: var(--toolbar-height);
		min-height: var(--toolbar-height);
		padding: var(--space-sm);
	}
}

/* intentional breakpoint: 640px matches the dialog full-screen spec */
@media (width <= 640px) {
	.modal-content--md.symbol-flags-dialog {
		width: 100vw;
		height: 100dvh;
		max-width: 100vw;
		max-height: 100dvh;
		margin: 0;
		border-radius: var(--radius-none);
	}
}

/* Symbol Flags dialog β€” editor view (compact) */
.symbol-flags-editor {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	padding-bottom: var(--space-sm);
}

.symbol-flags-editor__head {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.symbol-flags-editor__back {
	width: 1.75em;
	height: 1.75em;
	padding: 0;
	font-size: var(--font-md);
}

.symbol-flags-editor__heading {
	font-size: var(--font-md);
	font-weight: 600;
	color: var(--text);
}

.symbol-flags-editor__identity {
	display: flex;
	gap: var(--space-sm);
	align-items: flex-start;
}

.symbol-flags-editor__field {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	min-width: 0;
	flex: 1;
}

.symbol-flags-editor__field--emoji {
	position: relative;
	flex: 0 0 auto;
	min-width: 88px;
}

.symbol-flags-editor__emoji-control {
	display: flex;
	align-items: stretch;
	gap: 0;
}

.symbol-flags-editor__label {
	font-size: var(--font-xs);
	font-weight: 600;
	color: var(--text-muted);
}

.symbol-flags-editor__input,
.symbol-flags-editor__select {
	font-size: var(--font-md);
	padding: var(--space-xs) var(--space-sm);
}

.symbol-flags-editor__emoji-input {
	width: 2.8em;
	text-align: center;
	border-right: 0;
	border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.symbol-flags-editor__emoji-trigger {
	padding: 0 var(--space-xs-plus);
	font-size: var(--font-xs);
	line-height: 1;
	background: var(--bg);
	border: 1px solid var(--border);
	border-left: 0;
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
	color: var(--text-muted);
	cursor: pointer;
}

.symbol-flags-editor__emoji-trigger:hover,
.symbol-flags-editor__emoji-trigger[aria-expanded="true"] {
	color: var(--text);
	background: var(--overlay-1);
}

.symbol-flags-editor__emoji-picker {
	position: absolute;
	z-index: var(--z-100);
	top: calc(100% + var(--space-xs));
	left: 0;
	width: min(22rem, calc(100vw - var(--space-xl) - var(--space-xl)));
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
	overflow: hidden;
}

.symbol-flags-editor__emoji-picker.hidden {
	display: none !important;
}

.symbol-flags-editor__emoji-picker-element {
	display: block;
	width: 100%;
	height: 20rem;
	color-scheme: dark;

	--background: var(--bg-elevated);
	--border-color: var(--border);
	--border-radius: var(--radius-md);
	--button-active-background: var(--overlay-3);
	--button-hover-background: var(--overlay-2);
	--category-font-color: var(--text);
	--category-font-size: var(--font-sm);
	--emoji-padding: var(--space-xs);
	--emoji-size: var(--font-xxl);
	--indicator-color: var(--info);
	--input-border-color: var(--border);
	--input-border-radius: var(--radius-sm);
	--input-font-color: var(--text);
	--input-font-size: var(--font-sm);
	--input-placeholder-color: var(--text-muted);
	--outline-color: var(--border-focus);
	--skintone-border-radius: var(--radius-round);
}

.symbol-flags-editor__match {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-sm);
	border: none;
	margin: 0;
	padding: 0;
}

.symbol-flags-editor__radio {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	font-size: var(--font-sm);
	color: var(--text);
}

.symbol-flags-editor__hint,
.symbol-flags-editor__suffix,
.symbol-flags-editor__sep {
	font-size: var(--font-xs);
	color: var(--text-muted);
}

.symbol-flags-editor__rules {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: var(--space-sm);
}

.symbol-flags-editor__rule {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
}

.symbol-flags-editor__rule:not(:last-child) {
	border-bottom: 1px dashed var(--border);
	padding-bottom: var(--space-sm);
}

.symbol-flags-editor__rule-main {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-xs);
}

.symbol-flags-editor__rule-field {
	flex: 1;
	min-width: 8em;
}

.symbol-flags-editor__rule-remove {
	margin-left: auto;
	width: 1.5em;
	height: 1.5em;
	padding: 0;
	font-size: var(--font-sm);
}

.symbol-flags-editor__value,
.symbol-flags-editor__value-wrap,
.symbol-flags-editor__source-param {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
}

.symbol-flags-editor__value-input {
	width: 7em;
}

.symbol-flags-editor__value-input--list {
	width: 12em;
}

.symbol-flags-editor__days-input {
	width: 3.5em;
	text-align: center;
}

.symbol-flags-editor__rule-extra {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs);
}

.symbol-flags-editor__rule-extra:empty,
.symbol-flags-editor__chips:empty,
.symbol-flags-editor__preview-status:empty,
.symbol-flags-editor__preview-rows:empty,
.symbol-flags-editor__error:empty {
	display: none;
}

.symbol-flags-editor__rule-actions {
	display: flex;
	gap: var(--space-sm);
}

.symbol-flags-editor__template-input {
	font-size: var(--font-md);
	font-family: var(--font-sans);
	padding: var(--space-sm);
	min-height: 2.75em;
	max-height: 6em;
	width: 100%;
	box-sizing: border-box;
}

.symbol-flags-editor__chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs);
}

.symbol-flags-editor__chip {
	padding: var(--space-xs) var(--space-sm);
	font-size: var(--font-xs);
	line-height: 1;
	color: var(--text-muted);
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	transition: all var(--transition-fast);
}

.symbol-flags-editor__chip:hover {
	background: var(--overlay-2);
	color: var(--text);
}

.symbol-flags-editor__chip[aria-pressed="true"] {
	border-color: var(--accent);
	color: var(--text);
	background: var(--accent-bg);
}

.symbol-flags-editor__chip--placeholder {
	font-family: var(--font-mono);
}

.symbol-flags-editor__error {
	margin: 0;
	font-size: var(--font-xs);
	color: var(--danger);
}

.symbol-flags-editor__rule-error {
	padding-left: var(--space-sm);
}

.symbol-flags-editor__preview-head {
	font-size: var(--font-sm);
	font-weight: 600;
	color: var(--text-muted);
}

.symbol-flags-editor__preview-status {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
}

.symbol-flags-editor__preview-status-line {
	font-size: var(--font-xs);
	color: var(--text-muted);
}

.symbol-flags-editor__preview-status-line--error {
	color: var(--danger);
}

.symbol-flags-editor__preview-rows {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	font-size: var(--font-xs);
	color: var(--text-muted);
}

.symbol-flags-editor__preview-row {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	min-width: 0;
}

.symbol-flags-editor__preview-emoji {
	width: 1.5em;
	text-align: center;
	flex-shrink: 0;
}

.symbol-flags-editor__preview-body {
	display: flex;
	align-items: baseline;
	gap: var(--space-sm);
	flex: 1;
	min-width: 0;
}

.symbol-flags-editor__preview-symbol {
	font-weight: 600;
	color: var(--text);
	flex-shrink: 0;
}

.symbol-flags-editor__preview-tip {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}

.symbol-flags-editor__foot {
	display: flex;
	align-items: flex-start;
	gap: var(--space-sm);
	margin-top: var(--space-xs);
}

.symbol-flags-editor__form-error {
	flex: 1;
}

.symbol-flags-editor__actions {
	display: flex;
	gap: var(--space-sm);
	margin-left: auto;
}

.symbol-flags-editor__discard {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin-left: auto;
}

.symbol-flags-editor__discard-text {
	font-size: var(--font-sm);
	color: var(--text-muted);
}

@keyframes symbol-flags-row-flash {
	from {
		background-color: color-mix(in srgb, var(--accent) 22%, transparent);
	}

	to {
		background-color: transparent;
	}
}

.symbol-flags-row--highlighted {
	animation: symbol-flags-row-flash 1.8s ease 1;
	border-radius: var(--radius-sm);
}

/* Analyze Modal Styles β€” width comes from .modal-content--lg. */
.analyze-modal-content {
	max-width: 95vw;
	max-height: 85vh;
	max-height: 85dvh;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.analyze-modal-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}

/* Settings Modal β€” Data Sync panel in a dialog (gear icon in nav). It fits the
   default sm width, so it names no size. */
.settings-modal-content {
	max-width: 95vw;
	max-height: 85vh;
	max-height: 85dvh;
	display: flex;
	flex-direction: column;
}

.settings-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--space-md);
}

.settings-modal-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}

/* Sidebar sections in Settings: one row per section, a toggle and two movers. */
.nav-layout-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
}

.nav-layout-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	padding: var(--space-xs) var(--space-sm);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
}

.nav-layout-row__toggle {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	cursor: pointer;
}

.nav-layout-row__toggle input:disabled + span {
	color: var(--text-muted);
}

.nav-layout-row__move {
	display: flex;
	gap: var(--space-xs);
}

.nav-layout-row__move button {
	min-width: var(--control-height);
	min-height: var(--control-height);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text-secondary);
	cursor: pointer;
}

.nav-layout-row__move button:disabled {
	opacity: 0.4;
	cursor: default;
}

.settings-sync-status {
	display: flex;
	gap: var(--space-md);
	flex-wrap: wrap;
}

/* Notifications β€” same scroll shape as Settings, with a filing table and the
   global bankruptcy banner the poller raises. */
.notifications-modal-content {
	max-width: 95vw;
	max-height: 85vh;
	max-height: 85dvh;
	display: flex;
	flex-direction: column;
}

.notifications-status {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--space-xs) var(--space-sm);
	font-size: var(--font-xs);
}

.notifications-status__text {
	color: var(--text-muted);
}

/* The unread count reads as a state, not as a second sentence in the status
   line, so it cannot be lost inside the `Β·` join the old line used. */
.notifications-status__unread {
	padding: 0 var(--space-xs);
	border-radius: var(--radius-sm);
	background: color-mix(in srgb, var(--accent) 14%, transparent);
	color: var(--text-primary);
	font-weight: 600;
}

.notifications-status__unread--quiet {
	background: transparent;
	color: var(--text-muted);
	font-weight: 400;
}

.notifications-error {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-sm);
	margin-top: var(--space-sm);
	padding: var(--space-sm) var(--space-md);
	background: var(--negative-bg);
	border: 1px solid var(--negative);
	border-radius: var(--radius-md);
	color: var(--negative-text);
	font-size: var(--font-sm);
}

/* `.notifications-error` sets `display: flex`, which outranks the UA's
   `[hidden] { display: none }`; the hidden state has to be restated. */
.notifications-error[hidden] {
	display: none;
}

.notifications-error__text {
	flex: 1;
	min-width: 0;
}

.notifications-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	margin-top: var(--space-md);
}

.notifications-filters {
	justify-content: flex-end;
}

.notifications-prefs {
	flex-direction: column;
	align-items: stretch;
	width: 100%;
}

.notifications-prefs__group {
	width: 100%;
}

.notifications-table {
	width: 100%;
	table-layout: fixed;
}

.notifications-table .notification-cell--kind {
	width: 16%;
}

.notifications-table .notification-cell--symbol {
	width: 11%;
}

.notifications-table .notification-cell--date {
	width: 15%;
}

.notifications-table .notification-cell--actions {
	width: 14%;
}

.notification-row--unread {
	background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.notification-row__title {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.notification-row__meta {
	color: var(--text-muted);
	font-size: var(--font-xs);
}

.notification-row__read {
	font-size: var(--font-xs);
	white-space: nowrap;
}

/* Below the tablet width the four-column table does not fit a dialog capped
   at 95vw: the rows become stacked blocks instead of a horizontal scroller
   inside the modal. Explicit roles keep the table semantics across the
   display change. */
@media (width <= 768px) {
	.notifications-table,
	.notifications-table tbody {
		display: block;
	}

	.notifications-table thead {
		display: none;
	}

	.notifications-table tr {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"kind actions"
			"filing filing"
			"symbol date";
		gap: var(--space-xs) var(--space-sm);
		padding: var(--space-sm) 0;
		border-bottom: 1px solid var(--border);
	}

	.notifications-table tr:last-child {
		border-bottom: 0;
	}

	.notifications-table td {
		display: block;
		width: auto;
		padding: 0;
		border: 0;
	}

	.notification-cell--kind {
		grid-area: kind;
	}

	.notification-cell--filing {
		grid-area: filing;
	}

	.notification-cell--symbol {
		grid-area: symbol;
		align-self: center;
	}

	.notification-cell--date {
		grid-area: date;
		text-align: right;
	}

	.notification-cell--actions {
		grid-area: actions;
		justify-self: end;
	}

	.notifications-filters {
		justify-content: flex-start;
	}
}

.notification-banner {
	position: fixed;
	top: var(--space-lg);
	right: var(--space-lg);
	z-index: var(--z-500);
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	max-width: 90vw;
	padding: var(--space-md);
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-left: 3px solid var(--danger);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
}

.notification-banner__text {
	flex: 1;
	font-size: var(--font-sm);
	color: var(--text-primary);
}

@media (width <= 480px) {
	.notification-banner {
		inset: auto var(--space-md) var(--space-md);
		max-width: none;
	}
}

/* Geometry comes from .modal-input--sm; what is left here is what makes it an
   Analyze field β€” a symbol, so uppercase and tracked. The old radius-sm was
   the only radius in the tree outside the scale's --radius-md. */
.analyze-modal-input {
	flex: 1;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.analyze-modal-input:focus {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
	border-color: var(--accent);
}

.analyze-input-group {
	display: flex;
	gap: var(--space-xs);
	flex: 1;
}

.analyze-search-btn {
	padding: var(--space-xs-plus) var(--space-sm-plus);
	font-size: var(--font-sm);
	font-weight: 700;
	background: var(--accent);
	color: var(--bg);
	border: none;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all var(--transition-fast);
}

.analyze-search-btn:hover {
	filter: brightness(1.2);
}

.analyze-search-btn:active {
	transform: scale(0.95);
}

@media (width <= 768px) {
	.analyze-modal-content {
 		width: 100%;
 		max-height: var(--viewport-h);
 		border-radius: var(--radius-md);
 	}
}

.modal-title {
	font-size: var(--font-xl);
	font-weight: 600;
	margin-bottom: var(--space-md);
}

.flex {
	display: flex;
}

.text-dim {
	color: var(--text-muted);
}

.hidden {
	display: none !important;
}

/* ── Utility classes ── */
.u-flex-1        { flex: 1; }
.u-ml-auto       { margin-left: auto; }

.u-text-dim      {
	font-size: var(--font-sm);
	color: var(--text-dim);
	font-weight: 600;
}

.u-text-xs       {
	font-size: var(--font-xs);
	color: var(--text-muted);
}
.u-mb-xs         { margin-bottom: var(--space-xs); }
.u-mb-sm         { margin-bottom: var(--space-sm); }
.u-mb-md         { margin-bottom: var(--space-md); }
.u-mt-md         { margin-top: var(--space-md); }
.u-mt-xl         { margin-top: 2rem; }
.u-ml-sm         { margin-left: var(--space-sm); }
.u-pl-lg         { padding-left: var(--space-lg); }
.u-min-w-0       { min-width: 0; }
.u-min-line      { min-height: 1.5em; }
.u-m-0           { margin: 0; }
.u-cursor-pointer { cursor: pointer; }
.u-w-full        { width: 100%; }

/* Initial state for elements JS reveals with `el.style.display = …`. Not the
   `.hidden` class: that one is !important and would win over the reveal. */
.u-hidden        { display: none; }

.u-mono          { font-family: var(--font-mono); }

.u-text-sm       {
	font-size: var(--font-sm);
	color: var(--text-secondary);
}

.u-stack         {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

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

.u-progress-track {
	height: var(--space-sm);
	background: var(--bg);
	border-radius: var(--radius-md);
	overflow: hidden;
}

.u-progress-bar   {
	height: 100%;
	width: 0%;
	background: var(--accent);
	transition: width var(--transition-slow);
}

/* ── Symbol / Stock Link ── */
.symbol-link {
	color: var(--accent);
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
}

/* The surfaces that style the symbol under their own class (chart legend,
   chart symbol search, the calendar rows, the inspector header, the level2
   quote bar, the alert panel) now render a real anchor too, via
   shared/symbol-link.ts's `symbolActionHtml`. They keep their own class and
   their own colours; what they share is this reset, so none of them picks up
   a user-agent underline the moment it stops being a span. A global rule
   rather than six, because "every symbol is a link" is one rule. */
:is(
	.chart-legend-symbol,
	.chart-dropdown-symbol,
	.cal-stock-symbol,
	.inspector-symbol,
	.l2-quote-symbol-name,
	.chart-alert-symbol,
	.dilution-symbol
) {
	text-decoration: none;
}

/* ── Responsive Breakpoints System ── */

/*
   BREAKPOINTS UNIFICADOS (usar estos en TODOS los archivos CSS):
     xs:  <480px  β†’ phones chicos (iPhone SE)
     sm:  <768px  β†’ tablets / phones grandes
     md:  <1024px β†’ tablets landscape / laptops chicos
     lg:  <1400px β†’ desktop
   Base (>1400px): desktop grande

   Regla: siempre reducir columnas / apilar antes de recortar padding.
*/

/* ── Sidebar Responsive ──
   The sidebar is fixed and full-height on all sizes. On ≀768px it becomes a
   slide-in drawer (hidden by default) to preserve content width on small
   screens; a `nav--open` class (plus overlay) reveals it. */
@media (width <= 768px) {
	body {
		padding-left: 0;
	}

	/* Lock background scroll while the drawer is open */
	body.nav--open {
		overflow: hidden;
	}

	/* Hide the floating hamburger while the drawer is open (closing happens
	   via overlay click, Escape, or a nav action) */
	body.nav--open #nav-toggle-float {
		display: none;
	}

	nav.main-nav {
		transform: translateX(-100%);
		width: 200px;
		box-shadow: var(--shadow-lg);
		transition: transform var(--transition-base);
	}

	body.nav--open nav.main-nav,
	nav.main-nav.nav--open {
		transform: translateX(0);
	}

	/* Drawer rows are touch targets: at least the 44px minimum tall. */
	nav.main-nav .nav-search-btn,
	nav.main-nav .nav-links a {
		min-height: var(--touch-min);
	}

	/* The drawer's own toggle is off-screen while closed; use the floating
	   hamburger (rendered as a body sibling) instead. */
	nav.main-nav .nav-toggle {
		display: none;
	}

	/* The float is 38px tall and sits 8px from the top-left corner, so
	   every page needs a real offset for its first content child or the
	   hamburger covers the page title / topbar. The chart page has no
	   .page-wrapper β€” chart.css offsets .chart-shell instead.
	   The bottom padding keeps the last row of a page clear of the iPhone
	   home indicator (pages opt into the notch via viewport-fit=cover). */
	.page-wrapper {
		padding-top: calc(var(--nav-float-size) + var(--space-md));
		padding-bottom: calc(var(--space-xl) + var(--safe-b));
	}

	/* Full-screen modals: keep the close/send row above the home
	   indicator instead of letting it sit on the physical bottom edge. */
	.modal-content,
	.chat-modal-content,
	.analyze-modal-content {
		padding-bottom: calc(var(--space-lg) + var(--safe-b));
	}

	#nav-toggle-float {
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		top: var(--space-sm);
		left: var(--space-sm);

		/* Below the modals (--z-1000) so an open modal owns the top-left
		   corner; the drawer's own scrim (--z-200) matches it. */
		z-index: var(--z-200);

		/* Explicit box: the real size is 8 padding + 1 border + 20 svg
		   + 1 border + 8 padding. Stating it means the offset pages
		   reserve above cannot drift 2px short of the button. */
		width: var(--nav-float-size);
		height: var(--nav-float-size);
		background: var(--bg-elevated);
		border: 1px solid var(--border);
		color: var(--text-muted);
		cursor: pointer;
		padding: var(--space-sm);
		border-radius: var(--radius-md);
		transition: all var(--transition-fast);
	}

	#nav-toggle-float:hover {
		color: var(--text);
		background: var(--border);
	}

	#nav-toggle-float svg {
		width: var(--icon-size);
		height: var(--icon-size);
		display: block;
	}

	/* Overlay to close the drawer */
	body.nav--open::before {
		content: "";
		position: fixed;
		inset: 0;
		background: color-mix(in srgb, var(--black) 50%, transparent);
		z-index: var(--z-200);
	}

	/* Drawer always shows the nav labels for easy navigation. Matches the
	   specificity of the collapsed-sidebar hide rule above (body:not(...) .x),
	   because body .nav-label alone lost to it and the drawer showed icons only. */
	body:not(.sidebar-expanded) .nav-label,
	body .nav-label {
		display: inline;
	}

	body .nav-brand-label {
		display: inline;
	}
}

/* ── Grid Breakpoints ── */

@media (width <= 1400px) {
	.results-grid,
	.grid-layout {
		grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
	}
}

@media (width <= 1024px) {
	.results-grid,
	.grid-layout {
		grid-template-columns: repeat(auto-fill, minmax(min(var(--split-card-min-mobile), 100%), 1fr));
	}

	/* .action-row stacks a column earlier than the other two row patterns:
	   the buttons inside it are long enough that a row of them wraps into
	   an unreadable two-line mess on a tablet. It lives here, with the
	   class, instead of being re-declared in the page that first needed it. */
	.action-row {
		flex-direction: column;
		align-items: stretch;
	}
}

@media (width <= 480px) {
	.results-grid,
	.grid-layout,
	.dash-grid,
	.split-grid,
	.presets-panel {
		grid-template-columns: 1fr;
	}

	.inspector-metrics {
		grid-template-columns: 1fr 1fr;
	}

	/* Touch targets: minimum 44px for buttons on mobile */
	.btn,
	.tf-selector .tf-btn,
	.view-toggle .view-btn,
	nav.main-nav a {
		min-height: var(--touch-min);
	}

	/* Icon buttons and dense controls are 18–32px wide on desktop β€”
	   a thumb can't hit them. 44px min keeps the same visual weight (the
	   icon stays put) while the hit area grows.

	   Only the selectors common.css owns are listed. The chart page's and
	   the playbook page's own controls used to be named here too, which
	   forced this file to track the class inventory of three pages it does
	   not style; each of those now carries its own list in its own
	   <=480px block (chart.css, playbook.css), where the rest of its page
	   overrides already live. */
	.chart-topbar__actions .btn,
	.chart-date-jump-cal-header button,
	.ac-card-remove,
	.analyze-tab-close,
	.symbol-flags-toggle,
	.cal-nav-btn {
		min-width: var(--touch-min);
		min-height: var(--touch-min);
	}

	.chart-screener-filters .input-field {
		min-height: var(--touch-min);
	}

	/* Type scale step for small phones. 10–11px text was tuned on a
	   desktop monitor and is unreadable at 6" / DPR 3; every rule in the
	   app goes through these tokens, so this is the whole responsive type
	   system in four lines.

	   The four smallest steps move together, and they have to: this block
	   used to raise only xxs/xs/sm, which pushed --font-sm onto --font-md's
	   value (both 13px) so a --font-sm label next to a --font-md one was
	   indistinguishable. Any subset leaves a collision β€” raising xxs alone
	   lands it on the base --font-xs, raising xxs+xs lands --font-xs on the
	   base --font-sm β€” so the step is taken as a unit and --font-md moves
	   with it. The ladder stays strictly increasing and 14px still leaves
	   room below the unmoved --font-lg (15px). */
	:root {
		--font-xxs: 0.6875rem;
		--font-xs: 0.75rem;
		--font-sm: 0.8125rem;
		--font-md: 0.875rem;
	}

	/* Uppercase micro-labels: the 0.05–0.1em tracking was tuned on a
	   desktop monitor and, with a bigger glyph in a narrower column, it
	   makes the word harder to read rather than easier. 0.04em is the cap.

	   Scoped to the selectors common.css owns. A page stylesheet's own
	   uppercase rule sits after this file at equal specificity, so listing
	   its selectors here would be dead weight β€” each page's overrides belong
	   in that page's own <=480px block. */
	.input-label,
	.btn,
	.view-toggle .view-btn,
	.metric-label,
	.badge,
	.analyze-modal-input,
	.modal-field-label,
	.info__label,
	.chart-alert-status,
	.alb-preview-head,
	.fbc-sort-label,
	.flip-card__notes-label {
		letter-spacing: 0.04em;
	}

	.stock-row {
		grid-template-columns: 80px 1fr 1fr 1fr;

		/* hide the less critical columns at the narrowest mobile width */
	}

	body:not([data-page="chart"]) .page-wrapper {
		padding-top: calc(var(--nav-float-size) + var(--space-sm));
	}

	.cal-day {
		min-height: var(--touch-min);
	}
}

/* The horizontal-scroll wrapper and the trades table's 500px floor used to
   live here as a shared rule. Both consumers have since taken ownership --
   `.trades-sidebar .trades-table-wrap` in trades.css and
   `.results-table-container` in scan.css -- so these were dead weight in a
   file that does not style either page. */

/* stock-row: per-page variants β€” they replace inline styles from JS */
.stock-row--label {
	/* A 20px leading column, not an icon size: no column token names it, and --icon-size is for glyphs. */
	grid-template-columns: 20px 1fr auto;
	padding: var(--space-sm);
	background: var(--bg);
	border: none;
}

/* The Manage Labels list is a set of named rows, not stock cards: the swatch
   carries the label's own colour, and the name reads as body text rather than
   the muted row copy the stock variant uses. */
.stock-row--label strong {
	color: var(--text);
}

.label-badge--swatch {
	width: var(--space-md);
	height: var(--space-md);
	padding: 0;
}

.label-list-hint {
	color: var(--text-muted);
	font-size: var(--font-xs);
	margin-top: var(--space-sm);
}

/* list-view rows: JS writes only the --row-cols track list, so the stylesheet
   keeps ownership of the track sizing and can reshape it per breakpoint.

   Qualified with .stock-row on purpose. The base .stock-row card rule further
   down this file declares its own six-track grid-template-columns at the SAME
   specificity, and being later it won: --row-cols was silently discarded, the
   7th cell onward fell into implicit grid rows, and one result rendered as up
   to three stacked sub-rows. Measured on discover (17 columns): 6 tracks
   resolved instead of 17, 3 template rows, 4 distinct cell top offsets,
   85px per record. Source order alone is not a contract β€” the qualifier makes
   the list track list win regardless of where the base rule sits. */
.stock-row.stock-row--list,
.stock-row.stock-row--list-header {
	/* 40px is the list-header fallback column, not a control floor: --touch-compact has the same value but names a control. */
	grid-template-columns: var(--row-cols, 40px);
}

/* A list row is a data-table row, not the card the base .stock-row styles.
   The card spent ~31px of chrome around an 18px line (1px border top and
   bottom, 6px padding top and bottom, 4px radius), so a results list showed
   roughly a third of the rows it could and read as stacked cards rather than
   a table. A hairline separator and 2px padding hand the height back to the
   line. The base card rule is untouched for its tile usage.

   line-height is a fixed length, not the inherited ratio, because cells in one
   row do not share a font size: .metric-value is --font-md against the row's
   --font-sm, and a ratio line box sized each of them independently (19.5px vs
   18px), leaving the numeric columns 1.5px off the symbol column's baseline.
   One box height for the whole row puts every cell on one baseline. */
.stock-row.stock-row--list {
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--border);
	border-radius: var(--radius-none);
	padding: var(--space-2xs) var(--space-sm);
	line-height: 18px;
}

/* The lead star shares the row's line box. Left at its natural 25px it made
   the row taller than the header, and since the cells are centred in the row
   (align-self: center, so a tall neighbour does not drag single-line text)
   they ended up 4px below the header label for their own column β€” a vertical
   misalignment that only appears on pages that render a star. The whole row is
   the click target; the star is a secondary toggle, so it takes the line. */
.stock-row.stock-row--list > .unified-chart-action-btn {
	height: 18px;
	min-width: 18px;
	padding: 0 var(--space-xs);
	line-height: 1;
}

/* The base hover only recolours a border, which on a hairline row means one
   coloured pixel β€” give the row a surface so the pointer's row is findable. */
.stock-row.stock-row--list:hover {
	background: var(--bg-elevated);
	border-bottom-color: var(--accent);
}

@media (width <= 480px) {
	/* 40px lead track plus one flexible track per data column, so a list row
	   fits the viewport instead of overflowing at 670px+. */
	.stock-row.stock-row--list,
	.stock-row.stock-row--list-header {
		/* 40px is the phone list-header column, not a control floor: --touch-compact has the same value but names a control. */
		grid-template-columns: 40px;
		grid-auto-columns: minmax(0, 1fr);
	}

	.stock-row.stock-row--list > *,
	.stock-row.stock-row--list-header > * {
		min-width: 0;
	}

	/* Dense rows are a pointer layout: 2px of padding and an 18px line box
	   hand the height back to the text. A phone has no pointer, so the row's
	   own link and its secondary star each take the 28px touch floor the
	   responsive audit enforces instead β€” a taller row is the cost of a hit
	   area a finger can actually land on. */
	.stock-row.stock-row--list .symbol-link {
		display: inline-flex;
		align-items: center;
		min-height: var(--control-height);
	}

	.stock-row.stock-row--list > .unified-chart-action-btn {
		height: var(--control-height);
		min-width: var(--control-height);
	}
}

/* The header shares the rows' horizontal padding and column gap, or every
   label sits a padding-width to the left of the column it titles. Vertical
   padding stays 0: this is a label row, and giving it the rows' 2px only
   makes the header taller than the labels need. */
.stock-row.stock-row--list-header {
	background: transparent;
	border: none;
	padding: 0 var(--space-sm);
}

.list-header {
	display: grid;
	gap: var(--space-sm);
}

/* A headerCell list header (ListView.renderTable) is a table so its th cells
   parse. The table, thead and tr take no box, so the cells are the row's grid
   tracks exactly as the span headers were. */
.list-header__table,
.list-header__table thead,
.list-header__table tr {
	display: contents;
}

/* The lead cell is pinned to the first track instead of being placed in source
   order. A page whose header cells are its own <span>s (discover) hands them to
   the parser inside the header table's <tr>, where HTML5 foster parenting moves
   them out in front of the table: the lead <th> then became the last grid item,
   every label sat one track (40px plus the row gap) to the left of the column it
   titles, and the lead landed in the last column. Pinning the lead to the track
   the row's --row-cols reserve for it holds whatever order the parser leaves
   the cells in, and grid auto-placement starts the labels at the second track;
   a header whose cells already parse in order (the <th> pages) is unaffected. */
.list-header__lead {
	padding: 0;
	grid-column: 1;
	grid-row: 1;
}

/* Sortable column headers (shared/sortable-table.ts). The th keeps the column's
   track and label typography; the button fills the label so the whole label is
   the target. A phone gets the 28px touch floor the responsive audit checks. */
.sortable-th {
	padding: 0;
	margin: 0;
	min-width: 0;
	text-align: left;
	font: inherit;
	font-weight: inherit;
	color: inherit;
	white-space: nowrap;
}

.sortable-th__button {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2xs);
	max-width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: inherit;
	cursor: pointer;
}

.sortable-th__button:focus-visible {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
	border-radius: var(--radius-sm);
}

.sortable-th--active {
	color: var(--accent);
}

.sortable-th__arrow {
	font-size: 0.7em;
	line-height: 1;
}

@media (width <= 480px) {
	/* --control-height (26px) is under the touch floor, so the header button takes it on both axes. */
	.sortable-th__button {
		min-width: var(--touch-floor);
		min-height: var(--touch-floor);
	}
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ── Shared animations (used across pages) ── */
@keyframes pulse {
	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.5;
	}
}

@keyframes slideUpFade {
	from {
		opacity: 0;

		/* 20px is this sheet's slide distance; --icon-size shares the value but
		   names a glyph box. */
		transform: translateY(20px) scale(0.98);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes slideDownFade {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes shimmer {
	0% {
		background-position: 200% 0;
	}

	100% {
		background-position: -200% 0;
	}
}

@keyframes loading-bar-slide {
	0%   { transform: translateX(-100%); }
	50%  { transform: translateX(150%); }
	100% { transform: translateX(350%); }
}

@keyframes alert-trigger-flash {
	0% { background: var(--positive-bg); }
	50% { background: color-mix(in srgb, var(--positive) 30%, transparent); }
	100% { background: var(--positive-bg); }
}

/* Geometry comes from .select-field--sm (see common.css); this rule is the
   one thing the base cannot know: the selector holds a grid column. */
.unified-chart-label-selector {
	max-width: 120px;
}

/* The stock row's selector holds its grid column; the dashboard's flip card
   keeps the shrink-to-content behaviour the base rule above allows. */
.unified-chart-label-selector--fixed {
	width: 120px;
}

.unified-chart-action-btn {
	background: transparent;
	border: 1px solid var(--border);
	color: var(--text-muted);
	padding: var(--space-xs) var(--space-sm);
	font-size: var(--font-sm);
	font-weight: 600;
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: all var(--transition-fast);
	min-width: var(--space-xl);
}

.unified-chart-action-btn:hover {
	background: var(--accent);
	color: var(--on-accent);
	border-color: var(--accent);
}

.unified-chart-action-btn.added {
	background: var(--positive);
	color: var(--on-accent);
	border-color: var(--positive);
}

.unified-chart-action-btn.remove {
	background: transparent;
	color: var(--negative);
	border-color: var(--negative);
}

.unified-chart-action-btn.remove:hover {
	background: var(--negative);
	color: var(--on-danger);
}

.stock-row {
	display: grid;
	grid-template-columns: 90px 90px 90px 90px 100px 70px;
	gap: var(--space-sm);
	align-items: center;
	padding: var(--space-sm);
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	font-size: var(--font-sm);
	transition: border-color var(--transition-fast);
}

.stock-row:hover {
	border-color: var(--accent);
}

.stock-row-symbol {
	font-weight: 600;
	color: var(--accent);
	cursor: pointer;
}

.stock-row-symbol:hover {
	text-decoration: underline;
}

.stock-row-price {
	font-weight: 600;
}

.stock-row-change {
	font-weight: 600;
	padding: var(--space-2xs) var(--space-sm);
	border-radius: var(--radius-md);
	text-align: center;
}

.stock-row-change.positive {
	color: var(--positive-text);
	background: var(--positive-bg);
}

.stock-row-change.negative {
	color: var(--negative-text);
	background: var(--negative-bg);
}

.stock-row-volume {
	color: var(--text-muted);
	font-size: var(--font-sm);
}

/* ── List header drag-reorder (discover & scanner) ──────────────────── */

.list-header__drag-ghost {
	position: fixed;
	pointer-events: none;
	z-index: var(--z-max);
	padding: 3px 10px;
	background: var(--primary);
	color: var(--bg);
	border-radius: var(--radius-sm);
	font-size: var(--font-xs);
	font-weight: 600;
	white-space: nowrap;
	opacity: 0.92;
	transform: translate(-50%, -130%);
	box-shadow: 0 3px 10px var(--scrim-25);
}

.list-header__drop-indicator {
	position: fixed;
	pointer-events: none;
	z-index: calc(var(--z-max) - 1);
	width: 3px;
	background: var(--accent);
	border-radius: var(--radius-sm);
	opacity: 0;
	transition: opacity var(--transition-instant);
}

.list-header__drop-indicator.active {
	opacity: 1;
}

.list-header span.list-header__drag-source {
	opacity: 0.3;
}

.label-badge {
	display: inline-block;
	padding: var(--space-2xs) var(--space-sm);
	border-radius: var(--radius-md);
	font-size: var(--font-xs);
	font-weight: 600;
	color: var(--on-accent);
}

textarea {
	flex: 1;
	background: var(--bg);
	border: 1px solid var(--border);
	color: var(--text);
	padding: var(--space-md);
	border-radius: var(--radius-md);
	font-family: var(--font-sans);
	font-size: var(--font-lg);
	min-height: var(--touch-min);
	max-height: 150px;
	resize: vertical;
	transition: border-color var(--transition-fast);
}

.empty-state {
	text-align: center;

	/* 20px inline padding: the spacing scale has no 20px step (4/8/16/24), and
	   --icon-size, the only equal value, names glyphs. A literal until the scale
	   grows a step; inventing --space-md-plus here would add a ninth size. */
	padding: 60px 20px;
	color: var(--text-muted);
	background: var(--bg-elevated);
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	margin: var(--space-lg) 0;
}

/* ── Filter help button (shared opt-in) ──
   Promoted out of scan.css: the reports page puts the same "?" beside its
   filter expression and does not load the scanner's stylesheet, so there the
   button fell back to the UA default and rendered 179px wide beside the
   textarea. Any page with a filter box uses this one. */
.btn-help-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--control-height);
	height: var(--control-height);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg);
	color: var(--text-muted);
	font-size: var(--font-lg);
	font-weight: 700;
	cursor: pointer;
	flex-shrink: 0;
	transition: all var(--transition-base);
}

.btn-help-icon:hover {
	background: var(--accent);
	color: var(--bg);
	border-color: var(--accent);
}

/* A 28px target is under the 44px touch minimum, so it grows on phones. */
@media (width <= 480px) {
	.btn-help-icon {
		width: var(--trades-layout-offset);
		height: var(--trades-layout-offset);
	}
}

input,
select,
textarea {
	background: var(--bg);
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: var(--radius-md);
	padding: var(--space-sm) var(--space-md);
}

textarea:focus,
input:focus,
select:focus {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
	border-color: var(--accent);
}

button {
	font-family: var(--font-sans);
	cursor: pointer;
	border-radius: var(--radius-md);
	border: 1px solid transparent;
	padding: 10px var(--space-md);
	font-weight: 600;
	transition:
		transform 0.1s ease,
		filter 0.1s ease;
	background: var(--bg);
	color: var(--text);
}

button:active {
	transform: scale(0.98);
}

button.secondary {
	background: var(--secondary);
	color: var(--text-secondary);
	border-color: transparent;
}

button.secondary:hover {
	background: var(--secondary-hover);
	color: var(--text);
}

button.danger {
	background: var(--danger);
	color: var(--bg);
}

button.danger:hover {
	background: var(--danger-hover);
}

/* ========================================
   Inspector Panel (shared across workspaces)
   ======================================== */

.inspector-panel {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--bg-elevated);
	border-radius: var(--radius-md);
	overflow: hidden;
}

.inspector-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--space-md);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.inspector-title {
	display: flex;
	align-items: baseline;
	gap: var(--space-sm);
}

.inspector-symbol {
	font-weight: 700;
	font-size: var(--font-xl);
	color: var(--accent);
}

.inspector-date {
	font-size: var(--font-sm);
	color: var(--text-muted);
}

.inspector-change {
	font-size: var(--font-md);
	font-weight: 700;
	padding: var(--space-2xs) var(--space-sm);
	border-radius: var(--radius-md);
}

.inspector-change.positive {
	background: var(--positive-bg);
	color: var(--positive-text);
}

.inspector-change.negative {
	background: var(--negative-bg);
	color: var(--negative-text);
}

.inspector-close {
	color: var(--text-muted);
	font-size: var(--font-xxl);
	cursor: pointer;
	padding: 0 var(--space-xs);
	line-height: 1;
}

.inspector-close:hover {
	color: var(--text);
}

.inspector-metrics {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1px;
	background: var(--border);
	padding: 1px;
	flex-shrink: 0;
}

.metric {
	background: var(--bg-elevated);
	padding: 10px var(--space-sm-plus);
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
}

.inspector-actions {
	display: flex;
	gap: var(--space-sm);
	padding: var(--space-md);
	border-top: 1px solid var(--border);
	flex-shrink: 0;
}

.inspector-action-btn {
	flex: 1;
	padding: var(--space-sm) var(--space-md);
	font-size: var(--font-sm);
	font-weight: 600;
	background: var(--bg);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: all var(--transition-base);
}

.inspector-action-btn:hover {
	border-color: var(--accent);
	background: var(--bg-elevated);
}

/* Typography utilities */
.text-negative {
	color: var(--negative);
}

/* Width comes from .modal-content (sm). */
.app-dialog {
	max-width: 95vw;
}

.app-dialog__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-md);
}

.app-dialog__header .modal-title {
	margin-bottom: 0;
}

.app-dialog__message {
	white-space: pre-wrap;
	line-height: 1.5;
	color: var(--text-muted);
	margin: var(--space-md) 0 0;
}

.app-dialog__field {
	display: block;
	font-size: var(--font-xs);
	color: var(--text-muted);
	margin: var(--space-md) 0 var(--space-xs);
}

.app-dialog__input {
	width: 100%;
}

.app-dialog__actions {
	margin-top: var(--space-lg);
}

/* ── Modal form helpers ── */

/* Shared footer row for every dialog that ends in Cancel/Save-style buttons
   (backtest, scan, watchlist, discover, playbook, dashboard). Pages that need
   a pinned/bordered variant override this locally. */
.modal-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--space-sm);
	margin-top: var(--space-lg);
}

.modal-field-group {
	margin-bottom: var(--space-md);
}

.modal-field-label {
	font-size: var(--font-xs);
	color: var(--text-muted);
	margin-bottom: var(--space-xs);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.modal-field-row {
	display: flex;
	gap: var(--space-md);
	align-items: center;
}

.modal-field-row label {
	font-size: var(--font-sm);
	color: var(--text-secondary);
	display: flex;
	gap: var(--space-xs-plus);
	align-items: center;
}

.modal-field-row input[type="number"] {
	width: 60px;
	text-align: center;
}

/* ── Accessibility: Reduced Motion ──
   The universal rule flattens every CSS animation and transition. The two
   scrolling bodies are named explicitly as well: they are the containers a
   reader actually scrolls inside a dialog, and they set scroll-behavior on
   themselves, so the intent should be visible where it applies rather than
   only inherited from a blanket selector.

   Not reachable from here, because CSS cannot reach the script: the one
   JS-driven piece of motion, the at-risk tab bar's smooth scroll, asks
   static/js/core/reduced-motion.ts instead (STY-4.8). The app's other
   requestAnimationFrame uses are layout and focus, not animation, and stay. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	.chat-modal-body,
	.filter-help-body {
		scroll-behavior: auto;
	}

	/* A stopped spinner must still read as "busy": keep the accent arc
	   static instead of letting it freeze mid-rotation. */
	.spinner {
		animation: none;
	}
}

/* ── Loading spinner ──────────────────────────────
   One base ring for every `.spinner` in the app. The only place this used to
   be sized was `.chat-modal-tool-call .spinner` (a 10px ring in a tool-call
   row), so a bare `<div class="spinner">` β€” the Analyze modal's loading state
   and the Chat modal awaiting its first response β€” rendered as a 0x0 div and
   the panel stayed empty. `.chat-modal-tool-call .spinner` keeps its own size
   override; everything else inherits this one.

   The spin duration is a literal on purpose: it is an animation period, not a
   UI transition, so it must not read the --transition-* tokens. */

.spinner {
	width: var(--spinner-size);
	height: var(--spinner-size);
	border: var(--space-2xs) solid var(--border);
	border-top-color: var(--accent);
	border-radius: var(--radius-round);
	animation: spinner-spin 0.8s linear infinite;
	flex-shrink: 0;
}

@keyframes spinner-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ── Loading bar (YouTube-style) ────────────────── */

.loading-bar {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 3px;
	z-index: var(--z-max);
	pointer-events: none;
	visibility: hidden;
}

.loading-bar::after {
	content: "";
	display: block;
	height: 100%;
	width: 40%;
	background: linear-gradient(90deg, var(--accent), var(--info), var(--accent));
	background-size: 200% 100%;
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	animation: loading-bar-slide 1.4s ease-in-out infinite;
	transform: translateX(-100%);
}

/* ── Loading states responsive ──────────────────── */

@media (width <= 768px) {
	.state {
		padding: var(--space-lg) var(--space-md);
		margin: var(--space-sm);
		font-size: var(--font-sm);
	}

	.status-loading,
	.status-empty,
	.status-error {
		padding: var(--space-lg) var(--space-md);
		margin: var(--space-sm);
		font-size: var(--font-sm);
	}
}

/* ═══════════════════════════════════════════════════════════════════════
   Shared patterns β€” opt-in classes promoted from reverse-splits page.
   Pages use these by adding the class; nothing changes unless a page
   explicitly opts in.
   ═══════════════════════════════════════════════════════════════════════ */

/* Shared page header β€” the same title/context/count/next-action block every
   discovery source renders (see features/shared/page-header.ts). No subtitle
   line: the title and its meta row are the whole header. */
.page-header {
	margin: 0 0 var(--space-md);
	padding-bottom: var(--space-xs);
	border-bottom: 1px solid var(--border);
}

.page-header__title {
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: var(--page-title-size);
	color: var(--text);
	margin: 0;
}

.page-header__meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm) var(--space-lg);
	font-size: var(--font-sm);
	color: var(--text-muted);
}

.page-header__context::before {
	content: "context Β· ";
	color: var(--text-dim);
}

.page-header__count::before {
	content: "results Β· ";
	color: var(--text-dim);
}

.page-header__count {
	color: var(--text);
	font-weight: 600;
}

/* Dynamic slots are always rendered but hidden while empty so their
   "context Β·"/"results Β·" labels only appear once a value arrives. */
.page-header__context:empty,
.page-header__count:empty {
	display: none;
}

.page-header__next::before {
	content: "next Β· ";
	color: var(--text-dim);
}

/* Empty-state placeholder β€” the view title + instructions centered in the
   middle of the view, shown while the view is loading/empty/failed. Replaces
   the old always-on top page header: once data arrives the full height
   belongs to the results, and the title lives on in the navbar. */
.page-empty {
	max-width: 620px;
	margin: var(--space-xxl) auto;
	padding: 0 var(--space-md);
	text-align: center;
}

.page-empty .page-header {
	border-bottom: none;
	margin-bottom: var(--space-md);
}

.page-empty .page-header__meta {
	justify-content: center;
}

.page-empty .state--empty {
	margin-top: var(--space-md);
}

/* ═══════════════════════════════════════════════════════════════════════
   Shared Components (opt-in, promoted from page CSS)
   ══════════════════════════════════════════════════════════════════════ */

/* ── Calendar Navigation ── */
.cal-nav-btn {
	background: var(--bg);
	border: 1px solid var(--border);
	color: var(--text);
	width: var(--space-xl);
	height: var(--space-xl);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-md);
	cursor: pointer;
	font-size: var(--font-xs);
	padding: 0;
	transition: border-color var(--transition-fast);
}

.cal-nav-btn:hover {
	border-color: var(--accent);
}

 /* ── Preset list row: name + Load/Delete text buttons (Scan's "Manage
    Presets" modal, reused by the backtest alert-config manager) ── */
.preset-info {
	flex: 1;
	min-width: 0;
}

.preset-actions {
	display: flex;
	gap: var(--space-xs);
	flex-shrink: 0;
}

 /* ── Preset Item (used by Discover, Scanner) ── */
.preset-item {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	padding: 5px var(--space-sm);
	border-radius: var(--radius-sm);
	font-size: var(--font-xs);
	color: var(--text-secondary);
	cursor: pointer;
	transition: background var(--transition-base);
}

.preset-item:hover {
	background: var(--surface-raised);
	color: var(--text);
}

.preset-item__name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.preset-item__actions {
	display: flex;
	gap: var(--space-2xs);
	flex-shrink: 0;
}

.preset-item__actions button {
	background: none;
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	padding: var(--space-2xs) 5px;
	font-size: var(--font-xs);
	border-radius: var(--radius-sm);
	transition: all var(--transition-base);
	line-height: 1;
}

.preset-item__actions button:hover {
	color: var(--text);
	background: var(--surface);
}

.preset-item__actions .preset-action-danger:hover {
	color: var(--danger);
}

.preset-item__badge {
	font-size: var(--font-xs);
	color: var(--text-muted);
	padding: 1px 5px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	flex-shrink: 0;
}

/* ── Calendar Day (shared base: Trades + Scanner) ──
   Page CSS may only override dimensions (min-height, padding) β€” never
   re-declare the whole component: duplicate owners make layout depend on
   <link> order. Trades sets 54px (trades.css); Scanner sets 80px (scan.css). */
.cal-day {
	background: var(--bg-elevated);
	min-height: 64px;
	padding: 5px var(--space-xs-plus);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-2xs);
	cursor: pointer;
	transition: background var(--transition-fast);
	position: relative;
	color: var(--text);
}

.cal-day:hover {
	background: var(--overlay-2);
}

.cal-day--today {
	background: var(--overlay-1);
}

.cal-day--selected {
	box-shadow: inset 0 0 0 1px var(--accent);
	background: var(--overlay-3);
}

.cal-day--empty {
	background: var(--bg);
	cursor: default;
	min-height: 64px;
}

.cal-day--other-month {
	opacity: 0.3;
}

/* P&L shown via cell background (not colored text) for legibility.
   Combined today/selected states brighten the tint with an inset
   box-shadow layer β€” the old `background: var(--overlay), var(--tint)`
   shorthand was invalid (colors don't stack in comma layers) and the
   browser dropped the declaration. */
.cal-day.pos {
	background: var(--positive-bg);
}

.cal-day.neg {
	background: var(--negative-bg);
}

.cal-day.pos.cal-day--today,
.cal-day.neg.cal-day--today {
	box-shadow: inset 0 0 0 999px var(--overlay-2);
}

.cal-day.pos.cal-day--selected,
.cal-day.neg.cal-day--selected {
	box-shadow:
		inset 0 0 0 999px var(--overlay-3),
		inset 0 0 0 1px var(--accent);
}

.day-num {
	font-family: var(--font-sans);
	font-size: var(--font-sm);
	font-weight: 700;
	color: var(--text-muted);
	line-height: 1;
}

.cal-day--today .day-num {
	color: var(--accent);
}

/* day-pnl / day-stats / day-trades / day-wins / day-losses / day-wr are
   trades-calendar-only styles and live in trades.css (single owner). */

/* Origin label β€” tags a result with the source it came from */
.origin-badge {
	display: inline-block;
	font-size: var(--font-xs);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--text-secondary);
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 1px var(--space-xs);
	margin-left: var(--space-xs);
	vertical-align: middle;
	white-space: nowrap;
}

/* ── Print Styles ── */

/* ── Print ─────────────────────────────────────────
   Paper is light. The old block set `body` only, so the ~130 components
   that set their own `background: var(--bg-elevated)` printed black text on
   a #1e222d card; `button { display: none }` emptied any cell whose only
   content was a control; and --text-muted / --positive / --negative kept
   their dark-theme values, printing dark-theme contrast onto white.

   Fixing that one component at a time would mean 130 edits, so the print
   tier re-points the tokens instead: everything already reading
   var(--bg-elevated) or var(--text-muted) follows for free.

   The selector is `html body[data-page]`, not `:root`, and deliberately so.
   The Research and Dilution pages re-declare the same token names on
   body[data-page="..."] (specificity 0-1-1); a `:root` block (0-1-0) would
   lose to them and those two pages would still print dark. 0-1-2 outranks
   both, and because every page carries data-page it also outranks the
   inherited :root values without a second rule.

   Not covered: the chart cards' shadow root, which inherits from its host
   and not from body (see chart-card-element.ts). */
@media print {
	/* stylelint-disable color-no-hex, lt/no-raw-hex-outside-root -- this IS a token definition block: the print tier of the palette, the same role :root has on screen */
	html body[data-page] {
		--bg: #fff;
		--bg-primary: #fff;
		--bg-elevated: #fff;
		--bg-surface: #fff;
		--bg-input: #fff;
		--surface: #fff;
		--surface-raised: #f7f7f7;
		--bg-secondary: #f4f4f4;
		--bg-tertiary: #e8e8e8;
		--glass-bg: #fff;
		--glass-border: #b8b8b8;

		/* Overlays: white washes are invisible on paper, so the same four
		   steps in black keep zebra rows and hovers from vanishing. */
		--overlay-1: var(--shade-4);
		--overlay-2: var(--shade-7);
		--overlay-3: var(--shade-10);
		--overlay-4: var(--shade-14);

		/* Borders */
		--border: #a8a8a8;
		--border-focus: #444;

		/* Text: every step re-picked for >= 4.5:1 on white. */
		--text: #000;
		--text-primary: #000;
		--text-secondary: #1c1c1c;
		--text-muted: #3d3d3d;
		--text-dim: #4a4a4a;
		--text-disabled: #6f6f6f;

		/* --accent carries 22 text-emphasis uses and 13 solid fills, so the
		   print tier inverts the pair: dark ink for the former, and
		   --on-accent flips with it for the latter. */
		--accent: #3a3a3a;
		--on-accent: #fff;
		--primary: #3a3a3a;
		--primary-hover: #1c1c1c;
		--secondary: #4a4a4a;
		--secondary-hover: #2a2a2a;

		/* Status colours re-picked for >= 4.5:1 on white, and the tints
		   stay tinted: the P&L sign is carried by the tint, so flattening
		   the tints to white would delete the only channel for the sign
		   (see the forced-colors block above for the same reasoning). */
		--positive: #0a6a52;
		--success: #0a6a52;
		--positive-bg: var(--positive-10);
		--negative: #a11d2c;
		--danger: #a11d2c;
		--negative-bg: var(--negative-10);
		--warning: #7a5c00;
		--warning-text: #7a5c00;
		--warning-bg: var(--warning-10);
		--info: #1b4fbd;
		--info-bg: var(--info-10);
		--accent-bg: transparent;
		--catalyst: #7a5c00;

		/* The app's --on-danger ink is dark and this tier's --danger is dark
		   too: #131722 on #a11d2c is 2.32:1 where white is 7.70:1. */
		--on-danger: #fff;

		/* A drop shadow is a screen affordance; on paper it is a smudge
		   that costs ink. */
		--shadow-sm: none;
		--shadow-md: none;
		--shadow-lg: none;

		/* Safe-area insets and the full-viewport height describe a device
		   that has neither on paper. */
		--safe-b: 0px;
		--viewport-h: auto;

		/* Any control that survives the rules below renders for paper. */
		color-scheme: light;	}
	/* stylelint-enable color-no-hex, lt/no-raw-hex-outside-root */

	/* Backgrounds are stripped by default when printing; the tints above
	   are the only channel carrying the P&L sign, so ask for them back. */
	body,
	html body[data-page] * {
		print-color-adjust: exact;
		-webkit-print-color-adjust: exact;
	}

	/* Chrome: navigation exists to navigate a screen. */
	nav.main-nav,
	#nav-toggle-float,
	.sidebar-toggle-wrap,
	body.nav--open::before {
		display: none !important;
	}

	/* The sidebar is gone, so its content offset is just a blank margin. */
	body {
		padding-left: 0;
	}

	/* Form controls hold no content of their own. */
	input,
	select,
	textarea,
	.unified-chart-action-btn {
		display: none !important;
	}

	/* Buttons DO hold content, and a cell whose only child is one prints
	   empty if buttons are hidden β€” so they are unwrapped into plain text
	   instead of removed. The selector carries a class on purpose: a bare
	   `button` (0-0-1) loses to every button variant (.btn, .btn-primary,
	   .modal-close-btn, ...), so the box would survive the unwrap. */
	html body[data-page] button {
		display: inline;
		background: none;
		border: 0;
		padding: 0;
		color: inherit;
		font: inherit;
		font-size: inherit;
		box-shadow: none;
		text-transform: none;
		letter-spacing: normal;
	}

	/* A printed URL is noise and a row of underlines is unreadable. */
	a {
		color: inherit;
		text-decoration: none;
	}

	/* Rows break cleanly across pages; the header repeats on each. */
	tr {
		break-inside: avoid;
	}

	thead {
		display: table-header-group;
	}
}

/* ═══════════════════════════════════════════════════════════════════════
   Generic chart fullscreen button (matches <stock-chart-card> expand-btn)
   Used by charts that are NOT wrapped in the <stock-chart-card> element
    (trades summary charts, scanner backtest/stats).
   ═══════════════════════════════════════════════════════════════════════ */

.chart-fs-btn {
	position: absolute;
	top: var(--space-xs);
	right: var(--space-xs);
	z-index: var(--z-10);
	background: var(--ink-scrim-70);
	border: 1px solid var(--border);
	color: var(--text-muted);
	padding: var(--space-2xs) var(--space-xs-plus);
	font-size: var(--font-xs);
	line-height: 1;
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: all 0.15s;
}

.chart-fs-btn:hover {
	background: var(--accent);
	color: var(--on-accent);
	border-color: var(--accent);
}

@media (width <= 480px) {
	/* The overlay button sits on the chart's top-right corner. Its 26px control
	   height is below the 28px touch floor the responsive audit enforces, so it
	   stays a small glyph with a real target of the floor around it. */
	.chart-fs-btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: var(--touch-floor);
		min-height: var(--touch-floor);
	}

	/* The TradingView attribution link (35x19) that lightweight-charts paints on
	   every chart. The logo keeps its size; the link box grows around it. */
	#tv-attr-logo {
		display: inline-flex;
		align-items: center;
		min-height: var(--touch-floor);
	}
}

.chart-fs-overlay {
	position: fixed;
	inset: 0;
	z-index: var(--z-1000);
	background: var(--bg);
	display: none;
	padding: var(--space-md);
}

.chart-fs-overlay.active {
	display: block;
}

.chart-fs-overlay > div {
	width: 100%;
	height: 100%;
}

/* ════════════════════════════════════════════════════════
   Analyze Modal (shared) β€” migrated from analyze.css
   The analyze modal is a global component (common-runtime.js injects it on
   every page), so its styles live in common.css. This block is appended at
   the END of the file to preserve the exact cascade position analyze.css
   had when injected last β€” do not move it earlier.
   ════════════════════════════════════════════════════════ */

/* ── FINAL BOSS KILL SWITCH ── */
#analyze-modal a,
#analyze-modal a:link,
#analyze-modal a:visited,
#analyze-modal a:hover,
#analyze-modal a:active {
	color: var(--text);
	text-decoration: none;
}

/* Stock Analyzer */

.analyze-modal-header {
	padding: var(--space-xs) var(--space-sm);
	background: var(--bg-elevated);
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: var(--space-xs);
}

.analyze-clear-header-btn,
.analyze-watchlist-btn,
.modal-close-btn {
	background: none;
	border: none;
	font-size: var(--font-md);
	color: var(--text-muted);
	cursor: pointer;
	width: var(--space-lg);
	height: var(--space-lg);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color var(--transition-fast);
}

.analyze-clear-header-btn:hover,
.modal-close-btn:hover {
	color: var(--text-primary);
}

.analyze-watchlist-btn {
	font-size: var(--font-lg);
	color: var(--text-muted);
}

.analyze-watchlist-btn:hover {
	color: var(--accent);
}

.analyze-watchlist-btn.added {
	color: var(--accent);
}

.analyze-research-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 var(--space-sm);
	height: var(--space-lg);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: none;
	font-size: var(--font-xs);
	color: var(--text-muted);
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
	transition:
		color var(--transition-fast),
		border-color var(--transition-fast);
}

.analyze-research-btn:hover {
	color: var(--accent);
	border-color: var(--accent);
}

.analyze-modal-tabs {
	background: var(--bg-elevated);
	padding: var(--space-xs) var(--space-sm);
	border-bottom: 1px solid var(--border);
	display: flex;
	gap: var(--space-xs);
	overflow-x: auto;
	flex-wrap: nowrap;

	/* Hide scrollbar for Chrome/Safari/Firefox */
	scrollbar-width: none;
}

.analyze-modal-tabs::-webkit-scrollbar {
	display: none;
}

.analyze-tab {
	padding: 5px 10px;
	font-weight: 700;
	font-size: var(--font-sm);
	color: var(--text-secondary);
	cursor: pointer;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	transition: all var(--transition-fast);
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	flex-shrink: 0;
}

.analyze-tab:hover {
	background: var(--bg-elevated);
	color: var(--text-secondary);
}

.analyze-tab.active {
	color: var(--accent);
	background: color-mix(in srgb, var(--accent) 10%, transparent);
	border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Tab glow β€” gold border highlight on symbols with a matched news catalyst. */
.analyze-tab--catalyst:not(.active) {
	border-color: var(--catalyst);
	background: var(--catalyst-bg);
	box-shadow: 0 0 var(--space-sm) rgb(var(--catalyst-rgb) / 55%);
}

.analyze-tab--catalyst.active {
	box-shadow: 0 0 10px rgb(var(--catalyst-rgb) / 45%);
}

.analyze-symbol-content {
	display: none;
	padding: var(--space-sm);
}

.analyze-symbol-content.active {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	padding: var(--space-sm);
}

/* Firm visual grouping: separate the price-action/event/catalyst data zone
   from the charts so the hierarchy reads at a glance on any screen width. */
.analyze-symbol-content .analyze-chart-section {
	border-top: 1px solid var(--border);
	margin-top: var(--space-xs);
	padding-top: var(--space-sm);
}

/* Events and catalyst/news each sit on their own subtle separator so a
   screen reader / scanner sees clear blocks instead of one dense stream. */
.analyze-symbol-content .analyze-compact-bar ~ .analyze-compact-bar {
	margin-top: var(--space-2xs);
}

.analyze-symbol-content .analyze-alert-chips {
	margin-top: -2px;
}

/* Chart Section */
.analyze-chart-section {
	margin: 0;
}

/* ── Compact Info Bar ── */
.analyze-compact-bar {
	display: flex;
	align-items: center;
	gap: var(--space-xs-plus);
	font-size: var(--font-sm);
	color: var(--text-secondary);
	padding: 0;
	flex-wrap: nowrap;
	line-height: 1.4;
	white-space: nowrap;
}

.analyze-compact-bar strong {
	font-weight: 700;
	color: var(--text-primary);
}

.analyze-compact-bar .compact-text {
	color: var(--text-primary);
	font-weight: 600;
	flex: 1;
	min-width: 0;
	line-height: 1.5;
	white-space: normal;
}

.analyze-compact-bar .compact-muted {
	color: var(--text-muted);
	flex-shrink: 0;
}

.analyze-compact-bar .bar-sep {
	color: var(--border);
	flex-shrink: 0;
	margin: 0 3px;
}

.analyze-compact-bar .compact-dot-positive,
.analyze-compact-bar .compact-dot-negative,
.analyze-compact-bar .compact-dot-neutral {
	font-size: var(--font-md);
	line-height: 1;
}

.analyze-compact-bar .compact-dot-positive {
	color: var(--positive);
}

.analyze-compact-bar .compact-dot-warning {
	color: var(--warning);
}

.analyze-compact-bar .compact-dot-negative {
	color: var(--negative);
}

.analyze-compact-bar .compact-dot-neutral {
	color: var(--text-muted);
}

.analyze-compact-bar .compact-news-link {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	color: var(--text-primary);
	text-decoration: none;
	overflow: hidden;
	flex: 1;
	min-width: 0;
}

.analyze-compact-bar .compact-news-link:hover {
	color: var(--accent);
}

.ai-summarize-btn {
	background: none;
	border: 1px solid var(--border);
	color: var(--text-muted);
	padding: 1px 5px;
	border-radius: var(--radius-md);
	cursor: pointer;
	font-size: var(--font-xs);
	line-height: 1;
	flex-shrink: 0;
	transition: all 0.15s;
}

.ai-summarize-btn:hover {
	background: var(--bg-elevated);
	color: var(--text-primary);
	border-color: var(--text-muted);
}

/* ── JS Floating Tooltip (avoids clipping from overflow: hidden) ── */
.instant-tooltip {
	position: relative;
	cursor: help;
}

.floating-tooltip {
	/* Surface from .surface (this file); the rule owns the tooltip's own box. */
	position: fixed;
	white-space: pre-line;
	color: var(--text-primary);
	padding: var(--space-xs-plus) 10px;
	font-size: var(--font-xs);
	font-weight: 600;
	line-height: 1.5;
	box-shadow: 0 var(--space-xs) var(--space-sm-plus) color-mix(in srgb, var(--black) 30%, transparent);
	pointer-events: none;
	z-index: calc(var(--z-1000) + 1);

	/* 360px tooltip cap: --chart-min-width has the same value but names a chart, so it is not reused here. */
	max-width: min(360px, 90vw);
	text-align: left;
}

.floating-tooltip.hidden {
	display: none;
}

/* Company Sector β€” always know what ticker you're on */
.analyze-company-sector {
	font-size: var(--font-md);
	font-weight: 600;
	color: var(--text-secondary);
	letter-spacing: normal;
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-xs-plus);
	line-height: 1.4;
}

.analyze-company-sector .sector-divider {
	color: var(--border);
	margin: 0 var(--space-xs);
	font-weight: 400;
	font-size: var(--font-xs);
}

.sector-item {
	color: var(--text-secondary);
	font-weight: 600;
}

.company-name {
	color: var(--text-primary);
	font-weight: 700;
}

.analyze-alert-chips .sector-divider {
	color: var(--border);
	margin: 0 1px;
}

/* ── Signals row β€” plain container, no group-level color/label. ── */
.risk-bar {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	flex-wrap: wrap;
	font-size: var(--font-xs);
	color: var(--text-secondary);
	line-height: 1.4;
}

.risk-bar-signals {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-xs) var(--space-sm);
	min-width: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   Indicator chip β€” the ONE shape/size/style for every badge in the analyze
   modal (dilution/NC/unlock/lockup/earnings/corp-actions/shelf/ATM/theme/
   resistance/former-name). Severity is conveyed only by border+text color
   via the modifier below β€” same padding, radius, font everywhere.
   ═══════════════════════════════════════════════════════════════════════ */
.indicator-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	padding: 1px 7px;
	border-radius: var(--radius-sm);
	font-size: var(--font-xs);
	font-weight: 600;
	line-height: 1.4;
	white-space: nowrap;
	border: 1px solid var(--border);
	background: var(--accent-bg);
	color: var(--text-muted);
}

.indicator-chip.instant-tooltip {
	cursor: help;
}

.indicator-chip:hover {
	color: var(--text-primary);
	border-color: var(--text-muted);
}

.indicator-chip--critical {
	border-color: var(--danger);
	background: var(--negative-bg);
	color: var(--danger);
}

.indicator-chip--critical:hover {
	border-color: var(--danger);
}

.indicator-chip--warn {
	border-color: var(--warning);
	background: var(--warning-bg);
	color: var(--warning);
}

.indicator-chip--warn:hover {
	border-color: var(--warning);
}

/* News-catalyst chip β€” gold accent for a recent headline that matched one of
   the 8 trader catalyst categories (M&A, gov contracts, clinical, ...). */
.indicator-chip--catalyst {
	border-color: var(--catalyst);
	background: var(--catalyst-bg);
	color: var(--catalyst);
}

.indicator-chip--catalyst:hover {
	border-color: var(--catalyst);
}

/* ── events-recent pulse still applies on top of any severity ── */

/* ── Metrics Line (key data in compact row, unified with compact-bar) ── */
.analyze-metrics-line {
	display: flex;
	align-items: center;
	gap: var(--space-xs-plus);
	font-size: var(--font-sm);
	color: var(--text-secondary);
	padding: 0;
	flex-wrap: nowrap;
	overflow: hidden;
	white-space: nowrap;
	line-height: 1.4;
}

.analyze-metrics-line strong {
	font-weight: 700;
	color: var(--text-primary);
}

.analyze-metrics-line .bar-sep {
	color: var(--border);
	flex-shrink: 0;
	margin: 0 3px;
}

.metric-price strong {
	font-size: var(--font-lg);
	font-weight: 700;
	color: var(--text-primary);
}

.analyze-skeleton {
	background: linear-gradient(
		90deg,
		var(--bg-elevated) 25%,
		var(--border) 50%,
		var(--bg-elevated) 75%
	);
	background-size: 200% 100%;
	animation: shimmer 1.5s infinite;
	border-radius: var(--radius-md);
}

.analyze-error {
	background: color-mix(in srgb, var(--negative) 10%, transparent);
	border: 1px solid var(--negative);
	border-radius: var(--radius-md);
	padding: 10px;
	margin-bottom: var(--space-sm-plus);
	color: var(--negative);
}

/* Empty State - Compact */
.analyze-empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: var(--space-md);
	text-align: center;
	min-height: 150px;
}

.analyze-empty-icon {
	font-size: var(--font-xxxl);
	margin-bottom: var(--space-sm);
}

.analyze-empty-title {
	font-size: var(--font-md);
	font-weight: 700;
	color: var(--text-primary);
	margin-bottom: var(--space-xs);
}

.analyze-empty-text {
	color: var(--text-muted);
	font-size: var(--font-sm);
}

/* Footer with shortcuts hint - Compact */
.analyze-modal-footer {
	padding: var(--space-xs) var(--space-sm);
	background: var(--bg);
	border-top: 1px solid var(--border);
	font-size: var(--font-sm);
	color: var(--text-muted);
}

.analyze-shortcuts-hint {
	display: flex;
	gap: var(--space-md);
	justify-content: center;
	flex-wrap: wrap;
}

.analyze-shortcut-link {
	display: inline-flex;
	align-items: center;
	color: var(--text-muted);
	text-decoration: none;
	font-weight: 600;
	font-size: var(--font-sm);
	cursor: pointer;
	transition: color var(--transition-fast);
}

.analyze-shortcut-link:hover {
	color: var(--accent);
}

/* `.analyze-shortcut` is only the gap between a key chip and its label now. */
.analyze-shortcut {
	margin-right: 5px;
}

/* Keyboard key chip: the one shape a shortcut hint wears, wherever it appears.
   The chip is chrome, so it stays muted and never takes the accent. */
.kbd {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: var(--font-xs);
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
}

/* Loading text */
.analyze-modal-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--space-sm);
	padding: var(--space-lg);
}

.analyze-loading-text {
	font-size: var(--font-sm);
	color: var(--text-muted);
}

/* Larger tab close button */
.analyze-tab-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	margin-left: var(--space-xs);
	border-radius: var(--radius-round);
	font-size: var(--font-icon);
	line-height: 1;
	color: var(--text-muted);
	transition: all var(--transition-fast);
}

.analyze-tab-close:hover {
	background: var(--negative);
	color: var(--on-danger);
}

/* Focus visible for accessibility */
#analyze-modal input:focus,
#analyze-modal button:focus {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
}

/* Split charts layout (e.g., 1D/1H) */
.split-charts {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

.split-charts stock-chart-card {
	border: none;
	border-radius: var(--radius-none);
}

.split-charts stock-chart-card:first-child {
	border-right: 1px solid var(--border);
}

/* ── Symbol widgets: analyze modal (sw-*) + dashboard (dash-*) ───
   Per-symbol widget cards (Stock Info / News / SEC Filings / Dilution)
   mounted by features/shared/symbol-widgets.ts and by the dashboard. The
   inner markup is identical in both, so the pieces below are unprefixed
   base classes owned here; sw-* / dash-* only carry the card shell. */

.sw-widgets {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
	gap: var(--space-sm);
	margin-top: var(--space-sm);
}

.sw-widget {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--bg-surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	overflow: hidden;
}

.sw-widget__head {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	padding: var(--space-sm) var(--space-md);
	border-bottom: 1px solid var(--border);
	font-weight: 600;
	font-size: var(--font-sm);
	color: var(--text);
	background: linear-gradient(
		180deg,
		color-mix(in srgb, var(--accent) 3.5%, transparent),
		transparent
	);
}

.sw-widget__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}

.sw-widget__placeholder {
	color: var(--text-dim);
	font-size: var(--font-sm);
}

.sw-widget[data-sw-widget="info"] .sw-widget__body {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
	gap: var(--space-sm);
	padding: var(--space-md);
	align-content: start;
}

.sw-widget[data-sw-widget="news"] .sw-widget__body,
.sw-widget[data-sw-widget="filings"] .sw-widget__body {
	display: flex;
	flex-direction: column;
	padding: var(--space-xs) var(--space-md) var(--space-sm);
}

.sw-widget[data-sw-widget="dilution"] .sw-widget__body {
	padding: var(--space-md);
}

.info__cell {
	min-width: 0;
	padding: var(--space-sm) var(--space-md);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
}

.info__full {
	grid-column: 1 / -1;
}

.info__label {
	margin-bottom: var(--space-2xs);
	font-size: var(--font-xxs);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-dim);
	white-space: nowrap;
}

.info__value {
	font-size: var(--font-md);
	font-weight: 600;
	color: var(--text-primary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.info__headline {
	font-size: var(--font-sm);
	line-height: 1.5;
	color: var(--text-secondary);
}

.info--up {
	color: var(--positive);
}

.info--down {
	color: var(--negative);
}

.info__desc {
	margin: 0;
	font-size: var(--font-sm);
	line-height: 1.55;
	color: var(--text-secondary);
	display: -webkit-box;
	-webkit-line-clamp: 6;
	line-clamp: 6;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.news-item {
	padding: var(--space-sm) var(--space-xs);
	border-bottom: 1px solid color-mix(in srgb, var(--accent) 6%, transparent);
	min-width: 0;
}

.news-item:last-child {
	border-bottom: none;
}

.news-link {
	display: block;
	color: var(--text-secondary);
	font-size: var(--font-sm);
	line-height: 1.45;
	text-decoration: none;
	overflow-wrap: anywhere;
}

.news-link:hover {
	color: var(--text-primary);
	text-decoration: underline;
	text-underline-offset: var(--space-2xs);
}

.news-time {
	margin-top: var(--space-2xs);
	font-size: var(--font-xs);
	color: var(--text-dim);
}

.filing {
	display: flex;
	align-items: flex-start;
	gap: var(--space-sm);
	padding: var(--space-sm) var(--space-xs);
	border-bottom: 1px solid color-mix(in srgb, var(--accent) 6%, transparent);
	min-width: 0;
}

.filing:last-child {
	border-bottom: none;
}

.filing__form {
	flex-shrink: 0;
	font-size: var(--font-xxs);
	font-weight: 700;
	letter-spacing: 0.05em;
	padding: var(--space-2xs) var(--space-xs-plus);
	border-radius: var(--radius-sm);
	background: color-mix(in srgb, var(--warning) 12%, transparent);
	color: var(--warning);
}

.filing__meta {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
}

.filing__link {
	color: var(--text-secondary);
	font-size: var(--font-sm);
	line-height: 1.4;
	text-decoration: none;
	overflow-wrap: anywhere;
}

.filing__link:hover {
	color: var(--text-primary);
	text-decoration: underline;
	text-underline-offset: var(--space-2xs);
}

.filing__date {
	font-size: var(--font-xs);
	color: var(--text-dim);
}

/* The per-row "jump to the source" chip. The filing description itself now
   opens the in-app Research reader, so EDGAR needs its own small target
   rather than being the row's only link. `.filing__meta` is a column, so the
   chip aligns to its own start edge. */
.filing__edgar {
	align-self: flex-start;
	margin-top: var(--space-xs);
	padding: 0 var(--space-xs);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text-dim);
	font-size: var(--font-xs);
	letter-spacing: 0.04em;
	text-decoration: none;
	white-space: nowrap;
}

.filing__edgar:hover {
	color: var(--text-primary);
	border-color: var(--text-dim);
}

.dilution-metrics {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
	gap: var(--space-sm);
	margin-top: var(--space-md);
}

/* Cross-link from the summary Dilution Risk Profile (Dashboard + Analyze
   widgets) into the per-symbol dilution page that owns the depth. Shared by
   both cards, so it lives here next to .dilution-metrics. */
.dilution-page-link {
	display: inline-block;
	margin-top: var(--space-sm);
	color: var(--text-secondary);
	font-size: var(--font-sm);
	text-decoration: none;
}

.dilution-page-link:hover {
	color: var(--text-primary);
	text-decoration: underline;
	text-underline-offset: var(--space-2xs);
}

.sw-drp {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: var(--space-md);
}

@media (width <= 768px) {
	.sw-widgets {
		grid-template-columns: 1fr;
	}
}

#analyze-modal input:focus-visible,
#analyze-modal button:focus-visible {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
}

/* Chinese Profile Badge */
.chinese-badge {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 3px;
	padding: 1px 7px;
	border-radius: var(--radius-sm);
	font-size: var(--font-sm);
	font-weight: 700;
	cursor: help;
	line-height: 1.4;
}

.chinese-badge--high {
	background: color-mix(in srgb, var(--negative) 12%, transparent);
	color: var(--negative);
	border: 1px solid color-mix(in srgb, var(--negative) 25%, transparent);
}

.chinese-badge--medium {
	background: color-mix(in srgb, var(--warning) 12%, transparent);
	color: var(--warning);
	border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent);
}

.vol-rel {
	font-weight: 400;
	opacity: 0.7;
}

.events-recent {
	animation: pulse-recent 1.5s ease-in-out infinite;
}

@keyframes pulse-recent {
	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.55;
	}
}

.analyze-gap-hist .positive {
	color: var(--positive);
}

.analyze-gap-hist .negative {
	color: var(--negative);
}

.analyze-gap-hist .muted {
	color: var(--text-muted);
}

/* ════════════════════════════════════
   Responsive β€” Analyze Modal
   ════════════════════════════════════ */

@media (width <= 768px) {
	/* Stack split charts before the 480px query kicks in β€” two
	   <stock-chart-card> panels otherwise get squeezed into ~250-380px
	   grid cells inside a modal capped at max-width: 95vw. */
	.split-charts {
		grid-template-columns: 1fr;
	}

	.split-charts stock-chart-card:first-child {
		border-right: none;
		border-bottom: 1px solid var(--border);
	}

	/* Wrap metric/catalyst text instead of silently clipping it */
	.analyze-compact-bar {
		flex-wrap: wrap;
		white-space: normal;
	}

	.analyze-metrics-line {
		flex-wrap: wrap;
		white-space: normal;
		overflow: visible;
	}

	/* Enlarge undersized header/action touch targets */
	.analyze-clear-header-btn,
	.analyze-watchlist-btn {
		width: var(--touch-min);
		height: var(--touch-min);
	}

	.analyze-research-btn {
		height: var(--touch-min);
		padding: 0 var(--space-md);
	}
}

@media (width <= 480px) {
	.analyze-modal-content {
		width: 100%;
		max-width: 100vw;
		max-height: var(--viewport-h);
		border-radius: var(--radius-none);
	}

	.analyze-modal-header {
		flex-wrap: wrap;
		padding: var(--space-xs);
	}

	/* Enlarge close button for mobile touch targets (min 44x44) */
	.modal-close-btn {
		width: var(--touch-min);
		height: var(--touch-min);
		font-size: var(--font-xl);
	}

	.analyze-modal-tabs {
		padding: var(--space-xs) var(--space-xs);
	}

	.analyze-tab {
		padding: var(--space-xs) var(--space-sm);
		font-size: var(--font-xs);
	}

	/* Hide keyboard shortcut hints on mobile β€” not usable */
	.analyze-shortcuts-hint {
		display: none;
	}

	/* Show swipe-to-close hint instead */
	.analyze-modal-footer::after {
		content: "Swipe down to close";
		display: block;
		text-align: center;
		font-size: var(--font-xs);
		color: var(--text-muted);
		padding-top: var(--space-xs);
	}
}

/* ── Keyword highlighting (features/analyze/highlight-service.js) ── */
.hl-positive {
	color: var(--positive);
	font-weight: 600;
}

.hl-negative {
	color: var(--negative);
	font-weight: 600;
}

.hl-neutral {
	color: var(--accent);
	font-weight: 600;
}

.hl-corporate {
	color: var(--catalyst);
	font-weight: 600;
}

.hl-number {
	color: var(--text-primary);
	font-weight: 700;
}

/* ── Board of Directors (tooltip) ── */

/* .live-signals-pref is still used by chart-alerts-panel.js's sound-toggle
   label β€” the rest of this former "Watchlist live signals" feature (panel,
   drawer, per-signal rows) was removed as dead. */
.live-signals-pref {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════
   ALERTS PANEL & DIALOG β€” TradingView-style alert system
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Alerts Panel (right-docked, like Watchlist/Level2/Screener) ── */
.chart-alerts-panel {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: var(--chart-min-width);
	max-width: 100vw;
	background: var(--bg-elevated);
	border-left: 1px solid var(--border);
	z-index: var(--z-1000);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform var(--transition-base);
	overflow: hidden;
}

.chart-alerts-panel:not(.hidden) {
	transform: translateX(0);
}

.chart-alerts-panel .chart-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-md);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
	gap: var(--space-sm);
}

.chart-alerts-panel .chart-panel-title {
	font-size: var(--font-lg);
	font-weight: 700;
}

.chart-alerts-tabs {
	display: flex;
	gap: var(--space-xs);
	flex: 1;
}

.chart-alerts-tab {
	flex: 1;
	padding: var(--space-xs) var(--space-sm);
	font-size: var(--font-xs);
	font-weight: 600;
	color: var(--text-muted);
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all var(--transition-fast);
	white-space: nowrap;
}

.chart-alerts-tab:hover {
	color: var(--text);
	background: var(--bg);
	border-color: var(--border);
}

.chart-alerts-tab.active {
	color: var(--accent);
	background: color-mix(in srgb, var(--accent) 10%, transparent);
	border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.chart-alerts-tab:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.chart-alerts-list {
	flex: 1;
	overflow-y: auto;
	padding: var(--space-sm);
	display: grid;
	gap: var(--space-xs);
}

.chart-alerts-empty {
	padding: var(--space-xl) var(--space-md);
	text-align: center;
	color: var(--text-muted);
	font-size: var(--font-sm);
	line-height: 1.6;
}

.chart-alerts-empty p:first-child {
	font-weight: 600;
	color: var(--text-secondary);
	margin-bottom: var(--space-xs);
}

/* The two alert systems share one word and nothing else (D4), so each panel
   says which one it is and where the other one lives. */
.chart-alerts-crosslink {
	padding: var(--space-xs) var(--space-md);
	border-bottom: 1px solid var(--border);
	color: var(--text-dim);
	font-size: var(--font-xs);
	line-height: 1.5;
}

.chart-alerts-crosslink strong {
	color: var(--text-secondary);
	font-weight: 600;
}

.chart-alerts-crosslink a {
	color: var(--text-secondary);
}

.chart-alerts-crosslink a:hover {
	color: var(--text-primary);
}

.chart-alert-item {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: var(--space-sm);
	padding: var(--space-sm);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	transition: all var(--transition-fast);
}

.chart-alert-item:hover {
	border-color: var(--accent);
}

.chart-alert-item--triggered {
	border-color: var(--positive);
	background: var(--positive-bg);
}

.chart-alert-item--just-triggered {
	animation: alert-trigger-flash 0.5s ease;
}

.chart-alert-item__main {
	min-width: 0;
}

.chart-alert-item__header {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin-bottom: var(--space-xs);
	flex-wrap: wrap;
}

.chart-alert-symbol {
	font-weight: 700;
	font-size: var(--font-md);
	color: var(--accent);
}

.chart-alert-status {
	display: inline-flex;
	align-items: center;
	padding: 1px var(--space-xs-plus);
	border-radius: var(--radius-sm);
	font-size: var(--font-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* The status washes come from the tokens, not from literals. The two
   literals this block used to carry were 15% and 10% of #828694 β€” the
   neutral grey that has no tint token β€” so the ladder is expressed with the
   two tokens that do: --accent-bg for the stronger pair, --overlay-1 for
   the weaker one. Both are lighter than what they replace, so the muted
   and dim text above gains contrast. The remaining sub-4.5:1 pairs are
   the badge contrast finding (appendix A4, Wave 5.2), which is decision
   gated and not touched here. */
.chart-alert-status--active {
	background: var(--positive-bg);
	color: var(--positive);
}

.chart-alert-status--triggered {
	background: var(--negative-bg);
	color: var(--negative);
}

.chart-alert-status--expired {
	background: var(--accent-bg);
	color: var(--text-muted);
}

.chart-alert-status--disabled {
	background: var(--overlay-1);
	color: var(--text-dim);
}

.chart-alert-item__details {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
	font-size: var(--font-xs);
	color: var(--text-secondary);
	line-height: 1.5;
}

.chart-alert-type {
	font-weight: 600;
	color: var(--text);
}

.chart-alert-condition {
	color: var(--warning);
}

.chart-alert-price {
	font-family: var(--font-mono);
	font-weight: 600;
}

.chart-alert-drawing {
	color: var(--text-muted);
}

.chart-alert-name {
	font-style: italic;
	color: var(--text-muted);
}

.chart-alert-item__meta {
	margin-top: var(--space-xs);
	font-size: var(--font-xs);
	color: var(--text-dim);
}

.chart-alert-item__actions {
	display: flex;
	gap: var(--space-xs);
	flex-shrink: 0;
}

/* ── Alert Dialog (modal) ── */
.chart-alert-dialog-overlay {
	position: fixed;
	inset: 0;
	background: color-mix(in srgb, var(--black) 60%, transparent);
	z-index: var(--z-max);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-md);
	animation: fadeIn 0.15s ease;
}

.chart-alert-dialog-overlay.hidden {
	display: none;
}

.chart-alert-dialog {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	width: 100%;
	max-width: var(--dialog-width-sm);
	max-height: 90vh;
	max-height: 90dvh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: var(--shadow-lg);
}

.chart-alert-dialog__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-md);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.chart-alert-dialog__header h2 {
	margin: 0;
	font-size: var(--font-lg);
	font-weight: 700;
}

.chart-alert-dialog__close {
	background: none;
	border: none;
	color: var(--text-muted);
	font-size: var(--font-xxl);
	line-height: 1;
	cursor: pointer;
	padding: var(--space-xs);
	transition: color var(--transition-fast);
}

.chart-alert-dialog__close:hover {
	color: var(--text);
}

.chart-alert-dialog__tabs {
	display: flex;
	border-bottom: 1px solid var(--border);
	background: var(--bg);
	flex-shrink: 0;
	overflow-x: auto;
}

.chart-alert-dialog-tab {
	padding: var(--space-sm) var(--space-md);
	font-size: var(--font-sm);
	font-weight: 600;
	color: var(--text-muted);
	background: transparent;
	border: none;
	border-bottom: var(--space-2xs) solid transparent;
	cursor: pointer;
	transition: all var(--transition-fast);
	white-space: nowrap;
}

.chart-alert-dialog-tab:hover {
	color: var(--text);
}

.chart-alert-dialog-tab.active {
	color: var(--accent);
	border-bottom-color: var(--accent);
}

.chart-alert-dialog-tab:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.chart-alert-dialog__content {
	flex: 1;
	overflow-y: auto;
	padding: var(--space-md);
}

.chart-alert-dialog-panel {
	display: none;
	flex-direction: column;
	gap: var(--space-md);
}

.chart-alert-dialog-panel.active {
	display: flex;
}

.chart-alert-dialog-empty {
	padding: var(--space-xl);
	text-align: center;
	color: var(--text-muted);
	line-height: 1.6;
}

.chart-alert-dialog__footer {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-sm);
	padding: var(--space-md);
	border-top: 1px solid var(--border);
	flex-shrink: 0;
}

/* Responsive alerts panel */
@media (width <= 768px) {
	.chart-alerts-panel {
		width: 100vw;
	}

	.chart-alert-dialog {
		max-width: 100%;
		max-height: 100%;
		border-radius: var(--radius-none);
	}
}

.ac-pill.active {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--on-accent);
	font-weight: 600;
}

.ac-minmax-row .modal-input {
	width: 120px;
	min-width: 0;
}

/* ── Shared alert builder (features/shared/alert-builder.js) ──────────── */

.alb-test-field .modal-input {
	width: 110px;
	min-width: 0;
}

.alb-test-progress .bt-progress-track {
	flex: 1;
}

/* Backtest progress bar β€” page component promoted here because the shared
   alert builder's test tab reuses it on pages that never load backtest.css. */
.bt-progress-track {
	flex: 1;
	height: var(--space-sm);
	background: var(--bg-input);
	border-radius: var(--radius-md);
	overflow: hidden;
}

.bt-progress-fill {
	height: 100%;
	width: 0%;
	background: var(--success);
	transition: width var(--transition-slow);
}

/* Inline text-style button (shared builders' disclosure toggles). */
.btn-link {
	background: none;
	border: none;
	color: var(--text-secondary);
	cursor: pointer;
	padding: 0;
	font-family: var(--font-sans);
	font-size: var(--font-sm);
	transition: color var(--transition-fast);
}

.btn-link:hover {
	color: var(--text-primary);
}

/* ── Signal alert DSL editor (backtest + dashboard alert widget) ──
   The builder modal this replaces was an overlay; this renders inline on
   both pages, so its only layout rule is the one wrapper. Everything else
   borrows the shared primitives (filter-textarea, preset-item, rac-issue
   status rows, btn-link). */
.alert-dsl-editor {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	padding: var(--space-md);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
}

.alert-dsl-editor__saved,
.alert-dsl-editor__form {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.alert-dsl-editor__saved-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
}

.alert-dsl-editor__saved-title {
	color: var(--text-secondary);
	font-size: var(--font-xs);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.alert-dsl-editor__list {
	max-height: var(--picker-list-height);
	overflow-y: auto;
}

.alert-dsl-editor__empty {
	font-size: var(--font-sm);
}

.alert-dsl-editor__summary {
	font-size: var(--font-xs);
	display: block;
	max-width: 460px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.alert-dsl-editor__field {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
}

.alert-dsl-editor__label {
	color: var(--text-secondary);
	font-size: var(--font-sm);
	font-weight: 600;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-sm);
}

.alert-dsl-editor__scope {
	font-size: var(--font-xs);
	margin: 0;
	line-height: 1.4;
}

.alert-dsl-editor__scope a {
	color: var(--accent);
}

.alert-dsl-editor__field-error {
	color: var(--danger);
	font-size: var(--font-xs);
}

.alert-dsl-editor__dsl {
	font-family: var(--font-mono);
	font-size: var(--font-xs);
	resize: vertical;
	width: 100%;
}

.alert-dsl-editor__preview {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
}

.alert-dsl-editor__summary-line {
	color: var(--text);
	font-size: var(--font-sm);
	margin: 0;
	padding: var(--space-xs) var(--space-sm);
	background: var(--surface-raised);
	border-radius: var(--radius-sm);
	line-height: 1.4;
}

.alert-dsl-editor__unconvertible {
	margin: 0;
}

.alert-dsl-editor__status {
	font-size: var(--font-sm);
}

.alert-dsl-editor__actions {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.alert-dsl-editor__actions .btn-danger {
	margin-left: auto;
}

/* Lint/issue rows, kept under the old prefix: the preview, the add-widget
   clone and the smoke tests reference the rac-issue classes. */
.rac-issue {
	font-size: var(--font-xs);
	line-height: 1.4;
	border-radius: var(--radius-sm);
	padding: var(--space-xs) var(--space-sm);
	background: var(--info-bg);
	color: var(--text);
}

.rac-issue--warning {
	background: var(--warning-bg);
}

.rac-issue--error {
	background: var(--negative-bg);
	color: var(--danger);
}

/* ── Data tables ────────────────────────────────────────────────
   One base for every data table in the app. Feature tables keep their
   own column widths, header treatment and row states on top of it; this
   only owns what every table needs: a collapse that doesn't double the
   borders, a padding floor for th/td, tabular figures so numeric columns
   line up, and a wrapper that scrolls sideways with momentum on touch.
   (No scroll shadow here: it needs an opaque base color per surface, and
   the tables sit on --bg, --bg-elevated and --surface alike.) */
.data-table {
	width: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
	padding: var(--table-cell-pad-y) var(--table-cell-pad-x);
	font-size: var(--table-font-size);
	text-align: left;
	vertical-align: middle;
}

/* The canonical table header (decision 4.2). Five tables wrote this five ways
   β€” three font sizes, two tracking values, three text colours, four sticky
   backgrounds β€” and every one of them also carries `.data-table`, so the
   overrides were winning over the base by being last. This is the one
   definition: a page's table class owns its cell padding, its column widths
   and its sticky background (a table on a card and a table on the page are
   not the same surface), and nothing else about the header. */
.data-table th {
	position: sticky;
	top: 0;
	z-index: var(--z-1);
	background: var(--bg-elevated);
	border-bottom: 1px solid var(--border);
	color: var(--text-muted);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	text-align: left;
}

/* ── The surface primitive (decision 10.3) ─────────────────────────────────
   One card body. `background: var(--bg-elevated)` + a 1px border + a radius
   was written ~130 times, which is not 130 decisions: the audit's count
   included hover and active states, badges and cells, none of which a class on
   the element can express. What is left is the container set β€” a panel, a
   section, a dialog body, a card β€” and this is it.

   --surface-1/2/3 are the three elevations a page tier can remap, so a tier
   that restyles its shell restyles its cards by overriding three tokens
   instead of every rule that paints one. */
.surface {
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
}

/* .floating-tooltip also carries the .surface class; --surface-1 is never
   defined, so .surface alone leaves the tooltip transparent. This compound
   selector beats .surface in specificity, giving the tooltip an opaque
   background. */
.surface.floating-tooltip {
	background-color: var(--surface);
}

.surface-2 {
	background: var(--surface-2);
}

.surface-3 {
	background: var(--surface-3);
}

.data-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ── Accessibility: forced colors & increased contrast ───────────────────
   The P&L sign is carried by a translucent tint (--positive-bg /
   --negative-bg) on a card. Forced-colors flattens every background to the
   system canvas, so the tint vanishes and the number falls back to the
   system text colour: the sign is gone. Nothing here hardcodes a palette β€”
   the user still picks the colors β€” what we add is a second, non-color
   channel for the sign, and firmer borders where a border was the only
   thing separating two surfaces.

   The card selectors below are the real card bodies. They used to lead with
   `.card`, which no stylesheet defines and no markup uses, so high-contrast
   mode was strengthening the border of 4 of ~130 card implementations. */
@media (forced-colors: active) {
	.metric-value.positive,
	.metric-value.negative,
	.stock-row-change.positive,
	.stock-row-change.negative,
	.inspector-change.positive,
	.inspector-change.negative,
	.day-pnl {
		forced-color-adjust: none;
		border: 1px solid;
		border-color: currentcolor;
		border-radius: var(--radius-sm);
	}

	.dash-widget,
	.dilution-card,
	.dilution-chart-card,
	.trade-chart-panel,
	.playbook-card,
	.fh-preset-card,
	.sw-dilution-card,
	.inspector-chart-card,
	.data-table th,
	.data-table td {
		border-color: CanvasText;
	}
}

/* Increased contrast (not the Windows HC mode): keep the palette, but make
   the state borders carry more weight so a tinted card still reads as a
   card. */
@media (prefers-contrast: more) {
	.dash-widget,
	.dilution-card,
	.dilution-chart-card,
	.trade-chart-panel,
	.playbook-card,
	.fh-preset-card,
	.sw-dilution-card,
	.inspector-chart-card,
	.data-table th,
	.data-table td {
		border-width: var(--space-2xs);
	}

	.metric-value,
	.day-pnl,
	.stock-row-change {
		font-weight: 700;
	}
}

/* ── Flip card (chart notes) ──────────────────────────────────────
   Every chart in the app flips on the Y axis to reveal a notes face.
   Three rules keep this from being a layout change:

   - the wrapper declares no padding, border or margin, so the chart keeps
     the exact box it had before the flip existed;
   - the back face is `position: absolute; inset: 0`, so it covers the front
     rather than competing with it for height. The front face is the only
     thing that contributes height, on both faces;
   - the two faces are stacked with grid inside that wrapper, so a face is a
     grid item and stretches to the wrapper the same way a bare chart did.

   Rotating (rather than swapping the faces) also leaves the chart's own box
   untouched mid-transition, so the canvas is never asked to re-measure. */
.flip-card {
	display: grid;

	/* The row is the wrapper's only child track, so it must not be `auto`:
	   an auto track sizes to the card's content, and a card whose chart is
	   measured by a ResizeObserver then feeds its own height back in and
	   grows without bound (the scanner calendar's sidebar chart went from
	   ~440px to thousands). minmax(0, 1fr) caps the track at the wrapper's
	   own (definite) height, so a fill chart inside is bounded. */
	grid-template-rows: minmax(0, 1fr);

	/* Same for the single column: an `auto` track lets a wide chart canvas
	   widen the card past its wrapper, which the ResizeObserver then reads
	   back and widens again on the next symbol switch. */
	grid-template-columns: minmax(0, 1fr);
	position: relative;
	height: 100%;
	perspective: 1200px;
}

.flip-card__inner {
	display: grid;
	grid-template-areas: "face";
	transform-style: preserve-3d;
	transition: transform var(--transition-slow);
}

.flip-card--flipped .flip-card__inner {
	transform: rotateY(180deg);
}

.flip-card__face {
	grid-area: face;

	/* A grid item's default `min-height`/`min-width: auto` refuses to shrink
	   below its content, which would let the bounded tracks above be
	   overflowed anyway. */
	min-height: 0;
	min-width: 0;
	backface-visibility: hidden;
}

/* Only the face turned toward the reader takes pointer input, so a hidden face
   cannot swallow a click meant for the chart underneath it. */
.flip-card__face--front {
	pointer-events: auto;
}

.flip-card__back {
	transform: rotateY(180deg);
	pointer-events: none;
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	padding: var(--space-md);
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
	overflow: auto;
}

.flip-card--flipped .flip-card__face--front {
	pointer-events: none;
}

.flip-card--flipped .flip-card__back {
	pointer-events: auto;
}

/* ── Chart corner controls ───────────────────────────────────────
   One look for the fullscreen / notes / star cluster that sits in a
   chart's top-right corner. The card's own two buttons are inside its shadow
   root and cannot read this file, so chart-card-element.ts carries the same
   block; tests/chart/test_chart_flip.py pins the two declarations together, because
   a shadow-root copy is the one thing that can silently drift.

   The star is slotted in from the page (its handler and active state are the
   page's), and a light-tree declaration always beats ::slotted() -- so this
   block, not the card's, is what actually styles it. */
.corner-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--icon-size);
	height: var(--icon-size);
	padding: 0;
	background: color-mix(in srgb, var(--black) 70%, transparent);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	color: var(--text-muted);
	font-size: var(--font-xs);
	line-height: 1;
	cursor: pointer;
}

.corner-btn:hover {
	background: var(--text);
	color: var(--bg);
}

/* Active reads through the glyph's colour alone: a filled block was louder
   than the chart it sits on. */
.corner-btn.added {
	color: var(--warning);
}

.corner-btn.added:hover {
	color: var(--warning);
	background: var(--text);
}

/* The toggle for the charts that are not <stock-chart-card> and so have no
   shadow root to render one in (dilution, research, level2, /chart). Same
   muted shape as the card's own expand button, in the same top-right corner,
   and absolutely positioned so it costs the chart no layout. */
.flip-card__toggle {
	position: absolute;
	top: var(--space-xs);
	right: var(--space-xs);

	/* Was the literal 20. --z-10 is the nearest row below it and every
	   sibling inside .flip-card sits at auto (0): the toggle only has to
	   clear the back face and the chart canvas.

	   Note .flip-card is position:relative with no z-index, so it is NOT a
	   stacking context and this value competes in the page's context rather
	   than the card's. --z-10 keeps the claim as small as the behaviour
	   needs; the audit's "each literal is inside its own stacking context"
	   does not hold for this one. */
	z-index: var(--z-10);
	padding: var(--space-2xs) var(--space-xs-plus);
	font-family: var(--font-sans);
	font-size: var(--font-xs);
	font-weight: 600;
	line-height: 1;
	color: var(--text-muted);
	background: color-mix(in srgb, var(--black) 70%, transparent);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	cursor: pointer;
}

.flip-card__toggle:hover {
	background: var(--text);
	color: var(--bg);
}

.flip-card__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	flex-wrap: wrap;
}

.flip-card__notes-label {
	font-size: var(--font-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--text-muted);
}

.flip-card__notes {
	flex: 1;
	width: 100%;
	min-height: 120px;
	padding: var(--space-sm);
	background: var(--bg-input);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	font-family: var(--font-sans);
	font-size: var(--font-sm);
	line-height: 1.5;
	resize: vertical;
}

.flip-card__notes:focus {
	border-color: var(--border-focus);
	outline: none;
}

.flip-card__notes:focus-visible {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
}

.flip-card__actions {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	flex-wrap: wrap;
}

.flip-card__saved {
	font-size: var(--font-xs);
	color: var(--text-muted);
	opacity: 0;
	transition: opacity var(--transition-base);
}

.flip-card__saved--visible {
	opacity: 1;
}

/* The chart expands to fullscreen with `:host(.expanded) { position: fixed;
   inset: 0 }`. Three things above -- `perspective`, `preserve-3d` and the
   `rotateY` on a flipped card -- each make an element the containing block for
   fixed-position descendants, so while any of them was in effect the expanded
   chart resolved `inset: 0` against the wrapper instead of the viewport and
   came out clipped to the card's own 440x341 box. Drop all three for as long
   as a chart is expanded, so `fixed` means fixed to the viewport again --
   including the case where the card was already flipped to its notes face. */
.flip-card:has(stock-chart-card.expanded) {
	perspective: none;
}

.flip-card:has(stock-chart-card.expanded) .flip-card__inner {
	transform-style: flat;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.flip-card__inner {
		transition: none;
	}
}


/* ── Touch targets ───────────────────────────────────────────
   Dense desktop controls keep their size on phones: the Signal/Full toggle is
   19px tall and the tab bars are 24px. On a coarse pointer these get a 32px
   hit height, which is above the 24px WCAG floor and below the 44px platform
   ideal on purpose: the surrounding layout was built for the denser size. */
@media (pointer: coarse) {
	.mode-btn,
	.tab,
	.backtest-tab,
	.trades-tab,
	.tf-btn {
		min-height: var(--tab-height);
	}
}

/* ── Touch floor ──────────────────────────────────────────────────────────
   The desktop chrome is compact (26-28px). On touch-sized viewports every
   interactive control keeps a 40px floor, so the compact tokens never shrink
   a finger target. min-height/min-width leave wider or taller controls alone. */
@media (width <= 1024px) {
	.tab,
	.btn,
	.dash-tab,
	.trades-tab,
	.backtest-tab,
	.view-toggle,
	.view-toggle .view-btn,
	.tf-btn,
	.mode-btn,
	.input-field,
	.select-field {
		min-height: var(--touch-compact);
	}

	.chart-tool-btn {
		min-width: var(--touch-compact);
		min-height: var(--touch-compact);
	}

	/* A checkbox or radio with its text in a <label> is one target: the label
	   is the hit area, and the native box is raised to the 28px audit floor. */
	label:has(> input[type="checkbox"]),
	label:has(> input[type="radio"]) {
		min-height: var(--touch-compact);
	}

	input[type="checkbox"],
	input[type="radio"] {
		width: var(--tab-height);
		height: var(--tab-height);
	}
}

/* ── Disclosure β€” advanced controls on demand ─────────────────────────────
   One shared pattern for "minimal UI by default": a page keeps its primary
   controls visible and moves the rest into a closed
   `<details class="ui-disclosure">` whose `<summary>` is labelled after what
   it hides (usually "Advanced"). Styled from the token block, so it follows
   the dark palette; the caret is a text marker instead of a vendor-prefixed
   pseudo-element, and touch widths get the full 44px target. */
.ui-disclosure {
	min-width: 0;
}

.ui-disclosure__summary {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	height: var(--control-height);
	padding: 0 var(--space-md);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
	color: var(--secondary);
	font-family: var(--font-sans);
	font-size: var(--control-font-size);
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	list-style: none;
	user-select: none;
	transition: background var(--transition-fast), color var(--transition-fast);
}

/* Own the caret: drop the native triangle, then draw ours. */
.ui-disclosure__summary::marker {
	content: "";
}

.ui-disclosure__summary::after {
	content: "\25BE";
	font-size: var(--font-xs);
	line-height: 1;
	transition: transform var(--transition-fast);
}

.ui-disclosure[open] > .ui-disclosure__summary::after {
	transform: rotate(180deg);
}

.ui-disclosure__summary:hover {
	background: var(--border);
	color: var(--text);
}

.ui-disclosure__summary:focus-visible {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
}

.ui-disclosure__body {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm);
	padding-top: var(--space-sm);
}

@media (width <= 1024px) {
	.ui-disclosure__summary {
		height: auto;
		min-height: var(--touch-min);
	}
}

/* Popover variant, for the advanced group of a toolbar. The toolbar keeps its
   height and the list below does not move: the group opens as a panel anchored
   to its button, bounded in width, scrollable, and closed by an outside click
   (see common-runtime). The inline default stays for groups inside a card. */
.ui-disclosure--popover {
	position: relative;
}

.ui-disclosure--popover > .ui-disclosure__body {
	position: absolute;
	top: calc(100% + var(--space-xs));
	right: 0;
	z-index: var(--z-50);
	display: flex;
	flex-flow: column nowrap;
	align-items: stretch;
	gap: var(--space-md);

	/* Sized to its content, never wider than 44rem or the viewport. */
	width: max-content;
	max-width: min(44rem, calc(100vw - 2 * var(--space-md)));
	max-height: min(70vh, 40rem);
	overflow: auto;
	margin: 0;
	padding: var(--space-md);
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
}

.ui-disclosure--popover > .ui-disclosure__body > * {
	min-width: 0;
}

/* A phone has no room beside the button, and the toolbar is a sideways strip
   that would clip an anchored panel. The group opens as a bottom sheet instead:
   fixed to the viewport, so no scrolling strip can cut it off. */
@media (width <= 600px) {
	.ui-disclosure--popover > .ui-disclosure__body {
		position: fixed;
		inset: auto 0 0;
		z-index: var(--z-200);
		width: auto;
		max-height: 75vh;
		border-radius: var(--radius-lg) var(--radius-lg) 0 0;
		box-shadow: var(--shadow-lg);
	}

	/* A closed popover still lays out its body (Chrome keeps closed details
	   content in the box tree), so its buttons counted as on-screen targets
	   off the top of the phone. A closed sheet draws nothing, so it takes no box. */
	.ui-disclosure--popover:not([open]) > .ui-disclosure__body {
		display: none;
	}
}

/* In a control-panel row the disclosure is the row's last item, so it takes
   the free width the corner toggle used to: pushed to the far edge on a wide
   row, and kept inside the row when it wraps instead of being pushed off a
   strip with no visible scrollbar. */
.control-panel__main > .ui-disclosure,
.control-panel__display > .ui-disclosure {
	margin-left: auto;
}

/* Groups inside a popover: a small label over each set of related controls. */
.ui-disclosure__group {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs-plus);
	min-width: 0;
}

.ui-disclosure__label {
	margin: 0;
	font-family: var(--font-sans);
	font-size: var(--font-xs);
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.ui-disclosure__hint {
	margin: 0;
	font-size: var(--font-xs);
	color: var(--text-muted);
}

.ui-disclosure__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm);
}

/* Long lists inside a popover scroll inside their own group, so the other
   groups stay reachable without the whole panel growing. */
.ui-disclosure--popover .presets-panel {
	grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
	max-height: 16rem;
	overflow: auto;
}

.ui-disclosure--popover .input-field {
	width: 100%;
	min-width: 0;
}

/* An inline Advanced group inside an action row takes its own full line, so
   its buttons wrap inside the row instead of running past the card's edge. */
.action-row > .ui-disclosure {
	flex-basis: 100%;
	min-width: 0;
}

.action-row > .ui-disclosure > .ui-disclosure__body {
	flex-wrap: wrap;
	width: 100%;
}

/* A timeframe strip inside a popover wraps instead of running past its edge. */
.ui-disclosure--popover .tf-selector {
	flex-wrap: wrap;
	overflow: visible;
	max-width: 100%;
}

/* Analyze opened without a ticker: a short start page with one field. */
.analyze-start {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);

	/* auto width, not .page-wrapper's 100%: a 100% box plus the 16px margin on
	   each side was 16px wider than a 390px phone (the audit's analyze OVERFLOW). */
	width: auto;
	max-width: 32rem;
	margin-inline: var(--space-md);
	padding-top: var(--space-xl);
}

/* The three ways to open a stock, shown when the page has no ticker. */
.analyze-start__ways {
	display: grid;
	gap: var(--space-xs);
	margin-top: var(--space-md);
}

.analyze-start__way {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--space-2xs);
	min-height: var(--touch-min);
	padding: var(--space-xs) var(--space-sm);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg-elevated);
	color: var(--text-primary);
	text-decoration: none;
}

.analyze-start__way:hover {
	border-color: var(--accent);
}

.analyze-start__way:focus-visible {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
}

.analyze-start__way-label {
	font-weight: 600;
}

.analyze-start__way-hint {
	color: var(--text-muted);
	font-size: var(--font-sm);
}

.analyze-start__title {
	margin: 0;
	font-size: var(--page-title-size);
	color: var(--text-primary);
}

.analyze-start__hint {
	margin: 0;
	color: var(--text-muted);
	font-size: var(--font-sm);
}

.analyze-start__form {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
}

.analyze-start__form .input-field {
	flex: 1 1 12rem;
	min-width: 0;
	min-height: var(--touch-min);
	text-transform: uppercase;
}

/* Phone: the field takes the first line and Analyze the second, both at the
   44px touch floor. */
@media (width <= 480px) {
	.analyze-start__form {
		flex-direction: column;
	}

	.analyze-start__form .input-field,
	.analyze-start__form .btn {
		flex: none;
		width: 100%;
		min-height: var(--touch-min);
	}
}

/* Visually hidden, still announced by screen readers. */
.u-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Native date inputs take the same focus ring as the other fields. */
input[type="date"]:focus-visible,
input[type="time"]:focus-visible,
input[type="month"]:focus-visible {
	outline: var(--focus-ring-width) solid var(--accent);
	outline-offset: var(--focus-ring-offset);
}

/* Touch screens: chart card corner buttons and the notes toggle are 36px. */
@media (pointer: coarse), (width <= 600px) {
	.flip-card__toggle {
		min-width: var(--touch-target-size);
		min-height: var(--touch-target-size);
	}
}

/* Touch screens: a settings row (checkbox plus label) is one 36px target. */
@media (pointer: coarse), (width <= 600px) {
	.nav-layout-row__toggle {
		min-height: var(--touch-target-size);
		align-items: center;
	}
}