/* Live-display stability. Load after pro.css, lighter.css and order-sizing.css.
   No visibility, order submission or feed policy is changed here. */

/* The sidebar remains the single vertical scroll container for the ticket/book.
   A reserved scrollbar gutter keeps quote-driven updates from changing its width. */
.side:has(#sizingPanel){min-width:0;scrollbar-gutter:stable;overflow-x:hidden;overflow-anchor:none}
.side:has(#sizingPanel)>.pn.tk,.tk:has(#sizingPanel) .tk-b{min-width:0}
.tk:has(#sizingPanel) #qty,.tk:has(#sizingPanel) #szx,
#sizingPanel,#sizingPanel .order-sizing__value{font-variant-numeric:tabular-nums lining-nums}

/* A conversion summary can move from one to two lines when a value gains a digit. */
.tk:has(#sizingPanel) #szx{min-block-size:3.3em;overflow-wrap:anywhere}
#sizingPanel{min-width:0;overflow-anchor:none}
#sizingPanel .order-sizing__summary{min-block-size:1.4em;overflow-wrap:anywhere}

/* Both sides keep identical value/action columns in every state. The previous
   :has-visible-button rule changed two columns into three and moved later fields. */
#sizingPanel .order-sizing__side,
#sizingPanel .order-sizing__side:has(.order-sizing__adjust:not([hidden])){
  grid-template-columns:minmax(0,1fr) minmax(0,1.35fr) 88px;
  grid-template-rows:minmax(36px,auto);
  align-items:center;
  gap:4px 6px;
  min-height:36px;
  padding:0;
}
#sizingPanel .order-sizing__label{grid-column:1;grid-row:1;min-width:0;line-height:1.35}
#sizingPanel .order-sizing__value{
  grid-column:2;grid-row:1;min-width:0;line-height:1.35;
  text-align:right;white-space:normal;overflow-wrap:anywhere;
}
#sizingPanel .order-sizing__adjust,
#sizingPanel .order-sizing__side:has(.order-sizing__adjust:not([hidden])) .order-sizing__adjust{
  grid-column:3;grid-row:1;justify-self:stretch;
  display:inline-flex;align-items:center;justify-content:center;
  width:100%;min-width:0;min-height:32px;padding:6px;
  font-size:10px;line-height:1.2;white-space:nowrap;
}
/* Compatibility with the previous controller: an unavailable hidden action
   remains invisible and unfocusable, but its measured slot does not disappear. */
#sizingPanel .order-sizing__adjust[hidden]{display:inline-flex!important;visibility:hidden;pointer-events:none}
#sizingPanel .order-sizing__adjust:disabled{opacity:.42;cursor:not-allowed}

/* Three lines accommodate the controller's concise status and capacity messages.
   This is a minimum, never a clamp: unusually long critical copy stays readable. */
#sizingPanel .order-sizing__message,
#sizingPanel .order-sizing__message:empty{
  display:block;
  min-block-size:calc(4.5em + 8px);
  margin-top:7px;padding-top:7px;
  line-height:1.5;overflow-wrap:anywhere;
}
#sizingPanel .order-sizing__message:empty{border-color:transparent}

/* --red and --ra are defined in every Pro theme; --acc is not a CSS token. */
.tk:has(#sizingPanel) #szp button[aria-pressed="true"]{
  border-color:var(--red);color:var(--ink);background:var(--ra);
}

/* Positions only. Calendar, history, movers and other .g tables keep their layout.
   These widths include the existing 262px two-slot protection editor and all
   three position actions. Horizontal scrolling belongs to #dk, not individual cells. */
.dock:has(#dockT [data-d="pos"].on) #dk{scrollbar-gutter:stable;overflow-anchor:none}
#dk table.g:has(tbody tr[data-prow]){table-layout:fixed;width:100%;min-width:1220px}
#dk table.g:has(tbody tr[data-prow]) th:nth-child(1){width:156px}
#dk table.g:has(tbody tr[data-prow]) th:nth-child(2){width:72px}
#dk table.g:has(tbody tr[data-prow]) th:nth-child(3){width:128px}
#dk table.g:has(tbody tr[data-prow]) th:nth-child(4),
#dk table.g:has(tbody tr[data-prow]) th:nth-child(5){width:112px}
#dk table.g:has(tbody tr[data-prow]) th:nth-child(6){width:80px}
#dk table.g:has(tbody tr[data-prow]) th:nth-child(7){width:124px}
#dk table.g:has(tbody tr[data-prow]) th:nth-child(8){width:282px}
#dk table.g:has(tbody tr[data-prow]) th:nth-child(9){width:154px}
#dk table.g:has(tbody tr[data-prow]) td{font-variant-numeric:tabular-nums lining-nums}
#dk table.g:has(tbody tr[data-prow]) td:nth-child(n+3):nth-child(-n+7){
  white-space:normal;overflow-wrap:anywhere;line-height:1.35;
}
#dk table.g:has(tbody tr[data-prow]) .nt{min-width:0}
#dk table.g:has(tbody tr[data-prow]) .nt>b{white-space:normal;overflow-wrap:anywhere}

@media(max-width:700px),(pointer:coarse){
  #sizingPanel .order-sizing__side,
  #sizingPanel .order-sizing__side:has(.order-sizing__adjust:not([hidden])){
    grid-template-rows:minmax(50px,auto);min-height:50px;
  }
  #sizingPanel .order-sizing__adjust,
  #sizingPanel .order-sizing__side:has(.order-sizing__adjust:not([hidden])) .order-sizing__adjust{
    min-height:44px;font-size:10px;
  }
}
