/* Reusable component styles: header, badges, table, sparkbars, keymap
 * overlay, drawer, banners, skeletons. */

/* ---- Header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-h2);
  color: var(--text-primary);
  white-space: nowrap;
}

.brand-mark {
  width: 1.4em;
  height: 1.4em;
  flex: none;
}

.brand-mark-glow {
  fill: var(--lamp-glow);
}

.brand-mark-rays {
  stroke: var(--lamp-glow);
}

.brand-tagline {
  font-size: var(--text-body-md);
  color: var(--text-secondary);
  white-space: nowrap;
}

@media (max-width: 1365px) {
  .brand-tagline {
    display: none;
  }
}

.snapshot-chip {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-pill);
  padding: 2px var(--space-sm);
  border: 1px solid var(--border-subtle);
}

/* NB-2: a failed snapshot fetch (U-15) — the chip must be visibly
 * distinct from its normal "id · version" state, never a silent
 * "Loading..." that never resolves. */
.snapshot-chip.error-chip {
  color: var(--text-primary);
  background: var(--quad-graveyard-wash);
  border-color: var(--quad-graveyard);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
  flex-wrap: wrap;
}

.header-filter-group {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
}

.header-filter-group[hidden] {
  display: none;
}

.field-label {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  margin-right: var(--space-2xs);
}

select.control,
input.control {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 6px var(--space-sm);
  color: var(--text-primary);
}

.icon-button {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 6px var(--space-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.icon-button:hover {
  background: var(--bg-surface-hover);
}

/* ---- Primary nav (06 §2 Leaderboard/Matrix/Compare/Configure/Methodology) ---- */
.primary-tabs {
  position: sticky;
  top: var(--header-height);
  z-index: 19;
  display: flex;
  gap: var(--space-xs);
  padding: 0 var(--space-md);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.primary-tabs::-webkit-scrollbar {
  display: none;
}

.primary-tab {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.primary-tab:hover {
  color: var(--text-primary);
}

.primary-tab[aria-selected="true"] {
  color: var(--text-primary);
  border-bottom-color: var(--accent-violet);
}

/* ---- Onboarding subtitle ---- */
.onboarding-banner {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-body-md);
  color: var(--text-secondary);
  line-height: 1.45;
}

.onboarding-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 500;
}

.onboarding-link:hover {
  text-decoration: underline;
}

/* ---- Tabs (Leaderboard's own Ranked/Not-ranked sub-tabs) ---- */
.tabs {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-md);
}

.tab {
  padding: var(--space-xs) var(--space-md);
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
}

.tab[aria-selected="true"] {
  color: var(--text-primary);
  border-bottom-color: var(--accent-cyan);
}

.tab .count {
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-left: var(--space-2xs);
}

/* ---- Counts strip (always visible; U-2) ---- */
.counts-strip {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  padding: var(--space-2xs) 0 var(--space-sm);
}

/* ---- Corpus meter: how much of the snapshot is rated at all ----
 * A part-to-whole of ONE population, so a single stacked bar, not three
 * bars. Segment colours come from --corpus-* (validated; see tokens.css).
 * The 2px surface gap between fills is the dataviz mark spec — it keeps
 * adjacent segments readable without an outline, including in
 * forced-colors mode where the fills may be overridden. */
.corpus-meter {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  /* No track fill. The segments always sum to the whole, so a track adds
   * nothing -- and it actively misled: the recessive `gated` segment (the
   * MAJORITY of a mid-collection snapshot) sat at 2.4:1 against
   * --bg-surface-elevated and read as empty track rather than as the
   * largest share. The 2px inter-segment gaps now show the page surface,
   * which delimits each segment crisply without a competing fill. */
}

.corpus-seg {
  flex-basis: 0;
  min-width: 2px; /* a tiny share stays visible instead of vanishing */
}

/* Rounded data-ends anchored to the ends of the bar (dataviz mark spec):
 * only the outer edges round, so the inner joins stay square and the
 * proportions read true. */
.corpus-meter .corpus-seg:first-child {
  border-radius: var(--radius-pill) 0 0 var(--radius-pill);
}

.corpus-meter .corpus-seg:last-child {
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
}

.corpus-seg-rated { background: var(--corpus-rated); }
.corpus-seg-gated { background: var(--corpus-gated); }
.corpus-seg-unrated { background: var(--corpus-unrated); }

.corpus-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  align-items: baseline;
}

.corpus-key {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2xs);
}

/* The swatch is decoration; the label and count beside it carry identity,
 * which is what lets the muted segments sit below 3:1 on the surface. */
.corpus-swatch {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-badge);
  align-self: center;
  flex: none;
}

