/* ===== V6: chart-first layout and ProjectX-style order controls ===== */
#app{grid-template-rows:58px minmax(0,1fr);gap:9px;padding:9px}
header{min-height:58px;padding:0 13px;gap:13px}
main{grid-template-columns:164px minmax(0,1fr) 236px;grid-template-rows:minmax(460px,1fr) 162px;gap:8px}
#watch{grid-column:1;grid-row:1}
#chartbox{grid-column:2;grid-row:1;min-width:0}
#ticket{grid-column:3;grid-row:1;min-width:0}
#bottom{grid-column:1/4;grid-row:2}
#watch .watch-intro,#watch .watch-foot{display:none}
#wl{padding:4px}
.wrow{padding:8px 7px;margin:1px 0}
.w-symbol small{max-width:82px}
.panel-head{height:39px;min-height:39px;padding:0 11px}
.chart-toolbar{min-height:39px;padding:6px 10px;gap:6px}
.instrument{gap:7px;margin-right:3px}
.instrument-desc{max-width:130px}
.tf{padding:4px 7px;min-width:28px}
.chart-scalebar{min-height:31px;padding:4px 10px;gap:8px}
.scale-btn{height:22px;min-width:23px}
.scale-auto{height:22px}
.scale-tip{display:none}
.chart-hint{display:none}
.chart-legend{bottom:9px}
.ticket-scroll{padding:10px;gap:9px}
.ticket-symbol{padding:7px 8px}
input,select{padding:7px 8px}
.order-type button{padding:6px}
.go button{padding:8px 6px}
.risk-card{padding:8px;gap:6px}
.activity-head{min-height:38px}
.tab{padding:0 10px}
th,td{padding:7px 10px}
#orderOverlay{overflow:visible;--axis-width:58px;--order-card-width:132px}
.order-line-hit{height:26px;transform:translateY(-50%);overflow:visible;cursor:ns-resize;touch-action:none;user-select:none}
.order-line-hit:before{top:12px;right:0;border-top:1.5px dashed var(--line-color,currentColor);opacity:.95}
.order-line-hit.entry:before{border-top-style:solid;border-top-width:2px}
.order-line-hit.stop:before,.order-line-hit.target:before,.order-line-hit.working:before{border-top-style:dashed}
.order-line-card{position:absolute;left:var(--badge-left,45%);top:50%;transform:translateY(-50%);height:22px;display:inline-flex;align-items:stretch;white-space:nowrap;background:var(--line-color,currentColor);border:1px solid var(--line-color,currentColor);border-radius:2px;box-shadow:0 1px 4px rgba(0,0,0,.20);pointer-events:auto;cursor:ns-resize}
.order-line-grip{width:14px;display:grid;place-items:center;color:rgba(255,255,255,.9);font-size:11px;font-weight:700;line-height:1;background:rgba(0,0,0,.10);border-right:1px solid rgba(255,255,255,.22);cursor:ns-resize}
.order-line-pnl{height:100%;width:72px;min-width:72px;padding:0 4px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:8px;font-weight:700;letter-spacing:-.015em}
.order-line-qty{width:22px;display:grid;place-items:center;background:rgba(0,0,0,.16);border-left:1px solid rgba(255,255,255,.24);border-right:1px solid rgba(255,255,255,.24);color:#fff;font-size:9px;font-weight:700}
.order-line-x{width:22px;min-width:22px;height:20px;align-self:center;margin:0 0 0 1px;border:0;border-radius:0 1px 1px 0;background:#fff;color:#151a22;display:grid;place-items:center;font:500 15px/1 Arial,sans-serif;padding:0;cursor:pointer}
.order-line-x:hover{background:#e8edf3;color:#d12f46}
.order-axis-price{position:absolute;right:calc(-1 * var(--axis-width));top:50%;transform:translateY(-50%);height:19px;width:var(--axis-width);display:flex;align-items:center;justify-content:center;padding:0 2px;background:var(--line-color,currentColor);color:#fff;font-size:9px;font-weight:700;white-space:nowrap;box-shadow:0 1px 3px rgba(0,0,0,.18);pointer-events:none}
.order-line-add{height:17px;min-width:32px;padding:0 4px;border-radius:2px;font-size:8px;z-index:2}
.order-line-add.sl{right:calc(var(--axis-width) + 42px)}
.order-line-add.tp{right:calc(var(--axis-width) + 4px)}
@media(max-width:1160px) and (min-width:921px){
 main{grid-template-columns:150px minmax(360px,1fr) 218px;grid-template-rows:minmax(430px,1fr) 154px;gap:8px}
 .brand{min-width:140px}.stat{padding:0 9px;min-width:91px}
 .ticket-scroll{padding:9px;gap:8px}
 .instrument-desc{max-width:105px}
}
@media(max-width:920px){
 body{overflow:auto}
 #app{height:auto;min-height:100%;display:flex;flex-direction:column;padding:8px;gap:8px}
 header{min-height:0;height:auto;flex-wrap:wrap;padding:10px 12px;gap:10px}
 .brand{min-width:0;margin-right:auto}
 .header-stats{order:3;width:100%;margin:0;overflow:auto;padding-top:7px;border-top:1px solid var(--line)}
 .stat{flex:1;min-width:0;padding:0 9px}.stat:first-child{padding-left:0}.stat b{font-size:12px}
 main{display:flex;flex-direction:column;gap:8px}
 .panel{flex:none}
 #chartbox{order:1;height:520px;min-height:520px}
 #ticket{order:2}
 #watch{order:3;max-height:285px}
 #bottom{order:4;min-height:230px}
 .ticket-scroll{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
 .ticket-symbol,.order-type,.go,.ticket-divider,.risk-card,.flat,.bracket-title,.two{grid-column:1/-1}
 #watch .watch-intro,#watch .watch-foot{display:none}
}
@media(max-width:560px){
 #chartbox{height:460px;min-height:460px}
 .chart-toolbar{flex-wrap:wrap}.instrument{width:100%;margin:0}.instrument-desc{max-width:none}
 .tf-group{order:2}.chart-toolbar #ohlc{order:3;margin-left:auto;max-width:58%;font-size:9px}
 .chart-scalebar{gap:7px;padding:5px 8px}.scale-value{min-width:40px;font-size:9px}
 .chart-legend{bottom:6px;left:7px}
 .ticket-scroll{grid-template-columns:1fr 1fr;padding:10px;gap:10px}
 .panel-head{padding:0 11px}.activity-head{overflow:auto}.activity-label{display:none}
 .tab{padding:0 9px}.tbl{max-height:250px}th,td{padding:8px 9px}
 #orderOverlay{--order-card-width:118px}.order-line-hit{height:28px}.order-line-hit:before{top:13px}.order-line-pnl{width:64px;min-width:64px;padding:0 3px;font-size:7.5px}.order-line-card{height:20px}.order-line-x{height:18px;width:20px;min-width:20px;font-size:14px}.order-line-qty{width:20px;font-size:8px}.order-line-grip{width:12px;font-size:10px}.order-axis-price{height:18px;font-size:8px}.order-line-add{height:16px;min-width:30px;font-size:8px}
}


@media(min-width:921px) and (max-height:760px){
 #app{grid-template-rows:54px minmax(0,1fr);padding:7px;gap:7px}
 header{min-height:54px}
 main{grid-template-rows:minmax(340px,1fr) 118px;gap:7px}
 .activity-head{min-height:33px}
 .panel-head{height:36px;min-height:36px}
 .chart-toolbar{min-height:36px}
 .chart-scalebar{min-height:28px}
 .ticket-scroll{gap:7px;padding:8px}
}

