/* Trade page styles (terminal.js). Dark-first trading layout.
   Palette: accent #284cf9, ink #141a2a, pale #eff2ff; Manrope type; labels in sentence case. */
body.trade{
  --t-bg:#0b1020;--t-panel:#10172a;--t-raise:#161e35;--t-line:#1f2943;--t-line-2:#2a3554;
  --t-text:#e8ecf8;--t-muted:#a3acc6;--t-faint:#7f8aa8;--t-link:#9aabff;
  --up:#2fc48d;--up-soft:#2fc48d1f;--down:#f2596c;--down-soft:#f2596c1f;--warn-t:#f1b34c;
  --t-hover:#141c33;--t-gut:#1a2238;--t-on-up:#062417;--t-on-down:#2a0710;--t-head:#0c1121f2;--t-tag-bg:#284cf926;--t-tag-line:#284cf966;--t-tag-text:#cdd6ff;
  background:var(--t-bg);color:var(--t-text)
}

/* no separate account bar: the picker sits in the ticket and totals in the account panel */
.up{color:var(--up)}.down{color:var(--down)}

/* Main grid. Left: market header above the chart. Beside it: book, then a full-height ticket column.
   Tables sit below chart + book; the account panel below the ticket. Each panel is a card separated by a gutter,
   and the bottom row's height is restored from the saved preference. */
