/* Live mode, phone and small tablet layout. Everything is scoped to .is-live and to narrow screens,
   so desktop is untouched. Loaded after live.css. */
@media (max-width: 720px) {
  /* page grids: a single auto column grows to the widest child (a long table or title); pin it to the viewport */
  .is-live .page, .is-live .page.narrow { grid-template-columns: minmax(0, 1fr); }
  .is-live .page > * { min-width: 0; }

  /* top bar: the breadcrumb (long part codes) may shrink and cut with an ellipsis instead of pushing the bar wide */
  .is-live #topbar { gap: 8px; }
  .is-live #topbar > .row { flex: 1 1 0; min-width: 0; }
  .is-live .crumbs { flex: 1 1 0; min-width: 0; overflow: hidden; }
  .is-live .crumbs .cur { flex: 0 1 auto; min-width: 0; white-space: nowrap; }
  .is-live .crumbs a, .is-live .crumbs .sep { flex: none; }
  .is-live .tb-right { gap: 4px; }
  .is-live .icon-btn { min-width: 40px; min-height: 40px; }

  /* page heads: title first, action buttons wrap below it at full width */
  .is-live .page-head { flex-wrap: wrap; align-items: flex-start; gap: 14px; }
  .is-live .page-head > * { min-width: 0; }
  .is-live .page-head h1 { font-size: 24px; overflow-wrap: anywhere; }
  .is-live .ph-actions { flex: 1 1 100%; flex-wrap: wrap; gap: 8px; }
  .is-live .ph-actions > .btn, .is-live .ph-actions > a.btn { flex: 1 1 auto; }

  /* tap targets for primary and ordinary buttons (small buttons stay compact inside tables) */
  .is-live .btn:not(.sm) { min-height: 40px; }
  .is-live .btn.sm { min-height: 36px; }

  /* tables scroll inside their own wrapper, never the page */
  .is-live .table-wrap, .is-live .card > .table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .is-live .card { min-width: 0; max-width: 100%; }
  .is-live .ad-people-h { padding: 16px; flex-wrap: wrap; }

  /* library: library.css collapses the split to "1fr", which still grows to the widest child; pin it */
  .is-live .lb-split, .is-live .lb-as-grid { grid-template-columns: minmax(0, 1fr); }
  .is-live .lb-split > *, .is-live .lb-main { min-width: 0; }
  .is-live .lb-mh { flex-wrap: wrap; gap: 10px; }
  .is-live .lb-live-note { min-width: 180px; max-width: none; }

  /* wide tables keep a readable width and scroll sideways inside their wrapper */
  .is-live .sp-st, .is-live .ad-table, .is-live .lb-live-t, .is-live .lb-as-t { min-width: 560px; }

  /* long words in cards wrap rather than stretch the layout (break-word does not shrink table columns) */
  .is-live .card, .is-live .sp-head, .is-live .rs-row { overflow-wrap: break-word; }

  /* results: context strip stacks (picture beside title, facts underneath) */
  .is-live .rs-ctx { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 16px; align-items: start; }
  .is-live .rs-ctx-art { width: 64px; height: 56px; }
  .is-live .rs-ctx-t h2 { font-size: 18px; }
  .is-live .rs-ctx .rs-ctx-m { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); max-width: none; }
  .is-live .rs-ctx-m > div { grid-template-columns: 90px minmax(0, 1fr); align-items: start; }
  .is-live .rs-ctx-m dd { flex-wrap: wrap; }

  /* results: funnel label sits above its bar; side cards stack; donut legend goes under the ring */
  .is-live .rs-fun .funnel .fn-row, .is-live .fn-row { grid-template-columns: minmax(0, 1fr) 70px; gap: 6px 12px; }
  .is-live .fn-row .fn-l { grid-column: 1 / -1; }
  .is-live .fn-row .fn-track { grid-column: 1; grid-row: 2; }
  .is-live .fn-row .fn-v { grid-column: 2; grid-row: 2; }
  .is-live .rs-side { grid-template-columns: minmax(0, 1fr); }
  .is-live .rs-side .donut-wrap { flex-direction: column; align-items: stretch; gap: 14px; }
  .is-live .rs-side .donut-wrap .chart-box, .is-live .rs-side .donut-wrap .dn-box { align-self: center; }

  /* results: supplier rows. The (hidden in live) tick column is dropped so the name gets the width */
  .is-live .rs-row { grid-template-columns: 22px minmax(0, 1fr) auto; column-gap: 10px; padding: 14px 14px 12px; }
  .is-live .rs-row .rs-ck { display: none; }
  .is-live .rs-row .rs-rank { grid-column: 1; }
  .is-live .rs-row .rs-main { grid-column: 2; }
  .is-live .rs-row .rs-act { grid-column: 3; }
  /* column 3 belongs to the action buttons, so the text lines stay in column 2 */
  .is-live .rs-row .rs-why, .is-live .rs-row .rs-docs { grid-column: 2; padding-left: 0; }
  .is-live .rs-why span { white-space: normal; }
  .is-live .rs-filters { padding: 12px 14px; }
  .is-live .rs-find, .is-live .rs-find .input { width: 100%; }
  .is-live .rs-lh, .is-live .rs-group { padding-left: 14px; padding-right: 14px; }
}
