/**
 * Shell V2 — app grid, top bar, bottom tabs, safe-areas.
 *
 * Scoped: activates only on <body class="app-shell">. Legacy pages unaffected.
 * Tokens: canonical --t-* only. No hex, no legacy aliases.
 *
 * ─── Shell-private runtime vars (ADR-0002) ──────────────────────────────
 * These are LAYOUT RUNTIME vars, not design tokens. They do NOT belong in
 * inyourbody-design-system/project/colors_and_type.css. Do not add them to
 * the brand token catalog — they only make sense inside Shell V2.
 *
 *   --app-topbar-h   Reserved height of the floating top pill (incl. margins).
 *                    Set here on body.app-shell. Read by .app-screen sizing
 *                    math and any consumer that needs to offset from the top
 *                    chrome.
 *
 *   --app-tabs-h     Reserved height of the floating bottom dock (incl. gap
 *                    + safe-area slack). Set here on body.app-shell. Read
 *                    by .app-content's bottom padding, .app-sticky-cta's
 *                    sticky offset, and .app-scrim--bottom's height.
 *
 *   --kb-inset       Live keyboard inset in px. Set at runtime by
 *                    assets/js/ui.js via window.visualViewport.resize → the
 *                    JS writes the current inset to body.style. Read by
 *                    .app-content padding-bottom and .app-sticky-cta offset
 *                    so the CTA rides above the soft keyboard on iOS/Android.
 *
 * Why not brand tokens: values depend on device chrome, PWA mode, and live
 * keyboard state — they change at runtime. Brand tokens are static visual
 * constants. Keeping these shell-private preserves a clean boundary between
 * design system (colors/type/shape/shadow/motion) and app layout runtime.
 */
/* Shell V2 scroll invariant: html/body must never become the vertical
   scroller on app-shell pages. Keep all page scrolling inside .app-content.
   Use stable 100svh here; 100dvh follows iOS browser chrome changes and can
   shift fixed shell UI such as the topbar and bottom dock. */
html:has(> body.app-shell) {
  height: 100%;
  overflow: hidden;
  background: var(--t-shell-bg, var(--t-bg));
}

:root {
  /* Shared mobile bottom-surface contract. The underlay owns the edge-to-edge
     safe-area fill; the interactive dock stays a fully rounded floating pill. */
  --mobile-shell-dock-edge-gap: 8px;
  --mobile-shell-dock-bottom: calc(
    var(--mobile-shell-bottom-safe-pad)
    + var(--mobile-shell-dock-edge-gap)
  );
  --mobile-shell-bottom-underlay-z: 10;
  --mobile-shell-dock-z: 1500;
  --mobile-shell-workout-underlay-z: 2599;
  --mobile-shell-workout-dock-z: 2600;
  --mobile-shell-topbar-z: 3000;
  --mobile-shell-bottom-safe-pad: env(safe-area-inset-bottom, 0px);
  --mobile-shell-dock-pad-x: 6px;
  --mobile-shell-dock-pad-top: 6px;
  --mobile-shell-dock-pad-bottom: 6px;
  --mobile-shell-dock-item-gap: 2px;
  --mobile-shell-dock-icon-w: 40px;
  --mobile-shell-dock-icon-h: 28px;
  --mobile-shell-dock-icon-size: 24px;
  --mobile-shell-dock-label-size: 11px;
  --mobile-shell-dock-label-line-height: 1;
  --mobile-shell-dock-pad-bottom-effective: var(--mobile-shell-dock-pad-bottom);
  /* Actual pill height: outer padding + item vertical stack
     (7px + icon 28px + gap 2px + label 11px) + 1px borders. Safe-area and
     edge gap live in --mobile-shell-dock-bottom, outside the rounded pill.
     Runtime measurement replaces this fallback after boot. */
  --mobile-shell-dock-h: calc(
    var(--mobile-shell-dock-pad-top)
    + 54px
    + var(--mobile-shell-dock-pad-bottom-effective)
    + 2px
  );
}