.corpus-count {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.corpus-pct {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.corpus-lens {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 1px var(--space-xs);
}

@media (forced-colors: active) {
  /* Forced-colors drops the fills; the legend text still identifies each
   * segment, and a border keeps the proportions visible. */
  .corpus-seg,
  .corpus-swatch {
    border: 1px solid CanvasText;
  }
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 2px var(--space-xs);
  border-radius: var(--radius-badge);
  font-family: var(--font-mono);
  font-size: var(--metric-pill);
  font-weight: 600;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.badge-coverage-full .badge-dot {
  background: var(--coverage-full);
}

.badge-coverage-a .badge-dot {
  background: var(--coverage-a);
}

.badge-coverage-b .badge-dot {
  background: var(--coverage-b);
}

.badge-coverage-below .badge-dot {
  background: var(--coverage-below);
}

.tier-pill {
  font-family: var(--font-mono);
  font-weight: 700;
}

.tier-capped {
  color: var(--text-secondary);
  font-weight: 400;
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

/* No audited stars in the rows on screen: hide the column as a unit (th + td share data-col/data-cell). */
.stars-unaudited [data-col="stars"],
.stars-unaudited [data-cell="stars"] {
  display: none;
}

.quadrant-glyph {
  font-size: 1rem;
  margin-right: var(--space-2xs);
}

.quad-sweet-spot {
  color: var(--quad-sweet-spot);
}

.quad-crucible {
  color: var(--quad-crucible);
}

.quad-nursery {
  color: var(--quad-nursery);
}

.quad-graveyard {
  color: var(--quad-graveyard);
}

.suspicion-icon {
  color: var(--accent-warning);
  cursor: default;
}

.tie-mark {
  color: var(--accent-cyan);
  font-weight: 700;
  margin-left: var(--space-2xs);
  cursor: default;
}

/* ---- Sparkbars (five-pillar mini bars) ---- */
.sparkbar-group {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 20px;
}

.sparkbar {
  width: 6px;
  border-radius: 2px 2px 0 0;
  background: var(--accent-cyan);
  position: relative;
}

.sparkbar[data-unmeasured="true"] {
  background: var(--bg-surface-hover);
  border: 1px dashed var(--border-strong);
}

/* ---- Table ---- */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-md);
}

/* Owner instruction 2026-09-13: "the page itself scrolls with a sticky
 * header row." The document/window scrolls now (not a bounded `main` box),
 * so the thead sticks relative to the viewport, offset by the also-sticky
 * app header + primary nav height so they never overlap. */
.leaderboard-table thead th {
  position: sticky;
  top: calc(var(--header-height) + var(--primary-nav-height, 41px));
  z-index: 2;
  background: var(--bg-surface);
}

.leaderboard-table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-caption);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.leaderboard-table th[data-sortable="true"] {
  cursor: pointer;
}

.leaderboard-table th[data-sortable="true"]:hover,
.leaderboard-table th[data-sortable="true"].is-active {
  color: var(--text-primary);
}

.pillars-col-header {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.pillar-sort-btn {
  border: 0;
  background: transparent;
  padding: 2px 3px;
  border-radius: var(--radius-badge);
  font: inherit;
  color: var(--text-secondary);
  cursor: pointer;
}

.pillar-sort-btn:hover,
.pillar-sort-btn.is-active {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.pillar-sort-sep {
  color: var(--text-muted);
}

.leaderboard-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

/* Fixed row height so the DOM's real rendered height matches
 * components/table.js's ROW_HEIGHT_PX exactly — the windowing spacers'
 * inline heights are computed from that same constant, and any drift
 * between the two would misalign the scrollbar against the real content. */
.leaderboard-table tbody tr:not([aria-hidden="true"]) {
  height: 40px;
  box-sizing: border-box;
  cursor: pointer;
}

.leaderboard-table tbody tr:not([aria-hidden="true"]) td {
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}

.leaderboard-table tbody tr:hover,
.leaderboard-table tbody tr.row-selected {
  background: var(--bg-surface-hover);
}

.leaderboard-table tbody tr.row-tied {
  background: var(--tie-row-band);
}

/* Windowing spacers (components/table.js createSpacerElement): no border,
 * no padding, no hover/cursor styling — only their inline `height` counts. */
.leaderboard-table tbody tr[aria-hidden="true"] {
  cursor: default;
  border: 0;
}

.leaderboard-table tbody tr[aria-hidden="true"] td {
  padding: 0;
  border: 0;
}

.leaderboard-cards > div[aria-hidden="true"] {
  padding: 0;
  margin: 0;
  border: 0;
}

.cell-numeric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.cell-missing {
  color: var(--text-muted);
  cursor: help;
}

.repo-name {
  color: var(--text-primary);
  font-weight: 500;
}

.repo-owner {
  color: var(--text-secondary);
}

.eco-chip {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-pill);
  padding: 1px var(--space-xs);
  margin-left: var(--space-xs);
}

.delta-up {
  color: var(--accent-success);
}

.delta-down {
  color: var(--accent-warning);
}

.delta-flat {
  color: var(--text-muted);
}

/* ---- Card list (< 768px leaderboard) ---- */
/* No flex `gap` here: each real card's own `margin-bottom` supplies the
 * spacing, so a card's total vertical footprint (content + margin) is one
 * fixed number that matches components/table.js's CARD_HEIGHT_PX exactly —
 * the same fixed-height contract the desktop table's rows keep, needed for
 * the windowing spacers' inline heights to line up with real content. */
.leaderboard-cards {
  display: block;
}

.leaderboard-card {
  height: 156px;
  box-sizing: border-box;
  overflow: hidden;
  margin-bottom: 12px; /* 156 + 12 = components/table.js CARD_HEIGHT_PX (168) */
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-sm);
}

.leaderboard-card.row-tied {
  background: var(--tie-row-band);
}

.leaderboard-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

/* ---- Reason chips (Not ranked) ---- */
.reason-chip {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

.notranked-group {
  margin-bottom: var(--space-lg);
}

.notranked-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

/* The name and its ecosystem chip may shrink and break anywhere: a long name with no break points otherwise
 * pushes the row past a 320 px screen. */
.notranked-row > :first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notranked-row:hover {
  background: var(--bg-surface-hover);
}

/* ---- States: skeleton / empty / error / partial ---- */
.skeleton-row {
  height: 32px;
  border-radius: var(--radius-control);
  background: linear-gradient(
    90deg,
    var(--bg-surface-elevated) 25%,
    var(--bg-surface-hover) 50%,
    var(--bg-surface-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  margin-bottom: var(--space-xs);
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-row {
    animation: none;
  }
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.empty-state,
.error-banner {
  padding: var(--space-md);
  border-radius: var(--radius-card);
  margin-bottom: var(--space-md);
}

.empty-state {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.error-banner {
  background: var(--quad-graveyard-wash);
  border: 1px solid var(--quad-graveyard);
  color: var(--text-primary);
}

.stale-table {
  opacity: 0.55;
  pointer-events: none;
}

/* Ruling C: persona refetch keeps the old table visible+greyed (via
 * .stale-table above) with this thin indeterminate progress bar, instead
 * of a full-page skeleton. */
.refetch-progress {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 3;
  height: 2px;
  overflow: hidden;
  background: var(--bg-surface-elevated);
}

.refetch-progress::before {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent-cyan);
  animation: refetch-progress-sweep 1.1s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .refetch-progress::before {
    animation: none;
    width: 100%;
  }
}

@keyframes refetch-progress-sweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

/* ---- Keymap overlay ---- */
.keymap-overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.keymap-overlay {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: var(--space-lg);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-popover);
}

.keymap-overlay table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-sm);
}

.keymap-overlay td {
  padding: var(--space-2xs) var(--space-xs);
  border-bottom: 1px solid var(--border-subtle);
}

.keymap-overlay kbd {
  font-family: var(--font-mono);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-badge);
  padding: 1px 6px;
}

/* ---- Drawer ---- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  display: flex;
  justify-content: flex-end;
}

.drawer {
  width: 520px;
  max-width: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-drawer);
  overflow-y: auto;
  overflow-x: hidden; /* the wide tables inside scroll in their own .table-scroll box */
  padding: var(--space-md);
  transition: transform var(--motion-duration) var(--motion-easing);
}