.term{display:grid;grid-template-columns:minmax(0,1fr) 264px 280px;grid-template-rows:auto minmax(160px,1fr) var(--book-h,240px);grid-template-areas:"head ob side" "chart ob side" "book book acct";gap:4px;padding:4px;background:var(--t-gut);min-height:0}
.term>*{background:var(--t-panel);min-width:0;border-radius:6px}
.t-head{grid-area:head;display:flex;align-items:center;gap:24px;padding:8px 14px;overflow-x:auto;scrollbar-width:none}
.t-head::-webkit-scrollbar{display:none}
.t-chart{grid-area:chart;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.t-ob{grid-area:ob;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.t-side{grid-area:side;display:flex;flex-direction:column;min-height:0;overflow-x:hidden;overflow-y:auto;scrollbar-width:thin}
.t-rules{grid-area:acct}
.t-book{grid-area:book;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.book-resize{flex:none;height:8px;margin-bottom:-4px;cursor:ns-resize;touch-action:none;display:grid;place-items:center;background:transparent;border-radius:6px 6px 0 0}
.book-resize::before{content:"";width:36px;height:3px;border-radius:3px;background:var(--t-line-2);opacity:.7}
.book-resize:focus-visible{outline:2px solid #284cf9;outline-offset:-2px}

/* market tabs and stats */
.mkt-pick{display:flex;flex:none}
.sym-btn{white-space:nowrap;display:flex;align-items:center;gap:8px;height:40px;padding:0 8px 0 4px;margin-left:-4px;border-radius:8px;border:0;background:transparent;color:var(--t-text);font:inherit;font-weight:600;font-size:20px;letter-spacing:-.01em;cursor:pointer;transition:background-color .15s ease}
.sym-btn .lev{font-size:12px;font-weight:700;letter-spacing:0;color:var(--t-tag-text);background:var(--t-tag-bg);border-radius:5px;padding:2px 6px;line-height:16px}
.sym-btn .lev:empty{display:none}
.sym-caret{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;color:var(--t-muted);transition:transform .15s ease}
.sym-btn[aria-expanded="true"] .sym-caret{transform:rotate(180deg)}
.sym-key{font:inherit;font-size:11px;font-weight:700;letter-spacing:0;color:var(--t-faint);border:1px solid var(--t-line-2);border-radius:5px;min-width:20px;height:20px;display:inline-grid;place-items:center;background:transparent}
.sym-btn:focus-visible{outline:2px solid #284cf9;outline-offset:2px}
@media(hover:hover) and (pointer:fine){.sym-btn:hover{background:var(--t-raise)}}
@media(pointer:coarse){.sym-key{display:none}}
.mkt-last{display:flex;flex-direction:column;justify-content:center;gap:1px;min-width:7.5rem;flex:none}
.mkt-last-px{font-size:22px;font-weight:800;letter-spacing:-.02em;line-height:1.1;transition:color .12s ease,background-color .12s ease;border-radius:4px;padding:0 2px;margin:0 -2px}
.mkt-last-px.is-up{color:var(--t-up,#0a7a3e);background:rgba(10,122,62,.08)}
.mkt-last-px.is-down{color:var(--t-down,#c0352b);background:rgba(192,53,43,.08)}
.mkt-last-src{font-size:11px;font-weight:600;color:var(--t-faint);text-transform:uppercase;letter-spacing:.04em}
.mkt-stats{display:flex;gap:24px;margin:0;flex:none}
.mkt-stats div{display:grid;gap:2px}
.mkt-stats dt{font-size:12px;color:var(--t-faint);font-weight:500;white-space:nowrap}
.mkt-stats dd{margin:0;font-size:14px;font-weight:600;white-space:nowrap}
.feed{margin-left:auto;display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--t-muted);white-space:nowrap;flex:none}
.feed i{width:8px;height:8px;border-radius:50%;background:var(--t-faint)}
.feed[data-state="live"] i{background:var(--up)}
.feed[data-state="reconnecting"] i,.feed[data-state="delayed"] i{background:var(--warn-t)}
.feed[data-state="delayed"]{color:var(--warn-t)}
.mkt-stats.is-stale dd,.mkt-last.is-stale .mkt-last-px{color:var(--t-faint)}
/* Wide-screen header: 12 px labels with unrounded figures. When space runs out, the figures row scrolls horizontally
   (wheel, drag or keyboard) and fades at the clipped edge, while the symbol and main price stay pinned. The feed
   indicator is just a dot unless prices are delayed, when its label appears. */
@media(min-width:861px){
  .t-head{gap:14px;padding:8px 12px;overflow:hidden}
  .sym-btn{font-size:18px;gap:6px;padding-right:2px}
  .mkt-last{min-width:0;gap:0}
  .mkt-last-px{font-size:18px}
  .mkt-last-src{font-size:10.5px}
  .mkt-stats{flex:1 1 auto;min-width:0;gap:12px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;outline-offset:2px}
  .mkt-stats::-webkit-scrollbar{display:none}
  .mkt-stats div{flex:none;gap:3px}
  .mkt-stats dt,.mkt-stats dd{font-size:12px}
  .mkt-stats dd{font-weight:600}
  .mkt-stats.is-cut{-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 36px),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - 36px),transparent)}
  .mkt-stats.is-cut.at-end{-webkit-mask-image:linear-gradient(90deg,transparent,#000 36px);mask-image:linear-gradient(90deg,transparent,#000 36px)}
  .mkt-stats.is-cut.is-mid{-webkit-mask-image:linear-gradient(90deg,transparent,#000 36px,#000 calc(100% - 36px),transparent);mask-image:linear-gradient(90deg,transparent,#000 36px,#000 calc(100% - 36px),transparent)}
  .feed{margin-left:0}
  .feed:not([data-state="delayed"]) span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
}
@media(min-width:861px) and (max-width:1599px){.sym-key{display:none}}

/* chart */
.chart-bar{display:flex;align-items:center;gap:12px;padding:8px 12px;border-bottom:1px solid var(--t-line)}
.chart-name{font-size:14px;font-weight:600;color:var(--t-muted);letter-spacing:0;margin-left:auto}
.intervals,.view-switch{display:flex;gap:2px}
.intervals button,.view-switch button{height:30px;min-width:38px;padding:0 9px;border:0;border-radius:7px;background:transparent;color:var(--t-muted);font-size:13px;font-weight:600}
.intervals button[aria-pressed="true"],.view-switch button[aria-pressed="true"]{background:var(--t-raise);color:var(--t-text)}
@media(hover:hover) and (pointer:fine){.intervals button:hover,.view-switch button:hover{color:var(--t-text)}}
.view-switch{display:none}
.chart-wrap{position:relative;flex:1;min-height:0;overflow:hidden}
.tv-chart{position:absolute;inset:0}
.chart-ui{position:absolute;inset:0;z-index:3;pointer-events:none;overflow:hidden}
.c-row{position:absolute;left:8px;right:72px;top:0;bottom:0;height:auto;pointer-events:none}
.c-rule{position:absolute;left:0;right:0;top:0;border-top:1px dashed currentColor}
.c-rule.pos{border-top:2px solid #284cf9}
.c-rule.tp,.c-rule.sl{pointer-events:auto;cursor:ns-resize;touch-action:none}
.c-rule.tp::before,.c-rule.sl::before{content:"";position:absolute;left:0;right:0;top:-12px;height:24px}
.c-rule.tp{color:var(--up)}
.c-rule.sl{color:var(--down)}
.c-row:hover .c-rule.tp,.c-row:hover .c-rule.sl{border-top-width:2px;filter:brightness(1.15)}
.c-chip{position:absolute;top:0;pointer-events:auto;display:flex;align-items:center;gap:4px;height:26px;max-width:100%;padding:0 4px 0 8px;border-radius:7px;font-size:12px;font-weight:600;font-variant-numeric:tabular-nums;cursor:ns-resize;user-select:none;white-space:nowrap;box-shadow:0 1px 2px #141a2a22;touch-action:none}
.c-chip.pos{right:0;background:#284cf9;color:#fff;cursor:default}
.c-chip.tp{left:0;background:var(--up);color:#fff}
.c-chip.sl{left:0;background:var(--down);color:#fff}
.c-chip.tp:hover,.c-chip.sl:hover,.c-make:hover{filter:brightness(1.12);box-shadow:0 0 0 2px #ffffff}
.c-grip{display:inline-grid;place-items:center;font-size:14px;line-height:1;opacity:.95}
.c-chip button{pointer-events:auto;border:0;background:transparent;color:inherit;font:inherit;font-weight:700;height:20px;padding:0 6px;border-radius:5px;cursor:pointer}
.c-chip button.c-make,.c-make{cursor:ns-resize;display:inline-flex;align-items:center;gap:2px;border:1px solid #ffffff88 !important;border-radius:6px;height:22px}
.c-chip .c-x{width:18px;padding:0;border:1px solid transparent}
.c-chip button:hover,.c-chip button:focus-visible{background:#ffffff2e}
.c-chip button:focus-visible,.c-rule:focus-visible{outline:2px solid #fff;outline-offset:1px}
.c-hint{position:absolute;left:0;top:calc(100% + 4px);background:#141a2a;color:#fff;font-size:12px;font-weight:600;padding:6px 8px;border-radius:8px;white-space:nowrap;pointer-events:none;box-shadow:0 2px 8px #141a2a44}
@media (pointer:coarse),(max-width:860px){
  .c-chip{height:44px;padding:0 4px}
  .c-make,.c-chip .c-x{min-width:44px;min-height:44px}
  .c-rule.tp::before,.c-rule.sl::before{top:-22px;height:44px}
}
.c-float{position:absolute;left:8px;z-index:4;pointer-events:none;background:#141a2a;color:#fff;font-size:12px;font-weight:600;padding:6px 8px;border-radius:8px;font-variant-numeric:tabular-nums}
.chart-msg{position:absolute;inset:0;display:grid;place-items:center;color:var(--t-muted);font-size:14px;text-align:center;padding:24px}

/* order book */
.t-ob{font-size:12px}
.ob-tabs{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--t-line);flex:none}
.ob-tabs button{height:36px;border:0;background:none;color:var(--t-muted);font:inherit;font-size:13px;font-weight:600;border-bottom:2px solid transparent;margin-bottom:-1px;cursor:pointer}
.ob-tabs button[aria-selected="true"]{color:var(--t-text);border-bottom-color:#284cf9}
.ob-tabs button:focus-visible,.ob-sel:focus-visible{outline:2px solid #284cf9;outline-offset:-2px}
.ob-tools{display:flex;align-items:center;justify-content:space-between;gap:6px;height:30px;padding:0 6px 0 4px;flex:none}
.ob-sel{appearance:none;-webkit-appearance:none;background:transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3acc6' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 4px center/14px;border:0;color:var(--t-text);font:inherit;font-size:12px;height:26px;padding:0 22px 0 6px;border-radius:6px;cursor:pointer;font-variant-numeric:tabular-nums}
.ob-sel:hover{background-color:var(--t-hover)}
.ob-sel option{background:var(--t-panel);color:var(--t-text)}
.ob-sel:disabled{opacity:.6;cursor:default}
.ob-state{font-size:11px;font-weight:600;color:var(--warn-t);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ob-cols,.ob-row,.ob-trow{display:grid;grid-template-columns:28% 36% 36%;align-items:center}
.ob-cols{color:var(--t-faint);height:22px;flex:none}
.ob-cols span:first-child,.ob-row span:first-of-type,.ob-trow span:first-child{padding-left:10px}
.ob-cols span:not(:first-child),.ob-row span:not(:first-of-type),.ob-trow span:not(:first-child){text-align:right}
.ob-cols span:nth-child(2),.ob-row span:nth-of-type(2),.ob-trow span:nth-child(2){padding-right:3px}
.ob-cols span:last-child,.ob-row span:last-of-type,.ob-trow span:last-child{padding-right:10px}
.ob-grid{flex:1;min-height:0;display:grid;grid-auto-rows:23px;row-gap:2px;align-content:center;overflow:hidden}
.ob-row{position:relative;height:23px;line-height:23px;cursor:pointer;color:var(--t-muted)}
.ob-row.is-blank{cursor:default}
.ob-row:not(.is-blank):hover{background:var(--t-hover)}
.ob-row .bar{position:absolute;left:0;top:0;bottom:0;opacity:.15;pointer-events:none}
.ob-row.ask .bar{background:var(--down)}.ob-row.bid .bar{background:var(--up)}
.ob-row span{position:relative;white-space:nowrap;overflow:hidden}
.ob-row.ask .p{color:var(--down)}.ob-row.bid .p{color:var(--up)}
.ob-spread{display:flex;justify-content:center;align-items:center;gap:32px;height:23px;line-height:23px;background:var(--t-raise);color:var(--t-text)}
.ob-empty{display:grid;place-items:center;height:100%;min-height:120px;color:var(--t-faint);grid-row:1/-1}
.ob-tlist{display:none;flex:1;min-height:0;overflow-y:auto;scrollbar-width:thin}
.ob-trow{height:23px;line-height:23px;color:var(--t-muted)}
.ob-trow span:first-child.up{color:var(--up)}.ob-trow span:first-child.down{color:var(--down)}
.t-ob[data-tab="trades"] .ob-grid{display:none}
.t-ob[data-tab="trades"] #obGroup{visibility:hidden}
.t-ob[data-tab="trades"] .ob-tlist{display:block}
.t-ob.is-stale .ob-grid,.t-ob.is-stale .ob-tlist{opacity:.55}

/* order ticket, top to bottom: account + leverage, type tabs, side, current position, size, TP/SL, submit, estimate */
.t-ticket form{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;padding:10px 12px 12px}

.t-acct{display:block;min-width:0}
.t-acct select{appearance:none;-webkit-appearance:none;width:100%;background:var(--t-raise) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8aa8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center/14px;border:0;color:var(--t-text);height:34px;padding:0 28px 0 10px;border-radius:8px;font:inherit;font-size:12.5px;font-weight:600;text-overflow:ellipsis;cursor:pointer}
.t-acct select:focus-visible,.tk-lev:focus-visible{outline:2px solid #284cf9;outline-offset:1px}
.tk-lev{height:34px;border:0;border-radius:8px;background:var(--t-raise);color:var(--t-text);font:inherit;font-size:12.5px;font-weight:700;cursor:pointer}
.tk-lev output{pointer-events:none}
.tk-lev[aria-expanded="true"]{box-shadow:inset 0 0 0 1px #284cf9}
@media(hover:hover) and (pointer:fine){.tk-lev:hover,.t-acct select:hover{filter:brightness(1.08)}}
.lev-pop{display:grid;gap:8px;padding:10px;border:1px solid var(--t-line-2);border-radius:8px}
.lev-pop[hidden]{display:none}
.lev-pop .t-fine{margin:0}
.type-switch{display:grid;grid-template-columns:repeat(3,1fr);border-bottom:1px solid var(--t-line)}
.type-switch button{border:0;background:none;color:var(--t-muted);font:inherit;font-weight:600;font-size:12.5px;padding:6px 0 9px;border-bottom:2px solid transparent;margin-bottom:-1px;cursor:pointer}
.type-switch button.is-on{color:var(--t-text);border-bottom-color:#284cf9}
@media(hover:hover) and (pointer:fine){.type-switch button:not(.is-on):hover{color:var(--t-text)}}

.tk-info,.t-sum,.acct-sum{display:grid;gap:7px;margin:0}
.tk-info div,.t-sum div,.acct-sum div{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-size:12px;line-height:16px}
.tk-info dt,.t-sum dt,.acct-sum dt{color:var(--t-faint);white-space:nowrap}
.tk-info dd,.t-sum dd,.acct-sum dd{margin:0;font-weight:600;text-align:right;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.f{display:grid;gap:8px;min-width:0}
.lev-row{display:flex;justify-content:space-between;align-items:center;gap:8px}
.lev-row label{font-size:12px;color:var(--t-muted);font-weight:600}
.in{display:flex;align-items:center;height:40px;border:1px solid var(--t-line-2);background:transparent;border-radius:8px;padding:0 4px 0 10px;transition:border-color .15s ease}
.in:focus-within{border-color:#284cf9}
.in-l{flex:none;font-size:12px;color:var(--t-faint);font-weight:500;margin-right:8px;cursor:text}
.in input{flex:1;min-width:0;border:0;background:transparent;color:var(--t-text);font:inherit;font-size:13px;font-weight:600;font-variant-numeric:tabular-nums;outline:none;height:100%;text-align:right;padding:0 6px 0 0}
.in input::placeholder{color:var(--t-faint)}
.in .unit{flex:none;display:inline-flex;align-items:center;gap:3px;height:28px;padding:0 6px 0 8px;border:0;border-left:1px solid var(--t-line);background:transparent;color:var(--t-text);font:inherit;font-size:12px;font-weight:700;cursor:pointer}
.in .unit::after{content:"";width:12px;height:12px;background:currentColor;opacity:.6;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M7 10l5-5 5 5M7 14l5 5 5-5'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M7 10l5-5 5 5M7 14l5 5 5-5'/%3E%3C/svg%3E") center/contain no-repeat}
.in .unit:focus-visible{outline:2px solid #284cf9;outline-offset:-2px;border-radius:6px}
.in-btn{flex:none;border:0;background:var(--t-raise);color:var(--t-muted);font:inherit;font-size:11.5px;font-weight:700;height:28px;padding:0 9px;border-radius:6px;cursor:pointer}
@media(hover:hover) and (pointer:fine){.in-btn:hover,.in .unit:hover{color:var(--t-text)}}
.pct-row{display:grid;grid-template-columns:minmax(0,1fr) 60px;gap:12px;align-items:center}
.pct-box{display:flex;align-items:center;height:32px;border:1px solid var(--t-line-2);border-radius:8px;padding:0 8px;font-size:12px;color:var(--t-faint)}
.pct-box:focus-within{border-color:#284cf9}
.pct-box input{width:100%;min-width:0;border:0;background:transparent;color:var(--t-text);font:inherit;font-size:12.5px;font-weight:600;text-align:right;outline:0;padding-right:4px}
input[type="range"]{width:100%;accent-color:#284cf9;height:20px;margin:0}
#sizePct,#lev{-webkit-appearance:none;appearance:none;height:20px;background:transparent;cursor:pointer}
#sizePct::-webkit-slider-runnable-track,#lev::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:linear-gradient(90deg,#284cf9 0 var(--p,0%),var(--t-line-2) var(--p,0%) 100%)}
#sizePct::-moz-range-track,#lev::-moz-range-track{height:4px;border-radius:2px;background:var(--t-line-2)}
#sizePct::-moz-range-progress,#lev::-moz-range-progress{height:4px;border-radius:2px;background:#284cf9}
#sizePct::-webkit-slider-thumb,#lev::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;margin-top:-5px;border-radius:50%;background:var(--t-panel);border:2px solid #284cf9}
#sizePct::-moz-range-thumb,#lev::-moz-range-thumb{width:10px;height:10px;border-radius:50%;background:var(--t-panel);border:2px solid #284cf9}
#sizePct:focus-visible,#lev:focus-visible{outline:2px solid #284cf9;outline-offset:2px;border-radius:4px}
#lev:disabled{opacity:.5;cursor:not-allowed}
.hint{font-size:11.5px;color:var(--t-faint);margin:-2px 0 0}
.chk{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--t-text);cursor:pointer;width:max-content}
.chk input{width:14px;height:14px;margin:0;accent-color:#284cf9}
.tpsl{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px}
.tpsl[hidden]{display:none}
.t-submit{height:38px;border:0;border-radius:8px;font:inherit;font-weight:700;font-size:13px;cursor:pointer;transition:filter .15s ease,transform .16s var(--ease)}
.t-submit.long{background:var(--up);color:var(--t-on-up)}
.t-submit.short{background:var(--down);color:var(--t-on-down)}
.t-submit:active{transform:scale(.98)}
.t-submit[disabled]{opacity:.45;cursor:not-allowed;transform:none}
@media(hover:hover) and (pointer:fine){.t-submit:not([disabled]):hover{filter:brightness(1.08)}}
.form-msg{font-size:12px;line-height:1.5;min-height:0;color:var(--t-muted);margin:-2px 0 0}
.form-msg:empty{display:none}
.form-msg.err{color:var(--down)}
.t-sum{padding-top:10px;border-top:1px solid var(--t-line)}
.tk-more summary{font-size:12px;color:var(--t-faint);cursor:pointer;width:max-content;list-style-position:inside}
.tk-more summary:focus-visible{outline:2px solid #284cf9;outline-offset:2px;border-radius:4px}
.tk-more[open] summary{margin-bottom:6px}
.t-fine{font-size:11.5px;line-height:1.55;color:var(--t-faint)}
.t-fine a{color:var(--t-link)}

/* account panel: label/value pairs followed by slim progress bars for each rule */
.t-rules{display:flex;flex-direction:column;gap:10px;padding:10px 12px 12px;overflow:auto;min-height:0;scrollbar-width:thin}
.rules-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.rules-head h2{font-size:13px;font-weight:700;letter-spacing:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.state{flex:none;font-size:11.5px;font-weight:700;padding:2px 7px;border-radius:5px;background:var(--up-soft);color:var(--up)}
.state[data-s="breached"]{background:var(--down-soft);color:var(--down)}
.state[data-s="passed"]{background:var(--t-tag-bg);color:var(--t-tag-text)}
.state[data-s="closed"],.state[data-s="expired"]{background:var(--t-raise);color:var(--t-muted)}
.acct-sum{padding-bottom:10px;border-bottom:1px solid var(--t-line)}
.hms{display:grid;gap:10px}
.hm{display:grid;gap:5px}
.hm-top{display:flex;justify-content:space-between;gap:8px;font-size:12px}
.hm-top span{color:var(--t-faint)}
.hm-top b{font-weight:600;font-variant-numeric:tabular-nums;text-align:right}
.hm-track{height:4px;border-radius:2px;background:var(--t-raise);overflow:hidden}
.hm-fill{height:100%;border-radius:2px;background:#284cf9;transition:width .4s var(--ease)}
.hm.is-risk .hm-fill{background:var(--down)}
.hm.is-warn .hm-fill{background:var(--warn-t)}
.hm.is-good .hm-fill{background:var(--up)}
.hm-sub{font-size:11.5px;line-height:1.45;color:var(--t-faint)}
.t-rules .t-fine{margin:0}
.t-ghost{align-self:flex-start;border:1px solid var(--t-line-2);background:transparent;color:var(--t-muted);height:30px;padding:0 10px;border-radius:8px;font:inherit;font-size:12px;font-weight:600;cursor:pointer}
.t-ghost[hidden]{display:none}
@media(hover:hover) and (pointer:fine){.t-ghost:hover{color:var(--t-text)}}

/* bottom tables (positions, open orders, fills) at 12 px */
.book-tabs{display:flex;gap:0;padding:0 4px;border-bottom:1px solid var(--t-line);overflow-x:auto;scrollbar-width:none;flex:none}
.book-tabs::-webkit-scrollbar{display:none}
.book-tabs button{border:0;background:none;color:var(--t-muted);font:inherit;font-weight:500;font-size:12.5px;padding:10px 12px 9px;border-bottom:2px solid transparent;margin-bottom:-1px;white-space:nowrap;display:flex;align-items:center;gap:3px;cursor:pointer}
.book-tabs button[aria-selected="true"]{color:var(--t-text);font-weight:600;border-bottom-color:#284cf9}
@media(hover:hover) and (pointer:fine){.book-tabs button:hover{color:var(--t-text)}}
.count{font-size:inherit;font-weight:inherit;color:inherit;background:none;padding:0;border-radius:0}
.count:empty{display:none}
.count::before{content:"("}.count::after{content:")"}
.book-body{flex:1;min-height:0;overflow:auto;scrollbar-width:thin}
.ptbl{width:100%;border-collapse:collapse;font-size:12px}
.ptbl th{position:sticky;top:0;z-index:1;background:var(--t-panel);font-weight:500;color:var(--t-faint);text-align:left;padding:7px 12px;white-space:nowrap;font-size:12px}
.ptbl td{padding:5px 12px;height:30px;white-space:nowrap}
.ptbl td.r,.ptbl th.r{text-align:right}
.ptbl tr:hover td{background:var(--t-hover)}
.ptbl tr.is-long .coin-cell{background:linear-gradient(90deg,var(--up-soft),transparent 80%);box-shadow:inset 2px 0 var(--up)}
.ptbl tr.is-short .coin-cell{background:linear-gradient(90deg,var(--down-soft),transparent 80%);box-shadow:inset 2px 0 var(--down)}
.coin-cell .mkt-cell{vertical-align:middle}

.jump{cursor:pointer}
.side-tag{font-weight:600}
.row-btn{border:1px solid var(--t-line-2);background:transparent;color:var(--t-text);height:24px;padding:0 9px;border-radius:6px;font:inherit;font-size:12px;font-weight:600;cursor:pointer}
@media(hover:hover) and (pointer:fine){.row-btn:hover{border-color:#284cf9;color:var(--t-link)}}
.row-btn:disabled{opacity:.5;cursor:default}
.empty-t{padding:10px 12px;text-align:left;color:var(--t-faint);font-size:12px;line-height:1.5}
.empty-t b{display:inline;color:var(--t-text);font-weight:600;margin:0}
.empty-t a{color:var(--t-link)}
.more-row{margin:8px 12px}
.tpsl-cell{color:var(--t-muted)}

html:not([data-theme="dark"]) body.trade{--t-gut:#e6eaf3}

/* toast: compact card pinned to the lower right */
body.trade .toast{left:auto;right:16px;bottom:16px;max-width:min(380px,calc(100% - 32px));padding:11px 14px;border-radius:8px;background:var(--t-raise);color:var(--t-text);border:1px solid var(--t-line-2);font-size:12.5px;line-height:1.45;box-shadow:0 12px 32px -10px #0c112173;transform:translateY(12px);width:auto}
body.trade .toast.is-on{transform:none}
body.trade .toast svg{stroke:var(--up)}

/* footer */
.t-foot{padding:20px 16px 28px;display:grid;gap:10px;max-width:1100px}
.t-foot p{font-size:12.5px;line-height:1.65;color:var(--t-faint)}
.t-foot strong{color:var(--t-text);font-weight:600}
.t-foot a{color:var(--t-link)}

.mob-act{display:none}

/* ---- responsive ---- */
@media (max-height:820px) and (min-width:861px){
  .t-ticket form{gap:8px;padding:8px 12px 10px}
  .in{height:36px}
  .t-submit{height:36px}
  .t-sum{padding-top:8px;gap:5px}
}
@media(min-width:861px){
  body.trade{height:100dvh;overflow:hidden;display:flex;flex-direction:column}
  body.trade .sim-bar,body.trade .app-head{flex:none}
  body.trade .term{flex:1}
  body.trade .t-foot{display:none}
  body.trade .app-head{position:relative}
}
@media(max-width:1280px) and (min-width:1024px){.term{grid-template-columns:minmax(0,1fr) 248px 280px}}
@media(max-width:1023px){
  .term{grid-template-columns:minmax(0,1fr) 296px;grid-template-rows:auto minmax(160px,1fr) minmax(160px,240px) var(--book-h,220px);grid-template-areas:"head side" "chart side" "ob side" "book acct"}
  .t-ob{max-height:360px}
}
@media(max-width:860px){
  .mkt-stats .hide-xs{display:none}
  .t-head{flex-wrap:wrap;overflow:visible}
  .mkt-pick{flex:1;min-width:0}
  .sym-btn{height:44px;justify-content:flex-start;font-size:20px}
  .mkt-stats{order:2}
  .mkt-stats{width:100%;justify-content:space-between;gap:12px}
  .chart-bar{flex-wrap:wrap;gap:8px}
  .view-switch{order:-1;width:100%;background:var(--t-bg);padding:3px;border-radius:10px}
  .view-switch button{flex:1;height:34px}
  .intervals{width:100%;justify-content:space-between}
  body.trade{height:auto;overflow:visible;display:block}
  body.trade .t-foot{display:grid}
  .term{grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-template-areas:"head" "chart" "ob" "side" "book" "acct";padding:0;gap:4px}
  .term>*{border-radius:0}
  .t-side,.t-rules{overflow:visible}
  .t-book{display:block;overflow:visible;min-height:0}
  .book-resize{display:none}
  .book-body{overflow:visible}
  .t-head{gap:16px;padding:10px 12px}
  .feed span{display:none}
  .t-chart{height:min(520px,64vh)}
  .view-switch{display:flex}
  .chart-name{display:none}
  .intervals{overflow-x:auto;scrollbar-width:none}
  .t-ob{display:none;max-height:none;height:420px}
  .term.show-ob .t-chart .chart-wrap{display:none}
  .term.show-ob .t-chart{height:auto}
  .term.show-ob .t-ob{display:flex}
  .t-ticket form{padding:12px 16px 16px;gap:12px}
  .in{height:44px}
  .t-submit{height:44px;font-size:14px}
  
  .t-acct select,.tk-lev{height:40px;font-size:13px}
  .type-switch button{font-size:13px;padding:8px 0 10px}
  .book-tabs button{font-size:13px;padding:12px 12px 11px}
  .t-rules{padding:12px 16px 16px}
  .mob-act{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:fixed;left:0;right:0;bottom:calc(64px + env(safe-area-inset-bottom));z-index:54;padding:8px 12px;background:var(--t-head);border-top:1px solid var(--t-line);transition:transform .25s var(--ease),opacity .2s ease}
  .mob-act button{height:44px;border:0;border-radius:8px;font:inherit;font-weight:700;font-size:14px}
  .mob-act .long{background:var(--up);color:var(--t-on-up)}.mob-act .short{background:var(--down);color:var(--t-on-down)}
  .mob-act.is-hidden{transform:translateY(120%);opacity:0;pointer-events:none}
  .t-foot{padding-bottom:calc(150px + env(safe-area-inset-bottom))}
  /* positions as cards */
  .ptbl thead{display:none}
  .ptbl,.ptbl tbody,.ptbl tr,.ptbl td{display:block;width:100%}
  .ptbl tr{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 12px;padding:12px 16px;border-top:1px solid var(--t-line)}
  .ptbl td{border:0;padding:0;height:auto;white-space:normal;text-align:left!important;font-size:12.5px;min-width:0;overflow-wrap:anywhere}
  .ptbl td[data-l]::before{content:attr(data-l);display:block;font-size:11.5px;color:var(--t-faint);margin-bottom:1px}
  .ptbl td.coin-cell{grid-column:1/3;background:none!important;box-shadow:none!important;font-size:13.5px;font-weight:700}
  .ptbl td.coin-cell::before{display:none!important}
  .ptbl td.act{grid-column:3;grid-row:1;text-align:right!important}
  .ptbl td.act .row-btn{height:32px;padding:0 12px}
  .ptbl tr.is-long{box-shadow:inset 3px 0 var(--up)}
  .ptbl tr.is-short{box-shadow:inset 3px 0 var(--down)}
  .empty-t{padding:14px 16px}
  body.trade .toast{left:12px;right:12px;max-width:none;bottom:calc(130px + env(safe-area-inset-bottom))}
  .ptbl tr:hover td{background:none}
}
@media(prefers-reduced-motion:reduce){.hm-fill,.mob-act{transition:none}}
.t-side,.t-ticket,.t-rules{scroll-margin-top:76px}

body.trade .app-tools .icon-btn{color:var(--t-text)}

/* "Max Nx" hint beside the leverage label */
.lev-cap{font-size:11.5px;font-weight:600;color:var(--t-muted);background:var(--t-raise);padding:2px 8px;border-radius:5px}

/* market picker: drops down from the symbol button on wide screens, slides up as a sheet on phones */
body.mp-open{overflow:hidden}
.mp{position:fixed;inset:0;z-index:90;display:flex;align-items:flex-start;justify-content:flex-start}
.mp[hidden]{display:none}
.mp-back{position:absolute;inset:0;background:transparent}
.mp-card{position:absolute;left:var(--mp-x,16px);top:var(--mp-y,120px);width:min(780px,calc(100vw - 16px));max-height:min(560px,calc(100vh - var(--mp-y,120px) - 12px));display:flex;flex-direction:column;background:var(--t-panel);border:1px solid var(--t-line-2);border-radius:8px;box-shadow:0 18px 50px #0c112159;overflow:hidden}
.mp-search{display:flex;align-items:center;gap:10px;margin:10px 10px 0;padding:0 6px 0 12px;border:1px solid var(--t-line-2);border-radius:8px}
.mp-search:focus-within{border-color:#284cf9}
.mp-search svg{width:18px;height:18px;flex:none;fill:none;stroke:var(--t-muted);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.mp-search input{flex:1;min-width:0;height:36px;border:0;background:transparent;color:var(--t-text);font:inherit;font-size:13px;font-weight:600;outline:0}
.mp-search input::placeholder{color:var(--t-faint);font-weight:500}
.mp-x{flex:none;height:28px;min-width:40px;padding:0 8px;border-radius:7px;border:1px solid var(--t-line-2);background:var(--t-raise);color:var(--t-muted);font:inherit;font-size:11.5px;font-weight:700;cursor:pointer}
.mp-cols,.mp-row{display:grid;grid-template-columns:40px minmax(0,1fr) 92px 64px 56px;align-items:center;column-gap:6px;padding:0 12px 0 4px}
.mp-cols{height:30px;font-size:12px;font-weight:500;color:var(--t-faint)}
.mp-cols .r,.mp-row .r{text-align:right}
.mp-list{flex:1;min-height:120px;overflow-y:auto;overscroll-behavior:contain}
.mp-row{height:32px;font-size:12.5px;font-weight:600;cursor:pointer;border:0;background:transparent;width:100%;color:var(--t-text);text-align:left;font-family:inherit}
.mp-row .sym{display:flex;align-items:center;gap:8px;min-width:0;font-weight:700}
.mp-row .sym small{font-size:11.5px;font-weight:600;color:var(--t-faint)}
.mp-row.is-active,.mp-row[aria-selected="true"]{background:var(--t-raise)}
.mp-row[data-current="true"] .sym::after{content:"";width:6px;height:6px;border-radius:50%;background:#284cf9;flex:none}
.mp-star{width:36px;height:36px;display:grid;place-items:center;border:0;background:transparent;color:var(--t-faint);cursor:pointer;border-radius:8px;padding:0}
.mp-star svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linejoin:round}
.mp-star[aria-pressed="true"]{color:#f5a623}
.mp-star[aria-pressed="true"] svg{fill:currentColor}
.mp-star:focus-visible{outline:2px solid #284cf9;outline-offset:-2px}
.mp-head{padding:8px 12px 4px;font-size:11.5px;font-weight:700;color:var(--t-faint);text-transform:none}
.mp-empty{padding:28px 16px;text-align:center;color:var(--t-muted);font-size:14px}
.mp-foot{display:flex;justify-content:space-between;gap:12px;padding:8px 12px;border-top:1px solid var(--t-line);font-size:12px;color:var(--t-faint)}
.mp-keys kbd{font:inherit;font-size:11px;font-weight:700;color:var(--t-text);background:var(--t-raise);border-radius:4px;padding:1px 5px;margin:0 3px 0 8px}
.mp-keys kbd:first-child{margin-left:0}
@media(hover:hover) and (pointer:fine){.mp-row:hover{background:var(--t-raise)}}
@media(max-width:860px){
  .mp-back{background:#0c1121a6}
  .mp-card{left:8px;right:8px;top:8px;bottom:8px;width:auto;max-height:none;border-radius:16px}
  .mp-cols,.mp-row{grid-template-columns:44px minmax(0,1fr) 84px 58px 46px;padding-right:10px}
  .mp-row{height:48px;font-size:14px}
  .mp-star{width:44px;height:44px}
  .mp-keys{display:none}
  .mp-x{height:36px;min-width:52px}
}
@media(prefers-reduced-motion:no-preference){.mp-card{animation:mpIn .14s ease-out}@keyframes mpIn{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}}

/* HIP-3 builder markets: operator badge, closed badge, asset-class tabs */
.sym-op,.op-tag{font-size:10.5px;font-weight:700;letter-spacing:.02em;color:var(--t-muted);border:1px solid var(--t-line-2);border-radius:5px;padding:1px 5px;line-height:15px;background:var(--t-panel);text-transform:uppercase}
.op-tag{margin-left:4px;vertical-align:1px}
.mkt-pick{align-items:center;gap:10px}
.mkt-state,.closed-tag,.mp-closed{font-style:normal;font-size:11.5px;font-weight:700;color:#f5a623;background:#f5a62324;border:1px solid #f5a62355;border-radius:6px;padding:2px 8px;white-space:nowrap}
.closed-tag{font-size:10.5px;padding:0 5px;margin-left:4px}
.mp-closed{font-size:10.5px;padding:0 6px;line-height:16px}
html:not([data-theme="dark"]) .mkt-state,html:not([data-theme="dark"]) .closed-tag,html:not([data-theme="dark"]) .mp-closed{color:#8a5200;background:#fff1d6;border-color:#f0c577}
.mkt-note{margin:0 0 10px;padding:9px 11px;border-radius:9px;background:var(--t-raise);border:1px solid var(--t-line);color:var(--t-muted);font-size:12px;line-height:1.45}
.mkt-note b{color:var(--t-text);font-weight:700}
.mkt-note.is-closed{background:#f5a6231a;border-color:#f5a62355}
html:not([data-theme="dark"]) .mkt-note.is-closed{background:#fff6e3;border-color:#f0c577}
.mkt-note[hidden]{display:none}
.mp-tabs{display:flex;gap:2px;padding:6px 6px 0;border-bottom:1px solid var(--t-line);overflow-x:auto;scrollbar-width:none}
.mp-tabs::-webkit-scrollbar{display:none}
.mp-tabs[hidden]{display:none}
/* The picker is a height-capped flex column where only the list flexes. The tabs row scrolls horizontally, which gives
   it a zero min-height, so without flex:none a long list would crush it to a blank strip below the search field. */
.mp-search,.mp-tabs,.mp-cols,.mp-foot{flex:none}
.mp-tab{flex:none;display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border:0;border-bottom:2px solid transparent;border-radius:0;margin-bottom:-1px;background:transparent;color:var(--t-muted);font:inherit;font-size:12.5px;font-weight:600;cursor:pointer;white-space:nowrap}
.mp-tab i{font-style:normal;font-size:11px;font-weight:700;color:var(--t-faint)}
.mp-tab.is-on{color:var(--t-text);border-bottom-color:#284cf9}
.mp-tab:focus-visible{outline:2px solid #284cf9;outline-offset:-2px}
@media(hover:hover) and (pointer:fine){.mp-tab:not(.is-on):hover{color:var(--t-text)}}
.mp-row .sym{flex-direction:column;align-items:flex-start;justify-content:center;gap:1px}
.mp-row .sym-line{display:flex;align-items:center;gap:7px;min-width:0}
.mp-row .sym-base{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mp-row .sym-sub{font-size:11px;font-weight:600;color:var(--t-faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.mp-row.has-sub{height:42px}
.mp-row[data-current="true"] .sym-line::after{content:"";width:6px;height:6px;border-radius:50%;background:#284cf9;flex:none}
.mp-row[data-current="true"] .sym::after{content:none}
@media(max-width:860px){
  .mkt-pick{flex-wrap:wrap}
  .mkt-state{flex:1 0 100%;text-align:center;white-space:normal}
  .mp-row.has-sub{height:56px}
  .mp-tab{height:38px}
}

.deg-tag{display:inline-block;margin-left:4px;padding:0 5px;border-radius:4px;background:rgba(240,170,60,.16);color:#e0a23c;font-size:10px;font-weight:700;letter-spacing:.02em;white-space:nowrap}
#sumSlip.down{color:var(--down)}
.mp-wait{color:var(--t-faint);letter-spacing:.1em}

.sym-icon{display:inline-flex;margin-right:2px}
.mkt-cell{display:inline-flex;align-items:center;gap:8px;min-width:0}
.mkt-cell .mkt-txt{min-width:0}
.mp-cols,.mp-row{grid-template-columns:36px 22px minmax(0,1fr) 92px 78px 78px 86px 92px 56px}
@media(max-width:860px){.mp-cols,.mp-row{grid-template-columns:40px 22px minmax(0,1fr) 84px 76px 46px}.mp-cols{white-space:nowrap}.mp-wide{display:none}.mp-search{margin:8px}.mp-search input{font-size:16px;height:40px}.mp-row{height:48px;font-size:14px}.mp-row.has-sub{height:56px}}

/* In-flight states awaiting the engine: TP/SL "Updating", orders "Cancelling", queued chart lines */
.pend-tag{display:inline-block;font-size:11px;font-weight:700;line-height:16px;padding:0 6px;border-radius:4px;background:var(--t-tag-bg);color:var(--t-tag-text);white-space:nowrap;vertical-align:1px}
.tpsl-cell.is-pending{color:var(--t-text);white-space:normal!important;min-width:150px;max-width:200px;line-height:1.35}
.tpsl-cell .tpsl-old{color:var(--t-faint);text-decoration:line-through}
.tpsl-cell .tpsl-new{font-weight:600}
.ptbl tr.is-cancelling td:not(.act){opacity:.55}
@media(prefers-reduced-motion:no-preference){.pend-tag{animation:pendPulse 1.2s ease-in-out infinite}@keyframes pendPulse{50%{opacity:.55}}}
.c-rule.is-next{border-top-style:dashed;border-top-width:1px;opacity:.75;pointer-events:none}
.c-chip.is-next{left:min(210px,42%);opacity:.9;cursor:default;background:var(--t-panel)!important;border:1px dashed currentColor;box-shadow:none}
.c-chip.tp.is-next{color:var(--up)}.c-chip.sl.is-next{color:var(--down)}
.c-rule.is-removing{opacity:.6}
.c-chip.is-removing{opacity:.75}

/* =====================================================================================================================
   Terminal theme layer. Almost-black background with slightly lighter panels (8 px radius, 1 px borders), tight
   gutters and 12–13 px text; grey labels get a dotted underline when they carry a hover tooltip.
   Regions: summary bar across the top, icon rail at left, market header above chart + book, ticket and account
   health at right, tables beneath chart + book, and a status bar with scrolling ticker at the foot. Accent #284cf9.
   ===================================================================================================================== */
body.trade{--t-bg:#0b0c0e;--t-gut:#0b0c0e;--t-panel:#121317;--t-raise:#1b1d22;--t-line:#21242b;--t-line-2:#2c2f37;--t-text:#e8e9ec;--t-muted:#a1a4ac;--t-faint:#6f737c;--t-hover:#181a1f;--t-head:#0b0c0ef2;
  --up:#22c280;--down:#f0475b;--up-soft:#22c2801f;--down-soft:#f0475b1f}
html:not([data-theme="dark"]) body.trade{--t-gut:#eceef3;--t-bg:#eceef3}
.lbl-tip{text-decoration:underline dotted;text-decoration-color:var(--t-faint);text-underline-offset:3px;cursor:help}

/* account strip */
.t-strip{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:28px;padding:0 12px;background:var(--t-bg);border-bottom:1px solid var(--t-line);font-size:12px;color:var(--t-faint);white-space:nowrap}
.t-strip b{color:var(--t-text);font-weight:600}
.t-strip b.up{color:var(--up)}.t-strip b.down{color:var(--down)}
.ts-l,.ts-r{display:flex;align-items:center;gap:8px;min-width:0}
.ts-r{gap:18px;overflow-x:auto;scrollbar-width:none}
.ts-r::-webkit-scrollbar{display:none}
.seg{display:inline-flex;gap:2px;align-items:center}
.seg i{display:block;width:6px;height:10px;border-radius:2px;background:var(--t-raise)}
.seg i.on{background:var(--up)}
.seg[data-tone="warn"] i.on{background:var(--warn-t)}
.seg[data-tone="risk"] i.on{background:var(--down)}
.seg-lg{display:flex;gap:3px}
.seg-lg i{flex:1;width:auto;height:8px}

/* grid */
.term{grid-template-columns:40px minmax(0,1fr) 300px 320px;grid-template-rows:auto minmax(160px,1fr) var(--book-h,250px);grid-template-areas:"rail head head side" "rail chart ob side" "rail book book acct";gap:4px;padding:4px;background:var(--t-gut)}
.term>*{border:1px solid var(--t-line);border-radius:8px}
.t-rail{grid-area:rail;display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 0;min-height:0}
.rail-btn{display:grid;place-items:center;width:30px;height:30px;border:0;border-radius:7px;background:transparent;color:var(--t-faint);cursor:pointer}
.rail-btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.rail-btn:focus-visible{outline:2px solid #284cf9;outline-offset:1px}
@media(hover:hover) and (pointer:fine){.rail-btn:hover{background:var(--t-raise);color:var(--t-text)}}
.rail-btn[aria-checked="true"]{color:var(--t-text)}
.rail-end{margin-top:auto}

/* market header */
.mkt-pick{flex:none}
.sym-pill{display:flex;align-items:center;gap:2px;height:44px;padding:0 6px 0 4px;border:1px solid var(--t-line-2);border-radius:10px;background:var(--t-raise)}
.fav-btn{display:grid;place-items:center;width:28px;height:28px;border:0;border-radius:6px;background:transparent;color:var(--t-faint);cursor:pointer}
.fav-btn svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}
.fav-btn[aria-pressed="true"]{color:#f5a623}.fav-btn[aria-pressed="true"] svg{fill:currentColor}
.fav-btn:focus-visible{outline:2px solid #284cf9;outline-offset:-2px}
.t-head .sym-btn{height:40px;margin:0;padding:0 4px;gap:8px;font-size:14px;background:transparent}
@media(hover:hover) and (pointer:fine){.t-head .sym-btn:hover{background:transparent}.sym-pill:hover{border-color:var(--t-faint)}}
.sym-txt{display:flex;flex-direction:column;align-items:flex-start;line-height:1.15}
.sym-name{font-size:14px;font-weight:700;color:var(--t-text)}
.sym-sub{font-size:11px;font-weight:500;color:var(--t-faint);max-width:9.5rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.t-head .sym-btn .lev{font-size:11px;padding:1px 6px;border-radius:5px}
.mkt-stats dt{font-weight:500;color:var(--t-faint);white-space:nowrap}
.mkt-stats dd{font-weight:600;color:var(--t-text)}
.mkt-stats dd.up{color:var(--up)}.mkt-stats dd.down{color:var(--down)}
.mkt-stats .mkt-last{display:grid;gap:3px;min-width:0}
.mkt-stats .mkt-last-px{font-weight:700;letter-spacing:0;line-height:inherit;margin:0;padding:0 2px}
.mkt-last-src{font-size:10.5px;font-weight:600;color:var(--t-faint);text-transform:none;letter-spacing:0;margin-left:2px}
.mkt-last-src::before{content:"· "}
.t-head{gap:20px;padding:6px 10px}
.mkt-stats{gap:22px}
.mkt-stats dt{font-size:11.5px}
.mkt-stats dd,.mkt-stats .mkt-last-px{font-size:12.5px}

/* chart */
.chart-bar{gap:6px;padding:4px 8px;min-height:36px}
.intervals button{height:26px;min-width:30px;padding:0 7px;font-size:12px;border-radius:6px}
.chart-tools{display:flex;gap:2px;margin-left:auto}
.ct-btn{display:grid;place-items:center;width:28px;height:28px;border:0;border-radius:6px;background:transparent;color:var(--t-faint);cursor:pointer}
.ct-btn svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
@media(hover:hover) and (pointer:fine){.ct-btn:hover{background:var(--t-raise);color:var(--t-text)}}
.ct-btn:focus-visible{outline:2px solid #284cf9;outline-offset:-2px}
.chart-legend{position:absolute;left:6px;top:4px;z-index:2;padding:2px 6px;border-radius:6px;background:color-mix(in srgb,var(--t-panel) 82%,transparent);pointer-events:none;font-size:12px;color:var(--t-faint);display:grid;gap:2px;max-width:calc(100% - 90px)}
.chart-legend .lg-1{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px}
.chart-legend b{font-weight:600}
.chart-legend b.up{color:var(--up)}.chart-legend b.down{color:var(--down)}
.chart-legend .lg-2 b{color:var(--t-muted)}
.chart-legend .chart-name{display:inline;margin:0;font-size:12px;font-weight:600;color:var(--t-text)}
.t-chart:fullscreen{background:var(--t-panel)}

/* order book */
.ob-tabs{display:flex;gap:0;padding:0 6px}
.ob-tabs button{flex:none;height:34px;padding:0 10px;font-size:12.5px}
.ob-cols,.ob-row,.ob-trow{grid-template-columns:34% 33% 33%}
.ob-cols{font-size:11.5px}
.ob-row,.ob-trow{font-size:12px}
.ob-row span:not(.p){color:var(--t-muted)}
.ob-spread{justify-content:space-between;gap:8px;padding:0 10px;background:transparent;border-block:1px solid var(--t-line);color:var(--t-faint);font-size:11.5px}
.ob-mid{font-size:15px;font-weight:700;color:var(--t-text);font-variant-numeric:tabular-nums}

/* ticket */
.t-side{grid-area:side}
.t-ticket form{gap:10px;padding:8px 12px 12px}
.tk-row{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px}
.tk-lev{display:inline-flex;align-items:center;gap:4px;height:26px;padding:0;border:0;background:none;color:var(--t-faint);font:inherit;font-size:12px;cursor:pointer;box-shadow:none}
.tk-lev output{color:var(--t-text);font-weight:700}
.tk-lev svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;transition:transform .15s ease}
.tk-lev[aria-expanded="true"]{box-shadow:none}.tk-lev[aria-expanded="true"] svg{transform:rotate(90deg)}
.tk-power{color:var(--t-faint);white-space:nowrap}.tk-power b{color:var(--t-text)}
.tk-info{display:none}
.pct-quick{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.pct-quick button{height:26px;border:1px solid var(--t-line-2);border-radius:6px;background:transparent;color:var(--t-muted);font:inherit;font-size:12px;font-weight:600;cursor:pointer}
@media(hover:hover) and (pointer:fine){.pct-quick button:hover{color:var(--t-text);border-color:var(--t-faint)}}
.pct-quick button:focus-visible{outline:2px solid #284cf9;outline-offset:1px}
.tk-checks{display:flex;gap:18px;flex-wrap:wrap}
.t-sum{gap:6px}
.t-sum dd span.up{color:var(--up)}.t-sum dd span.down{color:var(--down)}
.tk-btns{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.tk-btns .t-submit{height:40px;font-size:13px}
.tk-btns .t-submit.is-why{grid-column:1/-1;background:var(--t-raise);color:var(--t-muted);opacity:1}
.tk-btns .t-submit[hidden]{display:none}

/* account health */
.t-rules{gap:10px}
.rules-head .t-acct{flex:1;min-width:0}
.rules-head .t-acct select{height:30px;background-color:transparent;padding-left:0;font-size:13px;font-weight:700}
.health{display:grid;gap:6px}
.health-top{display:flex;justify-content:space-between;align-items:baseline;font-size:12px;color:var(--t-faint)}
.health-top b{font-size:13px;color:var(--t-text)}
.hms{padding-top:10px;border-top:1px solid var(--t-line)}

/* tables */
.book-tabs{padding:0 6px}
.book-tabs button{font-size:12.5px;padding:10px 10px 9px}
.book-filters{display:flex;align-items:center;gap:6px;padding:6px 10px;border-bottom:1px solid var(--t-line);flex:none;overflow-x:auto;scrollbar-width:none}
.book-filters[hidden]{display:none}
.chip-sel select{appearance:none;-webkit-appearance:none;height:26px;padding:0 24px 0 10px;border:1px solid var(--t-line-2);border-radius:13px;background:transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8aa8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 7px center/12px;color:var(--t-text);font:inherit;font-size:12px;cursor:pointer}
.chip-sel select option{background:var(--t-panel);color:var(--t-text)}
.chip-btn{margin-left:auto;display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border:1px solid var(--t-line-2);border-radius:13px;background:transparent;color:var(--t-muted);font:inherit;font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap}
.chip-btn svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.chip-sel select:focus-visible,.chip-btn:focus-visible,.sort-btn:focus-visible,.copy-btn:focus-visible{outline:2px solid #284cf9;outline-offset:1px}
.sort-btn{display:inline-flex;align-items:center;gap:3px;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}
.sort-btn i{font-style:normal;font-size:9px;opacity:.6}
.sort-btn.is-on{color:var(--t-text)}.sort-btn.is-on i{opacity:1}
.ptbl td{height:34px}
.mkt-txt{line-height:1.25}
.mk-sub{font-size:11px;font-weight:600}
.ptbl tr.is-long .coin-cell,.ptbl tr.is-short .coin-cell{background:none;box-shadow:none}
.tid{white-space:nowrap;color:var(--t-muted)}
.copy-btn{display:inline-grid;place-items:center;width:22px;height:22px;margin-left:4px;border:0;border-radius:5px;background:transparent;color:var(--t-faint);cursor:pointer;vertical-align:middle}
.copy-btn svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
@media(hover:hover) and (pointer:fine){.copy-btn:hover{color:var(--t-text);background:var(--t-raise)}}
.empty-t.is-big{display:grid;justify-items:center;align-content:center;gap:4px;min-height:120px;padding:24px 12px;text-align:center}
.empty-t.is-big svg{width:30px;height:30px;fill:none;stroke:var(--t-faint);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;margin-bottom:4px}
.empty-t.is-big b{display:block}

/* status bar */
.t-status{display:flex;align-items:center;gap:14px;height:28px;padding:0 12px;background:var(--t-bg);border-top:1px solid var(--t-line);font-size:12px;color:var(--t-faint);flex:none;min-width:0}
.t-status .feed{flex:none;margin:0;padding:0 8px;height:20px;border:1px solid var(--t-line-2);border-radius:10px;font-size:11.5px}
.t-status .feed span{position:static!important;width:auto!important;height:auto!important;overflow:visible!important;clip:auto!important}
.ticker{flex:1;min-width:0;overflow:hidden;-webkit-mask-image:linear-gradient(90deg,transparent,#000 24px,#000 calc(100% - 24px),transparent);mask-image:linear-gradient(90deg,transparent,#000 24px,#000 calc(100% - 24px),transparent)}
.ticker-in{display:inline-flex;align-items:center;white-space:nowrap}
.tick-item{display:inline-flex;align-items:center;gap:6px;padding:0 12px;border:0;background:none;color:var(--t-muted);font:inherit;font-size:12px;cursor:pointer}
.tick-item b{font-weight:600}.tick-item b.up{color:var(--up)}.tick-item b.down{color:var(--down)}
.tick-item:focus-visible{outline:2px solid #284cf9;outline-offset:-2px;border-radius:4px}
.tick-gap{display:inline-block;width:24px}
@media(prefers-reduced-motion:no-preference){.ticker-in{animation:tickFlash 80s linear infinite}.ticker:hover .ticker-in,.ticker:focus-within .ticker-in{animation-play-state:paused}@keyframes tickFlash{to{transform:translateX(-50%)}}}
@media(prefers-reduced-motion:reduce){.ticker{overflow-x:auto;scrollbar-width:none}}

@media(min-width:861px){body.trade .t-strip,body.trade .t-status{flex:none}}

/* widths */
@media(max-width:1280px) and (min-width:1024px){.term{grid-template-columns:40px minmax(0,1fr) 260px 300px}}
@media(max-width:1023px) and (min-width:861px){
  .term{grid-template-columns:minmax(0,1fr) 300px;grid-template-rows:auto minmax(160px,1fr) minmax(160px,240px) var(--book-h,220px);grid-template-areas:"head side" "chart side" "ob side" "book acct"}
  .t-rail{display:none}
}
@media(max-width:860px){
  .t-strip{flex-wrap:wrap;gap:4px 14px;padding:6px 12px}
  .ts-r{gap:14px;width:100%;flex-wrap:wrap;overflow:visible}
  .term{grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-template-areas:"head" "chart" "ob" "side" "acct" "book";padding:4px 0}
  .term>*{border-radius:0;border-left:0;border-right:0}
  .t-rail{display:none}
  .t-head{flex-wrap:wrap}
  .mkt-pick{width:100%}
  .sym-pill{flex:1;min-width:0}
  .t-head .sym-btn{flex:1;min-width:0;justify-content:flex-start}
  .t-head .sym-btn .sym-caret{margin-left:auto}
  .mkt-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 12px;width:100%;overflow:visible}
  .mkt-stats .hide-xs{display:block}
  .chart-legend{top:4px}
  .chart-tools{display:none}
  .ob-row,.ob-trow{font-size:12.5px}
  .tk-btns .t-submit{height:44px;font-size:14px}
  .pct-quick button{height:34px}
  .t-status{flex-wrap:wrap;height:auto;padding:8px 12px;gap:8px 14px}
  .ticker{order:3;flex:1 0 100%}
  
}
@media(max-width:1600px) and (min-width:861px){.ptbl th,.ptbl td{padding-left:8px;padding-right:8px}.ptbl .row-btn{padding:0 7px}}
@media(max-width:860px){.chart-legend .lg-ohlc b:not(:last-child),.chart-legend .lg-2{display:none}.chart-legend .lg-ohlc{font-size:0}.chart-legend .lg-ohlc b:last-child{font-size:12px}}

/* ---- Perpi phone layout (Dec 2026): compact header and strips, more room for the chart ---- */
@media(max-width:860px){
  .app-head-in{height:52px}
  .app-brand{width:96px}
  .t-strip{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;white-space:nowrap;gap:14px;padding:6px 12px;font-size:12px}
  .t-strip::-webkit-scrollbar,.mkt-stats::-webkit-scrollbar{display:none}
  .t-strip .seg,.t-strip #abPct{display:none}
  .ts-l,.ts-r{flex:none;width:auto;flex-wrap:nowrap;gap:14px}
  .t-head{gap:8px;padding:8px 12px}
  .t-head .sym-btn{height:40px;font-size:17px}
  .mkt-stats{display:flex;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;gap:18px;width:100%;padding-bottom:2px}
  .mkt-stats>div{flex:none}
  .mkt-stats .hide-xs{display:block}
  .mkt-stats dt{font-size:11px}
  .mkt-stats dd{font-size:13px;white-space:nowrap}
  .mkt-stats .mkt-last-px{font-size:17px}
  .t-chart{height:calc(100svh - 300px);min-height:340px;max-height:620px}
  .t-foot{font-size:11px;padding:12px 16px 96px}
}
