/* Global site chrome — the SINGLE owner of the app header.

   One header, one look, every route (2026-09-06). Before this pass the same
   `.sp-top-header` markup (layout.py) was repainted by fourteen route-scoped
   bands across six stylesheets — styles.css (base + /login + login-required +
   feed shell + real_feed + `/` and `/detail` + feed-theme-shell + data_studio),
   zz_new_content.css (studio pre-mount + post-mount), zz_compare.css,
   zz_statspoint.css and 05_page_chrome.css. They were near-identical copies
   fighting over specificity, and the only reason the app looked coherent was
   that this file's `body:has(#app-container)` prefix out-ranked all of them.
   All of it is deleted; the /explore treatment below is the look everywhere,
   written once.

   RULE: never add a route-scoped header band anywhere. A page that needs
   something of its own in the header puts it in `#header-route-extra-slot`
   (layout.py) — the styling stays here. A page's own bar (e.g. the studio's
   `.sp-builder-shell-topbar` in zz_studio_header.css) is a different
   component and does not belong to this file.

   Selectors keep the `body:has(#app-container)` prefix so the header still
   out-ranks Mantine's own component CSS on every control it wraps. */

:root {
  --spc-bg: var(--sp-bg);
  --spc-chrome: var(--sp-chrome);
  --spc-surface: var(--sp-surface);
  --spc-track: var(--sp-chip);
  --spc-border: var(--sp-border-strong);
  --spc-text: var(--sp-text);
  --spc-text-2: var(--sp-text-2);
  --spc-muted: var(--sp-text-3);
  --spc-accent: var(--sp-accent);
  --spc-accent-hover: var(--sp-accent-hover);
  --spc-display: "Bricolage Grotesque", "Archivo", sans-serif;
  --spc-ui: "Instrument Sans", "Manrope", sans-serif;
  --spc-mono: "Space Mono", ui-monospace, monospace;

  /* Header height — the single source. Pages that reserve room for the header
     read it as calc(100vh - var(--sp-header-h)); the deleted bands hard-coded
     58px / 60px / 62px and drifted apart. */
  --sp-header-h: 62px;
}

@media (max-width: 1024px) {
  :root {
    --sp-header-h: 58px;
  }
}

/* ---- header bar ----------------------------------------------------------- */

.sp-top-shell {
  margin: 0;
  padding: 0;
  width: 100%;
  background: transparent;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: color-mix(in srgb, var(--spc-bg) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--spc-border);
  box-shadow: none;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--sp-header-h);
  padding: 6px 14px;
}

@media (max-width: 1024px) {
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-row {
    padding: 6px 10px;
  }
}

/* ---- brand: the Ballproof wordmark, drawn in two pieces -------------------- */
/* The mark is the logo's B: two holes, the round one filled by the orange ball. The title is the rest of the word,
   ALLPROOF. Side by side they are the wordmark; where only the mark shows (the collapsed sidebar) it is the symbol.
   Both are masks filled with the text colour, so they follow every look and the light mode; the title span keeps its
   text for assistive technology and hides it. The drawer's brand shares the treatment.
   --sp-brand-cap is the letter height; the other numbers are the logo's own proportions (B width, space after the B,
   letters width, the ball's place inside the B). */

