.trade-workspace {
  display: grid;
  grid-template-columns: minmax(250px, .8fr) minmax(390px, 1fr) minmax(285px, .72fr);
  gap: 12px;
  align-items: start;
}
.order-book { border-right: 1px solid #ffffff; border-left: 1px solid #ffffff; font-variant-numeric: tabular-nums; }
.book-ladder { height: 568px; overflow-y: auto; overflow-anchor: none; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #9da8ad #e9ece8; }
.book-head, .book-row {
  display: grid;
  grid-template-columns: 40px 44px minmax(54px, 1fr) 88px minmax(54px, 1fr) 44px 40px;
  align-items: center;
  column-gap: 0;
}
.book-head {
  position: sticky;
  top: 0;
  z-index: 6;
  height: 30px;
  padding: 0 9px;
  border-top: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
  color: var(--muted);
  background: #eceee9;
  font-size: .7rem;
  font-weight: 800;
  text-align: center;
}
.book-row {
  height: 24px;
  padding: 0 9px;
  border-bottom: 1px solid #ffffff;
  background: #f1f5f8;
  font-size: .74rem;
  text-align: right;
}
.book-row.bid { background: #f8efef; }
.book-row:hover, .book-row:focus-within {
  position: relative;
  z-index: 1;
  outline: 1px solid #4d555b;
}
.book-change.up { color: var(--long); }
.book-change.down { color: var(--short); }
.book-price { font-weight: 900; }
.book-price, .book-side-action, .book-mit { min-width: 0; height: 22px; padding: 0 2px; border: 0; background: transparent; font: inherit; }
.book-price { color: inherit; font-size: .78rem; text-align: center; }
.book-side-action { color: var(--muted); font-size: .6rem; }
.book-side-action.sell { color: var(--short); }
.book-side-action.buy { color: var(--long); }
.book-head span:nth-child(-n+3),
.book-row.ask .book-price,
.book-row.ask .book-quantity b { color: var(--short); }
.book-head span:nth-child(n+5),
.book-row.bid .book-price,
.book-row.bid .book-quantity b { color: var(--long); }
.book-mit { color: #776da8; font-size: .56rem; font-weight: 900; }
.book-head > span,
.book-row > * {
  box-sizing: border-box;
  height: 100%;
  border-right: 1px solid #ffffff;
}
.book-head > span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  text-align: center;
  white-space: nowrap;
}
.book-head > span:last-child,
.book-row > *:last-child { border-right: 0; }
.book-price:hover, .book-price:focus-visible, .book-side-action:hover, .book-side-action:focus-visible, .book-mit:hover, .book-mit:focus-visible { background: rgba(255,255,255,.45); outline: 1px solid currentColor; }
.book-quantity {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 18px;
}
.book-quantity i {
  position: absolute;
  right: 0;
  height: 14px;
  background: #cfdde8;
}
.book-quantity.left { justify-content: flex-end; }
.book-quantity.right { justify-content: flex-start; }
.book-quantity.left i { right: 0; }
.book-quantity.right i { right: auto; left: 0; }
.book-row.bid .book-quantity i { background: #ead1d1; }
.book-quantity b { position: relative; z-index: 1; }
.book-current {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 12px;
  border-top: 1px solid #9ea5a0;
  border-bottom: 1px solid #9ea5a0;
  position: relative;
  z-index: 2;
  background: #f5f6f1;
}
.book-current span { color: var(--muted); font-size: .68rem; }
.book-current b { font-size: 1.25rem; }
.book-current em { font-size: .7rem; font-style: normal; }
.book-current.trade-up { background: #ffe8ea; box-shadow: inset 4px 0 var(--long); animation: trade-flash-up 850ms ease-out; }
.book-current.trade-down { background: #e8f3ff; box-shadow: inset 4px 0 var(--short); animation: trade-flash-down 850ms ease-out; }
@keyframes trade-flash-up { from { background: #ffc4ca; } to { background: #ffe8ea; } }
@keyframes trade-flash-down { from { background: #b9dcff; } to { background: #e8f3ff; } }
.book-totals {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  font-size: .66rem;
}
.book-totals span:last-child { text-align: right; }
@media (max-width: 1250px) {
  .trade-workspace { grid-template-columns: 1fr 1.2fr; }
  .trade-workspace > .panel:last-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .trade-workspace { grid-template-columns: 1fr; }
  .trade-workspace > .panel:last-child { grid-column: auto; }
  .book-head, .book-row { grid-template-columns: 24px 28px minmax(42px,1fr) 68px minmax(42px,1fr) 28px 24px; }
  .book-head, .book-row { padding: 0 3px; }
  .book-ladder { height: 568px; }
}
@media (max-width: 520px) {
  .trade-workspace { grid-template-columns: minmax(0,1fr); }
  .trade-workspace > .panel:last-child { grid-column: auto; }
  .book-head, .book-row { grid-template-columns: 30px 36px minmax(50px,1fr) 78px minmax(50px,1fr) 36px 30px; padding: 0 4px; }
  .book-head { font-size: .62rem; }
  .book-row { font-size: .68rem; }
  .book-price { font-size: .74rem; }
  .book-side-action { font-size: .58rem; }
  .book-mit { font-size: .54rem; }
}
@media (prefers-reduced-motion: reduce) {
  .book-current.trade-up, .book-current.trade-down { animation: none; }
}