@media (max-width: 767px) {
  .drawer-backdrop {
    align-items: flex-end;
  }

  .drawer {
    width: 100%;
    max-height: 90vh;
    border-left: none;
    border-top: 1px solid var(--border-strong);
  }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-md);
}

/* The title takes the room the buttons leave and breaks a long owner/name instead of pushing the panel wider. */
.drawer-header > :first-child {
  flex: 1 1 12ch;
  min-width: 0;
  overflow-wrap: anywhere;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.drawer-compare-btn,
.drawer-github-link {
  padding: 4px var(--space-sm);
  font-size: var(--text-caption);
  font-weight: 500;
  border-radius: var(--radius-control);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.drawer-compare-btn:hover,
.drawer-github-link:hover {
  background: var(--bg-surface-hover);
}

.drawer h1 {
  font-size: var(--text-h1);
  margin: 0 0 var(--space-2xs);
}

.drawer-kicker {
  font-size: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 var(--space-2xs);
}

.drawer details {
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-sm) 0;
}

.drawer summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-h2);
}

.radar-chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--space-xs) 0 var(--space-sm);
}

.radar-chart {
  max-width: 340px;
  width: 100%;
  height: auto;
}

.radar-grid {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 0.8;
  opacity: 0.8;
}

.radar-spoke {
  stroke: var(--border-subtle);
  stroke-width: 0.8;
  stroke-dasharray: 2, 2;
  opacity: 0.8;
}

