/* ============================================================
   coachOS Shell (Act 2)
   ------------------------------------------------------------
   Production CSS. ONE file owns the whole Shell: the structural
   Regions (the .shell grid + its slots) AND the Crown grammar
   that fills them. This supersedes the four legacy per-context
   header rule-sets (the old coach / participation / admin /
   participant headers), now collapsed into the single Crown.

   Region      .shell slot          fills with
   ──────      ───────────────────  ──────────────
   Rail        .shell__rail         .brandplate + Railnav
   Crown       .shell__crown        .crown (3 zones)
   Stage       .shell__stage        the view
   Dock        .shell__dock         .docknav | .footernav
   Rail (mobile).shell__rail-overlay Railnav (mobile overlay)

   All values are existing design-system tokens (Act 1 locked).
   ============================================================ */

/* ── THE SHELL METRIC · mode-immune chrome tokens ──────────── */
/* html[data-mode] used to set a per-mode ROOT font-size, which scaled every
   rem-denominated token ~14% between admin and member/participation families.
   The metric is now ONE for all modes (typography.css — unified to match
   Coach, user ruling 2026-07-09); data-mode scopes only the semantic color
   sets. This pin re-declares the tokens the chrome consumes at their
   documented px values (the railnav px-token precedent, railnav.css:22) as
   the hard guarantee: whatever happens to the root, the Shell chrome
   (brandplate, railnav, anchor/switcher, crown grammar, docknav, footernav,
   banner) renders byte-identical on every family. */
.shell__rail,
.shell__crown,
.shell__zonetabs,
.shell__dock,
.shell__rail-overlay,
.shell__banner {
  /* Bind to --shell-metric-* (tokens.css) — computed values identical to the
     former px literals (2/4/6/8/12/16/20/24/32/40/48 · 12/14/16/18 · 4/6/8/12). */
  --space-0-5: var(--shell-metric-space-0-5);
  --space-1: var(--shell-metric-space-1);
  --space-1-5: var(--shell-metric-space-1-5);
  --space-2: var(--shell-metric-space-2);
  --space-3: var(--shell-metric-space-3);
  --space-4: var(--shell-metric-space-4);
  --space-5: var(--shell-metric-space-5);
  --space-6: var(--shell-metric-space-6);
  --space-8: var(--shell-metric-space-8);
  --space-10: var(--shell-metric-space-10);
  --space-12: var(--shell-metric-space-12);
  --text-xs: var(--shell-metric-text-xs);
  --text-sm: var(--shell-metric-text-sm);
  --text-base: var(--shell-metric-text-base);
  --text-lg: var(--shell-metric-text-lg);
  --radius-sm: var(--shell-metric-radius-sm);
  --radius-md: var(--shell-metric-radius-md);
  --radius-lg: var(--shell-metric-radius-lg);
  --radius-xl: var(--shell-metric-radius-xl);
  /* [data-mode] body leading differs (1.5 admin vs 1.65 participant) — chrome
     text metrics must not inherit that seam. */
  line-height: var(--leading-normal);
}

/* ── SHELL · structural regions ────────────────────────────── */
.shell {
  /* Dock MIRRORS the Crown (user ruling 2026-07-23): the Dock bar is the same
     --crown-height band as the Crown, and the home-indicator inset is added
     BELOW exactly as the Crown adds the notch inset above — a pure env() inset,
     no 8px absorption. Browser tab: inset is 0, so the Dock is 48px unscrolled /
     40px scrolled on mobile, byte-for-byte the Crown's heights. Installed PWA:
     both bars grow by their respective safe-area inset, staying symmetric.
     --dock-height is the ONE source every dock-dependent offset reads (the
     install-prompt anchor, the chat composer) so they can never drift.
     (Supersedes the 2026-07-11 64px --participation-footer-height base + the
     8px-absorbing --dock-safe-bottom.) */
  --dock-safe-bottom: env(safe-area-inset-bottom, 0px);
  --dock-height: calc(var(--crown-height) + var(--dock-safe-bottom));
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  background-color: var(--surface-page);
  color: var(--text-primary);
}

