/* One 40px top bar (TradingView layout): the chart toolbar (#chartTools) lives inside #topbar, so the second toolbar row
   is gone and the chart gets that height. Secondary text in the header shrinks to icons/dots; what still does not fit
   goes to the «···» menu (toolsOverflow.js measures #chartTools as it is now laid out). Desktop and split-screen only. */
@media (min-width: 640px) {
  :root { --topbar-h: 40px; --tools-h: 0px; }
  #app { grid-template-rows: 40px 0 minmax(0, 1fr) var(--bottom) !important; }
  #topbar { height: 40px; gap: 2px; padding: 0 var(--s2); }
  #topbar .wordmark { display: none; }                 /* the mark alone, like TV's avatar spot */
  #topbar .market { gap: var(--s2); padding-left: 0; }
  #topbar .daily-change small { display: none; }        /* «24 год» — the % stays */
  #topbar .balance { display: none; }                    /* the demo balance is in the bottom bar */
  #connHealth #connLabel, #connHealth #connLat { display: none; } /* the coloured dot carries the state; title explains */
  #topbar .spacer { flex: 0 0 2px; }
  #topbar > #chartTools {
    flex: 1 1 auto; min-width: 0; height: 100%; padding: 0 var(--s1); border: 0; background: transparent;
    border-left: 1px solid var(--border); margin-left: var(--s1);
  }
  #topbar > #chartTools .tb-spacer { flex: 1 1 0; }
  /* Log / % / invert sit under the price axis, bottom right */
  .chart-foot .scale-btns { display: inline-flex; gap: 1px; margin-left: var(--s2); }
  .chart-foot .scale-btns .tb { height: 20px; min-width: 26px; padding: 0 6px; font: 500 var(--fs-2xs)/1 var(--sans); color: var(--muted); background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
  .chart-foot .scale-btns .tb:hover { color: var(--text); background: var(--hover); }
  .chart-foot .scale-btns .tb.active, .chart-foot .scale-btns .tb[aria-pressed="true"] { color: var(--text); background: var(--selected); }
}
@media (max-width: 639px) { .chart-foot .scale-btns { display: none; } }
@media (min-width: 640px) {
  /* room for undo/redo and «···» in one row: the 24h % is in the legend and the watchlist already */
  #topbar .daily-change { display: none; }
  #topbar > #chartTools .tfbar button { padding: 0 6px; min-width: 0; }
}
@media (min-width: 1600px) { #topbar .daily-change { display: inline-flex; } }
@media (min-width: 640px) and (max-width: 1199px) {
  /* narrow window: only the active timeframe stays, the rest is one click away in «⌄» */
  #topbar > #chartTools.compact .tfbar button:not(.active) { display: none; }
}
@media (min-width: 640px) and (max-width: 959px) {
  #topbar #hdrPrice { display: none; }   /* the price is on the axis and in the legend */
  #sessionsChip { display: none; }
}
@media (min-width: 640px) and (max-width: 959px) {
  #acctChip.btn { font-size: 0; gap: 0; padding: 0 6px; }   /* «Увійти» → its icon (title keeps the words) */
  #acctChip .icon { width: 16px; height: 16px; }
  #acctChip .badge { display: none; }
}
@media (min-width: 640px) {
  /* in one row the replay / undo / right-group separators only fence empty space: keep the three main ones */
  #topbar > #chartTools > .sep.s4, #topbar > #chartTools > .sep.s5, #topbar > #chartTools > .sep.rs { display: none; }
  /* spacing as padding (not margin) so toolsOverflow.js measures it */
  #topbar > #chartTools > .sep { margin: 0; padding: 0 4px; box-sizing: content-box; background-clip: content-box; }
}
@media (min-width: 640px) and (max-width: 959px) {
  #topbar #connHealth, #topbar #btnHelp { display: none; }  /* state: the legend; help: the «?» in the right rail */
}
