/* Mobile corrections — §6 of the launch list.
 *
 * A separate file rather than more rules buried in app.css's 1,600 lines. Every
 * rule here fixes something observed on a phone, and each one says what.
 *
 * Loaded last, so it wins over app.css without needing !important except where
 * app.css already used it. */

@media (max-width: 768px) {

  /* ── the toolbar ──────────────────────────────────────────────────────────
     The account pill sat on top of the tab strip and clipped the labels to
     "Catalyst F", "Coa", "Guid". The bar scrolls horizontally, so the fix is
     to stop the tabs shrinking and give the pill a lane of its own rather than
     letting it overlap what is behind it. */
  .suite-bar {
    gap: 2px;
    padding-right: 2px;
  }
  .suite-tab {
    flex: 0 0 auto;        /* never squeeze a label to fit */
    white-space: nowrap;
  }
  .account {
    /* .account is sticky (css/account.css) so it stays reachable. Give it an
       opaque backing and a hard edge so tabs scrolling underneath are cut off
       cleanly instead of bleeding through the avatar. */
    box-shadow: -8px 0 10px -6px var(--bg);
    z-index: 2;
  }
  .account-btn { max-width: 44px; padding: 0 2px; }
  .account-avatar { width: 22px; height: 22px; }
  .account-caret { display: none; }

  /* ── the preview banner ───────────────────────────────────────────────────
     Fixed to the bottom, so it sat on top of whatever was there -- half the
     Coach composer, a Market Intel quick-bar button. Reserve its height at the
     bottom of the scroll container instead of covering content. */
  body.preview .suite-content { padding-bottom: 84px; }
  body.preview .coach-composer { margin-bottom: 8px; }

  /* ── inputs: placeholders were being cut mid-word ────────────────────────
     "Ticker (AAPL,", "Watchlis", "Add tick". Monospace at 12px needs more room
     than these had, so the fields grow and the text shrinks a little. */
  .mi-inp,
  #mi-ticker-inp {
    min-width: 0 !important;
    width: 100%;
    flex: 1 1 100% !important;
    font-size: 12px;
  }
  #cf-watchlist-sel { max-width: 100% !important; flex: 1 1 auto; }
  .sw-page .inp,
  #newTicker { width: 100% !important; min-width: 0; }

  /* The watchlist toolbar ran "Mass Import" off the right edge. Let it wrap. */
  .sw-page .topbar {
    flex-wrap: wrap !important;
    row-gap: 6px;
  }
  .sw-page .topbar .btn { flex: 0 0 auto; }

  /* ── Market Intel index tiles left dead space on the right ──────────────── */
  #mi-index-bar {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 6px;
  }
  #mi-index-bar > * { min-width: 0; }

  /* ── section headers wrapped awkwardly ──────────────────────────────────── */
  .mi-section-title,
  .mi-card-title {
    font-size: 11px;
    line-height: 1.35;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  /* ── dashboard stats were one per row ───────────────────────────────────── */
  .dash-stats {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }
  .dash-stats > * { min-width: 0; }

  /* ── things that overflowed the right edge ──────────────────────────────
     The Fair Value card, the quarterly revenue legend and its source buttons.
     Nothing inside a card may be wider than the card. */
  .mi-card,
  .mi-panel,
  #page-mi .card {
    max-width: 100%;
    overflow-x: hidden;
  }
  #page-mi table { max-width: 100%; }
  .rev-legend,
  .rev-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
  }
  .rev-links a { flex: 0 1 auto; }

  /* ── the time-of-day heatmap ────────────────────────────────────────────
     24 columns will never fit a phone. Give it its own scroller rather than
     crushing every column to unreadable width, and keep the page itself from
     scrolling sideways. */
  .hour-heatmap,
  #hourHeatmap,
  .heatmap-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .hour-heatmap > *,
  #hourHeatmap > * { min-width: 560px; }
}

/* Very narrow phones. */
@media (max-width: 400px) {
  .suite-tab { font-size: 9px; padding: 0 6px; }
  .dash-stats { gap: 6px; }
}
