/* Order book with insights. Prices stay neutral everywhere; only the balance bar and the ladder's depth bars
   carry faint up and down tints, always with words and numbers beside them. */
.tm-binsight { container: tm-binsight / inline-size; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tm-space-12); font-variant-numeric: tabular-nums; }
/* Narrow (phones): order counts give way so quantities and prices keep their room. */
@container tm-binsight (width < 420px) {
  .tm-binsight .tm-book__half, .tm-binsight .tm-book__half--ask { grid-template-columns: 1fr 1fr; }
  .tm-binsight .tm-book__half .n, .tm-binsight .tm-book__head .tm-book__half--bid > span:first-child, .tm-binsight .tm-book__head .tm-book__half--ask > span:last-child { display: none; }
  .tm-bsum__px { font-size: var(--tm-type-subtitle-size); line-height: var(--tm-type-subtitle-line); }
  .tm-bal__row { grid-template-columns: 1fr 1fr; }
  .tm-bal__say { grid-column: 1 / -1; grid-row: 1; }
}
.tm-binsight .tm-book__spread { display: none; }

.tm-bsum { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: var(--tm-space-12); }
.tm-bsum > div { display: grid; gap: 2px; min-width: 0; }
.tm-bsum__side--ask { text-align: right; }
.tm-bsum__mid { text-align: center; padding: 0 var(--tm-space-8); }
.tm-bsum__k { font-size: var(--tm-density-font-label); color: var(--tm-color-text-secondary); }
.tm-bsum__px { font-size: var(--tm-type-title-size); line-height: var(--tm-type-title-line); font-weight: var(--tm-font-weight-semibold); color: var(--tm-color-text); }
.tm-bsum__mid b { font-weight: var(--tm-font-weight-semibold); }
.tm-bsum__sub { font-size: var(--tm-density-font-small); color: var(--tm-color-text-secondary); white-space: nowrap; }

.tm-bal { display: grid; gap: 6px; }
.tm-bal__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: var(--tm-space-8); font-size: var(--tm-density-font-small); color: var(--tm-color-text-secondary); }
.tm-bal__row > :last-child { text-align: right; }
.tm-bal__row b { color: var(--tm-color-text); font-weight: var(--tm-font-weight-semibold); }
.tm-bal__say { text-align: center; color: var(--tm-color-text); font-weight: var(--tm-font-weight-medium); }
.tm-bal__bar { position: relative; display: flex; height: 18px; border-radius: var(--lk-r-xs, 6px); overflow: hidden; box-shadow: inset 0 0 0 1px var(--tm-color-divider); font-size: 11px; line-height: 18px; color: var(--tm-color-text); }
.tm-bal__bar::after { content: ""; position: absolute; left: 50%; top: 3px; bottom: 3px; border-left: 1px dashed var(--tm-color-text-secondary); opacity: 0.6; }
.tm-bal__bar i { display: block; min-width: 0; font-style: normal; }
.tm-bal__b { background: var(--tm-color-up-tint); box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--tm-color-up) 14%, transparent); }
.tm-bal__a { flex: 1; background: var(--tm-color-down-tint); box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--tm-color-down) 14%, transparent); text-align: right; }
.tm-bal__bar span { padding: 0 8px; }
.tm-bal__note { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 6px; font-size: var(--tm-density-font-small); color: var(--tm-color-text-secondary); text-align: center; }

.tm-bfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: var(--tm-space-8); }
.tm-bfacts__cell { display: grid; gap: 2px; align-content: start; padding: var(--tm-space-12); border-radius: var(--lk-r-xs, var(--tm-radius-sm)); background: var(--tm-color-hover); min-width: 0; }
.tm-bfacts__k { font-size: var(--tm-density-font-label); color: var(--tm-color-text-secondary); }
.tm-bfacts__v { font-size: var(--tm-density-font-body); font-weight: var(--tm-font-weight-semibold); color: var(--tm-color-text); }
.tm-bfacts__sub { font-size: var(--tm-density-font-small); color: var(--tm-color-text-secondary); }
.tm-bfacts__note { grid-column: 1 / -1; margin: 0; font-size: var(--tm-density-font-small); color: var(--tm-color-text-secondary); }

.tm-bexplain { border-top: 1px solid var(--tm-color-divider); padding-top: var(--tm-space-8); font-size: var(--tm-density-font-small); color: var(--tm-color-text-secondary); }
.tm-bexplain summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--tm-color-primary-text); font-weight: var(--tm-font-weight-medium); list-style: none; }
.tm-bexplain summary::-webkit-details-marker { display: none; }
.tm-bexplain p { margin: var(--tm-space-8) 0 0; max-width: 60ch; }

/* Pro: tighter header, facts as one strip of four. */
.tm-binsight--pro { gap: 6px; }
.tm-bsum--pro { padding: 4px var(--tm-density-pad-cell); gap: var(--tm-space-8); }
.tm-bsum--pro .tm-bsum__px { font-size: 15px; line-height: 20px; }
.tm-bsum--pro .tm-bsum__k, .tm-bsum--pro .tm-bsum__sub { font-size: 11px; line-height: 14px; }
.tm-binsight--pro .tm-bal { padding: 0 var(--tm-density-pad-cell); gap: 4px; }
.tm-binsight--pro .tm-bal__bar { height: 14px; line-height: 14px; font-size: 10.5px; }
.tm-binsight--pro .tm-bal__row, .tm-binsight--pro .tm-bal__note { font-size: 11px; }
.tm-bfacts--pro { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; border-top: 1px solid var(--tm-color-divider); }
.tm-bfacts--pro .tm-bfacts__cell { padding: 6px var(--tm-density-pad-cell); border-radius: 0; background: none; border-right: 1px solid var(--tm-color-divider); }
.tm-bfacts--pro .tm-bfacts__cell:nth-child(4) { border-right: 0; }
.tm-bfacts--pro .tm-bfacts__k, .tm-bfacts--pro .tm-bfacts__sub { font-size: 11px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-bfacts--pro .tm-bfacts__v { font-size: var(--tm-density-font-data); font-weight: var(--tm-font-weight-medium); }
.tm-bfacts--pro .tm-bfacts__note { padding: 4px var(--tm-density-pad-cell); border-top: 1px solid var(--tm-color-divider); font-size: 11px; }
@container tm-panel (width < 360px) { .tm-bfacts--pro { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tm-bfacts--pro .tm-bfacts__cell:nth-child(2) { border-right: 0; } .tm-bfacts--pro .tm-bfacts__cell:nth-child(-n+2) { border-bottom: 1px solid var(--tm-color-divider); } }