body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-link {
  text-decoration: none;
  color: inherit;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-group,
body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-brand {
  --sp-brand-cap: 22px;
  --sp-brand-ink: var(--spc-text);
  align-items: center;
  gap: calc(var(--sp-brand-cap) * 0.07);
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-mark,
body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-mark {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: calc(var(--sp-brand-cap) * 0.6827) !important;
  height: var(--sp-brand-cap) !important;
  line-height: 0;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* The ball sits under the B and is larger than its hole (the hole is 49 % × 34 % of the box, from 27 % / 12 %): the
   B's own walls cover the rest, and no edge of the header shows between the two at any pixel rounding. */
body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-mark::before,
body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-mark::before {
  content: "";
  position: absolute;
  left: 23%;
  top: 9.5%;
  width: 57%;
  height: 38%;
  border-radius: 50%;
  background: var(--spc-accent);
}

/* The boxes have the artwork's exact proportions, so the masks fill them: no dependence on how a browser rounds an
   SVG's own size. */
body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-mark::after,
body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sp-brand-ink);
  -webkit-mask: url("/assets/brand/ballproof-b.svg") center / 100% 100% no-repeat;
  mask: url("/assets/brand/ballproof-b.svg") center / 100% 100% no-repeat;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-title,
body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-brand-title {
  display: inline-block;
  flex: 0 0 auto;
  width: calc(var(--sp-brand-cap) * 6.3515);
  height: var(--sp-brand-cap);
  padding: 0 !important;
  overflow: hidden;
  white-space: nowrap;
  text-indent: -200vw;
  background: var(--sp-brand-ink);
  -webkit-mask: url("/assets/brand/ballproof-letters.svg") center / 100% 100% no-repeat;
  mask: url("/assets/brand/ballproof-letters.svg") center / 100% 100% no-repeat;
}

/* ---- desktop nav ---------------------------------------------------------- */

/* True centering: the brand and the actions get equal flex shares so the nav
   group sits on the viewport axis regardless of how wide either side is
   (space-between alone centered it only in the leftover space). */
body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-wrap,
body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-actions {
  flex: 1 0 0;
  min-width: 0;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-nav {
  flex: 0 0 auto;
  min-width: 0;
  justify-content: center;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-nav-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-nav-btn {
  color: var(--spc-text-2) !important;
  font-family: var(--spc-ui);
  font-weight: 700;
  padding: 10px 14px !important;
  border-radius: 999px !important;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-nav-btn:hover {
  background: color-mix(in srgb, var(--spc-accent) 14%, transparent) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* Active route pill. No callback marks the current tab, so it is keyed off
   what each route already stamps: `sp-route-*` on <body>
   (assets/00_theme_bootstrap.js) for five of them, and the page shell for
   /explore, which stamps no route class. */
body:where([data-sp-has~="app"]):not(#sp-s).sp-route-home :is(#nav_home, #drawer-link-home),
body:where([data-sp-has~="app"]):not(#sp-s).sp-route-feed :is(#nav_feed, #drawer-link-feed),
body:where([data-sp-has~="app"]):not(#sp-s).sp-route-detail :is(#nav_feed, #drawer-link-feed),
body:where([data-sp-has~="app"]):not(#sp-s):where([data-sp-has~="compare-page"]):not(.sp-s) :is(#nav_explore, #drawer-link-explore),
body:where([data-sp-has~="app"]):not(#sp-s).sp-route-new-content :is(#nav_question, #drawer-link-newq),
body:where([data-sp-has~="app-unified-create"]):not(#sp-s):not(.sp-s):where([data-sp-has~="compare-page"]):not(.sp-s) :is(#nav_question, #drawer-link-newq),
body:where([data-sp-has~="app"]):not(#sp-s):where([data-sp-has~="profile-shell"]):not(.sp-s) :is(#nav_profile, #drawer-link-profile) {
  background: color-mix(in srgb, var(--spc-accent) 16%, transparent) !important;
  color: var(--spc-accent) !important;
}

/* One Create step (SP_UNIFIED_CREATE_HUB): the comparison and the editor are steps of Create, so the phone bar marks Create
   there, as it marked Explore before (assets/zzzzzzz_explore_final.css keys that colour to #sp-bottom-nav-explore). */
body:where([data-sp-has~="app-unified-create"]):not(#sp-s):not(.sp-s):where([data-sp-has~="explore-data-shell"]):not(#sp-s):not(.sp-s) #sp-bottom-nav-create {
  color: var(--sp-accent) !important;
  font-weight: 600;
}

/* ---- right-side actions --------------------------------------------------- */

body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-actions {
  justify-content: flex-end;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-mobile {
  align-items: center;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-header-route-extra-slot {
  display: flex;
  align-items: center;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-header-route-extra-slot:empty {
  display: none;
}

/* The menu button (768–1024 px): a bare icon like its neighbours, the favourites star and the light switch. */
body:where([data-sp-has~="app"]):not(#sp-s) .sp-hamburger-trigger {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  color: var(--hl-pi, var(--spc-text)) !important;
  border: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-hamburger-trigger:hover {
  background: transparent !important;
  color: var(--spc-accent) !important;
}

/* phones use the bottom nav; the desktop (>=1025) its sidebar, so the menu button only shows from 768 to 1024 */
@media (max-width: 767px) {
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-hamburger-trigger {
    display: none !important;
  }
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-target,
body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-avatar--guest,
body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-avatar--auth {
  background: var(--spc-surface) !important;
  border-color: var(--spc-border) !important;
  color: var(--spc-text) !important;
}

/* The target wraps the round avatar; its corners belong to the header. */
body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-target {
  background: transparent !important;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-dropdown {
  background: var(--spc-chrome) !important;
  border: 1px solid var(--spc-border) !important;
  color: var(--spc-text) !important;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-label {
  color: var(--spc-muted) !important;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-item {
  color: var(--spc-text-2) !important;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-item:hover {
  background: var(--spc-track) !important;
  color: var(--spc-text) !important;
}

/* ---- the menu behind the menu button (768–1024 px) ------------------------ */
/* Between the phone (bottom bar, ≤767) and the desktop (sidebar, ≥1025) the header's menu button is the only
   navigation. It opens the sidebar's items (layout.py builds both from one list) as a panel from the right, beside
   the button: the sidebar's rows with their labels shown, the same current-page mark. The Home look's colours and
   type are in assets/zzzzzzzzzzzzzzzzzzzz_explore_home_look.css. */

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer .mantine-Drawer-content {
  background: var(--spc-bg) !important;
  color: var(--spc-text) !important;
  border-left: 1px solid var(--spc-border);
  border-radius: 0;
  box-shadow: -16px 0 40px #0003;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer .mantine-Drawer-header {
  height: auto;
  min-height: var(--sp-header-h);
  padding: 6px 10px 6px 22px;
  background: transparent !important;
  border-bottom: 1px solid var(--spc-border);
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer .mantine-Drawer-title {
  margin: 0;
}

/* the wordmark itself (mark + title) is styled with the header's brand above */
body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-brand {
  display: flex;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer .mantine-Drawer-close {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  color: var(--spc-text-2);
  background: transparent;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer .mantine-Drawer-close:hover {
  background: var(--spc-track);
  color: var(--spc-text);
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer .mantine-Drawer-body {
  padding: 16px 12px;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-row {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 22px;
  width: 100%;
  min-height: 56px;
  padding: 0 15px;
  border-radius: 12px;
  color: var(--spc-text-2);
  font: 600 16px var(--spc-ui);
  cursor: pointer;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-row svg {
  flex-shrink: 0;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-nav-drawer-row:hover {
  background: var(--spc-track);
  color: var(--spc-text);
}

/* ---- swipe mode: no chrome ------------------------------------------------ */
/* UX backlog 2.4 (D-46b / D-50): the full-screen viewer at /reels
   (pages/feed/reels.py, shell class .sp-reels-viewer) shows neither the global
   header nor the bottom bar — Instagram's reels viewer shows neither. This is
   the chrome owner's rule, not a per-route repaint band. */
body:where([data-sp-has~="reels-viewer"]):not(.sp-s) .sp-top-header,
body:where([data-sp-has~="reels-viewer"]):not(.sp-s) .sp-bottom-nav {
  display: none !important;
}

/* ---- bottom nav (mobile) -------------------------------------------------- */

/* D-K1 (2026-10-26): while a text field has focus on a phone the on-screen keyboard
   shrinks the layout viewport (viewport meta `interactive-widget=resizes-content`), so a
   fixed bottom bar would ride up above the keyboard. Instagram shows no bar while
   typing; the bar hides and returns when the field blurs. Read-only fields (share URL)
   open no keyboard and are excluded. */
@media (max-width: 767px) {
  body:where([data-sp-has~="text-focus"]):not(.sp-s):not(.sp-s):not(.sp-s):not(.sp-s):not(.sp-s):not(sp-s) .sp-bottom-nav {
    display: none !important;
  }
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-bottom-nav {
  background: var(--spc-chrome) !important;
  border-top: 1px solid var(--spc-border) !important;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-bottom-nav-link {
  color: var(--spc-muted) !important;
}

body:where([data-sp-has~="app"]):not(#sp-s) .sp-bottom-nav-link.is-active {
  color: var(--spc-accent) !important;
}

/* UX 2.2 (docs/ux/decisions_2026-09-13.md D-10 / D-42, mockup B1): the bar is
   icons only — Home · Compare · Create · Profile — with Create as a "+" tile
   (YouTube / TikTok). Geometry of the bar itself (fixed ≤767, padding, the
   64px `--sp-bottom-nav-h` the studio reserves) stays in styles.css; only the
   link contents change here. The label survives as a visually hidden span so
   the link keeps its accessible name. */
.sp-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 767px) {
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-bottom-nav-link {
    gap: 0;
    min-height: 44px;           /* the old icon + label stack; the bar height is unchanged */
    justify-content: center;
    padding: 0;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-bottom-nav-link .iconify,
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-bottom-nav-link svg {
    width: 24px;
    height: 24px;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-bottom-nav-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 30px;
    border: 1.5px solid currentColor;
    border-radius: 9px;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-bottom-nav-tile .iconify,
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-bottom-nav-tile svg {
    width: 20px;
    height: 20px;
  }
}

/* ---- C1: the account menu is a <details> now, not a dmc.Menu -----------------
   Why (docs/new_content/perf_graph_load_options.md, option C1): dmc.MenuDropdown /
   MenuItem / MenuLabel carry the static `dashChildrenUpdate` property, so dash-renderer
   runs `determineChangedProps` — a scan of the whole `layoutHashes` table — for each of
   the six instances on EVERY store update, on every page. Measured on a studio deeplink:
   the nine flagged components on that route were 6.2 s of the 47 s main thread.
   The markup is now <details>/<summary> + dcc.Link (layout.py); the colours below are
   unchanged and still come from the theme blocks in styles.css / zz_new_content.css,
   which target `.sp-user-menu-dropdown`, `.sp-user-menu-label` and `.sp-user-menu-item`.
   Only the geometry that Mantine's floating engine used to provide is added here.
   Note: the old `withArrow` notch is gone (the themes override the dropdown background
   with `!important`, so a CSS arrow could not follow them); and the theme rules that
   targeted `.mantine-Menu-divider` / `.mantine-Menu-itemSection` no longer match — the
   replacement classes `.sp-user-menu-divider` / `.sp-user-menu-item-icon` below take over. */
.sp-user-menu {
  position: relative;
  display: inline-flex;
}

.sp-user-menu > summary {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.sp-user-menu > summary::-webkit-details-marker {
  display: none;
}

.sp-user-menu > summary::marker {
  content: "";
}

.sp-user-menu > .sp-user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sp-user-menu .sp-user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 10px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.sp-user-menu .sp-user-menu-item-icon {
  display: inline-flex;
  align-items: center;
  opacity: 0.78;
}

.sp-user-menu .sp-user-menu-label {
  font-size: 11px;
}

.sp-user-menu .sp-user-menu-divider {
  height: 1px;
  margin: 6px 4px;
  background: currentColor;
  opacity: 0.18;
}

/* The divider only makes sense when the item after it is visible. `sync_account_menu`
   (app.py) hides `logout-button` for guests with an inline `display: none`; dmc.Menu
   used to collapse around it, so keep the same result. */
.sp-user-menu .sp-user-menu-divider:has(+ .sp-user-menu-item[style*="display: none"]) {
  display: none;
}

/* ---- C1: `.sp-tip` — the app-wide CSS tooltip that replaced dmc.Tooltip ------
   A `dmc.Tooltip` type carries the static `dashChildrenUpdate` property: dash-renderer
   then runs `determineChangedProps` (a scan of the entire `layoutHashes` table) for
   every mounted instance on EVERY store update. Static labels gain nothing from it and
   the bill is real - see the note above and docs/new_content/perf_graph_load_options.md.
   Colours follow the builder tokens where they exist and fall back to the same values
   elsewhere, so the bubble looks identical on every route. */
.sp-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.sp-tip::after {
  content: attr(data-sp-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  z-index: 60;
  width: max-content;
  max-width: min(280px, 70vw);
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--bc-raised, var(--sp-surface));
  border: 1px solid var(--bc-border, var(--sp-border-strong));
  color: var(--bc-text, var(--sp-text));
  font-family: var(--sh-ui, inherit);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  transition: opacity 110ms ease, transform 110ms ease;
}

.sp-tip:hover::after,
.sp-tip:focus-within::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* The header avatar sits at the right edge - keep its bubble inside the viewport. */
.sp-user-menu .sp-tip::after {
  left: auto;
  right: 0;
  transform: translateY(2px);
}

.sp-user-menu .sp-tip:hover::after,
.sp-user-menu .sp-tip:focus-within::after {
  transform: translateY(0);
}

@media (hover: none) {
  .sp-tip::after {
    display: none;
  }
}

/* Desktop navigation: reserve only the icon rail; expansion overlays the page.
   Keep the same shell, route links and account IDs for mobile and desktop. */
.sp-sidebar-pin,
.sp-sidebar-account-label {
  display: none;
}

@media (min-width: 1025px) {
  :root {
    --sp-header-h: 0px;
    --sp-sidebar-width: 80px;
  }

  body:where([data-sp-has~="app"]):not(#sp-s):not(:where([data-sp-has~="reels-viewer"]):not(.sp-s)) #app-page-container {
    --sp-page-offset: var(--sp-sidebar-width);
    margin-left: var(--sp-page-offset);
    width: calc(100% - var(--sp-page-offset));
    min-width: 0;
  }

  body:where([data-sp-has~="app"]):not(#sp-s):where([data-sp-has~="header-pinned"]):not(.sp-s):not(.sp-s):not(.sp-s):not(:where([data-sp-has~="reels-viewer"]):not(.sp-s)) #app-page-container {
    --sp-page-offset: 260px;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-header {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sp-sidebar-width);
    height: 100dvh;
    border-bottom: 0;
    border-right: 1px solid var(--spc-border);
    background: var(--spc-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: width 0s, box-shadow 0s;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-header:is(:hover, :focus-within, .is-pinned):not(.is-dismissed) {
    width: 260px;
    box-shadow: 16px 0 40px #0003;
  }

  /* Brief hover intent delay; keyboard focus and pinning stay immediate. */
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-header:hover:not(:focus-within, .is-pinned, .is-dismissed) {
    transition-delay: 200ms;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-row {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 24px 12px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-wrap {
    flex: 0 0 44px;
    width: 100%;
    overflow: hidden;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-link {
    display: block;
    padding: 5px 10px;
  }

  /* the B stands alone while the sidebar is closed: a little larger, centred over the 24 px nav icons below it
     (the 34 px slot the old tile filled) */
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-group {
    --sp-brand-cap: 26px;
    flex-wrap: nowrap;
    width: max-content;
    min-height: 34px;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-mark {
    margin-left: calc((34px - var(--sp-brand-cap) * 0.6827) / 2);
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-nav {
    width: 100%;
    flex-wrap: nowrap;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px;
    margin-top: clamp(20px, 7vh, 64px);
    margin-bottom: 24px;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-nav-btn,
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-sidebar-pin {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 22px;
    width: 100%;
    min-height: 56px;
    flex-shrink: 0;
    padding: 0 15px !important;
    border: 0;
    border-radius: 12px !important;
    background: transparent;
    color: var(--spc-text-2);
    font: 600 16px var(--spc-ui);
    text-align: left;
    cursor: pointer;
    overflow: hidden;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-nav-btn:hover {
    transform: none;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-sidebar-pin:hover,
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-summary:hover {
    background: var(--spc-track);
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-header svg {
    flex-shrink: 0;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-sidebar-label,
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-brand-title {
    white-space: nowrap;
    opacity: 0;
    transition: opacity 180ms ease;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-header:is(:hover, :focus-within, .is-pinned):not(.is-dismissed) :is(.sp-sidebar-label, .sp-brand-title) {
    opacity: 1;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-header:hover:not(:focus-within, .is-pinned, .is-dismissed) :is(.sp-sidebar-label, .sp-brand-title) {
    transition-delay: 200ms;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-actions {
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: auto;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-actions > .mantine-Flex-root,
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu {
    width: 100%;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-summary {
    width: 100%;
    min-height: 56px;
    padding: 8px;
    gap: 16px;
    border-radius: 12px;
    overflow: hidden;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-target {
    flex: 0 0 40px;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-sidebar-account-label {
    display: inline;
    color: var(--spc-text);
    font: 600 16px var(--spc-ui);
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu-dropdown {
    top: auto;
    bottom: calc(100% + 8px);
    left: 0;
    right: auto;
    width: 234px;
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-user-menu .sp-tip::after {
    display: none;
  }

  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-header :is(a, button, summary):focus-visible {
    outline: 2px solid var(--spc-accent);
    outline-offset: -2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:where([data-sp-has~="app"]):not(#sp-s) .sp-top-header * {
    transition: none !important;
  }
}

/* The bar's first styling must not animate: without this its links fade in from the browser's blue link colour
   with their labels showing. assets/00_state_flags.js sets the attribute for the frame in which the bar is styled. */
:root[data-sp-mounting] .sp-top-header,
:root[data-sp-mounting] .sp-top-header * {
  transition: none !important;
}
