/* pd_history_html - the closed-container history search modal.
 *
 * The form's rules, kept here because the Anvil server strips a style body out
 * of an HTML template.
 *
 * SCOPING. This form's DOM is moved into the JS modal portal by
 * px_form_alert, so it must carry every rule it needs on its OWN private root
 * class and must never lean on .pack-deliveries-root as an ancestor.
 * .pdLayout-history-modal is the root itself and stays BARE - wrapped in
 * :where() it would still match, but the root rule has to outrank the scoped
 * reset. Every descendant rule gains :where(.pack-deliveries-history-root),
 * which adds zero specificity, so no rule changes which competitor it beats.
 *
 * ORDER: this head link loads before theme.css AND before the dependency's
 * runtime head injection, so it loses any tie. Audited rule by rule - the one
 * shared name either sheet also declares is the dependency's
 * [data-theme="dark"] input rule, which declares only color-scheme and is
 * disjoint from the width/padding/border set below.
 *
 * The two ::after escapes are copied character for character. Re-encoding
 * ' \25BC' / ' \25B2' silently changes the sort arrows.
 */

.pdLayout-history-modal { padding: 12px; min-width: 720px; max-width: 1100px; }
:where(.pack-deliveries-history-root) .pdLayout-history-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  align-items: end;
}
:where(.pack-deliveries-history-root) .pdLayout-history-filters label { font-size: 12px; color: var(--px-text-muted); display: block; margin-bottom: 2px; }
:where(.pack-deliveries-history-root) .pdLayout-history-filters input,
:where(.pack-deliveries-history-root) .pdLayout-history-filters select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--px-border);
  border-radius: var(--px-radius-sm);
}

/* The template's one inline style=, which a template may not
   carry. Nothing toggles it, so it is a plain static rule and no name outside
   this form declares it. */
:where(.pack-deliveries-history-root) .pdLayout-history-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

:where(.pack-deliveries-history-root) .pdLayout-history-results { max-height: 60vh; overflow-y: auto; }
:where(.pack-deliveries-history-root) .pdh-row {
  display: grid;
  grid-template-columns: 80px 1fr 130px 110px 110px 140px;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--px-border);
  cursor: pointer;
  font-size: 13px;
}
:where(.pack-deliveries-history-root) .pdh-row:hover { background: var(--px-bg-elevated); }
:where(.pack-deliveries-history-root) .pdh-row-header {
  font-weight: 600;
  background: var(--px-bg-elevated);
  cursor: default;
}
:where(.pack-deliveries-history-root) .pdh-row-header span {
  cursor: pointer;
  user-select: none;
}
:where(.pack-deliveries-history-root) .pdh-row-header span.is-sort::after {
  content: ' \25BC';
  font-size: 10px;
  color: var(--px-text-muted);
}
:where(.pack-deliveries-history-root) .pdh-row-header span.is-sort.is-asc::after {
  content: ' \25B2';
}
