/* Vibrozz 2 — trade: order ticket, position / order lists, position forms (V.trade.*). Tokens from base.css only. */

/* ---------- order ticket (host: a .card without padding) — fits one screen; the order button is sticky ---------- */
.tr-t{padding:16px 16px 0;display:grid;grid-template-columns:minmax(0,1fr);gap:10px;min-width:0}
.tr-t .field,.tr-br{grid-template-columns:minmax(0,1fr)}
.tr-t .field{gap:6px}
.tr-ls{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;border-radius:14px;background:var(--soft)}
.tr-ls button{height:38px;border:0;border-radius:11px;background:transparent;font-weight:700;font-size:15px;color:var(--tx-3);transition:background .12s,color .12s}
.tr-ls button:hover{color:var(--tx)}
.tr-ls button.l.on{background:var(--up);color:var(--on-up,#fff)}
.tr-ls button.s.on{background:var(--dn);color:var(--on-dn,#fff)}
.tr-t .field>span{align-items:center;min-height:24px}
.tr-t .seg button{padding-top:6px;padding-bottom:6px}
.tr-t .input{height:42px}
.tr-help{font-size:12px;color:var(--tx-3);font-weight:500}
.tr-mini{display:inline-flex;gap:2px;padding:2px;border-radius:9px;background:var(--soft)}
.tr-mini button{border:0;background:transparent;border-radius:7px;padding:3px 9px;font-size:12px;font-weight:700;color:var(--tx-3);min-width:34px}
.tr-mini button:hover{color:var(--tx)}
.tr-mini button.on{background:var(--card);color:var(--tx);box-shadow:0 1px 3px rgba(0,0,0,.1)}
:root[data-vz-theme=dark] .tr-mini button.on{background:var(--soft-2);box-shadow:none}
.tr-amount{display:flex;align-items:center;gap:10px;height:50px;padding:0 14px;border-radius:14px;background:var(--soft);border:1px solid transparent;cursor:text;transition:border-color .12s,background .12s}
.tr-amount:hover{border-color:var(--line-2)}
.tr-amount:focus-within{border-color:var(--acc-2);background:var(--card)}
.tr-amount input{flex:1 1 60px;width:60px;min-width:0;border:0;background:transparent;outline:0;font-size:21px;font-weight:700;letter-spacing:-.01em;color:var(--tx);padding:0}
.tr-amount input::placeholder{color:var(--tx-3)}
.tr-amount span{flex:0 1 auto;min-width:0;max-width:65%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;color:var(--tx-3);font-weight:500}
.tr-pct.chips{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin-top:-2px}
.tr-pct .chip{padding:6px 0;text-align:center;font-size:13px}
.tr-lev{gap:6px}
.tr-levrow{display:flex;align-items:center;gap:8px;min-width:0}
.tr-levbox{display:inline-flex;align-items:center;gap:2px;height:34px;padding:0 10px;border-radius:11px;background:var(--soft);border:1px solid transparent;color:var(--tx);flex:none;cursor:text}
.tr-levbox:focus-within{border-color:var(--acc-2);background:var(--card)}
.tr-levbox input{width:34px;border:0;background:transparent;outline:0;text-align:right;font-weight:700;font-size:15px;padding:0;color:var(--tx)}
.tr-levbox em{font-style:normal;font-weight:700;color:var(--tx-3)}
.tr-marks{display:flex;flex:1;min-width:0;gap:2px;justify-content:space-between}
.tr-marks button{flex:1 1 0;min-width:0;height:34px;border:0;background:transparent;border-radius:9px;padding:0 2px;font-size:12px;font-weight:600;color:var(--tx-3);white-space:nowrap}
.tr-marks button:hover{color:var(--tx);background:var(--soft)}
.tr-marks button.on{background:var(--tx);color:var(--card)}
.tr-levst{font-size:12px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.tr-levst.up{color:var(--up)}.tr-levst.dn{color:var(--dn)}.tr-levst.mu{color:var(--tx-3)}
.tr-br{display:grid;gap:8px}
.tr-br[hidden]{display:none}
.tr-lbl{font-weight:600;font-size:14px}
.tr-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.tr-two[hidden]{display:none}
.tr-two .chips.tr-sm{gap:4px;flex-wrap:nowrap}
.tr-sm .chip{padding:4px 0;flex:1;text-align:center;font-size:12px;min-width:0}
.tr-hint{display:grid;gap:8px;padding:10px 12px;border-radius:12px;background:var(--warn-soft);color:var(--tx);font-size:13px}
.tr-hint[hidden]{display:none}
.tr-hint .chips .chip{background:var(--card)}
.tr-sum{display:grid;gap:6px;padding:10px 12px;border-radius:14px;border:1px dashed var(--soft-2);font-size:13px;transition:opacity .15s}
.tr-sum[aria-busy=true]{opacity:.7}
.tr-sum>div{display:flex;justify-content:space-between;align-items:baseline;gap:12px;color:var(--tx-2);min-width:0}
.tr-sum>div>span{flex:none}
.tr-sum b{color:var(--tx);font-weight:600;text-align:right;min-width:0;overflow-wrap:anywhere}
.tr-sum b small{color:var(--tx-3);font-weight:500;font-size:12px}
.tr-sum b.up{color:var(--up)}.tr-sum b.dn{color:var(--dn)}.tr-sum b.wa{color:var(--warn)}.tr-sum b.mu{color:var(--tx-3)}
.tr-opts{gap:18px;font-size:13px;color:var(--tx-2)}
.tr-opts .check input{width:16px;height:16px}
.tr-opts .check:has(input:disabled){opacity:.45;cursor:default}
.tr-err{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 12px;border-radius:12px;background:var(--dn-soft);color:var(--dn);font-size:13px;font-weight:500}
.tr-err[hidden]{display:none}
.tr-err span{flex:1;min-width:160px}
/* the order button never leaves the screen: it sticks to the bottom of the ticket's scroll box */
.tr-cta-wrap{position:sticky;bottom:0;z-index:2;display:grid;gap:6px;margin:0 -16px;padding:4px 16px 16px;background:var(--card)}
.tr-cta-wrap::before{content:"";position:absolute;left:0;right:0;top:-14px;height:14px;background:linear-gradient(transparent,var(--card));pointer-events:none}
.tr-cta{height:52px;font-size:16px;border-radius:15px}
.tr-cta.long{color:var(--on-up,#fff)}.tr-cta.short{color:var(--on-dn,#fff)}
.tr-status{font-size:13px;color:var(--tx-2);min-height:0;text-align:center}
.tr-status:empty{display:none}
.tr-status.ok{color:var(--up)}.tr-status.bad{color:var(--dn)}.tr-status.wait{color:var(--warn)}

/* ---------- positions list ---------- */
.tr-plist .it{grid-template-columns:minmax(0,1.45fr) minmax(0,1.25fr) minmax(104px,auto) 34px;gap:16px}
.tr-qa{display:none;gap:6px;align-items:center}
.tr-qa .btn{height:32px;padding:0 11px;font-size:13px;white-space:nowrap}
.tr-qa .tr-qx:hover{background:var(--dn-soft);color:var(--dn)}
.tr-plist.compact .it{grid-template-columns:minmax(0,1.5fr) minmax(0,1fr) minmax(104px,auto) 20px}
.tr-pn{gap:12px;min-width:0}
.tr-pn b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:15px}
.tr-pn .pill{margin-left:2px}
.tr-pn small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tr-ps{min-width:0}
.tr-ps>b{display:block}
.tr-prot{display:flex!important;flex-wrap:wrap;align-items:center;gap:2px 12px;margin-top:2px}
.tr-prot>span{white-space:nowrap}
.tr-prot .pill{font-size:11px;padding:1px 7px}
.tr-pp b{font-size:16px;font-weight:700;letter-spacing:-.01em;display:block}
.tr-pp small.up{color:var(--up)}.tr-pp small.dn{color:var(--dn)}
.tr-more{color:var(--tx-3)}
.tr-more:hover,.tr-more[aria-expanded=true]{color:var(--tx);background:var(--soft)}
.tr-chev{color:var(--tx-3)}
.tr-pos:focus-visible{outline:2px solid var(--link);outline-offset:-2px;border-radius:12px}

/* ---------- orders list ---------- */
.tr-olist .it{grid-template-columns:minmax(0,1.5fr) minmax(90px,.8fr) minmax(110px,.9fr) minmax(110px,.8fr) auto;gap:14px}
.tr-on{border:0;background:transparent;padding:0;text-align:left;color:inherit;gap:12px;min-width:0}
.tr-on:hover b{color:var(--link)}
.tr-on b{display:flex;align-items:center;gap:6px;min-width:0;white-space:nowrap}
.tr-on b .pill{flex:none}
.tr-onm{min-width:0;overflow:hidden;text-overflow:ellipsis}
.tr-on small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tr-oact .icon-btn{background:var(--soft);box-shadow:none}
.tr-oact .icon-btn:hover{background:var(--soft-2)}
.tr-oact .tr-x:hover{background:var(--dn-soft);color:var(--dn)}

/* ---------- dialogs (position forms, amend, risk, jobs) ---------- */
.tr-id{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 12px;border-radius:14px;background:var(--soft);font-size:14px}
.tr-id .coin{width:24px;height:24px}
.tr-id b.tx,.tr-move b{color:var(--tx)}
.tr-now{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:14px}
.tr-now>span:first-child:not(.pill){color:var(--tx-3)}
.tr-now b.up{color:var(--up)}.tr-now b.dn{color:var(--dn)}
.tr-fhint{padding:10px 12px;border-radius:12px;background:var(--soft);font-size:13px;color:var(--tx-2);line-height:1.6}
.tr-fhint b.up{color:var(--up)}.tr-fhint b.dn{color:var(--dn)}
.tr-rm{border:0;background:transparent;padding:0 2px;font-size:13px;font-weight:600;color:var(--link)}
.tr-rm.on{color:var(--tx-2)}
.tr-trow{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) 34px;gap:10px;align-items:end}
.tr-trow .icon-btn{margin-bottom:6px}
.tr-add{justify-self:start}
.tr-warn{display:flex;gap:10px;align-items:flex-start;padding:12px 14px;border-radius:14px;background:var(--warn-soft);color:var(--tx);font-size:14px}
.tr-warn .ic{color:var(--warn);margin-top:1px}
.tr-move{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px 14px;border-radius:14px;background:var(--soft);font-size:15px}
.tr-move .up{color:var(--up);font-weight:600}.tr-move .dn{color:var(--dn);font-weight:600}
.tr-dlg .form-err:empty{display:none}
.tr-h{font-size:16px;font-weight:700}
.tr-mono{font-family:var(--mono);font-size:12px;overflow-wrap:anywhere}
.tr-ev .it{grid-template-columns:auto minmax(80px,auto) minmax(0,1fr);padding:9px 0;gap:12px;font-size:13px}
.tr-ev code{font-family:var(--mono);font-size:12px;color:var(--tx-2);overflow-wrap:anywhere;white-space:pre-wrap}
.tr-jobs .it{grid-template-columns:minmax(0,1fr) auto;width:100%;border:0;border-top:1px solid var(--line);background:transparent;text-align:left;padding:12px 4px;color:inherit}
.tr-jobs .it:first-child{border-top:0}
.tr-jobs .it:hover{background:var(--soft)}

/* ---------- narrow hosts and phones ---------- */
/* lists adapt to their own width (dock, half-width cards, phones) */
.tr-plist,.tr-olist{container-type:inline-size}
.tr-ss{display:none}
/* one-tap TP / SL · 50% · Закрыть where the list is wide enough */
@container (min-width:900px){
  .tr-plist .it{grid-template-columns:minmax(0,1.4fr) minmax(0,1.3fr) minmax(104px,auto) auto 34px}
  .tr-qa{display:flex}
}
@container (max-width:760px){
  .tr-plist .it{grid-template-columns:minmax(0,1.3fr) minmax(0,1.2fr) minmax(96px,auto) 34px}
}
@container (max-width:760px) and (min-width:561px){
  .tr-olist .it{grid-template-columns:minmax(170px,1.6fr) minmax(80px,.8fr) minmax(96px,.9fr) auto;gap:12px}
  .tr-olist .it>.tr-hs:nth-child(4){display:none}
}
@container (max-width:560px){
  /* positions: name + P&L + actions on top, size / stop / liquidation as a second line */
  .tr-plist .it,.tr-plist.compact .it{grid-template-columns:minmax(0,1fr) auto 40px;grid-template-areas:"n p m" "s s s";gap:6px 10px;padding-left:18px;padding-right:12px}
  .tr-plist.compact .it{grid-template-columns:minmax(0,1fr) auto 20px}
  .tr-pn{grid-area:n}.tr-pp{grid-area:p}.tr-more,.tr-chev{grid-area:m;justify-self:end}
  .tr-more{width:40px;height:40px}
  .tr-ps{grid-area:s;display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 8px;padding-left:52px}
  .tr-ps>b{font-size:14px}
  .tr-prot{margin-top:0}
  .tr-olist .it{grid-template-columns:minmax(0,1fr) auto auto;gap:10px;padding-left:18px;padding-right:12px}
  .tr-hs{display:none}
  .tr-ss{display:inline}
  .tr-on small{white-space:normal}
  .tr-q{display:none}
  .tr-pn small{white-space:normal}
  .tr-oact .icon-btn{width:40px;height:40px}
}
@media (max-width:760px){
  .tr-t{padding:16px 16px 0;gap:12px}
  .tr-cta-wrap{position:static;padding-bottom:16px}
  .tr-cta-wrap::before{display:none}
  .tr-amount input,.tr-t .input,.tr-levbox input{font-size:16px}
  .tr-amount input{font-size:20px}
  .tr-ls button,.tr-marks button,.tr-mini button{min-height:40px}
  .tr-marks button{min-width:40px}
  .tr-mini button{min-width:40px}
  .tr-t .seg button{min-height:40px}
  .tr-levbox{height:40px}
  .tr-levbox input{height:100%;width:40px}
  .tr-opts .check{min-height:40px}
  .tr-br .toggle{width:52px;height:32px;border-radius:16px}
  .tr-br .toggle::after{width:26px;height:26px}
  .tr-br .toggle.on::after{left:23px}
  .tr-br .toggle::before{content:"";position:absolute;inset:-6px -4px}
  .tr-pct .chip{min-height:40px}
  .tr-sm .chip{min-height:40px}
  .tr-trow{grid-template-columns:minmax(0,1fr) minmax(0,.8fr) 40px}
  .tr-ev .it{grid-template-columns:auto minmax(0,1fr)}
  .tr-ev code{grid-column:1/-1}
  .icon-btn.tr-more{width:40px;height:40px}
  .tr-dlg .chip,.tr-dlg .seg button{min-height:40px}
  .tr-dlg .btn.sm{height:40px}
  .tr-dlg .icon-btn.sm{width:40px;height:40px}
  .tr-rm{min-height:40px;margin:-8px 0;padding:0 6px}
}
@media (max-width:380px){
  .tr-two{grid-template-columns:1fr}
}
.tr-dlg .tbl th:first-child,.tr-dlg .tbl td:first-child{padding-left:0}.tr-dlg .tbl th:last-child,.tr-dlg .tbl td:last-child{padding-right:0}

/* iOS zooms the page when a focused field is under 16 px */
@media (max-width:760px){.tr-dlg input:not([type=checkbox]):not([type=radio]):not([type=range]):not(.sr),.tr-dlg select,.tr-dlg textarea{font-size:16px}}

/* tablets (touch, > 760 px): the phone's 40 px targets without the phone layout */
@media (min-width:761px) and (pointer:coarse){
  .tr-ls button,.tr-marks button,.tr-t .seg button{min-height:40px}
  .tr-marks button{min-width:40px}
  .tr-mini button{min-height:34px;min-width:40px}
  .tr-levbox{height:40px}
  .tr-levbox input{height:100%;width:40px}
  .tr-opts .check{min-height:40px}
  .tr-br .toggle{width:52px;height:32px;border-radius:16px}
  .tr-br .toggle::after{width:26px;height:26px}
  .tr-br .toggle.on::after{left:23px}
  .tr-pct .chip,.tr-sm .chip{min-height:40px}
  .icon-btn.tr-more,.tr-oact .icon-btn{width:40px;height:40px}
  .tr-dlg .chip,.tr-dlg .seg button{min-height:40px}
  .tr-dlg .btn.sm{height:40px}
  .tr-qa .btn{height:40px}
  .tr-rm{min-height:40px;margin:-8px 0;padding:0 6px}
  .tr-amount input,.tr-t .input,.tr-levbox input,.tr-dlg input:not([type=checkbox]):not([type=radio]):not([type=range]):not(.sr),.tr-dlg select,.tr-dlg textarea{font-size:16px}
  .tr-amount input{font-size:21px}
}
/* tablets: the terminal dock beside the ticket is ~320 px wide — a smaller logo keeps «BTC Long 10×» whole */
@media (min-width:761px){
  @container (max-width:380px){
    .tr-plist .it .coin,.tr-olist .it .coin{width:34px;height:34px}
    .tr-pn,.tr-on{gap:10px}
    .tr-ps{padding-left:44px}
  }
}
