/* trade tab: styles only this tab uses. Shared tokens and components live in app.css. */

.v-trade .warn-t { color: var(--amber); }
.v-trade .side-s { color: var(--red); font-weight: 700; }
.v-trade .count:empty { display: none; }
.v-trade .mint-s { color: var(--dim); font-stretch: 87.5%; }

/* instrument header */
.inst-id > div { min-width: 0; }
.inst-id > div > span { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mint-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--mute); font-stretch: 87.5%; padding: 1px 6px; border-radius: 4px; background: var(--ink-3); }
.mint-btn:hover, .mint-btn:focus-visible { color: var(--paper); background: var(--ink-4); outline: none; }
.mint-btn .ic { width: 14px; height: 14px; }
.inst-px .px { display: inline-block; padding: 0 2px; }
.inst-stats b .skel { height: 14px; }

/* chart */
.chart-src { position: absolute; left: 14px; top: 2px; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; pointer-events: none; }
.chart-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--mute); font-size: 15px; pointer-events: none; }
.chart-msg span:not(.spin) { max-width: 30em; }
.chart-h .seg button[aria-pressed="true"], .chart-h .seg .is-on { background: var(--ink-4); color: var(--paper); }

/* swap ticket */
.tsel-s { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsel-unv { height: 18px; padding: 0 5px; }
.tsel-static { cursor: default; padding-right: 14px; }
.tsel-static:hover { background: var(--ink-3); }
.amt-mid input.is-stale { color: var(--mute); }
.amt-mid input::placeholder { color: var(--ink-4); }
.amt-out .amt-mid input { cursor: default; }
.rate-btn { position: relative; color: var(--paper); font-weight: 600; text-align: right; font-size: 15px; border-bottom: 1px dashed var(--line-3); }
/* a finger-sized hit area around a line of text */
.rate-btn::after { content: ""; position: absolute; inset: -10px -6px; }
.rate-btn:hover, .rate-btn:focus-visible { color: var(--orange-hi); outline: none; }
.kv > div > span:last-child .dim { font-weight: 500; }
.slip-row b { color: var(--paper); font-weight: 650; margin-left: 4px; }
.sw-warns { display: flex; flex-direction: column; gap: 6px; }
.sw-warns:empty { display: none; }
.sw-w { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.4; padding: 9px 11px; border-radius: 6px; }
.sw-w .ic { margin-top: 2px; }
.sw-w.warn { background: rgba(232,197,71,.09); color: #EBD58A; border: 1px solid rgba(232,197,71,.22); }
.sw-w.warn .ic { color: var(--amber); }
.sw-w.bad { background: var(--red-soft); color: #F9B4BE; border: 1px solid rgba(244,89,107,.3); }
.sw-w.bad .ic { color: var(--red); }

/* token check strip */
.safety:empty { display: none; }
.safety { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.sf-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.sf-h .dim { font-stretch: 87.5%; }
.sf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; }
.sf { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 6px; background: var(--ink-0); border: 1px solid var(--line-2); min-width: 0; }
.sf span { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf b { font-size: 15px; font-weight: 650; color: var(--mute); }
.sf.ok b { color: var(--green); }
.sf.warn { border-color: rgba(232,197,71,.25); }
.sf.warn b { color: var(--amber); }
.sf.bad { border-color: rgba(244,89,107,.35); }
.sf.bad b { color: var(--red); }
.sf-none { font-size: 14px; color: var(--dim); }

/* ticket footer: the error sits above the button */
.tk-foot { flex-direction: column; align-items: stretch; gap: 8px; }
.tk-foot .err-line { margin: 0; font-size: 14px; }

/* holdings, trending */
.hx-skel { display: flex; justify-content: space-between; align-items: center; padding: 18px var(--pad); border-bottom: 1px solid #1B1B1B; }
.hx-err { padding: 16px var(--pad); color: var(--dim); font-size: 15px; }
.hx-list .tok-s { flex-wrap: wrap; row-gap: 2px; }
.hx-list > button:focus-visible { outline: none; background: var(--ink-3); }

/* bottom pane tabs (buttons, same look as the links) */
.pos-tabs button { display: flex; align-items: center; gap: 8px; padding: 0 10px; font-weight: 650; color: var(--mute); font-size: 16px; position: relative; white-space: nowrap; }
.pos-tabs button:hover { color: var(--paper); }
.pos-tabs button.is-on { color: var(--paper); }
.pos-tabs button.is-on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--paper); }
.pos-tabs a:focus-visible, .pos-tabs button:focus-visible { outline: 2px solid var(--orange-line); outline-offset: -4px; }
@media (min-width: 1380px) {
  .v-trade .ft-trend { display: none; }
}
.pt-empty:empty { display: none; }
.pt-none { padding: 18px var(--pad); color: var(--dim); font-size: 15px; line-height: 1.45; }
.pt-none .link { font-size: 15px; display: inline-flex; }
.pt-empty .empty { padding: 22px 20px; }
.pt-empty .empty p { font-size: 15px; }
.pos-err { margin: 10px var(--pad) 0; }
.pos-mk { font: inherit; color: var(--paper); font-weight: 650; padding: 0; text-align: left; }
.pos-mk:hover { color: var(--orange-hi); }
.tbl td .sub .money { display: inline; }

/* perps markets pane */
.p-mkts .scroll { display: flex; flex-direction: column; }
.mkt:focus-visible { outline: none; background: var(--ink-3); }
.mkt-top .tk { width: 32px; height: 32px; }
.mkt-skel { gap: 12px; cursor: default; }
.mkt-skel:hover { background: transparent; }
.acct-sum { border-top: 1px solid var(--line); }

/* order ticket */
.ls button:focus-visible, .lev-chips .chip:focus-visible, .chips .chip:focus-visible { outline: 2px solid var(--orange-line); outline-offset: 1px; }
.slider:focus-within .knob { box-shadow: 0 0 0 4px var(--orange-soft), 0 2px 8px rgba(0,0,0,.5); }
.v-trade .note { line-height: 1.45; }

/* laptop: the side pane is hidden by app.css, the bottom pane carries Trending */
@media (max-width: 1379px) and (min-width: 1100px) {
  .v-trade[data-sub="perps"] { grid-template-columns: 300px minmax(0, 1fr) 380px; }
}

/* small laptop and landscape tablet: chart left, ticket right, so the
   order form is on screen next to the price instead of a scroll away */
@media (min-width: 900px) and (max-width: 1099px) {
  .v-trade[data-sub="swap"] { grid-template-columns: minmax(0, 1fr) 400px; grid-template-areas: "inst inst" "chart ticket" "fills ticket" "holdx holdx"; }
  .v-trade[data-sub="perps"] { grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "inst inst" "chart pticket" "pos pticket" "mkts mkts"; }
}

/* tablet and phone: one column, panes size to content */
@media (max-width: 1099px) {
  .v-trade .inst { flex-wrap: wrap; gap: 12px 24px; }
  .v-trade .inst .vsep { display: none; }
  .v-trade .inst-stats { width: 100%; flex-wrap: wrap; gap: 14px 24px; }
  .v-trade .inst-id { min-width: 0; flex: 1 1 auto; }
  .v-trade .ft-trend { display: none; }
  .v-trade .p-fills .scroll { max-height: 440px; }
}
@media (max-width: 767px) {
  .chart-h .seg { flex: 1; }
  .chart-h .seg > * { flex: 1; justify-content: center; }
  .inst-id b { font-size: 18px; }
  .sf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sw-w { font-size: 14px; }
  .tsel-s { max-width: 7ch; }
  .amt-mid input { font-size: 28px; }
  .rate-btn { font-size: 14px; }
  .p-pos .tbl td { height: 64px; }
}

/* TradingView chart */
.chart-b .tv { position: absolute; inset: 6px 4px 0 8px; }
.chart-b .tv a[href*="tradingview"] { opacity: .45; transition: opacity .2s; }
.chart-b .tv a[href*="tradingview"]:hover { opacity: .9; }
.chart-b .chart-msg { z-index: 3; }
.chart-b .chart-src { z-index: 3; }
.chart-h .ohlc { font-variant-numeric: tabular-nums; }

/* ── perps: take profit and stop loss ─────────── */
/* stacked, so both fit the narrow last column */
.pos-acts { display: flex; flex-direction: column; gap: 4px; align-items: stretch; width: 64px; margin-left: auto; }
.pos-acts .btn { justify-content: center; padding: 0 8px; }
.tpsl-sum { display: flex; gap: 8px; margin-top: 3px; font-size: 13px; font-weight: 600; }
.tpsl-sum .tp { color: var(--green); }
.tpsl-sum .sl { color: var(--red); }
.tpsl-box { width: min(520px, 100%); }
.tpsl-box .pane-h h2 { gap: 8px; }
.tpsl { padding: 16px var(--pad) 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.tpsl-h { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--dim); }
.tpsl-h b { color: var(--paper); font-weight: 650; }
.tpsl-h b.down { color: var(--red); }
.tpsl-fs { display: flex; flex-direction: column; gap: 14px; }
.tpsl-f { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l l" "in b" "pnl pnl"; gap: 8px 10px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--ink-0); }
.tpsl-l { grid-area: l; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpsl-l.tp { color: var(--green); }
.tpsl-l.sl { color: var(--red); }
.tpsl-f .in { grid-area: in; height: 44px; }
.tpsl-f .in input { font-size: 17px; }
.tpsl-b { grid-area: b; display: flex; gap: 6px; }
.tpsl-b .btn { height: 44px; min-width: 72px; justify-content: center; }
.tpsl-pnl { grid-area: pnl; font-size: 13px; color: var(--dim); min-height: 1.2em; }
.tpsl-pnl.is-bad { color: var(--amber); }
.tpsl .note { font-size: 13px; }
.tpsl .err-line { margin: 0; }
@media (max-width: 767px) {
  .tpsl-f { grid-template-columns: minmax(0, 1fr); grid-template-areas: "l" "in" "b" "pnl"; }
  .tpsl-b .btn { flex: 1; }
}