body.app-shell {
  margin: 0;
  min-height: 100vh; /* fallback */
  min-height: 100svh;
  height: 100vh; /* fallback */
  height: 100svh;
  min-height: 100vh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--t-shell-bg, var(--t-bg));
  color: var(--t-text);
  font-family: var(--t-font);

  /* keyboard-inset (set by assets/js/ui.js on focus/resize) */
  --kb-inset: 0px;
  --app-layout-viewport-h: 100svh;
  --app-visual-viewport-h: 100svh;
  --app-visual-viewport-bottom-inset: 0px;
  --app-scrollport-bottom-inset: 0px;
  /* Backward-compatible alias for route styles that consume the shared
     bottom scroll reserve. The value is geometry-driven, not UA-driven. */
  --app-browser-bottom-inset: var(--app-scrollport-bottom-inset);
  --mobile-shell-dock-bottom: calc(
    var(--mobile-shell-bottom-safe-pad)
    + var(--mobile-shell-dock-edge-gap)
  );
  --mobile-shell-dock-pad-bottom-effective: var(--mobile-shell-dock-pad-bottom);
  --mobile-shell-dock-h: calc(
    var(--mobile-shell-dock-pad-top)
    + 54px
    + var(--mobile-shell-dock-pad-bottom-effective)
    + 2px
  );

  /* Shared mobile shell geometry. Admin mobile maps its --amo-* vars to the
     same contract in admin/mobile-shell.css. */
  --app-topbar-offset: 10px;
  --app-topbar-measured-h: 48px;
  --app-topbar-content-clearance: 24px;
  --app-access-banner-gap: 8px;
  --app-access-banner-h: 0px;
  --app-access-banner-reserve: 0px;
  --mobile-shell-topbar-h: calc(var(--app-topbar-offset) + var(--app-topbar-measured-h));
  --mobile-shell-dock-measured-h: var(--mobile-shell-dock-h);
  --mobile-shell-tabs-h: calc(var(--mobile-shell-dock-bottom) + var(--mobile-shell-dock-measured-h));
  --app-topbar-h: var(--mobile-shell-topbar-h);
  --app-tabs-h: var(--mobile-shell-tabs-h);
  /* Legacy bottom spacing used by message screens. Do not use for shell CTA
     geometry: the sticky CTA has its own explicit clearance below. */
  --cta-dock-gap: 30px;
  /* Visible gap between sticky CTA bottom and the dock's top edge. */
  --cta-dock-clearance: 10px;
  /* Scroll reserve for screens with a fixed terminal CTA: keeps the last
     content row liftable above the action lane on short viewports. */
  --app-sticky-cta-h: 56px;
  --app-sticky-cta-scroll-gap: 112px;

  /* Single app-frame width (ADR: client UX mobile-first at every viewport).
     Content column + fixed chrome pills (topbar / tabs / sticky CTA) share
     this width ≥640px. Split into w / half / pad so the frame-edge calc
     stays flat — no division inside calc() (Safari/iOS safer). */
  --app-frame-w: 560px;
  --app-frame-half: 280px;
  --app-frame-pad: 14px;

  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0);
}

/* WKWebView can leave CSS viewport units at the keyboard-sized height after
   an input blurs. Keep the native/installed shell canvas on the last stable
   layout viewport supplied by ui.js; the form sheet still follows the live
   visual viewport independently through --app-visual-viewport-h. */
@supports (-webkit-touch-callout: none) {
  body.app-shell.app-shell--standalone {
    height: var(--app-layout-viewport-h, 100svh);
    min-height: var(--app-layout-viewport-h, 100svh);
  }
}

/* App shell is a tappable-surface environment, not a webpage — kill the
   inherited a:hover underline from style.css. Prose links inside .prose
   re-enable underline below. */
body.app-shell a,
body.app-shell a:hover,
body.app-shell a:focus {
  text-decoration: none;
}
body.app-shell :is(a, button, [role="button"], input[type="button"], input[type="submit"], input[type="reset"]) {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
body.app-shell :is(input:not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select, [contenteditable="true"]) {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}
body.app-shell :is(a, button, [role="button"], input[type="button"], input[type="submit"], input[type="reset"]):focus-visible {
  outline: none;
}
body.app-shell .prose a,
body.app-shell .prose a:hover {
  text-decoration: underline;
}

/* ── Top app bar — floating liquid-glass pill ────────────────────────────
   Shell chrome: position: fixed to the viewport so content scrolls UNDER
   the pill (signature iOS-26 backdrop-filter dissolve). Matched pair with
   the bottom dock — both floating pills owned by the shell, not the page.
   Horizontal insets match the dock (14px) so the two chrome pills bookend
   the viewport, not the content column. */

.app-topbar {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0) + var(--app-topbar-offset));
  left: 14px;
  right: 14px;
  z-index: var(--mobile-shell-topbar-z);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 22px;
  border: 1px solid var(--t-topdock-border);
  background: var(--t-topdock-bg);
  -webkit-backdrop-filter: blur(22px) saturate(1.7);
  backdrop-filter: blur(22px) saturate(1.7);
  box-shadow: var(--t-topdock-shadow);
  transition: box-shadow var(--t-motion-base, 180ms) var(--t-ease-premium, ease);
}

/* Scrolled visual state (ADR-0003). Toggled by ui.js when .app-content
   scrollTop > 4. Layers a violet-tinted lift on top of the ambient
   topdock-shadow so the floating pill visibly "lifts off" when content
   passes beneath it. Token-driven — reuses --t-primary-rgb + shell motion
   contract (--t-motion-base / --t-ease-premium). No new animation language. */
.app-topbar--scrolled {
  box-shadow: var(--t-topdock-shadow),
              var(--t-shell-chrome-lift-shadow, 0 8px 24px rgba(var(--t-primary-rgb), 0.14));
}

.app-access-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0) + var(--app-topbar-h) + var(--app-access-banner-gap));
  left: 14px;
  right: 14px;
  z-index: calc(var(--mobile-shell-topbar-z) - 1);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 8px 6px 12px;
  border: 1px solid color-mix(in srgb, var(--t-border) 58%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--t-surface) 64%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  backdrop-filter: blur(14px) saturate(1.25);
}

.app-access-banner > div {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
}

.app-access-banner strong {
  color: var(--t-text-muted);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 600;
}

.app-access-banner span {
  color: var(--t-text-muted);
  font-size: 12px;
  line-height: 1.3;
}

.app-access-banner__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--t-cta-bg);
  background: var(--t-cta-surface, var(--t-cta-bg));
  color: var(--t-cta-fg);
  font-weight: 800;
  font-size: 12px;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.app-access-banner__cta::after {
  content: "";
  position: absolute;
  inset: -2px 0;
}

.app-access-banner__cta:hover {
  background: var(--t-cta-surface-hover, var(--t-cta-bg));
}

.app-access-banner__cta:active {
  transform: scale(0.96);
}

