/* MOBILE-HEADER-V2 (Dima 2026-12-03 17:10 UTC, designer's «search visible» header; flag AGENTGID_MOBILE_HEADER_V2).
   Phones and narrow tablets (under 880 px), only when base.html puts data-mh2 on <html>:
   - one 64 px row: the logo with the wordmark, and a «☰ Menu» pill that turns into «✕ Close» while the menu is open;
   - the search field always visible under it (44 px, 16 px text so iOS does not zoom); while it is in use a ✕ next to
     the Menu pill closes it;
   - under the sticky header a 44 px row «N agents tracked · ● agent status» in the normal flow, so it scrolls away
     with the page (no script, no layout shift); the old stats bar above the header is hidden on phones;
   - Log in / Sign up and the theme switch move into the menu (account row + System / Light / Dark).
   data-mh2="accent" (default): the open Menu pill gets the soft accent of the active section-menu item;
   data-mh2="plain": a neutral light pill. Tokens only; every colour is set for both themes. */
:root { --mh-tint: color-mix(in srgb, var(--link) 12%, transparent); --mh-ring: color-mix(in srgb, var(--link) 35%, transparent);
  --mh-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 14%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --mh-tint: color-mix(in srgb, var(--link) 20%, transparent); --mh-shadow: 0 1px 3px color-mix(in srgb, var(--plane) 60%, transparent); } }
:root[data-theme="dark"] { --mh-tint: color-mix(in srgb, var(--link) 20%, transparent); --mh-shadow: 0 1px 3px color-mix(in srgb, var(--plane) 60%, transparent); }

.mh-stats, .mh-x, .mh-bl, .mh-set { display: none; }

