/* Small-screen layout across the complete GHFX workspace. */
@media (max-width: 800px) {
  aside { position: sticky; top: 0; z-index: 20; height: auto; padding: 10px 12px; width: 100%; }
  .brand { max-width: 145px; }
  aside > small, .asidebottom { display: none; }
  nav { display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-inline: contain; margin: 8px -2px 0; padding: 0 2px 4px; scrollbar-width: thin; }
  nav button { flex: 0 0 auto; width: auto; min-height: 40px; margin: 0; padding: 9px 12px; white-space: nowrap; font-size: 12px; }
  main { width: 100%; max-width: none; margin: 0; padding: 0 16px; }
  header { min-height: 52px; height: auto; gap: 8px; }
  #intro { margin: 20px 0 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .ghfx-dashboard-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ghfx-dashboard-layout > .ghfx-stat, .ghfx-dashboard-layout > .ghfx-widget { grid-column: span 1; }
  .ghfx-dashboard-layout > .ghfx-widget.ghfx-wide { grid-column: 1 / -1; }
  .widejournal { max-height: 65vh; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .widejournal table { min-width: 2180px; }
  .journalcard .filters input { min-width: min(260px, 100%); }
  #tradeDialog { width: min(760px, 96vw); max-width: 96vw; padding: 20px; }
  .imageDialog, .demoDialog { max-width: 96vw; }
  .news-side-panels { min-width: 0; }
}

@media (max-width: 520px) {
  main { padding: 0 10px; }
  .card { padding: 14px; }
  header { align-items: flex-start; padding: 9px 0; }
  header > span:first-child { padding-top: 6px; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .header-actions button { min-height: 36px; }
  #intro { grid-template-columns: minmax(0, 1fr); }
  .ghfx-intro-copy, #intro > #add, .ghfx-header-session-clock { grid-column: 1; justify-self: stretch; }
  #intro > #add { grid-row: 3; justify-self: start; }
  .ghfx-header-session-clock { grid-row: 2; }
  .stats, .ghfx-dashboard-layout { grid-template-columns: minmax(0, 1fr); }
  .ghfx-dashboard-layout > .ghfx-stat, .ghfx-dashboard-layout > .ghfx-widget, .ghfx-dashboard-layout > .ghfx-widget.ghfx-wide { grid-column: 1; }
  .ghfx-headline-grid { grid-template-columns: minmax(0, 1fr); }
  .ghfx-streak-pair { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ghfx-streak-pair strong { font-size: clamp(20px, 7vw, 29px); overflow-wrap: anywhere; }
  .ghfx-account-grid, .ghfx-live-equity, .calc-supporting-results { grid-template-columns: minmax(0, 1fr); }
  .ghfx-session-grid, .sessionclocks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-column-list, .ghfx-widget-options { grid-template-columns: minmax(0, 1fr); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .actions { flex-wrap: wrap; }
  .actions button { flex: 1 1 130px; }
  .news-calendar-card .cardhead { align-items: flex-start; }
  body.calendar-page #content > .news-calendar-card .news-content-layout { grid-template-columns: minmax(0, 1fr); }
  body.calendar-page #content > .news-calendar-card .news-side-panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  body.calendar-page #content > .news-calendar-card .news-headline-panel { max-height: none; }
  body.calendar-page #content > .news-calendar-card .news-headline-scroll { max-height: 440px; }
  body.calendar-page #content > .card .filters { align-items: stretch; }
  body.calendar-page #content > .card .filters select { flex: 1 1 145px; min-width: 0; }
  footer { gap: 8px; }
}