.app-coach-context-banner {
  min-height: 60px;
  padding-block: 8px;
}

.app-coach-context-banner__copy {
  gap: 2px;
}

.app-coach-context-banner__copy strong {
  color: var(--t-text);
}

.app-coach-context-banner__copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-access-banner > .app-coach-context-banner__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: auto;
}

.app-coach-context-banner__actions form {
  margin: 0;
}

.app-coach-context-banner .app-access-banner__cta {
  min-height: 40px;
}

.app-coach-context-banner__exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--t-border);
  border-radius: 12px;
  background: var(--t-surface-subtle, transparent);
  color: var(--t-text-muted);
  cursor: pointer;
  transition: background 150ms ease-out, color 150ms ease-out, transform 150ms ease-out;
}

.app-coach-context-banner__exit:hover {
  background: var(--t-surface-hover, var(--t-surface));
  color: var(--t-text);
}

.app-coach-context-banner__exit:active {
  transform: scale(0.96);
}

body.app-shell:has(.app-access-banner) {
  --app-access-banner-h: 48px;
  --app-access-banner-reserve: calc(var(--app-access-banner-gap) + var(--app-access-banner-h));
}

body.app-shell:has(.app-coach-context-banner) {
  --app-access-banner-h: 60px;
}

@media (max-width: 380px) {
  .app-coach-context-banner__copy span {
    display: none;
  }

  .app-coach-context-banner .app-access-banner__cta {
    padding-inline: 10px;
  }
}

.app-topbar__back,
.app-topbar__trailing {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--t-text);
  cursor: pointer;
  border-radius: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.app-topbar__back { margin-left: -4px; }
.app-topbar__back svg,
.app-topbar__trailing svg {
  display: block;
}

.app-topbar__back:active,
.app-topbar__trailing:active {
  background: var(--t-border);
}

.app-topbar__trailing-wrap {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.app-topbar__notifications {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.app-topbar__notify {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  color: var(--t-text);
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

a.app-topbar__notify {
  cursor: pointer;
  text-decoration: none;
}

.app-topbar__notify svg {
  display: block;
}

.app-topbar__notify:active {
  background: transparent;
}

.app-topbar__notify:focus {
  outline: none;
}

.app-topbar__notify-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--t-danger);
  box-shadow: 0 0 0 2px var(--t-topdock-bg);
}

/* Compact shell brand mark — leading slot on root screens only.
   Suppressed automatically when a back button is present (top_bar.php). */
.app-topbar__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: 10px;
  overflow: hidden;
  border-radius: 6px;
  flex-shrink: 0;
}
.app-topbar__brand-img {
  width: 26px;
  height: 26px;
  display: block;
  border-radius: 6px;
  user-select: none;
  -webkit-user-drag: none;
}
/* Theme-aware asset swap: dark mark on light bg, white mark on dark/violet bg. */
.app-topbar__brand-img--dark { display: none; }
[data-theme="dark"] .app-topbar__brand-img--light,
[data-theme="violet"] .app-topbar__brand-img--light { display: none; }
[data-theme="dark"] .app-topbar__brand-img--dark,
[data-theme="violet"] .app-topbar__brand-img--dark { display: block; }

/* Section identity icon — leading slot on root/tab screens that aren't Home.
   Replaces the compact brand mark for per-tab identity (training=barbell,
   progress=chart-line-up, food=fork-knife, profile=user-circle). Suppressed
   automatically when a back button is present (top_bar.php). */
.app-topbar__section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  color: var(--t-text);
  flex-shrink: 0;
}
.app-topbar__section-icon svg { display: block; }

.app-topbar__title {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--t-text);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar__title-stack {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 1px;
}

.app-topbar__title-stack .app-topbar__title {
  flex: none;
  line-height: 1.08;
}