.radar-area {
  fill: rgba(99, 102, 241, 0.2);
  stroke: var(--accent-violet, #6366f1);
  stroke-width: 1.5;
}

.radar-point {
  fill: var(--accent-violet, #6366f1);
}

.radar-label {
  font-size: 11px;
  font-weight: 500;
  fill: var(--text-secondary);
}

.radar-score {
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-primary);
}

.evidence-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-caption);
  margin-top: var(--space-xs);
  table-layout: auto;
}

.evidence-table th,
.evidence-table td {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.evidence-table td:first-child,
.evidence-table th:first-child {
  white-space: normal;
  max-width: 120px;
  /* overflow-wrap, NOT word-break: `word-break: break-word` lowers the
   * cell's min-content to one character, so the auto table layout -- whose
   * other cells are all nowrap -- squeezed this column to ~22 px and stacked
   * "Decision Rate (90d)" one character per line (MEASURED 2026-09-22 in the
   * onnx/onnx drawer: cells up to 255 px tall). overflow-wrap still breaks an
   * overlong word, but never counts those breaks toward min-content. */
  overflow-wrap: break-word;
}

/* `.cell-numeric` breaks anywhere (views.css) so a digit run or digest never
 * overflows a cell. The drawer also puts the class on four PARAGRAPHS of
 * spaced text (pillar summary, Porchlamp line, hash, snapshot id), where break-all
 * split words mid-letter ("Governan|ce", MEASURED 2026-09-22). A paragraph
 * wraps at spaces and breaks a word only if it alone would overflow. */
p.cell-numeric {
  word-break: normal;
  overflow-wrap: break-word;
}

.gate-banner {
  background: var(--quad-graveyard-wash);
  border: 1px solid var(--quad-graveyard);
  border-radius: var(--radius-card);
  padding: var(--space-sm);
  margin-bottom: var(--space-md);
}

.playbook-disclaimer {
  font-style: italic;
  color: var(--text-muted);
  font-size: var(--text-caption);
}

/* ---- Footer ---- */
.app-footer {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

.app-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* The pager below the list: the same controls, spaced off the last row. */
.pager-bottom {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

/* ---- Phone header and tab bar ----
 * MEASURED 2026-10-12 at 375 px: the sticky header wrapped to 330 px (40% of the screen, on every screen) and the
 * five tabs ran off the right edge with no hint. Now: the header scrolls away with the page, its three controls
 * sit in two rows, the tab bar is the one thing that stays, and it fades at an edge that has more behind it. */
@media (max-width: 767px) {
  :root {
    --header-height: 0px; /* the header no longer sticks: whatever sticks, sticks under the tab bar */
  }

  .app-header {
    position: static;
    gap: var(--space-xs) var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
  }

  .header-controls {
    display: contents;
  }

  /* Rows: brand and snapshot / persona and ecosystem / search and the theme toggle. */
  .header-controls > [data-theme-toggle] {
    order: 5;
    flex: 0 0 auto;
    align-self: flex-end;
  }

  .header-filter-group {
    order: 3;
    flex: 1 1 calc(50% - var(--space-sm));
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .header-filter-group[data-header-search-group] {
    order: 4;
    flex: 1 1 calc(100% - 64px); /* a row of its own, with room beside it for the theme toggle */
  }

  .header-filter-group[hidden] {
    display: none;
  }

  .header-filter-group select.control,
  .header-filter-group input.control {
    width: 100%;
    min-width: 0;
  }

  .header-filter-group .field-label {
    margin: 0;
  }

  .app-primary-nav {
    position: sticky;
    top: 0;
    z-index: 19;
  }

  .primary-tabs {
    position: relative; /* its own offsetParent: the active tab is centred from its offsetLeft */
    padding: 0 var(--space-xs);
    gap: 0;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--space-sm), #000 calc(100% - var(--space-xl)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 var(--space-sm), #000 calc(100% - var(--space-xl)), transparent 100%);
  }

  .primary-tab {
    padding: var(--space-sm);
  }
}

/* The ways out of an empty list: side by side, wrapping on a phone. */
.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  justify-content: flex-start; /* with the message above them */
  margin: var(--space-xs) 0 0;
}
