/* Complaints list on phones (Ali, 22 Oct 2026): compact. The summary folds to one line (statuses behind a tap), Filters open as a bottom sheet,
   and every complaint is two short lines instead of a tall card. Same colours, fonts and pills as everywhere; only the spacing changes. */
.f-done, .sl-more { display: none; }
@media (max-width: 700px) {
  /* title and count on one line */
  .page-head:has(#c-sub) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; margin-bottom: 10px; }
  .page-head:has(#c-sub) > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; min-width: 0; }
  .page-head:has(#c-sub) h1 { margin: 0; }
  .page-head:has(#c-sub) p { margin: 0; white-space: nowrap; }
  .page-head:has(#c-sub) .head-btns { display: contents; }
  .page-head:has(#c-sub) #new { grid-column: 2; grid-row: 1; min-height: 44px; }
  .page-head:has(#c-sub) .seg { grid-column: 1; grid-row: 2; flex: none; }
  .page-head:has(#c-sub) #export { grid-column: 2; grid-row: 2; min-height: 36px; height: 36px; padding-top: 0; padding-bottom: 0; }
  /* summary: headline, gauge, four group counts and one Statuses tap */
  .sline-compact { padding: 8px 12px 4px; margin-bottom: 6px; }
  .sline-compact .sline-head b { font-size: 1.5rem; }
  .sline-compact .sline-key { margin-top: 4px; align-items: center; gap: 0 12px; }
  .sline-compact .sl-more { display: inline-flex; align-items: center; gap: 4px; margin-left: 12px; min-height: 36px; margin-block: -6px; padding: 0 2px; background: none; border: 0; color: var(--link); font: 600 0.85rem var(--font); }
  .sline-compact .sl-more::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); transition: transform 0.15s; }
  .sline-compact .sl-more[aria-expanded="true"]::after { transform: rotate(-135deg); }
  .sline-compact:not(.sl-open) .sline-legend { display: none; }
  .c-tools { margin-bottom: 4px; }
  #results > .count { margin: 0 0 4px; font-size: 0.82rem; }
  /* Filters: a sheet over the page, never pushing the list down */
  .c-tools.f-open::before { content: ""; position: fixed; inset: 0; z-index: 60; background: rgba(13, 27, 42, 0.4); }
  .c-tools.f-open .filters { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; margin: 0; max-height: 80vh; overflow-y: auto; overflow-x: hidden; flex-wrap: wrap; gap: 10px; background: var(--surface);
    border-radius: 18px 18px 0 0; padding: 20px 16px calc(var(--safe-b, 0px) + 16px); box-shadow: 0 -8px 30px rgba(13, 27, 42, 0.25); }
  .c-tools.f-open .filters > * { flex: 1 1 100%; }
  .c-tools.f-open .filters .check { flex: 1 1 auto; }
  .c-tools.f-open .filters select { width: 100%; }
  .c-tools .filters .f-done { display: flex; order: 9; justify-content: center; }
  .c-list .ls-sortbox, .c-list .c-sortli { padding: 4px 12px; gap: 8px; }
  .c-list .c-sortli label { display: flex; align-items: center; gap: 6px; }
  .c-list .c-sortli select, .c-list .c-sortli .btn { min-height: 36px; height: 36px; padding-top: 0; padding-bottom: 0; font-size: 0.85rem; }
  /* tighter controls: search, Filters, List/Board, Export, New Complaint */
  .c-tools .search-box input, .c-tools .filters-btn { min-height: 36px; height: 36px; }
  .c-tools .filters-btn { padding: 0 12px; }
  .page-head:has(#c-sub) .seg button { min-height: 34px; }
  /* one complaint = two short lines: tag + name + status, then the equipment and fault, days and people */
  .c-list .c-row, .c-list .with-days .c-row { grid-template-columns: auto minmax(0, 1fr) auto 56px; grid-template-areas: "ref name stage stage" "eq eq days people" "desc desc desc desc" "flags flags flags flags"; gap: 2px 10px; padding: 8px 12px; align-items: center; }
  .c-list .c-row.has-next { grid-template-rows: auto auto 36px; }
  .c-row .row-ref { grid-area: ref; }
  .c-row .row-ref small { display: none; }
  .c-row .row-main, .c-row .row-stage, .c-row .row-stage .status { display: contents; }
  .c-row .row-main b { grid-area: name; min-width: 0; font-size: 0.98rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .c-row .row-main small { display: contents; }
  .c-row .row-eq { grid-area: eq; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .c-row .row-desc { grid-area: desc; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); }
  .c-row.has-next .row-desc { -webkit-line-clamp: 1; align-self: center; max-width: calc(100% - 140px); }
  .c-row .row-main small.match-line { display: block; grid-area: auto; grid-column: 1 / -1; }
  .c-row .status-line { grid-area: stage; justify-self: end; }
  .c-row .status-due { display: none; }
  .c-row .row-flags { grid-area: flags; justify-self: start; }
  .c-row .row-days { grid-area: days; display: flex; margin: 0; justify-self: end; }
  .c-row .row-days small { display: none; }
  .c-row .row-people.kv { grid-area: people; justify-self: end; display: flex; gap: 4px; width: 56px; max-width: none; justify-content: flex-end; }
  .c-row .row-people.kv dt, .c-row .row-people.kv dd:nth-of-type(3) { display: none; }
  .c-row .row-people.kv dd { min-height: 0; }
  .c-row .row-people .av, .c-row .row-people .wt-noav { width: 24px !important; height: 24px !important; font-size: 0.6rem !important; }
  .c-list > li > .row-next { position: absolute; right: 12px; bottom: 8px; transform: none; width: auto; min-height: 36px; height: 36px; padding: 0 12px; font-size: 0.88rem; }
  .c-list > li > .row-next:active:not(:disabled) { transform: scale(0.97); }
}
/* Phone standards (Ali, 14 Nov 2026; docs/redesign/TEXTBOOK.md). Phones only. */
@media (max-width: 700px) {
  /* the row button is 30 high and ONE width: every button starts on the same left edge (never sized by its words) */
  .c-list > li > .row-next.row-next { width: 128px; min-height: 30px; height: 30px; padding: 0 6px; justify-content: center; white-space: nowrap; }
  .c-list .c-row.has-next { grid-template-rows: auto auto 30px; }
  /* the status pill comes last on its line, so every pill ends on the same right edge; Late and Urgent sit before it */
  .c-row .status-line { flex-wrap: nowrap; }
  .c-row .status-line .status-pill { order: 2; }
  /* the group counts under the gauge: the tap height of a row button */
  .sline-compact .sline-key a { display: inline-flex; align-items: center; min-height: 30px; }
}