.app-topbar__subtitle {
  overflow: hidden;
  color: var(--t-text-muted);
  font-size: 10.5px;
  font-weight: 560;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* When a back button is present, add a little inset */
.app-topbar__back + .app-topbar__title,
.app-topbar__back + .app-topbar__title-stack {
  margin-left: 4px;
}

/* Profile cluster (Home) — brand mark + display name + chevron as one
   tappable unit. Reads as a premium app header/title, not as a button
   or a web link. Entire cluster is the tap target. */
.app-topbar__profile {
  flex: 1;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  padding: 0 6px 0 0;
  margin: 0 -6px 0 0;
  color: inherit;
  text-decoration: none;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s var(--t-ease-premium, ease);
}
.app-topbar__profile:active {
  background: rgba(var(--t-primary-rgb), 0.06);
}
.app-topbar__profile .app-topbar__brand {
  margin-right: 10px;
  flex-shrink: 0;
}
.app-topbar__title--profile {
  flex: 0 1 auto;
  margin: 0;
  max-width: calc(100% - 28px);
  font-size: 17px;
  font-weight: 700;
  color: var(--t-text);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.app-topbar__profile-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  color: var(--t-text-muted);
  opacity: 0.55;
  flex-shrink: 0;
  transition: transform 0.15s var(--t-ease-premium, ease), opacity 0.15s;
}
.app-topbar__profile-chev svg {
  display: block;
}
.app-topbar__profile:active .app-topbar__profile-chev {
  opacity: 0.85;
  transform: translateX(1px);
}

/* ── Content area ────────────────────────────────────────────────────── */

.app-content {
  --app-content-bottom-clearance: calc(
    var(--app-tabs-h)
    + 24px
    + var(--kb-inset)
    + var(--app-browser-bottom-inset)
  );
  flex: 1 1 auto;
  min-height: 0;
  /* WebKit flex-item sizing quirk: without an explicit width, a flex child
     that is also an overflow:auto scroll container can collapse its cross-
     axis size to intrinsic min-content instead of stretching to the parent
     (then clamped by max-width). Narrow-content pages (e.g. progress hub)
     collapsed to ~296px on desktop despite max-width: var(--app-frame-w).
     width: 100% forces a definite cross-size so max-width clamps correctly. */
  width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  /* Top/bottom padding reserves clearance for the fixed floating topbar and
     dock — content scrolls under both via the matching paint layers. 16px
     horizontal gutter keeps familiar content alignment. */
  padding: calc(
      var(--app-topbar-h)
      + var(--app-topbar-content-clearance)
      + var(--app-access-banner-reserve)
    ) 16px var(--app-content-bottom-clearance);
  scroll-padding-top: calc(
    var(--app-topbar-h)
    + var(--app-topbar-content-clearance)
    + var(--app-access-banner-reserve)
  );
  scroll-padding-bottom: var(--app-content-bottom-clearance);
}

/* Screens with a shell-owned compact terminal CTA reserve exactly the dock,
   fixed CTA lane, 8px of visible content clearance, and browser chrome slack.
   This is the default for AppShellRenderer::stickyCta() because most save/send
   actions are one-row controls. Use .app-sticky-cta--wide only for unusually
   tall terminal controls that need legacy extra lift. */
body.app-shell:has(.app-sticky-cta) .app-content {
  --app-content-bottom-clearance: calc(
    var(--app-tabs-h)
    + var(--kb-inset)
    + var(--cta-dock-clearance)
    + var(--app-sticky-cta-h)
    + 8px
    + var(--app-browser-bottom-inset)
  );
}

/* Program start replaces the bottom navigation dock with a single terminal CTA.
   Keep the reserve tied to the CTA lane, not the hidden nav dock. */
body.app-shell:not(.vbp-workout-active):has(.vbp-start-cta) .app-content {
  --app-content-bottom-clearance: calc(
    var(--mobile-shell-bottom-safe-pad)
    + var(--kb-inset)
    + var(--app-sticky-cta-h)
    + 32px
    + var(--app-browser-bottom-inset)
  );
}

body.app-shell:has(.app-sticky-cta--wide) .app-content {
  --app-content-bottom-clearance: calc(
    var(--app-tabs-h)
    + var(--kb-inset)
    + var(--cta-dock-clearance)
    + var(--app-sticky-cta-h)
    + var(--app-sticky-cta-scroll-gap)
    + var(--app-browser-bottom-inset)
  );
}

/* When the dock is absent, hidden by focus mode, or replaced by the mobile
   keyboard, reserve only the visible system/keyboard lane. Do not leave the
   normal navigation height behind as a blank scroll tail. */
body.app-shell:not(:has(.app-tabs)) .app-content,
body.app-shell.app-shell--focus:not(:has(.app-sticky-cta)):not(:has(.vbp-start-cta)) .app-content,
body.app-shell.app-shell--keyboard:not(:has(.app-sticky-cta)):not(:has(.vbp-start-cta)) .app-content {
  --app-content-bottom-clearance: calc(
    var(--mobile-shell-bottom-safe-pad)
    + var(--kb-inset)
    + 24px
    + var(--app-browser-bottom-inset)
  );
}

body.app-shell:is(.app-shell--focus, .app-shell--keyboard):has(.app-sticky-cta) .app-content {
  --app-content-bottom-clearance: calc(
    var(--mobile-shell-bottom-safe-pad)
    + var(--kb-inset)
    + var(--app-sticky-cta-h)
    + 20px
    + var(--app-browser-bottom-inset)
  );
}

@supports (-webkit-touch-callout: none) {
  @media (hover: none) and (pointer: coarse) {
    body.app-shell.app-shell--standalone {
      /* JS fallback for installed iOS web apps whose CSS display-mode still
         resolves as browser even though navigator.standalone is true. */
      --mobile-shell-dock-edge-gap: 4px;
    }
  }

  @media (display-mode: standalone) and (hover: none) and (pointer: coarse) {
    body.app-shell {
      /* Keep the iPhone PWA pill close to the home-indicator lane while the
         safe-area inset itself remains fully reserved below the dock. */
      --mobile-shell-dock-edge-gap: 4px;
    }
  }

  @media (display-mode: browser) and (hover: none) and (pointer: coarse) {
    body.app-shell:not(.app-shell--standalone) {
      --mobile-shell-dock-bottom: 0px;
      --mobile-shell-dock-pad-bottom-effective: calc(
        var(--mobile-shell-dock-pad-bottom)
        + var(--mobile-shell-bottom-safe-pad)
      );
    }

    body.app-shell .app-topbar {
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
      isolation: isolate;
    }

    body.app-shell.app-shell--focus:has(.ob-screen) {
      --app-topbar-content-clearance: 28px;
    }

    body.app-shell .app-content {
      -webkit-overflow-scrolling: touch;
    }
  }
}

body.app-shell:not(.vbp-workout-active):has(.vbp-start-cta) {
  --mobile-shell-dock-bottom: 0px;
}

body.app-shell:has(.msg-screen--thread) .app-content {
  --app-content-bottom-clearance: calc(
    var(--msg-composer-h, var(--app-sticky-cta-h))
    + var(--mobile-shell-dock-bottom)
    + 24px
    + var(--kb-inset)
  );
  overflow: hidden;
}

body.app-shell:has(.msg-screen--thread) .app-screen,
body.app-shell:has(.msg-screen--thread) .app-screen__body {
  height: 100%;
  min-height: 0;
}

/* .app-screen / .app-screen__body are emitted by AppShellRenderer as plain
   block wrappers. The flex-col stage from v2.136.0 was rolled back in this
   wave because the CTA is now shell chrome (position: fixed), not a flex
   slot inside content. The wrappers remain in markup to preserve the class
   contract but have no styling — block-flow passthrough. */

/* ── Shell-owned bottom action lane (ADR-0003 v2) ─────────────────────────
   Both .app-sticky-cta (AppShellRenderer-emitted) and .vbp-start-cta (legacy
   hand-rolled shell on program.php) share the same chrome contract: fixed
   to the viewport above the dock's reserved zone, with matching horizontal
   insets. The wrapper is transparent (scrim owns the fade) and pointer-
   events:none so taps in surrounding padding pass to content; the CTA
   element inside opts back in via > *. Unified here so every terminal CTA
   across the app uses the exact same action lane geometry. */

body.app-shell .app-sticky-cta,
body.app-shell .vbp-start-cta {
  --app-cta-bottom-offset: calc(var(--app-tabs-h) + var(--cta-dock-clearance) + var(--kb-inset));
  position: fixed;
  left: 14px;
  right: 14px;
  /* Park CTA from the dock's real geometry: dock bottom offset + dock height
     (`--app-tabs-h`) + explicit visual clearance. This avoids relying on
     safe-area as an accidental Android/iPhone offset. */
  bottom: var(--app-cta-bottom-offset);
  z-index: 35;
  margin: 0;
  padding: 0;
  background: none;
  pointer-events: none;
}

body.app-shell .vbp-start-cta {
  z-index: var(--mobile-shell-workout-dock-z, 2600);
}

body.app-shell .app-sticky-cta > *,
body.app-shell .vbp-start-cta > * {
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

/* Messages are a focused chat surface: the composer/new-topic action replaces
   the bottom dock instead of floating above it. */
body.app-shell:has(.msg-screen) .app-sticky-cta {
  --app-cta-bottom-offset: calc(
    var(--mobile-shell-dock-bottom)
    + var(--app-browser-bottom-inset)
    + 8px
  );
  left: 12px;
  right: 12px;
  z-index: var(--mobile-shell-dock-z);
}

/* CTA-lane underlay (ADR-0003 v3). Solid shell-bg fill extending from the
   CTA wrapper's bottom edge down past the dock/system safe area. Fills the
   strip between the yellow pill and the dock/system browser chrome that the
   bottom-scrim gradient only fades over. Without this fill, scrolling content
   flashes through that strip during fast scroll and iOS address-bar
   transitions — read as CTA "flying away" from the dock. Dock z:50 paints
   above the underlay so the fill only shows in the exposed strip — no new
   visual surface, just continues the shell-bg canvas under the action lane.
   Keep it alive in focus mode too: onboarding hides .app-tabs and the bottom
   scrim, but iPhone Safari still exposes the system dock lane below CTA. */
body.app-shell .app-sticky-cta::after,
body.app-shell .vbp-start-cta::after {
  content: '';
  position: absolute;
  left: -14px;
  right: -14px;
  bottom: calc(0px - var(--app-cta-bottom-offset));
  height: calc(var(--app-cta-bottom-offset) + env(safe-area-inset-bottom, 0) + 28px);
  background: var(--t-shell-bg, var(--t-bg));
  pointer-events: none;
  z-index: 0;
}

body.app-shell .vbp-start-cta::after {
  top: 100%;
  bottom: auto;
  height: calc(var(--mobile-shell-bottom-safe-pad) + var(--kb-inset) + 32px);
}

body.app-shell--focus .app-sticky-cta,
body.app-shell--focus .vbp-start-cta {
  --app-cta-bottom-offset: calc(var(--mobile-shell-bottom-safe-pad) + var(--kb-inset) + 12px);
}

body.app-shell:not(.vbp-workout-active):has(.vbp-start-cta) .vbp-start-cta {
  --app-cta-bottom-offset: calc(var(--mobile-shell-bottom-safe-pad) + var(--kb-inset) + 12px);
}

body.app-shell--keyboard .app-sticky-cta {
  --app-cta-bottom-offset: calc(var(--mobile-shell-bottom-safe-pad) + var(--kb-inset) + 12px);
}

body.app-shell--keyboard .app-topbar {
  transform: translateY(var(--vv-offset-top, 0px));
}

body.app-shell--keyboard:has(.msg-screen) .app-sticky-cta {
  --app-cta-bottom-offset: max(6px, calc(var(--kb-inset) - var(--mobile-shell-bottom-safe-pad) + 6px));
}

body.app-shell--focus .app-sticky-cta::after,
body.app-shell--focus .vbp-start-cta::after {
  background: transparent;
}

body.app-shell .vbp-start-viewport-edge {
  display: none;
}

body.app-shell:not(.vbp-workout-active):has(.vbp-start-cta) .vbp-start-viewport-edge {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  z-index: 2147483647;
  background: color-mix(in srgb, var(--t-shell-bg, var(--t-bg)) 42%, transparent);
  -webkit-backdrop-filter: blur(26px) saturate(1.85) brightness(1.05);
  backdrop-filter: blur(26px) saturate(1.85) brightness(1.05);
  pointer-events: none;
  transform: translateZ(0);
}

body.app-shell.vbp-workout-active .vbp-start-viewport-edge {
  display: none;
}

/* ── Bottom scrim (ADR-0003) ──────────────────────────────────────────────
   Liquid-glass bottom chrome lane: one shell-owned layer above content and
   below the floating dock. It paints both the dock backdrop and the strip
   below it, so body::after does not compete with the nav lane on iOS Safari. */

.app-scrim--bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--app-tabs-h) + 12px);
  pointer-events: none;
  z-index: var(--mobile-shell-bottom-underlay-z);
  background: linear-gradient(to top, var(--t-shell-bg, var(--t-bg)) 45%, transparent);
}

