/* Keep the chart, including its volume pane, inside the opening viewport. */
.tracking-page #detail{width:min(1180px,calc(100vw - 32px));max-width:calc(100vw - 32px);height:fit-content;max-height:calc(100dvh - 32px);padding:16px 22px;overflow:auto;overscroll-behavior:contain}
.tracking-page #detail[open]{display:block}
#detail>.detail-head,#detail>.detail-toolbar,#detail>.detail-chart-readout,#detail>.detail-summary,#detail>.detail-foot{flex:0 0 auto;min-width:0}
#detail .detail-head{margin:0 0 10px;gap:16px;min-height:32px}
#detail .detail-identity{display:flex;align-items:baseline;gap:16px;flex-wrap:wrap;min-width:0}
#detail .detail-head h2{font:500 22px/1.35 var(--serif);letter-spacing:1px;margin:0;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
#detail .detail-head span{font-size:10px;line-height:1.5;letter-spacing:0}
#detail .detail-head button{flex-shrink:0;width:30px;height:30px;font-size:22px;line-height:1;padding:0}
#detail .detail-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px 18px;flex-wrap:wrap;border-top:1px solid #e1e6d8;padding:10px 0 4px}
#detail .detail-controls{display:flex;align-items:center;gap:16px;border:0;padding:0;flex-wrap:wrap}
#detail .detail-controls label{font-size:10px;gap:8px;white-space:nowrap}
#detail .detail-controls select{height:32px;min-height:32px;font-size:11px;padding-top:3px;padding-bottom:3px}
#detail #fullChart{font-size:10px;margin-left:8px;white-space:nowrap;color:#788e67;text-decoration:none}
#detail .chart-navigation{margin:0;gap:0;flex-wrap:nowrap}
#detail .chart-navigation-buttons{gap:5px}
#detail .chart-navigation button{height:30px;min-width:30px;padding:0 9px;font-size:14px}
#detail .chart-navigation #chartReset{font-size:10px;margin-left:2px}
#detail .chart-divider{height:14px;margin:0 2px}
#detail .detail-chart-readout{display:flex;flex-wrap:wrap;gap:3px 14px;min-height:30px;align-items:center;padding:6px 0 3px;font-size:10px;line-height:1.6;color:#819174;font-variant-numeric:tabular-nums}
#detail .detail-chart-readout>span{white-space:nowrap}
#detail .large-chart-surface{position:relative;flex:0 1 365px;height:365px;max-height:calc(100dvh - 240px);min-height:200px;width:100%;overflow:hidden;border-radius:4px}
#detail #largeChart{width:100%;height:100%;overflow:hidden;cursor:crosshair}
#detail #largeChart svg{display:block;width:100%;height:100%;min-height:0}
#detail .detail-summary{display:flex;align-items:center;justify-content:space-between;gap:3px 20px;flex-wrap:wrap;padding:4px 0 7px;border-bottom:1px solid #e0e5d7}
#detail .levels{padding:0;margin:0;border:0;gap:18px;font-size:10px;line-height:1.8}
#detail .levels>span{white-space:nowrap}
#detail .levels b{margin-left:6px}
#detail .chart-gesture-hint{margin:0;font-size:9px;line-height:1.6;color:#95a08a}
#detail .detail-foot{padding-top:7px;gap:12px;align-items:center;font-size:9px;line-height:1.5}
#detail .detail-chart-status{display:flex;align-items:center;gap:4px 18px;flex-wrap:wrap;min-width:0;font-variant-numeric:tabular-nums}
#detail #chartWindow{font-size:9px;flex-basis:auto}
#detail .detail-foot button{padding:6px 17px;white-space:nowrap;min-height:28px}
#detail .minute-window-footer{margin:0;padding:9px 14px;font-size:9px;line-height:1.5}
#detail .minute-window h2{letter-spacing:1px}
#detail .minute-window-head{background:#fafaf4}
@media(min-width:1450px){#detail .large-chart-surface{height:420px;flex-basis:420px}}
@media(max-width:700px){
 .tracking-page #detail{width:calc(100vw - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:12px 14px;border-radius:10px}
 #detail .detail-head{gap:8px;margin-bottom:8px}
 #detail .detail-identity{gap:3px 10px}
 #detail .detail-head h2{font-size:20px}
 #detail .detail-head span{font-size:9px}
 #detail .detail-toolbar{gap:8px;padding-top:8px}
 #detail .detail-controls{gap:8px 12px}
 #detail .detail-controls label{gap:6px;font-size:9px}
 #detail .detail-controls select{font-size:10px;height:30px;min-height:30px;padding-left:6px}
 #detail .chart-navigation button{min-width:32px;height:32px}
 #detail .detail-chart-readout{font-size:9px;gap:2px 10px;min-height:32px;padding:5px 0 2px}
 #detail .large-chart-surface{height:335px;flex-basis:335px;max-height:calc(100dvh - 280px)}
 #detail .detail-summary{gap:2px;padding-bottom:5px}
 #detail .levels{font-size:9px;gap:12px}
 #detail .chart-gesture-hint{font-size:8px}
 #detail .detail-foot{align-items:center;padding-top:5px;font-size:8px}
 #detail #chartWindow{font-size:8px}
 #detail .detail-chart-status{gap:2px}
 #detail .detail-chart-status>span{flex-basis:100%}
 #detail .minute-window-footer{padding:7px 12px;font-size:8px}
}
@media(max-height:540px){
 .tracking-page #detail{max-height:calc(100dvh - 12px);padding-top:9px;padding-bottom:9px}
 #detail .detail-head{margin-bottom:5px}
 #detail .large-chart-surface{min-height:200px}
}

/* A standalone chart keeps the enlarged view focused on price and traded amount. */
#detail .detail-summary,#detail .detail-controls label:has(#markType),#detail #fullChart,#detail .chart-navigation .ink-dock{display:none!important}
#detail .large-chart-surface{height:clamp(280px,70dvh,740px);max-height:calc(100dvh - 210px);min-height:200px}
#detail .detail-chart-readout{font-size:11px;gap:6px 18px;color:#7a8770;min-height:32px}
#detail .detail-chart-readout .ma-legend-item{gap:5px}
#detail .detail-chart-readout .ma-legend-item i{width:11px;height:3px}
#detail .detail-head h2{font-size:20px}#detail .detail-toolbar{padding:8px 0 4px}
#detail .pane-adjust{position:absolute;left:10px;right:67px;height:22px;transform:translateY(-50%);z-index:3;pointer-events:none;display:flex;align-items:center;justify-content:center}
#detail .pane-adjust::before{content:"";position:absolute;left:0;right:0;top:50%;height:1px;background:var(--line,#dce2d4);opacity:.6}
#detail .pane-adjust-controls{position:relative;display:flex;align-items:center;gap:2px;padding:0 3px;background:var(--paper,#fafaf4);border-radius:5px;pointer-events:auto;color:var(--muted,#819174)}
#detail .pane-adjust button,#detail #paneHandle{width:24px;height:22px;min-height:22px;display:grid;place-items:center;padding:0;border:0;background:transparent;color:inherit;border-radius:4px}
#detail .pane-adjust svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
#detail #paneHandle{width:30px;cursor:row-resize;touch-action:none;user-select:none}
#detail .pane-adjust button:hover,#detail #paneHandle:hover,#detail .pane-adjust.is-adjusting #paneHandle{background:var(--wash,#edf0e5);color:var(--ink,#566e45)}
#detail .pane-adjust button:disabled{opacity:.3;cursor:default}
#detail .pane-adjust :focus-visible{outline:2px solid var(--sage,#8ca479);outline-offset:1px}
.tracking-page #detail.is-sized[open]{display:flex;flex-direction:column;box-sizing:border-box;overflow:hidden}
#detail.is-sized .large-chart-surface{flex:1 1 0;height:auto;min-height:120px;max-height:none}
#detail .detail-window-resize{position:absolute;right:1px;bottom:1px;width:24px;height:24px;min-height:24px;display:grid;place-items:center;padding:0;border:0;background:transparent;color:var(--muted,#819174);border-radius:4px 0 10px 0;cursor:nwse-resize;touch-action:none;user-select:none;z-index:5}
#detail .detail-window-resize svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round;pointer-events:none}
#detail .detail-window-resize:hover,#detail.is-window-resizing .detail-window-resize{background:var(--wash,#edf0e5);color:var(--ink,#566e45)}
#detail .detail-window-resize:focus-visible{outline:2px solid var(--sage,#8ca479);outline-offset:-3px}
#detail.is-window-resizing{user-select:none}

/* Move only from the host header; embedded charts keep their own interactions. */
#detail>.detail-head{cursor:move;touch-action:none}
#detail>.detail-head button,#detail>.detail-head a{cursor:pointer;touch-action:manipulation}
#detail.is-window-moving{user-select:none}
#detail.is-window-moving>.detail-head{cursor:grabbing}
