/* /chart terminal look: same palette as /coin (deep black, neon up/down #2BD4A0 / #FF6474). Mobile first. */
.chart-body{--bg:#0D0F12;--surface:#15181D;--surface2:#111419;--line:#2A2F38;--line2:#363C47;--up:#2BD4A0;--down:#FF6474;background:var(--bg);margin:0;min-height:100vh;display:flex;flex-direction:column}
.chart-body header{flex:none}
#chart-main{flex:1;display:flex;flex-direction:column;width:100%;max-width:1400px;margin:0 auto;padding:0 16px;box-sizing:border-box;min-height:0}
.ct-bar{display:grid;grid-template-columns:minmax(0,260px) 1fr;gap:10px 16px;align-items:center;padding:8px 0}
.ct-sym{position:relative}
#ct-q{width:100%;min-height:44px;padding:0 14px;border:1px solid var(--line2);border-radius:6px;background:var(--surface2);color:var(--text);font:inherit;font-size:16px;box-sizing:border-box}
#ct-q:focus{outline:2px solid var(--accent);outline-offset:1px}
#ct-list{position:absolute;z-index:20;left:0;right:0;top:calc(100% + 4px);margin:0;padding:4px;list-style:none;border:1px solid var(--line2);border-radius:6px;background:#15181D;box-shadow:0 14px 40px rgba(0,0,0,.6)}
#ct-list[hidden]{display:none}
#ct-list li{display:flex;justify-content:space-between;align-items:center;min-height:44px;padding:0 12px;border-radius:8px;cursor:pointer;font-family:var(--mono);font-size:14px}
#ct-list li[aria-selected=true],#ct-list li:hover{background:rgba(240,185,11,.1)}
#ct-list small{color:var(--muted)}
.ct-price{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 12px;font-variant-numeric:tabular-nums}
.ct-price b{font-size:18px}.ct-price #ct-px{font-family:var(--mono);font-size:22px;font-weight:700}.ct-price em{font-style:normal;font-family:var(--mono);font-size:14px}
.ct-price em.up{color:var(--up)}.ct-price em.down{color:var(--down)}
.ct-chips{display:flex;gap:6px;flex-wrap:wrap;grid-column:1/2}
.ct-chips .chip{min-height:40px;padding:0 14px;font-size:14px;font-family:var(--mono)}
.ct-status{display:flex;align-items:center;gap:8px;justify-self:end;font-size:13px;color:var(--muted)}
.ct-status i{width:8px;height:8px;border-radius:50%;background:var(--muted)}
.ct-status[data-s=LIVE] i{background:var(--up);animation:ctPulse 1.6s infinite}.ct-status[data-s=LIVE] span{color:var(--up)}
.ct-status[data-s=DELAYED] i{background:#F2B84B}.ct-status[data-s=DELAYED] span{color:#F2B84B}
.ct-status[data-s=OFFLINE] i{background:var(--down)}.ct-status[data-s=OFFLINE] span{color:var(--down)}
@keyframes ctPulse{0%{box-shadow:0 0 0 0 rgba(43,212,160,.6)}70%{box-shadow:0 0 0 8px rgba(43,212,160,0)}100%{box-shadow:0 0 0 0 rgba(43,212,160,0)}}
@media(prefers-reduced-motion:reduce){.ct-status[data-s=LIVE] i{animation:none}}
.ct-legend{min-height:22px;font-family:var(--mono);font-size:12.5px;color:var(--muted);font-variant-numeric:tabular-nums;padding:2px 0 6px;display:flex;flex-wrap:wrap;gap:0 12px;line-height:1.5}.ct-legend>span{white-space:nowrap}
.ct-legend b{color:var(--text);font-weight:600}.ct-legend .up{color:var(--up)}.ct-legend .down{color:var(--down)}
.ct-chart{flex:1;min-height:360px;height:calc(100vh - 190px);height:calc(100dvh - 190px);border:1px solid var(--line);border-radius:6px;overflow:hidden;background:var(--bg);touch-action:none}
.ct-fail{padding:28px 18px;border:1px dashed var(--line2);border-radius:6px;text-align:center;color:var(--muted)}
.ct-fail[hidden]{display:none}.ct-fail p{margin:0 0 14px}.ct-fail .chip{display:inline-flex;align-items:center;min-height:44px}
.ct-actions{display:flex;justify-content:flex-end;padding:8px 0 0;min-height:44px}.ct-actions .chip[hidden]{display:none}.ct-actions .chip{min-height:40px;font-size:14px}
.ct-foot{flex:none;font-size:12px;color:var(--muted);display:flex;flex-wrap:wrap;gap:4px 24px;justify-content:space-between;padding-top:10px;padding-bottom:16px}
.ct-foot a{border-bottom:1px solid var(--line)}
@media(max-width:700px){#chart-main{padding:0 10px}.ct-bar{grid-template-columns:1fr}.ct-status{justify-self:start}.ct-chart{height:calc(100dvh - 250px);min-height:320px}.ct-chips .chip{flex:1;justify-content:center;padding:0 8px}}
.chart-body .chip{min-height:40px;padding:0 14px;border:1px solid var(--line2);border-radius:6px;background:var(--surface2);color:var(--text);font:inherit;font-size:14px;cursor:pointer;text-decoration:none}
.chart-body .chip:hover{border-color:#3d4452}
.chart-body .chip[aria-pressed=true]{border-color:#fff;background:#fff;color:#0D0F12;font-weight:600}
.chart-body .chip:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
#ct-list li.pinned{background:rgba(43,212,160,.07);border:1px solid rgba(43,212,160,.25)}#ct-list li.pinned small{color:var(--up)}
#ct-list li{justify-content:space-between;gap:12px}#ct-list li em{font-style:normal;font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}#ct-list li em.up{color:var(--up)}#ct-list li em.down{color:var(--down)}
.ct-status[hidden]{display:none}
@media(max-width:700px){.ct-legend{font-size:12px;gap:0 10px}.ct-chart{height:calc(100dvh - 270px)}}
.chart-body .chip[hidden]{display:none}
/* G2/G3: layers, drawing tools, info strip, order box */
.ct-tools{display:flex;gap:6px;flex-wrap:wrap;align-items:center;padding:0 0 8px}
.ct-tools .chip{min-height:38px;padding:0 12px;font-size:13.5px;white-space:nowrap}
.ct-tools .chip[hidden]{display:none}
.ct-quick{display:flex;gap:4px;flex:none;margin-left:auto}.ct-tools .ct-icon{min-width:38px;padding:0;display:inline-flex;align-items:center;justify-content:center}.ct-icon svg{width:18px;height:18px}.ct-tools .ct-icon:disabled{opacity:.35;cursor:default}
.ct-sep{width:1px;height:22px;background:var(--line2);margin:0 2px}

.ct-hint{margin:0 0 6px;font-size:13px;color:#F2B84B;min-height:18px}.ct-hint[hidden]{display:none}
.ct-chart.drawing{cursor:crosshair}.ct-chart.dragline{cursor:ns-resize}
.ct-info{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;padding:8px 0 0;font-size:13px;font-family:var(--mono);color:var(--muted);min-height:0}
.ct-info>span[hidden]{display:none}
.ct-info .badge{display:inline-flex;align-items:center;min-height:24px;padding:0 10px;border-radius:6px;border:1px solid var(--line2);font-weight:600;font-size:12.5px}
.ct-info .badge-quiet{color:#9fb3ff;border-color:#2d3a66}.ct-info .badge-normal{color:var(--text)}.ct-info .badge-hot{color:var(--down);border-color:rgba(255,100,116,.5);background:rgba(255,100,116,.08)}
.ct-flow b{color:var(--text);font-weight:600}.ct-flow.up b{color:var(--up)}.ct-flow.down b{color:var(--down)}
.ct-ratio b{color:var(--text);font-weight:600}
.ct-trade{margin-top:10px;padding:12px 14px;border:1px solid var(--line2);border-radius:6px;background:var(--surface);font-size:14px}
.ct-trade[hidden]{display:none}
.ct-trade h3{margin:0 0 8px;font-size:14px;font-weight:700;display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.ct-trade .row{display:flex;flex-wrap:wrap;gap:6px 8px;align-items:center;margin:6px 0}
.ct-trade .row>span{color:var(--muted);font-size:13px;min-width:74px}
.ct-trade .tb{min-height:36px;padding:0 12px;border:1px solid var(--line2);border-radius:6px;background:var(--surface2);color:var(--text);font:inherit;font-size:13.5px;cursor:pointer}
.ct-trade .tb[aria-pressed=true]{border-color:#fff;color:#0D0F12;background:#fff;font-weight:600}
.ct-trade .tb.long[aria-pressed=true]{border-color:var(--up);color:var(--up);background:rgba(43,212,160,.1)}.ct-trade .tb.short[aria-pressed=true]{border-color:var(--down);color:var(--down);background:rgba(255,100,116,.1)}
.ct-trade .lv{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:8px 0}
.ct-trade .lv label{display:flex;flex-direction:column;gap:3px;font-size:12px;color:var(--muted)}
.ct-trade .lv input{min-height:40px;padding:0 8px;border:1px solid var(--line2);border-radius:6px;background:var(--surface2);color:var(--text);font:inherit;font-size:16px;font-family:var(--mono);width:100%;box-sizing:border-box}
.ct-trade .lv small{font-size:12px}.ct-trade .lv .sl small{color:var(--down)}.ct-trade .lv .tp small{color:var(--up)}
.ct-trade .out{display:grid;gap:4px;margin:8px 0;font-family:var(--mono);font-size:13.5px}
.ct-trade .out p{margin:0;display:flex;justify-content:space-between;gap:12px}.ct-trade .out p span{color:var(--muted)}
.ct-trade .out .up{color:var(--up)}.ct-trade .out .down{color:var(--down)}.ct-trade .out .warn{color:#F2B84B}
.ct-trade .sw{margin:6px 0 0;padding:8px 10px;border-radius:6px;background:var(--surface2);font-size:13px;line-height:1.5;color:var(--muted)}
.ct-trade .sw.warn{border-left:3px solid #F2B84B}
.ct-trade .note{margin:8px 0 0;font-size:12px;color:var(--muted)}
@media(max-width:700px){.ct-tools{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}.ct-tools::-webkit-scrollbar{display:none}.ct-trade .lv{gap:6px}}
.ct-chart{height:calc(100dvh - 262px)}
@media(max-width:700px){.ct-chart{height:calc(100dvh - 330px);min-height:300px}}
.ct-flow small{margin-left:8px;color:var(--muted)}.ct-flow .tape-ico{margin-right:6px}
.ct-chart{height:calc(100dvh - 304px)}
@media(max-width:700px){.ct-legend{flex-wrap:nowrap;overflow:hidden;font-size:10.5px;gap:0 7px;padding:1px 0 3px;min-height:0}.ct-legend b{font-weight:500}}
.ct-tools[hidden]{display:none}
.ct-menu{position:fixed;z-index:50;width:230px;max-width:calc(100vw - 16px);overflow-y:auto;padding:6px;border:1px solid var(--line2);border-radius:6px;background:var(--surface2);box-shadow:0 10px 28px rgba(0,0,0,.5)}
.ct-menu[hidden]{display:none}
.ct-menu button{min-height:44px;border:0;border-radius:8px;background:none;color:var(--text);font:inherit;font-size:14px;cursor:pointer;white-space:nowrap}
.ct-menu button:hover:not(:disabled){background:rgba(255,255,255,.06)}
.ct-menu button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.ct-menu button:disabled{opacity:.4;cursor:default}
.ct-mrow{display:flex;align-items:center}.ct-mrow [data-draw]{flex:1;min-width:0;padding:0 10px;text-align:left}
.ct-gear{width:44px;flex:none;font-size:16px;color:var(--muted)!important}.ct-gear[aria-expanded=true]{color:var(--accent)!important}
.ct-style{margin:4px 0;padding:8px 6px;border-top:1px solid var(--line2);border-bottom:1px solid var(--line2)}.ct-style[hidden]{display:none}
.ct-style p{margin:0 4px 6px;font-size:12.5px;color:var(--muted)}
.ct-style div{display:flex;gap:4px;margin-bottom:6px}
.ct-style button{flex:1;min-height:40px;min-width:0;padding:0 4px;border:1px solid var(--line2);font-size:13px}
.ct-style button[aria-pressed=true]{border-color:#fff;color:#0D0F12;background:#fff}
.ct-style .sw{min-height:34px;height:34px}.ct-style .sw[aria-pressed=true]{outline:2px solid var(--text);outline-offset:1px}
.ct-style .reset{width:100%;min-height:38px;border:0;color:var(--muted);font-size:12.5px}
.ct-mfoot{display:flex;gap:4px;margin-top:4px;padding-top:4px;border-top:1px solid var(--line2)}.ct-mfoot button{flex:1;min-width:0;padding:0 4px;font-size:13px}
#ct-clear:not(:disabled){color:var(--down)}
@media(max-width:700px){.ct-tools{gap:4px}.ct-tools .chip{padding:0 6px;font-size:13px}.ct-sep{display:none}}

/* Layout D, owner 2026-11-01: chart on the left, Plan / Vị thế / Whales on the right */
#chart-main{max-width:1600px}
.ct-body{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:12px;align-items:start}
.ct-left{min-width:0}
.ct-rail{border:1px solid var(--line);border-radius:6px;background:var(--surface);min-width:0}
.ct-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:6px;border-bottom:1px solid var(--line)}
.ct-tabs button{min-height:40px;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--muted);font:inherit;font-size:13.5px;cursor:pointer}
.ct-tabs button.sel{background:#fff;border-color:#fff;color:#0D0F12;font-weight:600}
.ct-tabs button{position:relative}.ct-tabs button+button::before{content:'';position:absolute;left:-3.5px;top:50%;width:1px;height:20px;transform:translateY(-50%);background:rgba(255,255,255,.22);pointer-events:none}
.ct-tabs button:focus-visible{outline:2px solid #fff;outline-offset:2px}
.ct-panel{padding:10px 12px;font-size:13px}
#ct-info{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:0;line-height:1.5}
.ct-rail .ct-trade{margin:0;border:0;background:none}
.ct-rail:not([data-show=plan]) .ct-trade{display:none}
.ct-kv{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin:0}.ct-kv dt{color:var(--muted)}.ct-kv dd{margin:0;font-family:var(--mono)}
@media(max-width:1000px){.ct-body{grid-template-columns:minmax(0,1fr)}}
@media(min-width:1001px){.ct-bar{grid-template-columns:220px auto minmax(0,1fr) auto}.ct-chips{grid-column:auto}}
@media(max-width:700px){.chart-body header nav{gap:10px}.chart-body header nav a{white-space:nowrap;font-size:13px}}
.ct-facts{margin-bottom:10px}.ct-facts .ct-kv dd{text-align:right}
.ct-hold{margin-bottom:12px;padding-bottom:12px;border-bottom:1px solid var(--line)}.ct-hold-t{margin:0 0 8px;font-weight:600;color:var(--text)}.ct-hold .ct-kv{margin-bottom:10px}.ct-hold .ct-kv dd{text-align:right}.ct-kv dd.up{color:var(--up)}.ct-kv dd.down{color:var(--down)}

/* Cards, owner 2026-11-01: one row style, named groups, the result stays in view */
.ct-g{margin:0 0 14px}.ct-g:last-child{margin-bottom:0}
.ct-g h4{margin:0 0 6px;font-size:12px;font-weight:600;color:var(--muted)}
.ct-kv{gap:6px 12px}.ct-kv dt{font-size:13px}.ct-kv dd{font-size:13px;text-align:right}
.ct-facts{margin:0}.ct-facts:not(:empty){margin-bottom:14px}
.ct-hold{margin-bottom:14px;padding-bottom:14px}.ct-hold .ct-kv{margin-bottom:10px}
#ct-info{display:block;padding:0;font-family:inherit;line-height:inherit}
#ct-info:not(:has(>:not(h4):not([hidden]))){display:none}
.ct-row{display:flex;justify-content:space-between;gap:12px;align-items:baseline;margin-top:6px;font-size:13px;color:var(--muted)}
#ct-info h4+.ct-row,#ct-whales h4+.ct-row{margin-top:0}
.ct-row[hidden]{display:none}.ct-row>:last-child,.ct-row b{font-family:var(--mono);font-weight:500;color:var(--text);text-align:right}
.ct-row b.up,.ct-flow.up b{color:var(--up)}.ct-row b.down,.ct-flow.down b{color:var(--down)}.ct-flow .tape-ico,.ct-flow small{display:none}.ct-flow b{font-family:inherit}
.vol-quiet b{color:#9fb3ff}.vol-hot b{color:var(--down)}
.ct-ratio[hidden]{display:none}
.ct-m{display:grid;grid-template-columns:42px minmax(0,1fr) 62px;gap:8px;align-items:center;margin-top:6px;font-size:13px;color:var(--muted)}.ct-m i{display:block;height:6px;border-radius:3px;background:var(--surface2);overflow:hidden}.ct-m u{display:block;height:100%;text-decoration:none}.ct-m u.long{background:var(--up)}.ct-m u.short{background:var(--down)}.ct-m b{font-family:var(--mono);font-weight:500;color:var(--text);text-align:right}
.ct-g h4+.ct-m{margin-top:0}
.ct-trade{padding:10px 12px 0;font-size:13px}
.ct-trade h3{display:flex;flex-wrap:nowrap;gap:6px;margin:0 0 10px}
.ct-trade .seg{flex:1;display:grid;grid-template-columns:1fr 1fr;gap:0;border:1px solid var(--line2);border-radius:6px;overflow:hidden}
.ct-trade .seg .tb{border:0;border-radius:0;background:none;min-height:34px}
.ct-trade .ico{flex:none;width:36px;min-height:36px;padding:0;color:var(--muted)}
.ct-trade .lv{margin:0 0 8px}.ct-trade .lv label{position:relative}.ct-trade .lv small{position:absolute;top:0;right:0}
.ct-trade .cfg{width:100%;display:flex;justify-content:space-between;align-items:center;min-height:36px;padding:0;border:0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);background:none;color:var(--muted);font:inherit;cursor:pointer}.ct-trade .cfg b{font-family:var(--mono);font-weight:500;color:var(--text)}.ct-trade .cfg b::after{content:" ▾";color:var(--muted)}.ct-trade .cfg[aria-expanded=true] b::after{content:" ▴"}
.ct-trade .cfgb[hidden],.ct-trade .note[hidden]{display:none}
.ct-trade .cfgb .row{flex-wrap:nowrap;gap:4px;margin:6px 0}.ct-trade .cfgb .row>span{min-width:46px}.ct-trade .cfgb .tb{flex:1;min-width:0;min-height:34px;padding:0;font-size:13px}
.ct-trade .sw{font-size:12.5px;margin:8px 0 0}
.ct-trade .foot{position:sticky;bottom:0;margin:8px -12px 0;padding:8px 12px 10px;background:var(--surface);border-top:1px solid var(--line)}
.ct-trade .out{margin:0 0 8px;font-family:inherit;font-size:13px}.ct-trade .out p b{font-family:var(--mono);font-weight:500;text-align:right}
.ct-trade .held,.ct-trade .done{width:100%;background:#fff;border-color:#fff;color:#0D0F12;font-weight:600}.ct-trade .done{display:none}
@media(min-width:1001px){.ct-body{align-items:stretch}.ct-rail{height:0;min-height:100%;display:flex;flex-direction:column;overflow:hidden}.ct-tabs{flex:none}.ct-rail .ct-panel,.ct-rail .ct-trade{flex:1;min-height:0;overflow:auto}}
/* Narrow screen: the cards are a sheet. It only changes height, its content keeps its place, so nothing reflows while it moves.
   With the sheet open the chart is pinned to the space above it: a position tied to the page scroll left a gap and cut the chart on iPhone. */
@media(max-width:1000px){
:root{--sheet:52dvh;--tabs:53px;--safe:env(safe-area-inset-bottom)}
.ct-rail{position:fixed;left:0;right:0;bottom:0;z-index:30;display:block;height:calc(var(--tabs) + var(--safe));overflow:hidden;border:0;border-top:1px solid var(--line2);border-radius:12px 12px 0 0;transition:height .24s cubic-bezier(.2,.8,.2,1);will-change:height;overscroll-behavior:contain}
.ct-rail.open{height:var(--sheet)}
.ct-tabs{position:absolute;left:0;right:0;bottom:var(--safe);height:var(--tabs);box-sizing:border-box;z-index:2;background:var(--surface);border-bottom:0;border-top:1px solid var(--line)}
.ct-rail:not(.open) .ct-tabs{border-top-color:transparent}
.ct-rail .ct-panel,.ct-rail .ct-trade{position:absolute;left:0;right:0;bottom:calc(var(--tabs) + var(--safe));height:calc(var(--sheet) - var(--tabs) - var(--safe));box-sizing:border-box;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-top:38px}
.ct-grip{position:absolute;top:0;left:0;right:0;height:38px;z-index:3;background:var(--surface);touch-action:none;cursor:grab}.ct-grip::after{content:"";position:absolute;top:10px;left:50%;width:44px;height:5px;margin-left:-22px;border-radius:3px;background:var(--muted)}
.ct-rail:not(.open) .ct-grip{display:none}
.ct-rail:not(.open) .ct-tabs button.sel{background:transparent;border-color:transparent;color:var(--muted);font-weight:400}
.chart-body{padding-bottom:calc(var(--tabs) + var(--safe) + 8px)}
.rail-open header.shell,.rail-open .ct-sym,.rail-open .ct-chips,.rail-open .ct-status,.rail-open .ct-tools,.rail-open .ct-legend,.rail-open .ct-hint,.rail-open .ct-actions,.rail-open .ct-fail{display:none}
.chart-body.rail-open{overscroll-behavior:none}
.rail-open #chart-main{position:fixed;top:0;left:0;right:0;bottom:var(--sheet);display:flex;flex-direction:column;box-sizing:border-box;margin:0;max-width:none;padding:calc(env(safe-area-inset-top) + 4px) 10px 6px;overflow:hidden;animation:ct-in .2s ease-out}
.rail-open .ct-bar{flex:none;margin:0;padding:0 0 4px}
.rail-open .ct-body{flex:1;min-height:0;display:block}.rail-open .ct-left{height:100%}.rail-open #chart-main .ct-chart{height:100%;min-height:0}
/* Keyboard up: only the chart, the three prices and the result, fitted to what is really visible. --vt, --vh, --railh come from chart-rail.js. */
.rail-kb #chart-main{top:var(--vt);bottom:auto;height:calc(var(--vh) - var(--railh));animation:none}
.rail-kb .ct-rail.open{top:calc(var(--vt) + var(--vh));bottom:auto;height:auto;max-height:calc(var(--vh)*.6);overflow:auto;transform:translateY(-100%);transition:none;border-radius:0}
.rail-kb .ct-rail .ct-trade{position:static;height:auto;padding-top:8px;animation:none}
.rail-kb .ct-grip,.rail-kb .ct-tabs,.rail-kb .ct-trade h3,.rail-kb .ct-trade .cfg,.rail-kb .ct-trade .cfgb,.rail-kb .ct-trade .note,.rail-kb .ct-trade .sw,.rail-kb .ct-trade .held{display:none}
.rail-kb .ct-trade .done{display:block}
}
@media(min-width:1001px){.ct-grip{display:none}}
@keyframes ct-in{from{opacity:.55}}
@keyframes ct-fade{from{opacity:0}}
.ct-rail .ct-panel:not([hidden]),.ct-rail .ct-trade:not([hidden]){animation:ct-fade .14s ease-out}
.ct-tabs button{transition:background-color .14s ease-out,color .14s ease-out}
@media(prefers-reduced-motion:reduce){.ct-rail,.ct-tabs button{transition:none}.rail-open #chart-main,.ct-rail .ct-panel,.ct-rail .ct-trade{animation:none}}
.ct-rail .ct-trade{display:flex;flex-direction:column}.ct-rail .ct-trade>*{flex:none}.ct-rail .ct-trade[hidden]{display:none}.ct-trade .foot{margin-top:auto}.ct-trade .sw+.foot{margin-top:auto}
.ct-trade .sw{margin-bottom:8px}

/* Chart108 indicators (Phase 3): legend on each pane, the shared sheet for the menu and for settings. Shown only when the indicator host runs. */
.ct-left{position:relative}
.c108-legends{position:absolute;inset:0;pointer-events:none;z-index:7}
.c108-pane{position:absolute;left:8px;right:72px;display:flex;flex-direction:column;gap:1px;align-items:flex-start}
.c108-row{display:flex;align-items:center;gap:6px;min-height:20px;max-width:100%;font:12px/1.3 ui-monospace,Consolas,monospace;color:var(--muted);pointer-events:auto;text-shadow:0 0 3px #0D0F12,0 0 3px #0D0F12;padding:0 2px}
.c108-row.off{opacity:.5}
.c108-name{all:unset;cursor:pointer;color:var(--text);white-space:nowrap}
.c108-vals{display:flex;gap:6px;overflow:hidden}.c108-vals b{font-weight:400;white-space:nowrap}
.c108-err{color:var(--down);font-style:normal}
.c108-acts{display:none;gap:2px}.c108-acts button{all:unset;cursor:pointer;width:20px;text-align:center;color:var(--muted)}.c108-acts button:hover{color:var(--text)}
@media(hover:hover){.c108-row:hover .c108-acts,.c108-row:focus-within .c108-acts{display:inline-flex}}
@media(hover:none){.c108-row{min-height:26px}.c108-name{position:relative}.c108-name::after{content:'';position:absolute;inset:-6px -8px}}   /* the name is the way into settings on a phone */
.rail-open .c108-legends,.rail-open .c108-seps{display:none}
.c108-seps{position:absolute;inset:0;pointer-events:none;z-index:6}.c108-sep{position:absolute;left:0;right:64px;height:30px;margin-top:-15px;pointer-events:auto;touch-action:none;cursor:ns-resize;-webkit-tap-highlight-color:transparent}.c108-sep i{position:absolute;left:0;right:0;top:15px;height:1px;background:transparent;transition:background-color .12s ease-out}.c108-sep:hover i{background:rgba(255,255,255,.34)}.c108-sep.on i{height:2px;background:rgba(255,255,255,.6)}
.c108-row.open .c108-acts{display:inline-flex}.c108-row.open .c108-vals{display:none}.c108-row.open .c108-acts button{width:32px;height:26px;line-height:26px;font-size:15px}
@media(max-width:700px){.ct-chart{height:calc(100vh - 286px - var(--safe));height:calc(100svh - 286px - var(--safe));min-height:280px}.ct-tools{gap:2px}.ct-quick{gap:2px}.ct-tools .chip{padding:0 4px;font-size:12.5px}.ct-tools .ct-icon{min-width:32px}}   /* the whole row fits at 375 px; the chart ends above the tabs */
/* Pen, bin and camera keep their text for the code that reads it; the same line icon as undo and full screen is drawn over it. A pen with a tool on shows that tool. */
#ct-draw[aria-pressed=false],#ct-del,#ct-shot{font-size:0}#ct-shot[data-ready='1']{font-size:12.5px;padding:0 8px}#ct-shot[data-ready='1']::before{display:none}#ct-draw[aria-pressed=false]::before,#ct-del::before,#ct-shot::before{content:'';width:18px;height:18px;background:currentColor;-webkit-mask:var(--ic) center/18px no-repeat;mask:var(--ic) center/18px no-repeat}
#ct-draw{--ic:url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2024%2024'%20fill%3D'none'%20stroke%3D'black'%20stroke-width%3D'2'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Cpath%20d%3D'M4%2020l1-4L16.5%204.5a2.1%202.1%200%200%201%203%203L8%2019l-4%201z'%2F%3E%3Cpath%20d%3D'M14.5%206.5l3%203'%2F%3E%3C%2Fsvg%3E")}#ct-del{--ic:url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2024%2024'%20fill%3D'none'%20stroke%3D'black'%20stroke-width%3D'2'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Cpath%20d%3D'M4%207h16M10%207V4h4v3M6%207l1%2013h10l1-13M10%2011v5M14%2011v5'%2F%3E%3C%2Fsvg%3E")}#ct-shot{--ic:url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2024%2024'%20fill%3D'none'%20stroke%3D'black'%20stroke-width%3D'2'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Cpath%20d%3D'M4%208h3l2-3h6l2%203h3a1%201%200%200%201%201%201v9a1%201%200%200%201-1%201H4a1%201%200%200%201-1-1V9a1%201%200%200%201%201-1z'%2F%3E%3Ccircle%20cx%3D'12'%20cy%3D'13'%20r%3D'3.5'%2F%3E%3C%2Fsvg%3E")}
/* Phone: everything above and below the chart is small, so the chart has the room to work in. */
@media(max-width:700px){
:root{--tabs:38px}
.ct-bar{grid-template-columns:minmax(0,1fr) auto;gap:3px 8px;padding:2px 0 8px}
.ct-sym{grid-column:1/-1}#ct-q{width:72%;min-height:32px;padding:0 10px;font-size:13px}
.ct-price{grid-column:1;grid-row:2;flex-wrap:nowrap;gap:6px;align-items:baseline;min-width:0;white-space:nowrap}.ct-price b{font-size:14px}.ct-price #ct-px{font-size:16px}.ct-price em{font-size:11.5px}
.ct-status{grid-column:2;grid-row:2;justify-self:end;gap:5px;font-size:11px}.ct-status i{width:6px;height:6px}.ct-status small{display:none}
.ct-chips{grid-column:1/-1;gap:3px;flex-wrap:nowrap}.ct-chips .chip{min-height:28px;padding:0;font-size:12px}
.ct-tools{padding:0 0 3px}.ct-tools .chip{min-height:32px}
.ct-tabs{padding:3px 6px;gap:3px}.ct-tabs button{min-height:30px;font-size:12.5px}.ct-tabs button+button::before{height:16px}
.c108-row{min-height:22px}}
/* A tall phone: the page fits, so it does not scroll. A scroll would fold the browser bars, change the viewport and rescale the chart under the finger. svh above: the chart's height never follows those bars. */
@media(max-width:700px) and (min-height:640px) and (orientation:portrait){html:has(.chart-body),.chart-body{overflow:hidden;overscroll-behavior:none}}
/* A closed sheet shows only its tabs, whatever the browser bars do. */
@media(max-width:1000px){.ct-rail:not(.open) .ct-panel,.ct-rail:not(.open) .ct-trade{visibility:hidden}}
/* Head of the chart page: logo at one edge, language at the other, the links between them read as buttons. */
.chart-body header.shell{width:100%;max-width:1600px;gap:8px}.chart-body header nav{flex:1;min-width:0;gap:6px}.chart-body header nav a{min-height:34px;padding:0 10px;border:1px solid var(--line2);border-radius:6px;background:#1B1F26;color:var(--text);font-size:12.5px;font-weight:600;white-space:nowrap}.chart-body header nav a:first-child{margin-left:auto}.chart-body header nav a:last-of-type{margin-right:auto}.chart-body header nav a:hover{border-color:#fff}.chart-body header nav a[aria-current]{background:#fff;border-color:#fff;color:#0D0F12}
/* Phone: logo and language share the first row, the four links fill the second. */
@media(max-width:700px){.chart-body header.shell{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;padding-left:10px;padding-right:10px}.chart-body header .brand{grid-column:1/3;grid-row:1}.chart-body header nav{display:contents}.chart-body header nav #lang-toggle{grid-column:4;grid-row:1;justify-self:end;min-height:34px;height:34px}.chart-body header nav a{grid-row:2;justify-content:center;min-height:30px;margin:0!important;padding:0 2px;font-size:12px}.chart-body header nav a:first-child{display:none}}
/* Focus: the chart alone. CSS and not only the Fullscreen API, which iPhone Safari does not offer for a page. */
.ct-focus{overflow:hidden}
.ct-focus header.shell,.ct-focus .ct-bar,.ct-focus .ct-rail,.ct-focus .ct-legend,.ct-focus .ct-hint,.ct-focus .ct-menu,.ct-focus .ct-actions,.ct-focus footer,.ct-focus .ct-tools>:not(.ct-quick){display:none!important}
.ct-focus #chart-main{position:fixed;inset:0;bottom:0;z-index:40;max-width:none;margin:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);background:var(--bg);display:flex;flex-direction:column}
.ct-focus .ct-tools{display:flex!important;position:absolute;z-index:8;top:calc(env(safe-area-inset-top) + 6px);right:calc(env(safe-area-inset-right) + 84px);padding:0;overflow:visible}
.ct-focus .ct-body{flex:1;min-height:0;display:block}.ct-focus .ct-left{height:100%}.ct-focus #chart-main .ct-chart{height:100%;min-height:0;border:0;border-radius:0}
.c108-sheet{position:fixed;z-index:40;top:130px;right:max(16px,calc(50% - 680px));width:300px;max-height:calc(100dvh - 160px);overflow:auto;background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:12px;box-shadow:0 12px 32px rgba(0,0,0,.45);overscroll-behavior:contain}
.c108-sheet[hidden]{display:none}
.c108-sheet input[type=search],.c108-sheet input[type=text],.c108-sheet input[type=number],.c108-sheet select{width:100%;min-height:38px;box-sizing:border-box;background:var(--bg,#0d0f12);color:var(--text);border:1px solid var(--line);border-radius:6px;padding:0 10px;font:inherit}
.c108-head{display:flex;align-items:center;gap:8px;margin-bottom:10px}.c108-head b{flex:1}
.c108-slots{color:var(--muted);font:12px ui-monospace,Consolas,monospace}
.c108-x{all:unset;cursor:pointer;width:32px;height:32px;text-align:center;line-height:32px;color:var(--muted)}
.c108-sheet h4{margin:12px 0 4px;font-size:12px;font-weight:600;color:var(--muted)}
.c108-item{display:flex;align-items:center;border-radius:6px}.c108-item:hover{background:rgba(255,255,255,.04)}
.c108-add{all:unset;flex:1;cursor:pointer;padding:10px 8px;min-height:20px}
.c108-star{all:unset;cursor:pointer;width:38px;height:38px;text-align:center;line-height:38px;color:var(--muted)}.c108-star.on{color:#edca63}
.c108-note{margin:8px 0;font-size:13px;color:var(--muted)}
.c108-save{display:flex;gap:6px;margin-top:6px}.c108-save .chip{white-space:nowrap}
.c108-danger{all:unset;display:block;cursor:pointer;margin-top:12px;padding:8px;color:var(--muted);font-size:13px}.c108-danger:hover{color:var(--down)}
.c108-tabs{display:flex;gap:4px;margin-bottom:10px}.c108-tabs button{all:unset;cursor:pointer;flex:1;text-align:center;padding:8px 0;border-radius:6px;color:var(--muted)}.c108-tabs .sel{background:rgba(255,255,255,.08);color:var(--text)}
.c108-form{display:flex;flex-direction:column;gap:8px;align-items:stretch}
.c108-field{display:grid;grid-template-columns:96px minmax(0,1fr);align-items:center;gap:4px 8px;font-size:13px}.c108-field input[type=color]{width:100%;height:34px;padding:0;background:none;border:1px solid var(--line);border-radius:6px}.c108-field input[type=checkbox]{justify-self:start;width:20px;height:20px}
.c108-ferr{grid-column:2;color:var(--down);font-size:12px}.c108-ferr:empty{display:none}
.c108-sheet fieldset{border:1px solid var(--line);border-radius:6px;padding:8px;margin:0;display:flex;flex-direction:column;gap:6px}.c108-sheet legend{font-size:12px;color:var(--muted);padding:0 4px}
.c108-sizes{display:flex;align-items:center;gap:6px;font-size:13px}.c108-sizes span{flex:1}
@media(max-width:1000px){.c108-sheet{top:auto;left:0;right:0;bottom:0;width:auto;max-height:58dvh;border-radius:12px 12px 0 0;border-width:1px 0 0;padding:12px 16px calc(12px + env(safe-area-inset-bottom))}}
@media(max-width:700px){.c108-sheet{max-height:44dvh}.c108-pane{right:60px}.c108-row{font-size:11px}.c108-vals b:nth-child(n+2){display:none}}