body.app-shell--focus .app-scrim--bottom {
  display: none;
}

body.app-shell--focus:has(.app-sticky-cta) .app-scrim--bottom {
  display: block;
  height: calc(var(--mobile-shell-bottom-safe-pad) + var(--app-sticky-cta-h) + 104px);
  z-index: var(--mobile-shell-workout-underlay-z, 2599);
  background: linear-gradient(to top, var(--t-shell-bg, var(--t-bg)) 42%, transparent);
}

body.app-shell:not(.vbp-workout-active):has(.vbp-start-cta) .app-scrim--bottom {
  display: block;
  height: calc(var(--mobile-shell-bottom-safe-pad) + var(--app-sticky-cta-h) + 48px);
  z-index: var(--mobile-shell-workout-underlay-z, 2599);
  background: linear-gradient(to top, var(--t-shell-bg, var(--t-bg)) 70%, transparent);
}

body.app-shell:has(.msg-screen) .app-scrim--bottom {
  height: calc(
    var(--mobile-shell-dock-bottom)
    + var(--app-browser-bottom-inset)
    + env(safe-area-inset-bottom, 0)
    + 10px
  );
  background: var(--t-shell-bg, var(--t-bg));
}

/* ── Top scrim (ADR-0003 — top pair) ──────────────────────────────────────
   Shell-owned fade layer between content (z: default) and the floating
   topbar (z: 40). Purpose: content visually dissolves under the topbar
   instead of hitting it as a hard edge. Denser near the top, fades to
   transparent downward — a soft support for the pill, not a second surface.
   pointer-events: none so taps pass through. Stays visible in focus mode
   (topbar is NOT hidden in focus — only the bottom tabs are — so the top
   scrim must keep supporting it, otherwise content shows above the pill on
   scroll during active workout and any other focus-mode screen). Hidden on
   desktop ≥900px (topbar sits as a sticky card inside the centered column,
   no floating chrome to dissolve under). */