@media (max-width: 879px) {
  html[data-mh2] .statsbar { display: none; }

  /* the main row and the search row */
  html[data-mh2] .site-header > .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "brand x menu" "search search search";
    align-items: center; column-gap: 6px; row-gap: 0; height: auto; padding-top: 0; padding-bottom: 10px; }
  html[data-mh2].menu-open .site-header > .wrap { padding-bottom: 0; }
  html[data-mh2] .site-header > .wrap::after { content: none; }           /* NAV-V2-SCRIM dims the header row; here the row is part of the sheet */
  html[data-mh2] .site-header .nav { display: none; }
  html[data-mh2] .site-header .header-tools { display: contents; }
  html[data-mh2] .site-header .account-link, html[data-mh2] .site-header .signup-btn, html[data-mh2] .site-header [data-theme-toggle] { display: none; }

  html[data-mh2] .site-header .brand, html[data-mh2] .site-header.search-open .brand { grid-area: brand; display: inline-flex; min-height: 64px; min-width: 0; gap: 9px; }
  html[data-mh2] .site-header .brand svg { width: 28px; height: 28px; }
  html[data-mh2] .site-header .brand-word { display: inline; font-size: var(--fs-xl); font-weight: 700; white-space: nowrap; }

  /* the Menu pill */
  html[data-mh2] .site-header .menu-btn, html[data-mh2] .site-header.search-open .header-tools > .menu-btn { grid-area: menu; display: inline-flex; align-items: center; gap: 6px;
    width: auto; height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink);
    font: inherit; font-size: var(--fs-sm); font-weight: 600; box-shadow: var(--mh-shadow); }
  html[data-mh2] .site-header .menu-btn svg { width: 18px; height: 18px; }
  html[data-mh2] .site-header .menu-btn .mh-bl { display: inline; }
  html[data-mh2] .mh-bl .mh-c, html[data-mh2].menu-open .mh-bl .mh-o { display: none; }
  html[data-mh2].menu-open .mh-bl .mh-c { display: inline; }
  html[data-mh2].menu-open .site-header .menu-btn::before { width: 18px; height: 18px; }
  html[data-mh2="accent"].menu-open .site-header .menu-btn { background: var(--mh-tint); color: var(--link); box-shadow: inset 0 0 0 1px var(--mh-ring); }
  html[data-mh2="accent"].menu-open .site-header .menu-btn::before { background: var(--link); }
  html[data-mh2="plain"].menu-open .site-header .menu-btn { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--border-strong); }

  /* the search field, always visible */
  html[data-mh2] .site-header .search, html[data-mh2] .site-header.search-open .search { grid-area: search; display: block; width: 100%; }
  html[data-mh2] .site-header .search input, html[data-mh2] .site-header.search-open .search input { width: 100%; height: 44px; padding: 0 12px 0 40px;
    border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); font-size: var(--fs-lead); cursor: text; }
  html[data-mh2] .site-header .search input::placeholder { color: var(--ink-2); font-size: var(--fs-sm); }
  html[data-mh2] .site-header .search svg, html[data-mh2] .site-header.search-open .search svg { left: 13px; top: 14px; width: 16px; height: 16px; }
  html[data-mh2] .site-header .search-results { top: 50px; left: 0; right: 0; width: auto; max-width: none; }
  html[data-mh2].menu-open .site-header .search { display: none; }
  html[data-mh2] .site-header .sp-hint { display: none; }  /* the ⌘K hint lands before search-palette.css hides it: no 25px jump */
  html[data-mh2] .site-header.search-open .mh-x { grid-area: x; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); cursor: pointer; }
  html[data-mh2] .site-header .mh-x:hover { background: var(--surface-2); }

  /* the stats row under the header: in the flow, so it scrolls away with the page */
  html[data-mh2] .mh-stats { display: block; background: var(--surface); border-bottom: 1px solid var(--border); }
  html[data-mh2] .mh-stats .wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; font-size: var(--fs-xs); }
  html[data-mh2] .mh-stats a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ink-2); text-decoration: none; }
  html[data-mh2] .mh-stats a:hover span, html[data-mh2] .mh-stats a:hover { color: var(--ink); }
  html[data-mh2] .mh-stats b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
  html[data-mh2] .mh-stats svg { width: 14px; height: 14px; color: var(--meta); }
  html[data-mh2] .mh-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--meta); flex: none; }
  html[data-mh2] .mh-dot[data-state="ok"] { background: var(--up-mark, var(--up)); }
  html[data-mh2] .mh-dot[data-state="bad"] { background: var(--down-mark, var(--down)); }
  html[data-mh2] [data-mh-status] { display: inline-block; min-width: 15ch; text-align: right; }

  /* the menu sheet: account row and Appearance at its end */
  html[data-mh2] .mobile-menu { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); }
  html[data-mh2] .mh-set { display: block; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
  html[data-mh2] .mh-acc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
  html[data-mh2] .mh-acc { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); font-size: var(--fs-base); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
  html[data-mh2] .mh-acc svg { width: 18px; height: 18px; color: var(--ink-2); flex: none; }
  html[data-mh2] .mh-signup { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm); background: var(--accent-wash);
    color: var(--link); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
  html[data-mh2] .mh-tl { margin: 10px 0 6px; font-size: var(--fs-xs); color: var(--ink-2); }
  html[data-mh2] .mh-theme { display: flex; gap: 3px; padding: 3px; border-radius: var(--r-sm); background: var(--surface-2); }
  html[data-mh2] .mh-theme button { flex: 1; min-height: 44px; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
  html[data-mh2] .mh-theme button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--mh-shadow); }
}
@media (max-width: 350px) {
  html[data-mh2] .site-header .brand-word { font-size: var(--fs-lg); }
  html[data-mh2] .site-header .brand { gap: 7px; }
  html[data-mh2] .site-header > .wrap { padding-inline: 12px; column-gap: 2px; }
  html[data-mh2] .site-header .menu-btn { padding: 0 10px; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 879px) {
  html[data-mh2] .site-header .menu-btn, html[data-mh2] .mh-theme button { transition: background .16s ease, box-shadow .16s ease; }
}
