/* 2.9.1 (E, 10/23: "minimize the scrolling sideways ... fit everything in one page and a little bit of scrolling down")
   Boards that used to run off the right edge now wrap into rows that fit the window; each column keeps its own short
   scroll. Measured with tools/audit-hscroll.mjs at 1920, 1440, 1366, 1024 and 390 px. */

/* Work > tickets as cards (kanban): lanes wrap into rows instead of one long strip */
.dk-kanban { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-items: start; overflow-x: hidden; scroll-snap-type: none; }
.dk-lane { flex: none; min-width: 0; max-height: min(460px, 52vh); overflow-y: auto; overscroll-behavior: contain; }
.dk-lane-head { position: sticky; top: calc(-1 * var(--sp-2)); z-index: 1; background: inherit; }

/* Deals pipeline: stages wrap into rows; a stage with nothing in it stays small */
.gx-board { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); grid-auto-columns: auto; overflow-x: hidden; }
.gx-lane { min-width: 0; max-height: min(460px, 52vh); min-height: 0; }
@media (max-width: 760px) {
  .gx-board { grid-template-columns: minmax(0, 1fr); grid-auto-columns: auto; scroll-snap-type: none; }
  /* the filter chips wrap on a phone instead of scrolling sideways */
  .gx-tools { flex-wrap: wrap; overflow-x: visible; }
  .gx-tools > * { flex: 0 1 auto; min-width: 0; max-width: 100%; }
  .gx-tools select { max-width: 100%; }
}

/* Permits board: the five lanes wrap on a laptop or tablet instead of scrolling */
@media (max-width: 1240px) and (min-width: 761px) {
  .ph-board { grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); overflow-x: visible; scroll-snap-type: none; }
}
@media (max-width: 760px) { .ph-lanepick { overflow-x: visible; } .ph-lanepick .ph-seg { min-width: 0; flex-wrap: wrap; } }

/* Today: a list row never makes its card wider than the screen */
.tb-list { grid-template-columns: minmax(0, 1fr); }
.tb-list > li { min-width: 0; }

/* Analytics table widgets: long values wrap inside the card instead of pushing it sideways */
.an-w .an-table td, .an-w .an-table th { white-space: normal; overflow-wrap: anywhere; }
.an-w .an-table td { max-width: none; }

/* Analytics header buttons wrap on a phone */
.an-acts { flex-wrap: wrap; min-width: 0; max-width: 100%; }

/* Not changed on purpose: below 1100 px a data table (Savings and others) and the dispatch week grid (seven day columns)
   scroll inside their own box; the page itself never scrolls sideways. tools/audit-hscroll.mjs lists them as by design. */

/* 2.9.2 paste a SolarGrade link from Dispatch (web/sg-link.js) */
.sgp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; min-width: 0; }
.sgp input { flex: 1 1 280px; min-width: 0; }
.sgp > span { flex: 1 1 100%; }
.sgp-c { margin-top: 0; flex: 1 1 360px; }
.sgp-list summary { cursor: pointer; }
.sgp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.sgp-row > a { flex: 0 1 300px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