/* ── Top chrome lane — shell root ownership ──────────────────────────────
   The opaque shell-bg band lives as a pseudo-element on body.app-shell —
   the shell root itself — so it cannot be trapped by any content-subtree
   stacking/paint context (e.g. .app-content's overflow scroll container,
   the pill's backdrop-filter compositor). Previous attempts placed a
   <div class="app-top-bg"> inside <main class="app-content"> and the band
   was ineffective on iOS Safari despite being position: fixed.

   Contract: body::before owns the background fill at root. The gradient scrim
   (.app-scrim--top, z:30) and the floating pill (.app-topbar, shell topbar
   layer) composite ABOVE this band. The three together form the top chrome
   lane; content renders below. Desktop ≥900px suppresses the band alongside
   the scrim — sticky topbar in centered column, no floating chrome needed. */
body.app-shell::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(env(safe-area-inset-top, 0px) + 22px);
  pointer-events: none;
  z-index: 29;
  background: var(--t-shell-bg, var(--t-bg, #fafafb));
}

body.app-shell--keyboard::before {
  height: calc(env(safe-area-inset-top, 0px) + var(--vv-offset-top, 0px) + 22px);
}

@supports (-webkit-touch-callout: none) {
  @media (display-mode: browser) and (hover: none) and (pointer: coarse) {
    body.app-shell::before {
      height: calc(env(safe-area-inset-top, 0px) + 10px);
    }

    body.app-shell.app-shell--keyboard::before {
      height: calc(env(safe-area-inset-top, 0px) + var(--vv-offset-top, 0px) + 10px);
    }
  }
}

.app-scrim--top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(env(safe-area-inset-top, 0) + var(--app-topbar-h) + 12px);
  pointer-events: none;
  z-index: 30;
  background: linear-gradient(to bottom, var(--t-shell-bg, var(--t-bg)) 45%, transparent);
}

/* ── Bottom tabs — floating liquid-glass pill ────────────────────────────
   Shared mobile dock model: lower the whole surface. Safe-area clearance
   remains in content padding, not inside the nav pill's item layout. */

.app-tabs {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: var(--mobile-shell-dock-bottom);
  z-index: var(--mobile-shell-dock-z);
  padding: var(--mobile-shell-dock-pad-top) var(--mobile-shell-dock-pad-x) var(--mobile-shell-dock-pad-bottom-effective);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--mobile-shell-dock-item-gap);
  border-radius: 26px;
  border: 1px solid var(--t-dock-border);
  background: var(--t-dock-bg);
  -webkit-backdrop-filter: blur(22px) saturate(1.7);
  backdrop-filter: blur(22px) saturate(1.7);
  box-shadow: var(--t-dock-shadow);
}

body.app-shell:is(.app-shell--focus, .app-shell--keyboard) .app-tabs,
body.app-shell:not(.vbp-workout-active):has(.vbp-start-cta) .app-tabs {
  display: none;
}

