/* ============================================================================
   DOFT Loadboard — load search results header (2026-08-13)
   Owner report: the "List | Map … Select · N loads found" row sits too close to
   the grid and too far from the filters, and Select slides left whenever the
   count is absent.
   Loaded last, after round11. Scoped to the search grids only.
   ============================================================================ */

/* --------------------------------------------------------------------------
   1) Swap the row's vertical gaps.
      Before: 8px between the SEARCH button and the row, 18px between the row
      and the grid — the row read as a footer of the filter block instead of a
      header of the table it labels. Now 18px above (the gap that used to be
      below) and 8px below, binding the row to its grid.
      The top gap is padding on the wrapper, NOT margin on the two children: the
      List/Map pill is in flow so its margin-top collapses out through the
      border-less wrapper, while the floated #loadsCountBlock's does not. Any
      shared margin-top therefore drops the count line by that much relative to
      the pill — it is already 4.5px low today because of the 8px both carry.
      Padding on the wrapper starts both children on the same line and closes
      that gap. Longhands, not the `margin` shorthand: #loadsCountBlock's
      margin-left:16px (round7 §5) is the gutter between the count and the pill
      and must survive.

      ⚠ SCOPE. This was keyed on `.loads-page:not(.my-loads-page)`, and the negation was wrong
      twice over: SIX pages wear .loads-page, and only three of them have the count row this
      section is aligning. dispatch/my-loads carries just `loads-page` (its panel twin also
      carries `my-loads-page`), so the exclusion missed it and split the two My Loads twins
      apart by 18px; and shipper/loads has no #loadsCountBlock at all, so it took 18px of dead
      spacing above a row it does not have. Keyed instead on the element this very change ADDED:
      #loadsCountLabel exists only in the three JSPs it edited, so the layout half can no longer
      reach a page that did not receive the markup half. Excluding pages one at a time as they
      are discovered is what leaked onto two pages in a single round.

      #loadsCountBlock is also given the pill's own height rather than only having its margin
      zeroed: the two boxes are different heights (the block is display:flex/align-items:center,
      the pill is taller), so aligning their border-box TOPS left the text 3.5px off the pill's
      centre line — the same misalignment the paragraph above set out to close, in the other
      direction. Matching the height puts both on one centre line and takes it to 0.
   -------------------------------------------------------------------------- */
html[data-refresh] .loads-page #dTable_wrapper:has(#loadsCountLabel) {
  padding-top: 18px !important;
}
html[data-refresh] .loads-page #dTable_wrapper:has(#loadsCountLabel) > .wow-maptoggle,
html[data-refresh] .loads-page #dTable_wrapper:has(#loadsCountLabel) > #loadsCountBlock {
  margin-top: 0 !important;
  margin-bottom: 8px !important;
}
html[data-refresh] .loads-page #dTable_wrapper:has(#loadsCountLabel) > #loadsCountBlock {
  /* !important is not decoration here: refresh-hotfix-20260729-darkmode-round7.css:241 declares
     min-height:34px !IMPORTANT on this same element, and an important author declaration beats a
     normal one whatever the specificity - so this rule was silently discarded and the count stayed
     34px against the 41px pill. The two margin longhands above already carry it, which is why the
     gap swap landed while the height fix alone did not. */
  min-height: 41px !important;
}

/* --------------------------------------------------------------------------
   2) Keep Select pinned to the grid's right edge with or without the count.
      #loadsCountBlock is a right-floated shrink-to-fit box that ALWAYS renders
      the literal " loads found"; when no origin/destination filter is applied
      the block is merely visibility:hidden, so that invisible text still
      measured ~139px and pushed the Select bar — which ai-call.js prepends
      INSIDE the block — that far left of the table's right edge.
      The phrase now lives in #loadsCountLabel (panel/dispatch/private loads
      JSPs; the JS that hides the block now also clears #loadsCount) and is
      collapsed out of flow while #loadsCount is empty, so the bar's position
      stops depending on whether its sibling rendered.
   -------------------------------------------------------------------------- */
html[data-refresh] .loads-page #loadsCountBlock:has(#loadsCount:empty) #loadsCountLabel {
  display: none !important;
}
/* With the label collapsed the bar is the block's only content, so the 12px
   gutter that separated it from "N loads found" (round10 §1) would hold Select
   12px short of the very edge the count aligns to. */
html[data-refresh] .loads-page #loadsCountBlock:has(#loadsCount:empty) #aiCallSelectModeBar {
  margin-right: 0 !important;
}
