:root{
  --bg:#0A101E;--head:#0C1425;--panel:#111A2D;--hover:#172338;--border:#1D2A45;--border2:#2C3D60;
  --ink:#E6EBF3;--muted:#8A96AB;--dim:#7A87A2;--up:#22E07A;--dn:#F04452;--amb:#F5B749;--link:#60A5FA;--primary:#3B82F6;
  --pill-on:#1B2E57;--pill-on-border:#3B82F6;--pill-on-ink:#DCE8FF;
  --ema20:#E2B93B;--ema50:#6EA8FE;--ema200:#B48CF2;--cvd:#6EA8FE;--oi:#B48CF2;
  --sans:'IBM Plex Sans',system-ui,-apple-system,Segoe UI,sans-serif;--mono:'IBM Plex Mono',ui-monospace,Menlo,monospace;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font:14px/1.4 var(--sans);-webkit-font-smoothing:antialiased}
a{color:var(--link);text-decoration:none}a:hover{color:#9CC2FF}
button{font-family:inherit}
.num{font-family:var(--mono);font-variant-numeric:tabular-nums}
.up{color:var(--up)}.dn{color:var(--dn)}.amb{color:var(--amb)}.mut{color:var(--muted)}.dim{color:var(--dim)}
.sr{position:absolute;left:-9999px}
:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
:focus:not(:focus-visible){outline:0}
[hidden]{display:none!important}

/* header */
.top{display:flex;align-items:center;gap:20px;padding:0 24px;height:56px;border-bottom:1px solid var(--border);background:var(--head);position:sticky;top:0;z-index:20}
.logo{display:flex;align-items:center;gap:10px;font-weight:600;font-size:15px;color:var(--ink)}
.nav{display:flex;gap:4px}
.nav a{padding:7px 12px;border-radius:8px;color:var(--muted);font-weight:500;font-size:14px;display:flex;align-items:center;gap:6px}
.nav a .ico{display:none}
.nav a:hover{color:var(--ink)}.nav a.on{background:#1B2640;color:#fff}
.spacer{flex:1 1 auto}
.live{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--muted);white-space:nowrap}
.dot{width:8px;height:8px;border-radius:50%;background:var(--dim);display:inline-block}
.dot.live{background:var(--up)}.dot.silent{background:var(--amb)}.dot.mock{background:var(--amb)}.dot.reconnecting,.dot.connecting{background:var(--amb)}.dot.offline{background:var(--dn)}
.search input{appearance:none;background:var(--bg);border:1px solid var(--border);border-radius:8px;color:var(--ink);font:14px var(--sans);padding:7px 10px;width:220px;min-height:34px}
input::placeholder{color:var(--dim)}
.clock{font-size:13px;color:var(--muted);white-space:nowrap}
.banner{margin:12px 24px 0;padding:10px 14px;border:1px solid #5A4717;background:#2A2210;color:#F5D58A;border-radius:8px;font-size:13px;display:flex;align-items:flex-start;gap:10px}
.banner .x{margin-left:auto;flex:0 0 auto;background:none;border:0;color:inherit;font-size:20px;line-height:1;padding:0 4px;min-height:0;min-width:28px;cursor:pointer;opacity:.8}
.banner .x:hover{opacity:1}
.banner a{color:#FFE2A3;text-decoration:underline}

/* layout */
.app{padding:20px 24px 40px;display:flex;flex-direction:column;gap:18px;min-height:calc(100vh - 56px);max-width:1760px;margin:0 auto;width:100%}
.toolbar{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.title{display:flex;flex-direction:column;gap:2px;margin-right:8px}
.title h1{margin:0;font-size:20px;font-weight:600}
.title .sub{font-size:12.5px;color:var(--muted)}
.group{display:flex;gap:4px;flex-wrap:wrap}
.pill{appearance:none;border:1px solid var(--border);background:var(--panel);color:var(--muted);font:500 13px var(--sans);padding:6px 12px;border-radius:8px;cursor:pointer;min-height:32px}
.pill:hover{color:var(--ink);border-color:var(--border2)}
.pill.on{background:var(--pill-on);border-color:var(--pill-on-border);color:var(--pill-on-ink)}
.btn{appearance:none;border:1px solid var(--border2);background:#182238;color:var(--ink);font:500 13px var(--sans);padding:7px 14px;border-radius:8px;cursor:pointer;min-height:32px}
.btn:hover{background:#1E2A44}
.btn.primary{background:var(--primary);border-color:var(--primary);color:#fff}
.btn.sm{padding:4px 10px;min-height:26px;font-size:12px}
.btn.danger{color:var(--dn)}
.tog{appearance:none;border:1px solid var(--border);background:var(--panel);color:var(--muted);font:500 12.5px var(--sans);padding:6px 10px;border-radius:8px;cursor:pointer;min-height:32px;display:inline-flex;align-items:center;gap:7px}
.tog.on{color:var(--ink);border-color:var(--border2)}
.tog .sw{width:9px;height:9px;border-radius:50%;background:var(--dim);display:inline-block}
.tog.on .sw{background:var(--tog-color,var(--up))}
.panel{background:var(--panel);border:1px solid var(--border);border-radius:12px}
.panel.pad{padding:14px 16px 16px}
.h2{margin:0;font-size:15px;font-weight:600;color:var(--ink);display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.phead{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap;margin-bottom:12px}
.phead .note{font-size:12.5px;color:var(--muted)}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.grid4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
.lbl{font-size:11px;color:var(--muted);letter-spacing:.04em;text-transform:uppercase;font-weight:500}
.src{display:inline-block;font-size:10.5px;color:var(--dim);font-weight:400;letter-spacing:0;text-transform:none;margin-left:8px;border:1px solid var(--border);border-radius:4px;padding:0 5px;vertical-align:1px;white-space:nowrap;line-height:16px;cursor:help}
body.nolabels .src{display:none}

/* tables */
.tbl{width:100%;border-collapse:collapse}
.tbl th{font-size:11px;color:var(--muted);font-weight:500;text-align:right;padding:8px 10px;border-bottom:1px solid var(--border);letter-spacing:.04em;text-transform:uppercase;white-space:nowrap;cursor:default}
.tbl td{padding:7px 10px;border-bottom:1px solid var(--hover);text-align:right;font-size:13.5px;white-space:nowrap}
.tbl tr:last-child td{border-bottom:0}
.tbl th.l,.tbl td.l{text-align:left}
.tbl tbody tr:hover td{background:var(--hover)}
.tbl tr.rowlink{cursor:pointer}
.pair{color:var(--ink);font-weight:600}.pair:hover{color:#9CC2FF}
.sym{color:var(--dim);font-weight:400;font-size:11.5px;margin-left:6px}
.badge{display:inline-block;font-size:10px;font-weight:600;letter-spacing:.04em;color:var(--pill-on-ink);background:var(--pill-on);border:1px solid var(--pill-on-border);border-radius:4px;padding:1px 5px;margin-left:6px;vertical-align:1px}
.chip{display:inline-block;font-size:10.5px;font-weight:600;letter-spacing:.03em;border-radius:4px;padding:1px 6px;border:1px solid}
.chip.mix{color:var(--amb);border-color:#5A4717;background:#2A2210}
.chip.dn,.chip.res{color:var(--dn);border-color:#6B2431;background:#2C1319}
.chip.up,.chip.sup{color:var(--up);border-color:#1B6239;background:#0E2A1A}
.chip.grey{color:var(--muted);border-color:var(--border);background:var(--bg)}
.heat{display:flex;justify-content:space-between;align-items:center;width:58px;padding:3px 6px;border-radius:5px;color:var(--ink);font-size:11px;font-weight:500;min-height:22px;cursor:pointer}
.heatwrap{display:flex;flex-wrap:wrap;gap:6px}
.card{background:var(--panel);border:1px solid var(--border);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:6px}
.card .big{font-size:22px;font-weight:500}
.stat{display:flex;flex-direction:column;gap:6px;padding:12px 14px;border-bottom:1px solid var(--border)}
.stat:last-child{border-bottom:0}
.kv{display:flex;justify-content:space-between;align-items:baseline;gap:8px;font-size:13px}
.kv b{font-weight:500;color:var(--ink)}
.bar{height:8px;border-radius:4px;background:var(--dn);overflow:hidden}
.bar i{display:block;height:100%;background:var(--up)}
.flash{animation:flash .6s ease-out}
@keyframes flash{0%{background:rgba(110,168,254,.35)}100%{background:transparent}}
.skel{color:var(--dim)}
.empty{padding:28px;text-align:center;color:var(--muted)}
.sp{display:block}

/* pair screen */
.pairhead{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.pairhead .price{font-size:26px;font-weight:500}
.pairgrid{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:18px;align-items:start}
.chartbox{position:relative;min-height:460px}
.chartbox .cross{position:absolute;left:12px;top:10px;font-size:11.5px;color:var(--muted);z-index:5;pointer-events:none;display:flex;gap:10px;flex-wrap:wrap}
.chartwrap{height:720px} /* wide screens: pair.js fits the chart to the window, never under 560 px */
.side{display:flex;flex-direction:column}
.zonerow{display:flex;justify-content:space-between;align-items:center;font-size:12.5px;gap:8px}
.calc input{width:100%;appearance:none;background:var(--bg);border:1px solid var(--border);border-radius:6px;color:var(--ink);font:13px var(--mono);padding:6px 8px;min-height:32px}
.calc label{display:flex;flex-direction:column;gap:3px;font-size:11px;color:var(--muted)}
.calcgrid{display:grid;grid-template-columns:1fr 1fr;gap:8px}

/* forms */
select,input[type=text],input[type=number],input[type=url]{appearance:none;background:var(--bg);border:1px solid var(--border);border-radius:6px;color:var(--ink);font:14px var(--sans);padding:8px 10px;min-height:38px;width:100%}
.field{display:flex;flex-direction:column;gap:5px}
.field > span{font-size:11px;color:var(--muted);letter-spacing:.04em;text-transform:uppercase;font-weight:500}
.set{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:9px 0;border-bottom:1px solid var(--hover);font-size:13.5px}
.set:last-child{border-bottom:0}
.set select,.set input{width:auto;min-width:150px;min-height:32px;padding:5px 8px;font-size:13px}
.switch{appearance:none;width:38px;height:22px;border-radius:11px;background:#2A3650;border:0;position:relative;cursor:pointer;flex:0 0 auto}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#8A96AB;transition:left .15s}
.switch.on{background:var(--primary)}.switch.on::after{left:19px;background:#fff}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chips .chipx{display:inline-flex;align-items:center;gap:6px;background:var(--bg);border:1px solid var(--border);border-radius:6px;padding:4px 6px 4px 9px;font-size:12.5px}
.chips .chipx button{appearance:none;border:0;background:transparent;color:var(--dim);cursor:pointer;font-size:14px;line-height:1;padding:0 2px}
.chips .chipx button:hover{color:var(--dn)}
.three{display:grid;grid-template-columns:360px minmax(0,1fr) 340px;gap:18px;align-items:start}
.list{display:flex;flex-direction:column}
.row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--hover);font-size:13.5px}
.row:last-child{border-bottom:0}
.row .grow{flex:1 1 auto}

/* palette */
.palette{position:fixed;inset:0;background:rgba(5,8,14,.6);z-index:50;display:flex;align-items:flex-start;justify-content:center;padding-top:12vh}
.palette-box{width:min(520px,92vw);background:var(--panel);border:1px solid var(--border2);border-radius:12px;padding:10px;box-shadow:0 20px 60px rgba(0,0,0,.5)}
.palette-box input{width:100%;appearance:none;background:var(--bg);border:1px solid var(--border);border-radius:8px;color:var(--ink);font:16px var(--sans);padding:10px 12px}
.palette-list{list-style:none;margin:8px 0 0;padding:0;max-height:50vh;overflow:auto}
.palette-list li{padding:9px 12px;border-radius:6px;display:flex;justify-content:space-between;cursor:pointer;font-size:14px}
.palette-list li.on,.palette-list li:hover{background:var(--hover)}
.palette-hint{font-size:11.5px;padding:8px 12px 2px}
.toasts{position:fixed;right:16px;bottom:16px;display:flex;flex-direction:column;gap:8px;z-index:60}
.toast{background:#182238;border:1px solid var(--border2);border-radius:8px;padding:10px 14px;font-size:13px;max-width:360px;box-shadow:0 8px 30px rgba(0,0,0,.4)}
.toast.err{border-color:#5A2626}

/* pair chart area and toggles */
.chartarea{position:relative}
.chartarea .cross{position:absolute;left:12px;top:8px;font-size:11.5px;color:var(--muted);z-index:5;pointer-events:none;display:flex;gap:10px;flex-wrap:wrap}
.togs{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-top:10px}
.togs .sep{color:var(--dim);font-size:11px;text-transform:uppercase;letter-spacing:.04em;margin:0 4px 0 8px}
.pairhead > div{display:flex;align-items:baseline;gap:6px;white-space:nowrap}
.side .stat .lbl{display:flex;align-items:center;flex-wrap:wrap;gap:4px}
.calcgrid label{display:flex;flex-direction:column;gap:3px;font-size:11px;color:var(--muted)}
.three .set select{min-width:120px}
code{font-family:var(--mono);font-size:12px;background:var(--bg);padding:1px 4px;border-radius:4px}

/* plain-language readings */
.chip.rd{margin-left:auto;font-weight:600;cursor:help}
.chip.rd.big{font-size:14px;padding:4px 10px;margin-left:0}
.rdcard{background:linear-gradient(180deg,#141C2C,var(--panel))}
.rdline{cursor:help;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:baseline}
.rdline .rdn{font-size:11.5px;color:var(--ink);text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rdline .chip.rd{margin-left:0}
td.rd .chip.rd{margin-left:0}
body.noreadings .rd{display:none}
.lbl .src{margin-left:6px}

/* layout fixes */
.btn{white-space:nowrap}
.tblwrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
.grid2 .tbl td,.grid2 .tbl th{padding:6px 7px;font-size:13px}
.heat{width:auto;min-width:64px;gap:5px;padding:3px 7px;font-size:11px}
.heat .num{font-size:10.5px}
.three{grid-template-columns:400px minmax(0,1fr) 380px}
.row .btn.sm{padding:2px 7px;min-height:22px;font-size:12px}
.row .num{font-size:12.5px}
.set input[type=url]{flex:1 1 auto;min-width:0}
.set > div{display:flex;gap:8px;width:100%}
.set > .seg.mode{width:auto;flex:0 0 auto}
@media (min-width:901px) and (max-width:1300px){.three{grid-template-columns:1fr 1fr}.three > :last-child{grid-column:1/-1}}

/* grid items never force the page wider than the viewport: tables scroll inside .tblwrap */
.grid2 > *,.grid4 > *,.pairgrid > *,.three > *{min-width:0}
.form3{grid-template-columns:repeat(3,1fr)}

/* segmented tabs: shown on phones only, where two tables side by side do not fit */
.seg{display:none;gap:4px}
.seg .pill{flex:1 1 0}

/* tap tooltips: the text of a title attribute, opened by a tap or click on labels, chips and column titles */
.tipbox{position:fixed;z-index:70;background:#182238;border:1px solid var(--border2);border-radius:8px;padding:9px 12px;font-size:12.5px;line-height:1.45;color:var(--ink);box-shadow:0 8px 30px rgba(0,0,0,.45);white-space:normal}

/* redesign (20.10.): wordmark, the plain sentence, number cards, heat map, coin badges, column switch */
.wm{font-weight:700;font-size:17px;letter-spacing:-.01em;color:var(--ink)}.wm b{color:var(--primary);font-weight:700}
.plain{margin:0;font-size:15.5px;line-height:1.5;color:var(--ink)}
.kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
.kpi{background:var(--panel);border:1px solid var(--border);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:3px;min-width:0}
.kpi b{font-size:22px;font-weight:600;line-height:1.2;white-space:nowrap}
.kpi b small{font-size:13px;color:var(--muted);font-weight:400}
.kpi .sub{font-size:12px;color:var(--muted)}
.kpi.link{cursor:pointer}.kpi.link:hover{border-color:var(--border2)}
.rowbar{display:flex;align-items:center;gap:10px}
.heatmap.tree{position:relative;height:320px;overflow:hidden;border-radius:8px}
.heat.tm{position:absolute;flex-direction:column;align-items:flex-start;justify-content:center;gap:1px;padding:4px 7px;border-radius:5px;overflow:hidden;border:2px solid var(--panel);min-width:0;min-height:0;width:auto;line-height:1.15}
.heat.tm span{overflow:hidden;white-space:nowrap;max-width:100%}
.heat.tm.big{font-size:15px;font-weight:600}.heat.tm.big .num{font-size:13px}
.heat.tm.mid{font-size:12px}.heat.tm.mid .num{font-size:11px}
.heat.tm.small{font-size:10.5px;padding:2px 4px}
.heat.tm.none{padding:0}
.heatgrid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.heatgrid .heat{width:auto;min-width:0;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;min-height:52px;border-radius:8px;font-size:13px;font-weight:600}
.heatgrid .heat .num{font-size:11.5px;font-weight:500}
.coinb{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;font-size:10.5px;font-weight:700;color:#fff;margin-right:7px;vertical-align:-5px;flex:0 0 auto}
.coinb.img{background:transparent;object-fit:contain}
.ph-coin .coinb{width:26px;height:26px;vertical-align:-4px;margin-right:8px}
.tbl.calm [data-adv]{display:none}
.seg.mode{display:inline-flex;gap:0;border:1px solid var(--border);border-radius:8px;overflow:hidden;background:var(--panel);flex:0 0 auto}
.seg.mode .pill{border:0;border-radius:0;flex:0 0 auto;padding:6px 12px;min-height:30px;background:transparent}
.seg.mode .pill.on{background:var(--pill-on);color:var(--pill-on-ink)}
.legend{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;color:var(--muted);white-space:nowrap}
.legend i{width:10px;height:10px;border-radius:3px;display:inline-block}
.legend i.up{background:#1E8C52}.legend i.dn{background:#B9323F}
.phead .right{margin-left:auto;display:flex;gap:8px;align-items:center}

/* pair page, redesign: compact header, timeframes with "More" on phones, chart menus, sidebar sections, reading cards */
.pairhead2{display:flex;flex-direction:column;gap:8px}
.ph-top{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.ph-coin{font-size:24px;font-weight:700;line-height:1.1}
.ph-top .right{margin-left:auto;display:flex;gap:8px}
.ph-price{display:flex;align-items:baseline;gap:8px}
.ph-price .price{font-size:30px;font-weight:600;line-height:1.1}
.ph-stats{display:flex;flex-wrap:wrap;gap:10px 24px}
.ph-stats > div{display:flex;flex-direction:column;gap:2px;min-width:0}
.ph-stats > div.g{border-left:1px solid var(--border);padding-left:24px} /* three groups: range and volume, OI and funding, positioning */
.ph-stats .num{font-size:13.5px}
.tfs:not(.full) .pill[data-adv]{display:none}
.mv-ctl{display:contents}
.btn .narrow{display:none}
.search-btn{display:none}
.hint{color:var(--muted);border-bottom:1px dotted var(--muted);cursor:help;font-size:13px;margin-left:6px}
.alempty p{margin:0 0 12px;color:var(--muted);max-width:60ch}
.alempty .row{gap:8px;flex-wrap:wrap}
.menus{display:flex;gap:6px}
.menu{position:relative}
.menu .cnt{display:inline-block;min-width:18px;padding:0 5px;border-radius:9px;background:var(--pill-on);color:var(--pill-on-ink);font-size:11px;text-align:center;margin-left:2px}
.menu .pop{display:none;position:absolute;top:calc(100% + 6px);left:0;min-width:250px;max-width:calc(100vw - 32px);background:var(--panel);border:1px solid var(--border2);border-radius:10px;padding:6px;z-index:40;box-shadow:0 12px 40px rgba(0,0,0,.5)}
.menu .pop.flip{left:auto;right:0}
.menu.open .pop{display:flex;flex-direction:column;gap:2px}
.menu .pop .tog{width:100%;justify-content:flex-start;border-color:transparent;background:transparent;font-size:13px}
.menu .pop .tog:hover,.menu .pop .btn:hover{background:var(--hover)}
.menu .pop .sep{font-size:11px;color:var(--dim);text-transform:uppercase;letter-spacing:.04em;padding:6px 10px 2px}
.menu .pop .btn{width:100%;text-align:left;border-color:transparent;background:transparent;white-space:normal}
.sect{border-bottom:1px solid var(--border)}
.sect:last-child{border-bottom:0}
.sect > summary{cursor:pointer;list-style:none;padding:11px 14px;font-weight:600;font-size:13.5px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.sect > summary .dim{font-weight:400;font-size:12px}
.sect > summary::-webkit-details-marker{display:none}
.sect > summary::after{content:"";margin-left:auto;width:8px;height:8px;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:rotate(-45deg);transition:transform .15s;flex:0 0 auto}
.sect[open] > summary::after{transform:rotate(45deg)}
.rcards{display:none;margin-top:14px}
.sect .rdcard > .lbl{display:none}
.sect .rdcard > .kv:first-of-type .dim{display:none}
.rdsw{display:flex;align-items:center;gap:8px;padding:6px 14px 0;font-size:12px}
.rdsw .seg.mode .pill{padding:3px 9px;min-height:24px;font-size:11.5px}
/* details under the chart: one indicator at a time, picked by a tab */
.pairgrid > div > .dtl{margin-top:18px}
.dtabs{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:4px}
.dtabs .pill{padding:5px 11px;min-height:30px;font-size:12.5px}
.dtl .stat{padding:10px 0 0;border-bottom:0;max-width:640px}
.dtl .sp{max-width:100%}

/* focus page, redesign: expandable pair cards, collapsible chart section */
.pcards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start}
.pcard{overflow:hidden}
.pcard > summary{list-style:none;cursor:pointer;display:grid;grid-template-columns:minmax(0,1fr) auto auto;grid-template-areas:"id price spark" "meta meta meta";gap:8px 12px;padding:12px 14px;align-items:center}
.pcard > summary::-webkit-details-marker{display:none}
.pc-id{grid-area:id;display:flex;align-items:center;gap:8px;min-width:0}
.pc-name{display:block;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.pc-id b{font-size:15px;font-weight:600}
.pc-price{grid-area:price;display:flex;flex-direction:column;align-items:flex-end;font-size:15px;line-height:1.2}
.pc-price small{font-size:12px}
.pc-spark{grid-area:spark;display:flex}
.pc-meta{grid-area:meta;display:flex;gap:14px;flex-wrap:wrap;font-size:12.5px;color:var(--muted);align-items:center}
.pc-meta b{color:var(--ink);font-weight:500}
.pc-meta .pc-open{margin-left:auto}
.pc-body{border-top:1px solid var(--border)}
.panel.sect > summary{padding:14px 16px}
.panel.sect .pad{padding:0 16px 16px}
.panel.sect .phead{margin-bottom:10px}

/* alerts, redesign: rule cards, quick templates, history and delivery side by side; tabs on phones */
.tabs{display:none;gap:6px}
.tabs .pill{flex:1 1 0;text-align:center;padding:8px 6px;min-height:36px;white-space:nowrap}
.algrid{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) 330px;grid-template-areas:"rules history delivery" "templates history delivery";gap:18px;align-items:start}
.algrid > [data-tab=rules]{grid-area:rules}.algrid > [data-tab=templates]{grid-area:templates}.algrid > [data-tab=history]{grid-area:history}.algrid > [data-tab=delivery]{grid-area:delivery}
.alcol{display:flex;flex-direction:column;gap:12px;min-width:0}
.alform{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.alsent,.alactions{grid-column:1/-1}
.alsent{font-size:12.5px;color:var(--muted)}
.alactions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:12px}
.alands,.alandadd{grid-column:1/-1}
.alands{display:flex;flex-direction:column;gap:8px}
.alands:empty{display:none}
.androw{display:grid;grid-template-columns:auto repeat(4,minmax(0,1fr)) auto;gap:8px;align-items:end;padding:8px 10px;border:1px dashed var(--border);border-radius:8px}
.andlbl{font-size:11px;color:var(--muted);letter-spacing:.04em;text-transform:uppercase;font-weight:500;padding-bottom:9px}
.andx{min-width:32px}
.alandadd{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:12px;color:var(--muted)}
.rules{display:flex;flex-direction:column;gap:10px}
.rule{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"ic main sw" "ic main btns";gap:8px 12px;align-items:start;padding:12px 14px;background:var(--panel);border:1px solid var(--border);border-radius:12px}
.rule.off .rtitle b,.rule.off .rsub{color:var(--muted)}
.ric{grid-area:ic;width:34px;height:34px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:#94A3B8;background:rgba(148,163,184,.14)}
.ric svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.ric-price{color:#F59E0B;background:rgba(245,158,11,.16)}
.ric-level{color:#FB923C;background:rgba(251,146,60,.16)}
.ric-oi{color:#60A5FA;background:rgba(96,165,250,.16)}
.ric-funding{color:#A78BFA;background:rgba(167,139,250,.16)}
.ric-sr{color:#2DD4BF;background:rgba(45,212,191,.16)}
.ric-liq{color:#F87171;background:rgba(248,113,113,.16)}
.ric-rsi{color:#34D399;background:rgba(52,211,153,.16)}
.ric-cvd{color:#22D3EE;background:rgba(34,211,238,.16)}
.ric-combo{color:#E879F9;background:rgba(232,121,249,.16)}
.rmain{grid-area:main;display:flex;flex-direction:column;gap:4px;min-width:0}
.rtitle{font-size:14.5px}.rtitle b{font-weight:600}
.rsub{font-size:13px;color:var(--muted)}
.rchips{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-top:2px}
.rnow{display:flex;flex-wrap:wrap;align-items:center;gap:4px;margin-top:6px;font-size:12px;color:var(--text)}
.rnow .chip{font-weight:500;letter-spacing:0;font-size:11px}
.rnow .chip b{font-weight:600}
.rnow .chip.nodata{border-style:dashed;opacity:.75}
.rchips .chip{font-size:11px;padding:2px 7px;border-radius:6px;letter-spacing:0}
.rlast{font-size:12px;margin-left:2px}
.rsw{grid-area:sw;justify-self:end}
.rbtns{grid-area:btns;justify-self:end;display:flex;gap:4px}
.tpls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.tpl{appearance:none;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center;text-align:left;padding:10px 12px;background:var(--bg);border:1px solid var(--border);border-radius:10px;color:var(--ink);cursor:pointer;font:inherit;min-width:0}
.tpl:hover{border-color:var(--border2);background:var(--hover)}
.tpl .ric{grid-area:auto}
.tpl .tmain{min-width:0}
.tpl b{display:block;font-size:13.5px;font-weight:600}
.tpl .dim{display:block;font-size:12px;line-height:1.35}
.tpl .chev{color:var(--dim);font-size:18px}
.alog .row{flex-wrap:wrap}
.set .qh{width:68px;min-width:0;text-align:center;padding:5px 6px}

/* watchlist, redesign: Pairs | Settings tabs, searchable pair table with stars, settings in two columns */
.tabs.always{display:flex}
.tabs.always .pill{flex:0 0 auto;padding:8px 18px}
.wlgrid > [data-tab]{display:none}
.wlgrid[data-show=pairs] > [data-tab=pairs],.wlgrid[data-show=settings] > [data-tab=settings]{display:flex;flex-direction:column;gap:12px}
.wlbar{align-items:center}
.wlsearch{margin-left:auto}
.wlsearch input{width:260px}
.wltbl .star-cell{width:36px;padding-left:10px;padding-right:0}
.star{appearance:none;background:none;border:0;color:var(--dim);cursor:pointer;font-size:18px;line-height:1;padding:0;width:30px;height:30px;border-radius:8px}
.star:hover{color:var(--amb);background:var(--hover)}
.star.on{color:var(--amb)}
.wltbl td .sp{width:72px;height:20px}
.wlfoot{padding:8px 14px;font-size:12.5px}
.wlset{align-items:start}
.wlcol{display:flex;flex-direction:column;gap:18px;min-width:0}
.wlbtns{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.empty .btn{margin:0 4px}

/* phone: these rules come last so they win over the layout rules above */
@media (max-width:900px){
  /* app shell: header, scrolling main and tab bar are flow children of a body that fills the viewport, so nothing
     is position:fixed (fixed bars lag behind the scroll inside iframes on iOS and jump into place afterwards) */
  html{height:100%;overflow:hidden}
  body{height:100%;height:100dvh;overflow:hidden;display:flex;flex-direction:column}
  .top{position:static;flex:0 0 auto;padding:0 12px;gap:10px;height:calc(52px + env(safe-area-inset-top));padding-top:env(safe-area-inset-top)}
  .banner{flex:0 0 auto}
  .search{display:none}
  .search-btn{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--muted);flex:0 0 auto;padding:0}
  .clock,.live span:not(.dot):not(.num){display:none}
  .nav{position:static;flex:0 0 auto;width:100%;background:var(--head);border-top:1px solid var(--border);padding:2px 4px calc(2px + env(safe-area-inset-bottom));justify-content:space-around}
  .nav a{flex:1 1 0;justify-content:center;flex-direction:column;gap:3px;font-size:10.5px;padding:6px 0;min-height:48px;color:var(--dim)}
  .nav a .ico{display:block}.nav a.on{background:transparent;color:var(--pill-on-ink)}
  .app{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior-y:contain;padding:12px 16px 24px}
  .banner{margin:10px 12px 0;padding:7px 10px;font-size:12.5px}
  .grid2,.grid4,.pairgrid,.three{grid-template-columns:minmax(0,1fr)}
  .three > :last-child{grid-column:auto}
  .tbl td,.tbl th{padding:7px 6px;font-size:12.5px}
  .tblwrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .chartwrap{height:560px}
  .pairhead .price{font-size:22px}
  .seg{display:flex}
  .mv-tables > section:not(.on){display:none}
  .form3{grid-template-columns:1fr}
  .set{flex-wrap:wrap}
  .set select,.set input{min-width:0;max-width:100%}
  .row{flex-wrap:wrap}
  .row .grow{flex:1 1 60px}
  .toasts{left:16px;right:16px;bottom:calc(76px + env(safe-area-inset-bottom))}
  .toast{max-width:none}
}

/* touch: primary controls at least 44 px tall, secondary ones at least 36 px */
@media (pointer:coarse){
  .btn,.pill,.tog,select,input[type=text],input[type=number],input[type=url],.search input{min-height:44px}
  .pill{min-width:44px}
  .btn.sm,.row .btn.sm{min-height:36px;padding:4px 10px}
  .switch{width:48px;height:28px}
  .switch::after{width:22px;height:22px}
  .switch.on::after{left:23px}
  .chips .chipx{min-height:36px}
  .chips .chipx button{min-width:32px;min-height:32px}
  .heat{min-height:36px}
  .set select,.set input{min-height:44px}
}

/* phone, redesign: two number cards per row, the compact heat grid, symbols hidden in tables */
@media (max-width:900px){
  .wm{font-size:16px}
  .toolbar .mut{display:none}
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .kpi{padding:10px 12px}.kpi b{font-size:20px}
  .tbl .sym{display:none}
  .tbl .sp{width:56px;height:18px}
  .grid2 .tbl td,.grid2 .tbl th{padding:7px 5px}
  .heatmap.tree{height:auto}
  .rowbar{flex-wrap:wrap}
  .rowbar .seg{flex:1 1 100%}
  .rowbar .seg.mode{flex:0 0 auto;margin-left:auto}
  .rowbar .tog{margin-left:auto}
  .app{gap:12px}
  .panel.pad{padding:12px 12px 14px}
  .plain{font-size:15px}
  .kpi{padding:9px 11px}
  .phead{margin-bottom:10px}
  /* movers head: title and refresh on one line, windows and All/Focus on one swipeable line */
  .mv-top{gap:8px 10px}
  .mv-top .title{flex:1 1 0;min-width:0}
  .mv-top .sub{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mv-top .sub .wide{display:none}
  .mv-ctl{display:flex;flex:1 1 100%;order:2;gap:8px;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0 -16px;padding:0 16px 2px}
  .mv-ctl::-webkit-scrollbar{display:none}
  .mv-ctl .group{flex:0 0 auto;flex-wrap:nowrap}
  #mv-refresh{order:1;min-width:44px;padding:6px 10px}
  #mv-refresh .wide{display:none}#mv-refresh .narrow{display:inline;font-size:18px;line-height:1}
  /* advanced tables: the table scrolls inside its box, the pair column (and the rank or star before it) stays put */
  .tbl th.l:first-child,.tbl td.l:first-child{position:sticky;left:0;z-index:2;background:var(--panel)}
  .mv-tables .tbl th.l:first-child,.mv-tables .tbl td.l:first-child{width:30px;min-width:30px}
  .mv-tables .tbl th.l:nth-child(2),.mv-tables .tbl td.l:nth-child(2){position:sticky;left:30px;z-index:2;background:var(--panel)}
  .wltbl th.l:nth-child(2),.wltbl td.l:nth-child(2){position:sticky;left:36px;z-index:2;background:var(--panel)}
  .tbl tbody tr:hover td.l:first-child,.tbl tbody tr:hover td.l:nth-child(2){background:var(--hover)}
}

/* phone, pair page: chart first, compact head, reading cards and statistics under the chart */
@media (max-width:900px){
  .rcards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:8px}
  .rcards .kpi{padding:8px 10px;gap:2px}
  .rcards .kpi b{font-size:15px}
  .rcards .kpi .sub{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .ph-phone .ph-top{flex-wrap:nowrap;align-items:baseline;gap:8px}
  .ph-phone .ph-coin{font-size:22px}
  .ph-phone .ph-sym{display:none}
  .ph-phone .ph-price{margin-left:auto;align-items:baseline;gap:6px;white-space:nowrap}
  .ph-phone .ph-price .price{font-size:22px}
  .ph-below{margin-top:10px}
  .ph-actions{display:flex;gap:8px;margin-bottom:10px}
  .ph-actions .btn{flex:1 1 0;text-align:center}
  .ph-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 12px}
  .ph-stats > div.g{border-left:0;padding-left:0}
  .ph-stats #pr-next{display:none}
  .toolbar .tfs{flex:1 1 100%}
  .menus{flex:1 1 100%}
  .menus .menu{flex:1 1 0;min-width:0}
  .menus .menu > .btn{width:100%}
  .menu .pop{position:fixed;left:16px;right:16px;top:auto;bottom:calc(72px + env(safe-area-inset-bottom));max-width:none;max-height:60vh;overflow:auto}
  .menu .pop.flip{left:16px;right:16px}
}

/* phone, focus page */
@media (max-width:900px){
  .pcards{grid-template-columns:minmax(0,1fr);gap:10px}
}

/* phone, alerts page */
@media (max-width:900px){
  .tabs{display:flex}
  .algrid{display:block}
  .algrid > [data-tab]{display:none}
  .algrid[data-show=rules] > [data-tab=rules],.algrid[data-show=templates] > [data-tab=templates],.algrid[data-show=history] > [data-tab=history],.algrid[data-show=delivery] > [data-tab=delivery]{display:flex}
  .alform{grid-template-columns:1fr 1fr}
  .androw{grid-template-columns:1fr 1fr}
  .andlbl{grid-column:1/-1;padding:0}
  .andx{grid-column:1/-1;justify-self:start}
  .rule{grid-template-areas:"ic main sw" "ic btns btns";gap:4px 10px;padding:10px 12px}
  .rbtns{justify-self:start}
  .ric{width:30px;height:30px}.ric svg{width:15px;height:15px}
  .rtitle{font-size:14px}.rsub{font-size:12.5px}
  .tpls{grid-template-columns:minmax(0,1fr)}
}

/* phone, watchlist page */
@media (max-width:900px){
  .tabs.always .pill{flex:1 1 0;padding:8px 6px}
  .wlbar{flex-wrap:wrap}
  .wlbar .group{flex:1 1 100%;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:2px}
  .wlbar .group .pill{flex:0 0 auto;white-space:nowrap}
  .wlsearch{margin-left:0;flex:1 1 100%;order:-1}
  .wlsearch input{width:100%}
  .wl-sub{display:none}
  .wltbl td .sp{width:56px;height:18px}
  .wlset{grid-template-columns:minmax(0,1fr);gap:12px}
  .wlcol{gap:12px}
  .wlbtns .btn{flex:1 1 45%}
}

/* focus table: sortable column titles, the per-row price path */
.tbl th[data-sort]{cursor:pointer}
.tbl th[data-sort]:hover,.tbl th.sorted{color:var(--ink)}
.tbl th .arrow{font-size:9px;margin-left:3px;vertical-align:middle}
.tbl td.spk{padding-top:3px;padding-bottom:3px;line-height:0}