body.app-shell:has(.vb-fs:not([hidden])) .app-tabs {
  display: none;
}

/* Legacy profile form sheet follows the same dock-occlusion contract as the
   canonical .vb-fs primitive. WebKit otherwise promotes the blurred dock
   above the fixed sheet despite the sheet's higher z-index. */
body.app-shell:has(.pf-sheet:not([hidden])) .app-tabs,
body.app-shell:has(.pf-sheet:not([hidden])) .app-scrim--bottom {
  display: none;
}

body.app-shell:has(.msg-screen) .app-tabs {
  display: none;
}

.app-tabs__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 4px 6px;
  border-radius: 20px;
  color: var(--t-tab-inactive-fg, var(--t-text-muted));
  text-decoration: none;
  font-size: var(--mobile-shell-dock-label-size);
  font-weight: 500;
  transition: color 0.15s;
}

.app-tabs__item--active {
  color: var(--t-cta-bg, var(--t-tab-active-bg));
  font-weight: 700;
  background: transparent;
  box-shadow: none;
}
.app-tabs__item--active .app-tabs__icon {
  background: var(--t-cta-bg, var(--t-tab-active-bg));
  color: var(--t-cta-fg, var(--t-tab-active-fg));
  box-shadow: var(--t-cta-glow, var(--t-tab-active-glow)), var(--t-cta-inset, inset 0 1px 0 rgba(255,255,255,0.18));
}

.app-tabs__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--mobile-shell-dock-icon-w);
  height: var(--mobile-shell-dock-icon-h);
  border-radius: 10px;
  line-height: 1;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.app-tabs__icon svg {
  display: block;
  width: var(--mobile-shell-dock-icon-size);
  height: var(--mobile-shell-dock-icon-size);
}

.app-tabs__label {
  line-height: var(--mobile-shell-dock-label-line-height);
}

/* ── Offline banner (mounted by ui.js under top bar) ─────────────────── */

[data-offline-mount] {
  position: fixed;
  top: calc(
    env(safe-area-inset-top, 0px)
    + var(--app-topbar-h)
    + var(--app-access-banner-reserve)
    + 8px
  );
  left: 14px;
  right: 14px;
  z-index: calc(var(--mobile-shell-topbar-z) - 1);
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.app-offline {
  width: 100%;
  max-width: 560px;
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  background: var(--t-surface);
  color: var(--t-text);
  border: 1px solid var(--t-border);
  border-radius: 14px;
  box-shadow: var(--t-topdock-shadow);
  pointer-events: auto;
}

/* ── Wide-viewport centering ──────────────────────────────────────────────
   Client-facing UX is mobile-first at every viewport (ADR decisions.md).
   On wide screens we keep the same mobile app shell — floating topbar +
   floating bottom dock — and only cap the content column + pills so the
   whole app-frame stays aligned. Covers both .app-content (AppShellRenderer)
   and known hand-rolled page wrappers that predate it. Scrim, top-band
   (body.app-shell::before) and CTA underlay (::after) stay edge-to-edge —
   they're canvas fades, not frame chrome. Admin/coach pages don't use
   body.app-shell and are unaffected. */
@media (min-width: 640px) {
  body.app-shell .app-content,
  body.app-shell .home-v1,
  body.app-shell .vbp-page,
  body.app-shell .container,
  body.app-shell .msg-wrap,
  body.app-shell .pf-container,
  body.app-shell .stk-wrap {
    max-width: var(--app-frame-w);
    margin-inline: auto;
  }

  /* Centered-frame edge: on viewports narrower than the frame, pills stay
     at the mobile 14px inset; on wider viewports they align with the
     centered content column (+14px inner gutter to match the mobile look). */
  body.app-shell {
    --app-frame-edge: max(
      var(--app-frame-pad),
      calc(50vw - var(--app-frame-half) + var(--app-frame-pad))
    );
  }

  body.app-shell .app-topbar,
  body.app-shell .app-access-banner,
  body.app-shell .app-tabs,
  body.app-shell .app-sticky-cta,
  body.app-shell .vbp-start-cta {
    left: var(--app-frame-edge);
    right: var(--app-frame-edge);
  }

  body.app-shell:has(.msg-screen) .app-sticky-cta {
    left: var(--app-frame-edge);
    right: var(--app-frame-edge);
  }
}

.app-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
/* ── Burger menu (top-bar) ─────────────────────────────────────────────
   Leading 34×34 button on root-of-tab screens + bottom sheet with quick
   actions. Sheet mirrors the pf-sheet pattern (profile.css) but lives in
   shell chrome so it works on every Shell V2 screen. */

.app-topbar__burger {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--t-text);
  cursor: pointer;
  border-radius: 10px;
  flex-shrink: 0;
  margin-left: -4px;
  padding: 0;
}
.app-topbar__burger svg { display: block; }
.app-topbar__burger:focus { outline: none; }
.app-topbar__burger:active { background: var(--t-border); }

/* Keep entry navigation reachable while the authenticated questionnaire has Back. */
body:has(.ob-screen) .app-topbar__burger,
body:has(.ob-screen) .app-topbar__back { width: 44px; height: 44px; flex-shrink: 0; }
body:has(.ob-screen) .app-topbar__title { white-space: normal; text-overflow: clip; font-size: 1rem; line-height: 1.25; text-wrap: balance; }