.shell__rail {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  width: var(--rail-width);
  border-right: 1px solid var(--border-subtle);
  background-color: var(--surface-neutral);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: none;
  transition: width var(--duration-normal) var(--ease-out);
  display: none;
}
.shell--rail-collapsed .shell__rail {
  width: var(--rail-collapsed);
}

.shell__workspace {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: none;
  background-color: var(--surface-page);
  /* MOBILE DEFAULT — scrollbar hidden, scrolling kept (user ruling 2026-07-11):
     zones/pages of different heights otherwise toggle the gutter, shifting
     content left/right when tapping between mobile Zone Tabs. Touch devices use
     overlay scrollbars (zero layout width), so hiding costs nothing here.
     Horizontal scroll stays impossible (overflow-x above). Same pattern as
     .shell__zone--no-scrollbar (zones.css) / tables.css. DESKTOP re-enables the
     bar with a reserved gutter — see the min-width:1024px override below. */
  scrollbar-width: none;
}
.shell__workspace::-webkit-scrollbar { display: none; }

.shell__crown {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  flex-shrink: 0;
  margin: 0;
  height: calc(var(--crown-height) + env(safe-area-inset-top, 0px));
  /* Vertical centering is STRUCTURAL, never padding arithmetic (user gate
     feedback 2026-07-11): the bar flex-centers its content, so the Lead
     Wayfinder / Tail avatar sit dead-center at every height — desktop,
     mobile, and every mid-shrink frame. The notch inset is the only vertical
     padding; the former --space-2 insets (rem-based, mode-variant) are gone. */
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: 0;
  background-color: var(--surface-page-translucent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: height var(--duration-normal) var(--ease-out);
}
/* Crown scroll-shrink — CANONICAL mobile behavior for EVERY context (user
   ruling 2026-07-11): no payload opt-in (the former crown-mode knob is gone).
   Active below 1024px — the shipped participation polish window — and never
   above: shell_shrink_controller stops stamping .shell--shrunk at ≥1024px,
   and this media scope keeps desktop chrome calm even if a stale class
   lingers across a resize. */
@media (max-width: 1023px) {
  .shell.shell--shrunk .shell__crown {
    height: calc(var(--crown-height-collapsed) + env(safe-area-inset-top, 0px));
  }
  /* Content scales commensurately with the bar (user gate feedback
     2026-07-11): the collapsed Crown re-declares the metric vars its content
     reads (brand mark/logo) and steps the title, Wayfinder, and Tail controls
     down ~0.7×. Each element transitions on the Crown's own duration/easing
     tokens (see the base rules) so content and bar move together. */
  .shell.shell--shrunk .shell__crown {
    --railnav-mark-size: 20px;
    --crown-logo-height: 24px;
  }
  .shell.shell--shrunk .shell__crown .crown__title { font-size: var(--text-base); }
  .shell.shell--shrunk .shell__crown .brandplate__wordmark { font-size: var(--text-sm); }
  .shell.shell--shrunk .shell__crown .wayfinder { width: 32px; height: 32px; }
  .shell.shell--shrunk .shell__crown .wayfinder .material-symbols-rounded { font-size: 20px; }
  .shell.shell--shrunk .shell__crown .actionbar__avatar { width: 24px; height: 24px; }
  .shell.shell--shrunk .shell__crown .actionbar__btn .material-symbols-rounded { font-size: 18px; }
}

/* ── ZONE TABS · the mobile multi-zone switcher band (S2-B) ── */
/* A slim frosted sticky band under the Crown hosting DS .tabs--pills,
   label-only, centered (T2, locked 2026-07-10). The layout ships it ONLY
   when the Stage manifests ≥2 zones — zero bytes otherwise (Banner
   principle) — and it is visible <768px only (the existing coach
   breakpoint seam below). Its sticky offset tracks the Crown height —
   safe-area inset (P8) and the shrink transition (P1) included, on the
   Crown's own duration/easing so the band never gaps or overlaps. */
.shell__zonetabs {
  position: sticky;
  top: calc(var(--crown-height) + env(safe-area-inset-top, 0px));
  z-index: var(--z-sticky);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: var(--space-1-5) var(--space-3);
  background-color: var(--surface-page-translucent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: top var(--duration-normal) var(--ease-out);
}
/* Tracks the canonical mobile Crown shrink (same scope as the Crown rule). */
@media (max-width: 1023px) {
  .shell.shell--shrunk .shell__zonetabs {
    top: calc(var(--crown-height-collapsed) + env(safe-area-inset-top, 0px));
  }
}
.shell__zonetabs .tabs--pills { max-width: 100%; overflow-x: auto; }
/* Mobile zone switching: the active slot (stamped by the zone_tabs Stimulus
   controller on the workspace) is the only visible zone below the breakpoint.
   Desktop never matches these rules — the grid shows every zone; without JS
   nothing is stamped and the zones stack as before (progressive enhancement). */
@media (max-width: 767px) {
  .shell__workspace[data-zone-tabs-active="z1"] .shell__stage .shell__zone:not(.shell__zone--z1),
  .shell__workspace[data-zone-tabs-active="z2"] .shell__stage .shell__zone:not(.shell__zone--z2),
  .shell__workspace[data-zone-tabs-active="z3"] .shell__stage .shell__zone:not(.shell__zone--z3),
  .shell__workspace[data-zone-tabs-active="z4"] .shell__stage .shell__zone:not(.shell__zone--z4) { display: none; }
}

.shell__stage {
  flex: 1 0 auto;
  min-width: 0;
  /* Flex column so the Banner band stacks ABOVE the zone container
     (.shell__stage__body), which owns the ZoneLayout grid + max-width. The
     Stage itself stays the ONE owner of the content inset (padding/bleed). */
  display: flex;
  flex-direction: column;
  gap: var(--content-pad);
  /* Canonical workspace content inset — the ONE source of content padding for
     every view. x = top, responsive (narrow on mobile → comfortable as the
     viewport grows); bottom = 3× so there's always extra room to scroll.
     Opt OUT with .shell__stage--bleed (per-view via content_for :stage_bleed)
     or the context bleed rules below (participation/landing/nomination
     self-manage their own layout). box-sizing:border-box (reset).
     px/vw, NOT the rem space tokens: html[data-mode] scales the root (admin
     --text-sm vs participant --text-base), so a rem inset was 14/21/28px on
     admin vs 16/24/32px on member surfaces. The Shell's geometry is
     mode-immune — ONE inset everywhere (user ruling 2026-07-09).
     Fluid (user ruling 2026-07-11): content is king on mobile — 6px at ≤375px
     growing continuously (4vw − 9px) to the unchanged 32px desktop value at
     ~1024px. Replaces the former 16/24/32 breakpoint steps. */
  --content-pad: clamp(6px, 4vw - 9px, 32px);
  /* How far the full-bleed Banner strip pulls out to reach the Stage edges =
     the Stage's own horizontal padding. Bleed contexts (padding 0) reset it to
     0 so the strip doesn't over-pull up under the Crown / past the edges. */
  --banner-bleed: var(--content-pad);
  padding: var(--content-pad) var(--content-pad) calc(var(--content-pad) * 3);
}

/* Bleed = full edge-to-edge content (no slot padding): per-view opt-out plus the
   inherently self-managed contexts. The admin panel-layout editors (Experience
   Editor, Organization Editor) opt out per-view via content_for :stage_bleed. */
.shell__stage--bleed,
.shell[data-shell-context="landing"] .shell__stage,
.shell[data-shell-context="nomination"] .shell__stage {
  padding: 0;
  --banner-bleed: 0px;
}
/* Participation uses the canonical Stage inset (reader + --content-pad) since
   BS-7 — member-dashboard participation already did via .shell--member-dashboard. */

.shell__dock {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  flex-shrink: 0;
  margin: 0;
  /* The Crown's twin (see .shell --dock-height): --crown-height band + the
     home-indicator inset as padding below, mirroring the Crown's notch inset
     above. 48px mobile / 56px desktop unscrolled. */
  height: var(--dock-height);
  padding-top: 0;
  padding-bottom: var(--dock-safe-bottom);
  background-color: var(--surface-page-translucent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  transition: height var(--duration-normal) var(--ease-out);
}
.shell[data-dock="shrink"].shell--shrunk .shell__dock {
  /* Scrolled Dock == scrolled Crown: --crown-height-collapsed (40px) + inset. */
  height: calc(var(--crown-height-collapsed) + var(--dock-safe-bottom));
}
/* Zones layout (Participation footer-nav and similar button rows): restore
   the top padding so button-shaped content has visual breathing room above
   it as it scales with scroll-shrink. Default tabs layout keeps padding-top
   at 0 so the active-tab indicator hugs the top edge of the chrome. */
.shell[data-dock-layout="zones"] .shell__dock {
  padding-top: var(--space-2);
}

.shell__dock-content {
  display: flex;
  align-items: stretch;
  height: 100%;
  width: 100%;
  max-width: var(--dock-content-max-width, none);
  margin: 0 auto;
  padding: 0 var(--space-4);
}
.shell__dock-content > * {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shell[data-dock-layout="zones"] .shell__dock-content {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
}
.shell[data-dock-layout="zones"] .shell__dock-content > * {
  flex: unset;
  min-width: 0;
  display: flex;
  align-items: center;
}
.shell[data-dock-layout="zones"] .shell__dock-content > *:first-child {
  justify-content: flex-start;
}
.shell[data-dock-layout="zones"] .shell__dock-content > *:nth-child(2) {
  justify-content: center;
}
.shell[data-dock-layout="zones"] .shell__dock-content > *:last-child {
  justify-content: flex-end;
}

.shell__rail-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  margin: 0;
  padding: 0;
  border: none;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  background-color: var(--surface-page);
  color: var(--text-primary);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: none;
}
.shell__rail-overlay::backdrop { background-color: transparent; }

.shell__rail:empty,
.shell__crown:empty,
.shell__dock:empty { display: none; }

@media (min-width: 1024px) {
  .shell__rail-overlay[open] { display: none; }
  .shell__rail { display: flex; flex-direction: column; }

  /* DESKTOP — reveal the workspace scrollbar. `scrollbar-gutter: stable`
     reserves the channel permanently so it never toggles: the mobile shift bug
     (pages of different heights toggling the gutter → centered Stage reflows
     left/right) is a classic-scrollbar problem, so on desktop we keep the bar
     but pin its width. Mobile stays hidden (overlay bars, no reserved space) —
     see the .shell__workspace default above. */
  .shell__workspace {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
  }
  .shell__workspace::-webkit-scrollbar { display: block; width: 10px; }
  .shell__workspace::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
  }
}

@media (min-width: 768px) {
  /* Participation keeps the footer Dock (Back · Requirements · Next) on all
     breakpoints; coach/admin hide it once the Rail or desktop chrome takes over. */
  .shell:not([data-shell-context="participation"]) .shell__dock { display: none; }
  /* Zone Tabs are mobile-only (locked ruling 5, 2026-07-10): at this seam the
     desktop grid shows all zones, so the band leaves (P6 — same seam, no new
     breakpoint source). */
  .shell__zonetabs { display: none; }
}

/* Org Editor + Experience Editor (panel-layout inside a bleed stage) own the
   mobile bottom edge — suppress the member Dock so it doesn't stack on the
   panel tab bar. */
@media (max-width: 767px) {
  .shell__stage--bleed:has(.panel-layout) ~ .shell__dock { display: none; }
}

/* ── CROWN ─────────────────────────────────────────────────── */
.crown {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-2);
  height: 100%;
  width: 100%;
  padding: 0 var(--space-3);
}
.crown__lead    { display: flex; align-items: center; gap: var(--space-2); min-width: 0; justify-self: start; }
.crown__marquee { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.crown__tail    { display: flex; align-items: center; gap: var(--space-1); justify-self: end; }

/* Marquee alignment is context-derived, never per-view:
   - Member contexts center the brand.
   - Admin left-aligns the working title. */
.shell[data-shell-context="participation"] .crown__marquee,
.shell[data-shell-context="coach"]         .crown__marquee { justify-self: center; }
.shell[data-shell-context="admin"]         .crown__marquee { justify-self: start; }

/* ── BRANDPLATE (Rail top OR Crown Marquee) ────────────────── */
/* The ONE mark. Same component, two homes; the home is chosen by
   shell_brand_placement (see SPEC §2). Never rendered in both. */
.brandplate {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.brandplate__mark {
  flex-shrink: 0;
  width: var(--railnav-mark-size);
  height: var(--railnav-mark-size);
  /* Rides the Crown shrink (canonical mobile, 2026-07-11). */
  transition: width var(--duration-normal) var(--ease-out),
              height var(--duration-normal) var(--ease-out);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--accent-primary);
  color: var(--text-on-accent);
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brandplate__mark img { width: 100%; height: 100%; object-fit: contain; }
/* coachOS product mark (admin only) reads as product, not tenant */
.brandplate__mark--product { border-radius: var(--radius-full); background: var(--brand-600); }
/* Compact twin of a tenant logo — rendered only by logo brandplates, shown
   only in the collapsed Rail (see the collapsed rules below). */
.brandplate__mark--collapsed { display: none; }
.brandplate__logo {
  max-height: var(--crown-logo-height);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  transition: max-height var(--duration-normal) var(--ease-out);
}
.brandplate__wordmark {
  font-family: var(--soul-font-display);
  font-size: var(--text-base);
  transition: font-size var(--duration-normal) var(--ease-out);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Brandplate when it lives at the top of the Rail — matches the Crown height so
   the Rail head aligns with the Crown, but carries NO divider (the Rail is one
   continuous surface, no head bar). */
.shell__rail .brandplate {
  height: var(--crown-height);
  padding: 0 var(--space-4);
  flex-shrink: 0;
}
/* ── THE BRAND BOX · one sizing, every home that isn't a bar ──
   Consumer-grade brand box (tenant logo brandplates only): a two-axis contain
   box — full container width, centered — so ANY logo proportion (wide,
   stacked, tall, square) scales to its best size instead of being pinned to a
   36px strip. The height budget is viewport-responsive (fluid vh between DS
   space tokens): tall displays grant more brand room, short ones constrain it.
   Text/mark brandplates (product, no-logo fallback) keep the Crown-aligned bar
   above, and the Crown Marquee never boxes — it IS a bar.

   TWO homes share this ONE block (2026-07-23): the Rail head, and the auth
   portal on members sign-in, which rendered its own `.auth__logo` at
   --crown-logo-height and so showed a tenant wordmark as a 36px sliver. The
   Rail opts in by selector (its markup is byte-parity fixtured in
   spec/fixtures/shell_chrome); any other home opts in with the `box: true`
   local on shell/_brandplate. */
.shell__rail .brandplate--logo,
.brandplate--box {
  justify-content: center;
  height: auto;
  width: 100%;
}
/* Rail-only: the head still aligns to the Crown and carries the Rail inset. */
.shell__rail .brandplate--logo {
  min-height: var(--crown-height);
  padding: var(--space-3) var(--space-4);
}
.shell__rail .brandplate--logo .brandplate__logo,
.brandplate--box .brandplate__logo {
  width: 100%;
  height: auto;
  max-height: clamp(var(--space-16), var(--brandplate-logo-vh-budget), var(--space-32));
}
/* Collapsed Rail: keep the mark, drop the wordmark, center the mark. A tenant
   logo swaps to its compact twin (mobile logo, else initials) — a wordmark
   squeezed into 48px is not a brand. */
.shell--rail-collapsed .shell__rail .brandplate {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.shell--rail-collapsed .shell__rail .brandplate__wordmark { display: none; }
.shell--rail-collapsed .shell__rail .brandplate__logo { display: none; }
.shell--rail-collapsed .shell__rail .brandplate__mark--collapsed { display: flex; }

/* ── ONE BRAND RULE · CSS-driven placement ─────────────────── */
/* This app has no server-side viewport signal — desktop vs mobile is
   decided purely by CSS media queries (see the structural regions above and
   shell/coach.css). So the coach Brandplate is rendered in BOTH homes
   (Rail + Crown Marquee) and CSS guarantees exactly one is ever visible:

     • The coach Rail reveals at ≥768px (shell/coach.css), so the Rail
       Brandplate shows there and the Marquee Brandplate is hidden.
     • Below 768px the Rail is hidden, so only the Marquee Brandplate shows.

   Net: one mark at every width, never two, never zero — the One Brand
   Rule as a visual invariant, wired to the EXISTING breakpoint (no new
   breakpoint source invented). Admin's Rail reveals at ≥1024px (global)
   and its Marquee carries the Title, never the brand, so no swap rule is
   needed there. Participation with member dashboard chrome (terminal thank-you
   or in-flight Read-only/Active) uses the same swap via .shell--member-dashboard. */
/* The Marquee page title on brand crowns — hidden where the brand shows
   (mobile), revealed where the Rail takes the brand (the swap's desktop twin). */
/* The Crown title row — the ONE shape every page's Crown content takes, icon or
   not (ShellHelper#crown_title). A flex row centres the glyph and the words on the
   same middle; `vertical-align: middle` could not, because it aligns to the
   x-height and left the icon riding low. The row lives INSIDE the <h1> because
   .crown__title's own `display` is load-bearing (the One Brand swap toggles it
   none/block), so it must stay untouched. `1em` scales the icon with the title,
   including inside the shrunk Crown. */
.crown__title-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  vertical-align: middle;
}
.crown__title-icon {
  font-size: 1em;
  line-height: 1;
  flex-shrink: 0;
  color: var(--text-secondary);
}
/* The words truncate, never the glyph. */
.crown__title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crown__title--brand-swap { display: none; }
/* The Marquee brand's one-touch dashboard link (active-dashboard contexts,
   user ruling 2026-07-11) — a flex wrapper that adds no geometry of its own. */
.crown__brand-link {
  display: flex;
  align-items: center;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-md);
}
.crown__brand-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
@media (min-width: 768px) {
  .shell[data-shell-context="coach"] .crown__marquee .crown__brand-link,
  .shell.shell--member-dashboard .crown__marquee .crown__brand-link,
  .shell[data-shell-context="coach"] .crown__marquee .brandplate,
  .shell.shell--member-dashboard .crown__marquee .brandplate { display: none; }
  .shell[data-shell-context="coach"] .crown__marquee .crown__title--brand-swap,
  .shell.shell--member-dashboard .crown__marquee .crown__title--brand-swap { display: block; }
  /* With the brand gone, the Marquee carries the title — start-aligned like
     admin (mobile keeps the centered brand below the breakpoint). */
  .shell[data-shell-context="coach"] .crown__marquee,
  .shell.shell--member-dashboard .crown__marquee { justify-self: start; }
  /* The Wayfinder opens this Sheet on mobile; on coach desktop the Rail is
     the nav, so keep the Sheet hidden even if toggled (the global ≥1024
     rule covers admin; coach needs the earlier 768 cutoff). */
  .shell[data-shell-context="coach"] .shell__rail-overlay[open],
  .shell.shell--member-dashboard .shell__rail-overlay[open] { display: none; }
}

/* ── RAIL OVERLAY (mobile nav) ─────────────────────────────── */
/* The Rail overlay (.shell__rail-overlay dialog) hosts the Railnav on mobile, opened by
   the Crown Wayfinder. Neutralize the legacy slide-over transform so the nav
   fills the full-viewport dialog instead of sitting off-screen. The in-flight
   participation Sheet opens here as a Slide-over over the mounted step;
   closing returns the member to the exact step. */
.shell__rail-overlay .railnav {
  transform: none;
  width: 100%;
  height: 100%;
  box-shadow: none;
  border-right: none;
}

/* Mobile Sheet — full-viewport Railnav presentation (B20).
   Overrides the legacy 280px slide-over rules in railnav.css. */
@media (max-width: 767px) {
  .shell__rail-overlay .railnav {
    transform: none;
    width: 100%;
    max-width: none;
    z-index: auto;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .shell__rail-overlay .railnav__list {
    flex: 1;
    padding: calc(var(--crown-height) + var(--space-2)) var(--space-4) var(--space-2);
  }

  .shell__rail-overlay .railnav__section {
    margin-bottom: var(--space-5);
  }

  .shell__rail-overlay .railnav__group {
    padding: var(--space-2) var(--space-1);
  }

  /* The Anchor rides the overlay bottom with the safe-area inset (was the
     .railnav__foot rule; collapse hiding lives in railnav.css). */
  .shell__rail-overlay .railnav__anchor {
    margin-top: auto;
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  }
}
.wayfinder--close {
  position: absolute;
  top: calc(var(--space-3) + env(safe-area-inset-top, 0px));
  right: var(--space-3);
  z-index: 1;
}

/* ── WAYFINDER (the Menu — same in every context) ──────────── */
.wayfinder {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              width var(--duration-normal) var(--ease-out),
              height var(--duration-normal) var(--ease-out);
}
.wayfinder:hover { background: var(--surface-hover); color: var(--text-primary); }
.wayfinder:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
/* The overlay's close control never rings — no outline is EVER drawn around it
   (user ruling 2026-07-23). Same call the DS already made for the other close
   button of this exact kind, .modal__close (components/modals.css). Its
   affordance is the icon plus the Escape key, and a ring on a dismiss control
   sitting in the corner of a panel reads as damage, not guidance. */
.wayfinder--close:focus,
.wayfinder--close:focus-visible { outline: none; }
.wayfinder .material-symbols-rounded { font-size: 24px; }

/* The Crown menu Wayfinder is the MOBILE Rail-overlay trigger only — hidden
   wherever the Rail is visible (admin ≥1024px, coach ≥768px). Desktop Rail
   collapse is the Rail's own control, never the Crown. */
@media (min-width: 1024px) {
  .shell[data-shell-context="admin"] .wayfinder--menu { display: none; }
}
@media (min-width: 768px) {
  .shell[data-shell-context="coach"] .wayfinder--menu,
  .shell.shell--member-dashboard .wayfinder--menu { display: none; }
}

/* ── MARQUEE TITLE (admin working title only) ──────────────── */
.crown__title {
  font-family: var(--soul-font-display);
  font-size: var(--text-lg);
  transition: font-size var(--duration-normal) var(--ease-out);
  font-weight: var(--soul-display-weight);
  letter-spacing: var(--soul-display-tracking);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

/* ── ACTIONBAR (Crown Tail) ────────────────────────────────── */
.actionbar { display: flex; align-items: center; gap: var(--space-1); }
.actionbar__btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.actionbar__btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.actionbar__btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.actionbar__btn .material-symbols-rounded { font-size: 22px; }
.actionbar__avatar {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-out),
              height var(--duration-normal) var(--ease-out);
  background: var(--surface-selected);
  color: var(--accent-primary);
  font-size: var(--text-xs);
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden;
  text-decoration: none;
}
.actionbar__avatar img { width: 100%; height: 100%; object-fit: cover; }
.actionbar__avatar svg { width: 100%; height: 100%; display: block; }
/* Primary CTA living in the Tail (e.g. admin "New step") */
.actionbar__cta {
  display: inline-flex; align-items: center; gap: var(--space-1);
  height: 36px; padding: 0 var(--space-3);
  border-radius: var(--soul-radius-button);
  border: none;
  background: var(--accent-primary);
  color: var(--text-on-accent);
  font-family: var(--soul-font-chrome);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.actionbar__cta .material-symbols-rounded { font-size: 18px; }

/* ── DOCK · two layouts ────────────────────────────────────── */
/* Docknav (mobile tabs) — member dashboard */
.docknav { display: flex; align-items: stretch; width: 100%; height: 100%; }
.docknav__tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--shell-metric-space-0-5);
  text-decoration: none;
  color: var(--text-tertiary);
  position: relative;
}
.docknav__tab .material-symbols-rounded { font-size: 24px; }
.docknav__label { font-size: var(--railnav-group-font-size); font-weight: 500; }
.docknav__tab--active { color: var(--accent-primary); }
.docknav__tab--active .material-symbols-rounded { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.docknav__tab--active::before {
  content: ""; position: absolute; top: 0; left: 34%; right: 34%;
  height: 2px; border-radius: var(--radius-full); background: var(--accent-primary);
}

/* Footer-nav (participation) — Back · status · Finish/Next */
.footernav { display: flex; align-items: center; width: 100%; height: 100%; padding: 0 var(--space-4); gap: var(--space-2); }
.footernav__back   { flex: 0 0 auto; }
.footernav__center { flex: 1; display: flex; justify-content: center; }
.footernav__end    { flex: 0 0 auto; }
