.workspace-grid > *,
.learning-grid > * {
  min-width: 0;
}

@media (max-width: 560px) {
  .main-content,
  .panel,
  .table-wrap {
    min-width: 0;
    max-width: 100%;
  }
}

/* --- Mobile UX overhaul: chart-first, touch pan/zoom, less clutter --- */
.chart-wrap canvas,
.indicator-wrap canvas {
  touch-action: none;
}

@media (max-width: 920px) {
  /* Chart canvas immediately under the asset header; toolbars move below the chart */
  .chart-panel {
    display: flex;
    flex-direction: column;
  }
  .chart-panel .panel-head { order: -5; }
  .chart-panel .replay-status { order: -4; }
  .chart-panel .chart-wrap { order: -3; }
  .chart-panel .indicator-wrap { order: -2; }
  .chart-panel .chart-foot { order: -1; }
  .chart-panel > * { margin-top: 10px; }
  .chart-panel > .panel-head { margin-top: 0; }

  .chart-wrap { height: 46vh; min-height: 300px; }

  /* Toolbars become single-line horizontal scrollers */
  .range-tabs,
  .chart-toolbar,
  .indicator-toolbar,
  .replay-controls {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
  }
  .range-tabs::-webkit-scrollbar,
  .chart-toolbar::-webkit-scrollbar,
  .indicator-toolbar::-webkit-scrollbar,
  .replay-controls::-webkit-scrollbar { display: none; }
  .range-tabs button,
  .chart-toolbar button,
  .replay-controls button {
    flex: 0 0 auto;
    min-height: 38px;
  }
  .indicator-toolbar label { flex: 0 0 auto; }

  /* Declutter: decorative labels and secondary copy hidden on mobile */
  .section-label,
  .topbar .kicker,
  .chart-foot span:not(#candleTime):not(#positionAverageStatus),
  .account-strip article span,
  .journal-panel .panel-head p,
  .signal-panel .panel-head p { display: none; }

  .topbar h1 { font-size: 24px; margin: 0 0 4px; }
  .panel-head h2 { font-size: 17px; }
  .panel { padding: 14px; }

  /* Chart-first: compress everything above the chart */
  .topbar-copy h1 { display: none; }
  .topbar .mobile-brand { margin-bottom: 8px; }
  .symbol-switcher label,
  #symbolSwitcherStatus,
  .auth-hint { display: none; }
  .topbar { gap: 8px; }
  .top-actions { margin-top: 0; }
  .top-actions button { min-height: 38px; }
}