.app-burger {
  position: fixed;
  inset: 0;
  z-index: 3300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.app-burger:focus {
  outline: none;
}
.app-burger[hidden] { display: none; }

.app-burger__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.app-burger.is-open .app-burger__backdrop { opacity: 1; }

.app-burger__panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: var(--t-card, var(--card));
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.22);
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0));
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 0.24s ease;
}
.app-burger.is-open .app-burger__panel { transform: translateY(0); }

.app-burger__handle {
  width: 42px;
  height: 4px;
  background: var(--t-row-border, var(--border));
  border-radius: 2px;
  margin: 6px auto 12px;
}

.app-burger__close {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--t-text-muted);
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}
.app-burger__close:active {
  background: var(--t-border);
  transform: scale(0.96);
}
.app-burger__me {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 14px;
  text-decoration: none;
  color: var(--t-text);
}

.app-burger__avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--t-primary);
  color: var(--t-cta-fg, #1a1000);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}

.app-burger__me-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-burger__me-name {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-burger__me-hint {
  font-size: 12px;
  color: var(--t-text-muted);
}

.app-burger__chev {
  display: inline-flex;
  color: var(--t-text-subtle);
  flex-shrink: 0;
}

.app-burger__tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-bottom: 6px;
}

.app-burger__tiles [data-burger-install][hidden] { display: none; }

.app-burger__tile {
  display: flex;
  width: 100%;
  min-height: 74px;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--t-row-border, var(--border));
  border-radius: 16px;
  background: var(--t-primary-tint, var(--t-surface));
  color: var(--t-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.app-burger__tile:active { border-color: var(--t-primary); }

.app-burger__tile-icon {
  display: inline-flex;
  color: var(--t-primary-dark, var(--t-primary));
}

.app-burger__tile-label {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
}

.app-burger__rows {
  display: flex;
  flex-direction: column;
}

.app-burger__row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 4px;
  color: var(--t-text);
  text-decoration: none;
}
.app-burger__row + .app-burger__row {
  border-top: 1px solid var(--t-row-border, var(--border));
}

.app-burger__row-icon {
  display: inline-flex;
  color: var(--t-primary-dark, var(--t-primary));
  flex-shrink: 0;
}

.app-burger__row-label {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.app-burger__row-summary {
  font-size: 12px;
  font-weight: 400;
  color: var(--t-text-muted);
}

.app-burger__badge {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--t-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .app-burger__backdrop,
  .app-burger__panel,
  .app-burger__close {
    transition: none;
  }
}

/* Top docks use navigation controls plus text only. Section identity stays in
   the DOM for the shared persistent-router metadata contract. */
.app-topbar__section-icon {
    display: none;
}

/* TVK is a two-app, touch-first product. Do not expose browser keyboard focus
   rings in the client shell; form focus styling remains owned by each field. */
body.app-shell :focus-visible {
    outline: none !important;
}

/* If full tab labels no longer fit, keep readable names in a section sheet. */
.app-tabs { grid-template-columns:repeat(5,minmax(0,1fr)); }
.app-tabs__item { min-width:0; }
.app-tabs__label { max-width:100%; white-space:nowrap; hyphens:none; overflow-wrap:normal; }
.app-tabs__compact { display:none; grid-column:1 / -1; align-items:center; gap:12px; width:100%; min-height:56px; padding:10px 12px; border:0; border-radius:18px; background:var(--t-primary-tint); color:var(--text); text-align:left; font:inherit; cursor:pointer; }
.app-tabs__compact-icon { display:flex; flex-shrink:0; color:var(--t-cta-bg); }
.app-tabs__compact-copy { flex:1; min-width:0; display:grid; gap:3px; }
.app-tabs__compact-copy strong { font-size:1rem; line-height:1.2; overflow-wrap:anywhere; }
.app-tabs__compact-copy small { color:var(--t-primary-light); font-size:.8rem; line-height:1.35; }
.app-tabs__compact > svg { flex-shrink:0; color:var(--t-primary-light); }
.app-tabs--compact > .app-tabs__item { position:absolute; top:0; left:var(--mobile-shell-dock-pad-x); width:calc((100% - 2 * var(--mobile-shell-dock-pad-x) - 4 * var(--mobile-shell-dock-item-gap)) / 5); visibility:hidden; pointer-events:none; }
.app-tabs--compact .app-tabs__compact { display:flex; }
.app-sections-list { display:grid; gap:6px; }
.app-sections__link { display:flex; align-items:center; gap:14px; min-height:56px; padding:12px; border-radius:12px; color:var(--text); text-decoration:none; font-size:1rem; line-height:1.35; }
.app-sections__link > svg { color:var(--t-primary-light); flex-shrink:0; }
.app-sections__link > span { min-width:0; overflow-wrap:anywhere; }
.app-sections__link small { display:block; margin-top:3px; font-size:.78rem; color:var(--text-muted); }
.app-sections__link[aria-current="page"] { background:var(--t-primary-tint); }
body.app-shell .app-topbar__title { white-space:normal; text-overflow:clip; overflow-wrap:anywhere; line-height:1.2; }

.app-topbar--stacked-title { flex-wrap:wrap; }
.app-topbar--stacked-title > .app-topbar__title,
.app-topbar--stacked-title > .app-topbar__title-stack { order:3; flex:1 0 100%; margin-left:0; }
.app-topbar--stacked-title .app-topbar__title { overflow-wrap:normal; }
.app-topbar--stacked-title .app-topbar__trailing-wrap { margin-left:auto; }
