* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground-page);
  background-color: var(--ground-page-flat);
  color: var(--ink-primary);
  font-size: 16px;
  line-height: 1.5;
}
/* The V4 header bar (HENG-48 rework, R3): a glass chrome band spanning the
   content width, used unmodified by both views/layout.js's server-rendered
   pages and routes/home.js's ported analytics app. Recipe from theme.css's
   --surface-nav-glass-* tokens (HENG-87) -- dark mode's recipe is identical
   to the legacy --glass-topbar-* tokens (HENG-58); light mode gets its own
   recipe. Border must stay transparent for the border-box gradient layer to
   show, see theme.css's glass-primitives note. */
/* HENG-241: the nav bar sits in the same column as the dashboard, on every
   page, and scrolls away with the page. Full width less the gutter
   (HENG-214: no 1208px cap). */
.app-header-wrap {
  position: relative;
  z-index: 30;
  width: 100%;
  max-width: var(--ha-col, none);
  margin: 0 auto;
  padding: 12px var(--ha-gutter, 28px) 4px;
}
@media (max-width: 560px) { .app-header-wrap { padding-inline: 10px; } }
.app-header {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 14px;
  margin: 0;
  padding: 12px 22px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--surface-nav-glass-fill);
  backdrop-filter: var(--surface-nav-glass-blur);
  -webkit-backdrop-filter: var(--surface-nav-glass-blur);
  box-shadow: var(--surface-nav-glass-shadow);
}
.app-header--minimal { justify-content: space-between; }

.app-header__brandgroup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-header__divider {
  width: 1px;
  height: 17px;
  background: var(--line-hairline);
}
.app-header__beta {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 1px 7px 0 9px;
  border: 1px solid var(--beta-line);
  border-radius: 999px;
  background: var(--beta-fill);
  color: var(--beta-ink);
}

/* HENG-93: a customer or section an all-access employee sees without it being
 * enabled, on a dashboard tab and in the company switcher. One glyph, because
 * a worded pill outweighed the labels beside it. A red asterisk rather than a
 * quiet mark, so an employee sees at once that what they are looking at is
 * not something the customer has. --meaning-danger is the red the negative
 * deltas use, in both themes. The word is still there for a screen reader and
 * on hover. HENG-214: raised by position, not vertical-align, and with no
 * line height, so it never makes the line taller and pushes its label below
 * the labels beside it. */
.not-enabled-mark {
  display: inline-block;
  position: relative;
  top: -0.15em;
  margin-left: 3px;
  color: var(--meaning-danger);
  font-size: 1.15em;
  font-weight: 700;
  line-height: 0;
  vertical-align: baseline;
}
.not-enabled-mark::before { content: "*"; }

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  position: relative;
}
.app-header__mark { width: 32px; height: 32px; color: var(--ink-emphasis); flex: none; }
.wordmark { font-size: 24px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink-emphasis); }
.wordmark b { font-weight: 700; }
.wordmark sup { font-size: 0.6em; }

.app-header__nav {
  display: flex;
  align-items: center;
  flex: none;
  gap: 4px;
}
.app-header__nav-item {
  margin: 0;
  padding: 4px 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  padding: 10px 20px;
  border-radius: 10px;
  color: var(--ink-muted);
  text-decoration: none;
}
a.app-header__nav-item--active {
  position: relative;
  color: var(--ink-primary);
  cursor: pointer;
}
a.app-header__nav-item--active::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-primary);
}
.app-header__nav-item--disabled { opacity: 0.5; cursor: not-allowed; }

.app-header__search { position: relative; flex: 0 0 220px; width: 220px; }
.app-header__search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}
.app-header__search input {
  width: 100%;
  margin: 0;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--line-hairline);
  border-radius: 10px;
  background: var(--field-fill);
  color: var(--ink-primary);
  font-size: 13.5px;
}
.app-header__search input:disabled { opacity: 0.5; cursor: not-allowed; }
.app-header__search input::placeholder { color: var(--ink-muted); }

.app-header__share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: var(--cta-fill);
  border: 1px solid var(--cta-line);
  color: var(--cta-ink);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
/* HENG-182: the unavailable Share button look (tokens in shared/theme.css). */
.app-header__share:disabled {
  cursor: not-allowed;
  background: var(--share-unavailable-bg);
  border-color: var(--share-unavailable-line);
  color: var(--share-unavailable-ink);
  opacity: 0.5;
}

.app-header__end {
  display: flex;
  align-items: center;
  flex: none;
  gap: 10px;
  margin-left: auto;
}
.env {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-volt);
  color: var(--color-deep-green);
  flex: none;
}
.env.local { background: var(--state-hover-fill); color: var(--ink-primary); }

.app-header__version {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line-hairline);
  border-radius: 8px;
  background: var(--ink-primary);
  color: var(--ground-page-flat);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}
.app-header__brand:hover .app-header__version,
.app-header__brand:focus .app-header__version,
.app-header__brand:focus-visible .app-header__version {
  opacity: 1;
}

/* HENG-45 placeholder-page layout (HENG-48 rework, R4): this file is also
   loaded by the ported analytics page (routes/home.js / public/index.html),
   which supplies its own layout via public/app.css and must not inherit a
   720px measure, 52ch paragraph width, or a disabled-looking button style
   meant for the scaffold's settings and access-unavailable screens. Scoped to
   .scaffold-page, the class views/layout.js puts on <body> for exactly
   those screens -- the analytics page's <body> never carries it. */
.scaffold-page main { flex: 1; padding: 48px 24px; max-width: 720px; }
.scaffold-page h1 { font-size: 28px; margin: 0 0 12px; }
.scaffold-page p { color: var(--ink-muted); max-width: 52ch; }
.scaffold-page code {
  background: var(--state-hover-fill);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
/* --ink-accent, not --color-volt. Volt is a FIXED brand token: it does not
   flip, so this rendered volt-on-cream at 1.04:1 in the light theme -- a link
   you cannot see. Measured 2026-09-23 on the page /logout used to land on,
   where it was the only way back; `Try again` on views/unavailablePage.js is
   the same rule and the only action there. The rule predates HENG-87's token
   layer, from when every page in this app was dark. */
.scaffold-page a { color: var(--ink-accent); }
/* Forms in the page body only. Unscoped, this matched the header's sign-out form at (0,1,1), beating
 * .signout-form's margin: 0 and dropping the icon 24px out of line on every scaffold page. */
.scaffold-page main form { margin-top: 24px; }
.scaffold-page label { display: block; font-size: 13px; margin: 14px 0 4px; color: var(--ink-primary); }
.scaffold-page input {
  width: 100%;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid var(--line-hairline);
  border-radius: 8px;
  background: var(--state-hover-fill);
  color: var(--ink-primary);
  font-size: 15px;
}
/* HENG-45 styled a placeholder button here with `.scaffold-page button`.
 * .scaffold-page is on <body>, so that rule matched EVERY button on every
 * page at specificity (0,1,1) -- beating .btn-signout, .app-header__share and
 * .app-header__nav-item, which are all (0,1,0) and all set their own
 * background, margin and cursor. Sign-out therefore rendered as a lime
 * disabled pill pushed 18px down out of line with the env badge, which is
 * what it looked like on the no-access page.
 *
 * The rule is gone rather than narrowed: the placeholders it was written for
 * are gone too, and every button left in views/ is a real control with
 * styling of its own. */
.scaffold-page footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line-hairline);
  font-size: 12px;
  color: var(--ink-muted);
}

/* The sign-in page's own .auth-, .oauth-row, .btn-oauth, .cl- rules moved to
   public/login.css (HENG-88) -- that page no longer uses this file's
   .scaffold-page shell. .oauth-row/.btn-oauth were dead (cursor:not-allowed,
   no handler, superseded by Clerk's own social buttons) and were deleted
   outright rather than moved. .divider/.field__forgot/.btn.primary.full/
   .spinner below stay here: the dev sign-in form (styled via .dev-signin in
   login.css) still uses them, and .btn.primary.full is shared, non-flipping
   brand chrome, not part of the auth-card recipe. */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 18px;
  font-size: 12px;
  color: var(--ink-muted);
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-hairline);
}

.field__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.field__forgot {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  border-radius: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-muted);
  text-decoration: underline;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn.primary.full {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 1;

  background: var(--color-volt);
  color: var(--color-deep-green);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 14px;
  margin-top: 14px;
}

.btn.primary.full:hover {
  box-shadow: var(--glow-volt-md);
}

.btn.primary.full:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-deep-green), var(--focus-ring);
}

/* Submitting state (HENG-105): the native POST proceeds as-is -- see
   public/common/login-stub.js -- this only swaps the label for the spinner
   and freezes the cursor while the browser navigates away. .btn__label and
   .btn__loading share the same font-size inside the same flex container, and
   the spinner is smaller than that line box, so this never changes the
   button's height. */
.btn.primary.full.is-pending { cursor: default; }
.btn.primary.full.is-pending .btn__label { display: none; }
.btn.primary.full.is-pending .btn__loading { display: flex; }
.btn__loading { display: none; align-items: center; gap: 8px; }
/* The primary button (and its spinner track) is a fixed brand treatment that
   does not flip between themes -- see theme.css's --btn-primary-spinner-track
   token. .company-switcher__list .spinner overrides it below for the dark
   switcher panel. */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--btn-primary-spinner-track);
  border-top-color: var(--color-deep-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Header controls (HENG-47): company switcher + sign-out, between the
   wordmark and the env badge. */

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.signout-form { margin: 0; }
.btn-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-primary);
  cursor: pointer;
  opacity: 1;
}
.btn-signout:hover { background: var(--state-hover-fill); }

.company-switcher { position: relative; }

.company-switcher__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 14px;
  max-width: 220px;
  border: 1px solid var(--line-hairline);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  opacity: 1;
}
.company-switcher__trigger:hover { background: var(--state-hover-fill); }

.company-switcher__trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-switcher__chevron { flex: none; color: var(--ink-muted); }
/* The asterisk sits beside the name and never shrinks into it (HENG-93). */
.company-switcher__trigger .not-enabled-mark { flex: none; margin-left: 0; vertical-align: middle; }

/* Non-modal popover (HENG-58): dialog.show(), not showModal(), so this
   positions itself relative to .company-switcher (position: relative,
   above) instead of relying on the browser's centered top-layer placement.
   No ::backdrop -- non-modal dialogs never get one. */
.company-switcher__dialog {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  padding: 0;
  /* The dialog glass the lightbox uses, over its own opaque colour. A blur
   * cannot help here: the dialog sits inside .app-header, which has its own
   * backdrop-filter, and a nested backdrop-filter samples only that header,
   * never the page. So the translucent glass let the page's figures show
   * through the list. The solid colour beneath makes it opaque in both
   * themes. Transparent border so the fill's border-box layer draws the
   * glass edge. */
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-dialog-fill);
  background-color: var(--surface-dialog-solid);
  box-shadow: var(--surface-elevated-shadow);
  color: var(--ink-primary);
  width: max-content;
  min-width: 220px;
  max-width: 360px;
}

.company-switcher__dialog form { margin: 0; padding: 14px; }

.company-switcher__filter-row { margin: 0 0 10px; }
.company-switcher__filter {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--line-hairline);
  border-radius: 8px;
  background: var(--state-hover-fill);
  color: var(--ink-primary);
  font-size: 14px;
}

.company-switcher__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.company-switcher__list li { margin: 0; }

.company-switcher__list button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-primary);
  font-weight: 400;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  opacity: 1;
}
.company-switcher__list button:hover { background: var(--state-hover-fill); }
.company-switcher__list button[aria-current="true"] {
  background: var(--meaning-success-bg);
  color: var(--meaning-success);
  font-weight: 700;
}

/* Pending-submit state (HENG-58): the clicked row stays visible, disabled,
   with a spinner, until the native POST navigates the page away. */
.company-switcher__filter:disabled { opacity: 0.6; cursor: default; }
.company-switcher__list button:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}
.company-switcher__list button.is-pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  opacity: 1;
  cursor: default;
  pointer-events: none;
}
/* .spinner (above) is styled for the light/volt login button -- its border
 * colors would be invisible on this dialog's fixed-dark interior, so
 * override them here. The dialog itself now flips (--surface-elevated-fill)
 * but its interior list rows stay on the dark "console" palette below --
 * they are dashboard-adjacent chrome, not part of §5's role table, and the
 * dialog's own dark-leaning fill keeps them legible in both themes. */
.company-switcher__list .spinner {
  flex: none;
  border-color: var(--line-hairline);
  border-top-color: var(--color-volt);
}

/* This panel's rows stay on --surface-fixed-dark regardless of page theme
 * (comment above), but the generic :focus-visible rule now flips with the
 * page (theme.css, HENG-88) -- without this override, light mode would leave
 * a deep-green ring attempting to sit on a permanently-dark background, the
 * same low-contrast failure the flip exists to fix, just relocated. */
.company-switcher__list button:focus-visible {
  box-shadow: var(--focus-ring-on-fixed-dark);
}

/* The Clerk mounted sign-in and .auth-card__switch moved to public/login.css
 * (HENG-88) -- the sign-in page no longer uses this file's .scaffold-page
 * shell, and login.css can assume every token this file defines without
 * needing its own copy of the same selectors. */

/* The initials circle (HENG-90): a FIXED surface, not a themed one -- the
 * ink inside it comes from the circle, not from the page (see
 * shared/theme.css's --avatar-fixed-* comment), so this deliberately does
 * NOT use --ink-primary/--surface-* the way everything else here does. */
.avatar-circle { position: relative; }

.avatar-circle__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--avatar-fixed-bg);
  color: var(--avatar-fixed-ink);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  flex: none;
  opacity: 1;
}
.avatar-circle__trigger:focus-visible { box-shadow: var(--focus-ring); }

/* The lightbox: the first TRUE MODAL <dialog> in this codebase (showModal(),
 * see public/common/avatar-circle.js), unlike the company switcher's
 * deliberately non-modal popover above -- so, unlike that dialog, this one
 * gets a themed ::backdrop (shared/theme.css's --overlay-scrim). */
.avatar-circle__dialog {
  padding: 0;
  /* Transparent, so the fill's border-box layer draws the glass edge. */
  border: 1px solid transparent;
  border-radius: 18px;
  background: var(--surface-dialog-fill);
  -webkit-backdrop-filter: var(--surface-dialog-blur);
  backdrop-filter: var(--surface-dialog-blur);
  box-shadow: var(--surface-elevated-shadow);
  color: var(--ink-primary);
  /* Sized to its content, not to a number: Clerk's profile is a two-pane
   * card far wider than 480px, and a fixed width clipped its right-hand
   * pane. The minimum keeps the loading and error states their own size. */
  width: fit-content;
  min-width: min(480px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  /* QA (PR #60 round 1): mountUserProfile() can resolve with hasUi: true and
   * still paint nothing -- e.g. the admin stub session, where Clerk has no
   * underlying user to render. That leaves #clerk-user-profile at height 0,
   * and since .avatar-circle__close is position: absolute (out of flow),
   * the whole dialog collapses to a zero-height box: no panel, no radius,
   * no shadow, no visible close control -- only the ::backdrop scrim shows,
   * even though the dialog is technically open underneath. A min-height
   * guarantees the panel (and the close button inside it) stay visible
   * regardless of whether Clerk ever paints content. */
  min-height: 160px;
}
.avatar-circle__dialog::backdrop {
  background: var(--overlay-scrim);
}

/* z-index is load-bearing. The button precedes Clerk's mount in the DOM, and
 * Clerk's card is itself positioned, so without one the card paints over the
 * button. Its background is transparent (avatar-circle.js's appearance), so
 * the × stays visible while the card takes every click on it. */
.avatar-circle__close {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-primary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
}
.avatar-circle__close:hover { background: var(--state-hover-fill); }
.avatar-circle__close:focus-visible { box-shadow: var(--focus-ring); }

.avatar-circle__loading {
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-muted);
}

html.ha-scroll-locked { overflow: hidden; }

/* Reused error voice (public/login.js's showSystemError establishes this
 * pattern): duplicated from public/login.css's .auth-banner rather than
 * shared, because login.css is only linked on /login and this dialog can
 * open on every signed-in page, which never links login.css. */
.avatar-circle .auth-banner {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
}
.avatar-circle .auth-banner strong { display: block; font-weight: 700; margin-bottom: 2px; }
.avatar-circle .auth-banner span { color: inherit; }
.avatar-circle .auth-banner--error {
  background: var(--meaning-danger-bg);
  border: 1px solid var(--meaning-danger-border);
  color: var(--meaning-danger);
}

/* PR #82 review point 2 -- the header overflows sideways in the open gap
   above the 860px phone breakpoint (measured: 861px wide, header content
   978px). None of this is phone CSS (860 is the only phone breakpoint this
   ticket introduces), so this reuses the pre-existing 1024px breakpoint
   (public/app.css:68) already established for `.page-header__greeting`
   rather than inventing a new number. Beta tag and env badge are dropped
   (least essential, matching the phone treatment's own priority) and the nav
   becomes a shrinkable, internally-scrollable flex item rather than a fixed
   `flex: none` block that forces the header wider than the viewport. */
@media (max-width: 1024px) {
  .app-header__beta,
  .env {
    display: none;
  }
  .app-header__nav {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .app-header__nav::-webkit-scrollbar { display: none; }
}

/* ==========================================================================
   HENG-102 §2 -- phone top bar -> menu. The only four survivors at ≤860px
   are the menu button, spark+wordmark, Share, and the avatar (FD §4); every
   other top-bar control moves into the phoneMenu() sheet instead.
   ========================================================================== */
.phone-menu-btn {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-primary);
  cursor: pointer;
}
.phone-menu-btn:hover { background: var(--state-hover-fill); }
.phone-menu-btn:focus-visible { box-shadow: var(--focus-ring); }

@media (max-width: 860px) {
  .phone-menu-btn { display: flex; }
  .app-header__nav,
  .app-header__search,
  .app-header__divider,
  .app-header__beta,
  .header-controls,
  .signout-form,
  .env {
    display: none;
  }
  /* Compound selector, not `.app-header__theme-toggle` alone: public/index.html
     loads this file before shared/theme.css, so an equal-specificity single-class
     rule here would lose the cascade to theme.css's unconditional `.theme-toggle`
     rule regardless of source order within this file. */
  .app-header__theme-toggle.theme-toggle {
    display: none;
  }

  /* The four survivors (menu, spark+wordmark, Share, avatar) must fit
     393px without the bar itself scrolling sideways: tighter bar padding,
     a smaller wordmark, and an icon-only Share button. */
  .app-header {
    margin: 0;
    padding: 8px 12px;
    gap: 8px;
  }
  .app-header__brandgroup { gap: 6px; }
  .app-header__mark { width: 26px; height: 26px; }
  .wordmark { font-size: 17px; }
  .app-header__share {
    width: 36px;
    height: 32px;
    padding: 0;
    gap: 0;
    justify-content: center;
  }
  .app-header__share span { display: none; }
  .app-header__end { gap: 8px; }
}
@media (max-width: 560px) {
  .app-header { margin: 0; padding: 6px 10px; }
}

/* The sheet itself (FD §4.1): search/Support (disabled), company, theme,
   sign out, in that order -- Dashboard is never listed, it's the only
   destination there is. Positioned as a fixed sheet below the header rather
   than anchored to the trigger's own rect, same reasoning as the phone
   sheets in §4/§6: there is one stable place for it to open, not one per
   trigger. */
.phone-menu {
  display: none;
  position: fixed;
  top: 88px;
  left: 12px;
  right: 12px;
  z-index: 40;
  margin: 0;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--phone-menu-fill);
  backdrop-filter: var(--phone-menu-blur);
  -webkit-backdrop-filter: var(--phone-menu-blur);
  box-shadow: var(--phone-menu-shadow);
  color: var(--phone-menu-ink);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.phone-menu[open] { display: block; }

.phone-menu__row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.phone-menu__row:hover { background: var(--filter-dialog-row-hover); }
.phone-menu__row--disabled { opacity: 0.5; cursor: not-allowed; }
.phone-menu__row-icon { display: flex; flex: none; width: 16px; height: 16px; }

.phone-menu__section--company {
  margin: 4px 0;
  padding: 4px 0;
  border-top: 1px solid var(--filter-dialog-row-rule);
  border-bottom: 1px solid var(--filter-dialog-row-rule);
}
.phone-menu__company-static {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
}
/* companySwitcherListHtml()'s own list markup, reused inline here (no
   trigger/dialog of its own -- this sheet owns open/close). */
.phone-menu__section--company .company-switcher-list { width: 100%; }
.phone-menu__section--company .company-switcher__filter { font-size: 16px; }

.phone-menu__signout { margin: 0; }
.phone-menu__signout .phone-menu__row { color: var(--meaning-danger, inherit); }

/* HENG-115: NEW STYLES ONLY. Everything else on these screens is the site's
   shipped shared/theme.css, public/common/app.css and public/login.css,
   unchanged except theme.css's font paths. The build adds these rules to
   public/common/app.css and uses only existing tokens. The popover follows
   the V7 design's Support popover. */

/* Support becomes a real nav item: the open state reads like the V7 nav's
   selected item. */
.app-header__support { position: relative; display: inline-flex; }
.app-header__nav-item--open { color: var(--ink-primary); background: var(--state-hover-fill); cursor: pointer; }
button.app-header__nav-item:not(:disabled) { cursor: pointer; }

/* Non-modal popover anchored under Support, the company switcher's pattern:
   the dialog glass over its solid colour, because a nested backdrop-filter
   cannot sample the page. */
.support-popover {
  position: absolute; top: calc(100% + 10px); right: 0; left: auto; z-index: 80;
  width: 380px; max-width: 88vw; box-sizing: border-box; margin: 0;
  padding: 18px 20px 20px;
  border: 1px solid transparent; border-radius: 16px;
  background: var(--surface-dialog-fill); background-color: var(--surface-dialog-solid);
  box-shadow: var(--surface-elevated-shadow);
  color: var(--ink-primary); text-align: left;
}
.support-popover__title { margin: 0; font-family: var(--font-serif); font-size: 25px; font-weight: 400; color: var(--ink-primary); }
.support-popover__title em { font-style: italic; color: var(--ink-accent); }
.support-popover__sub { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-muted); }

.support-form { margin: 14px 0 0; }
.support-form__label {
  display: block; margin: 0 0 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-label);
}
.support-form textarea {
  display: block; width: 100%; box-sizing: border-box; min-height: 112px; resize: vertical;
  padding: 11px 13px; border: 1px solid var(--line-control-border); border-radius: 11px;
  background: var(--surface-input-fill); color: var(--ink-primary);
  font-family: var(--font-sans); font-size: 13.5px; line-height: 1.45;
}
.support-form textarea:focus { outline: none; border-color: var(--line-input-focus-border); box-shadow: var(--glow-input-focus); }
.support-form textarea:disabled { opacity: 0.6; }
.support-form__count { margin: 4px 0 0; font-size: 11px; color: var(--ink-muted); text-align: right; }

/* What goes with the message, stated to the user before they send it. */
.support-context {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line-hairline); background: var(--state-hover-fill);
  font-size: 12px; line-height: 1.5; color: var(--ink-soft);
}
.support-context b { color: var(--ink-primary); font-weight: 700; }

.support-form .btn.primary.full { margin-top: 12px; border-radius: 999px; }
.support-form .btn.primary.full:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.support-alt { margin: 14px 0 0; font-size: 12px; color: var(--ink-muted); }
.support-alt a { color: var(--ink-primary); font-weight: 700; }

/* Support unavailable (HENG-235): shown in place of the form. */
.support-notice {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 11px;
  border: 1px solid var(--line-hairline); background: var(--state-hover-fill);
  font-size: 13px; line-height: 1.5; color: var(--ink-soft);
}
.support-notice strong { display: block; margin-bottom: 3px; color: var(--ink-primary); }
.support-notice[hidden] { display: none; }

/* Shown in place of the form while availability is being checked. */
.support-checking { margin: 14px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.support-checking[hidden] { display: none; }

/* Sent and failed states. */
.support-done { margin: 14px 0 0; }
.support-done__ref {
  display: inline-block; margin: 0 0 8px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--meaning-success-border); background: var(--meaning-success-bg);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--ink-primary);
}
.support-done p { margin: 0 0 6px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.support-error {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--meaning-danger-border); background: var(--meaning-danger-bg);
  font-size: 12.5px; line-height: 1.45; color: var(--ink-primary);
}
.support-error strong { display: block; margin-bottom: 2px; }

/* Disabled in All companies: the reason is visible beside the greyed item. */
.support-unavailable-note {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 80; width: 260px;
  padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line-hairline);
  background: var(--surface-dialog-solid); box-shadow: var(--surface-elevated-shadow);
  font-size: 12px; line-height: 1.45; color: var(--ink-primary);
}

/* The phone menu's Support row opens the same form as a full-width panel. */
.support-sheet { position: static; display: block; width: 100%; max-width: none; box-sizing: border-box; margin: 8px 0 0; }

/* Sign-in footer: Support is now a link. */
a.si-footer__link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---- Your requests ---------------------------------------------------- */

/* Status, as the requester sees it. Inside the popover (light glass). */
.support-status {
  display: inline-block; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
  border: 1px solid var(--line-hairline); color: var(--ink-primary); background: var(--state-hover-fill);
}
.support-status--waiting { background: var(--color-volt); color: var(--color-deep-green); border-color: transparent; }
.support-status--closed { color: var(--ink-muted); background: transparent; }

/* The popover's recent requests, under the form. */
.support-recent { margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line-hairline); }
.support-recent__row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; font-size: 12.5px; color: var(--ink-primary); text-decoration: none;
}
.support-recent__row:hover { background: var(--state-hover-fill); }
.support-recent__subject { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-recent__ref { color: var(--ink-muted); margin-right: 6px; }
.support-recent__all { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--ink-primary); }
.support-done__links { margin: 10px 0 0; font-size: 12px; }
.support-done__links a { color: var(--ink-primary); font-weight: 700; }

/* The Support requests page. Support is the current page in the nav. */
.app-header__nav-item--current { position: relative; color: var(--ink-primary); cursor: pointer; }
.app-header__nav-item--current::after {
  content: ""; position: absolute; left: 20px; right: 20px; bottom: 6px; height: 2px;
  border-radius: 2px; background: var(--ink-primary);
}
.support-page { max-width: 1100px; }
.support-page .page-header__greeting { font-size: 44px; }
.support-page__intro { margin: 0 0 18px; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
.support-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.support-filter button {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-control-border);
  background: var(--surface-control-fill); color: var(--ink-primary);
  font-family: var(--font-sans); font-size: 12.5px; cursor: pointer;
}
.support-filter button[aria-pressed="true"] { background: var(--ink-primary); color: var(--ink-on-accent); border-color: transparent; }
.support-filter .n { margin-left: 6px; opacity: 0.7; }

/* On the page the table sits on dark glass, so status reads in console ink. */
.support-table .data-table td:first-child, .support-table .data-table th:first-child { position: static; }
.support-table .data-table td a { color: var(--ink-primary); font-weight: 700; }
.support-table .data-table td { white-space: normal; }
.support-table .data-table td.support-table__subject { min-width: 260px; }
.support-table .support-status { color: var(--console-ink); border-color: var(--ww-18); background: var(--ww-07); }
.support-table .support-status--waiting { color: var(--color-deep-green); background: var(--color-volt); border-color: transparent; }
.support-table .support-status--closed { color: var(--console-ink-60); background: transparent; }
.support-table__via { font-size: 11px; color: var(--console-ink-60); }

/* Request detail. */
.support-back { display: inline-block; margin: 0 0 14px; font-size: 13px; font-weight: 700; color: var(--ink-primary); }
.support-detail__head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; }
.support-detail__head .page-header__greeting { margin: 0; }
.support-detail__meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 24px;
  margin: 0 0 18px; padding: 16px 20px; color: var(--console-ink);
}
.support-detail__meta dt { margin: 0 0 3px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--console-ink-80); }
.support-detail__meta dd { margin: 0; font-size: 13px; }
.support-detail__block { margin: 0 0 18px; padding: 18px 20px; color: var(--console-ink); }
.support-detail__block h2 { margin: 0 0 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--console-ink-80); }
.support-detail__block p { margin: 0; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.support-detail__block ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
.support-detail__note { font-size: 13px; line-height: 1.5; color: var(--ink-soft); }

/* The page when requests can't be read. */
.support-unavailable { padding: 22px 20px; color: var(--console-ink); font-size: 13.5px; line-height: 1.5; }
/* The page titles do not play the dashboard greeting's rise-in. */
.support-page .page-header__word, .support-page .page-header__name, .support-page .page-header__hairline { animation: none; }

/* HENG-115: the All-companies reason is hidden until hover or focus (the
   reference screen shows it open). */
.app-header__support .support-unavailable-note { display: none; }
.app-header__support:hover .support-unavailable-note,
.app-header__support:focus-within .support-unavailable-note { display: block; }

/* HENG-145: Share dialog (Weekly Review report). Tokens from shared/theme.css. */
.share-dialog {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 91;
  width: 500px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); overflow: auto;
  box-sizing: border-box; margin: 0; padding: 26px 28px; border: 1px solid transparent; border-radius: 18px;
  background: var(--surface-dialog-fill); background-color: var(--surface-dialog-solid);
  box-shadow: var(--surface-elevated-shadow); color: var(--ink-primary);
}
.share-dialog__close {
  position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin: 0; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: var(--ink-primary); font-size: 20px; line-height: 1; cursor: pointer;
}
.share-dialog__close:hover { background: var(--state-hover-fill); }
.share-dialog__title { margin: 0 32px 0 0; font-family: var(--font-serif); font-size: 30px; font-weight: 400; color: var(--ink-primary); }
.share-dialog__title em { font-style: italic; color: var(--ink-accent); }
.share-dialog__context { margin: 4px 0 0; font-size: 12px; color: var(--ink-muted); }
.share-dialog__label { margin: 22px 0 10px; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: var(--ink-muted); }
.share-dialog__formats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-format {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  border: 1.5px solid var(--line-control-border); border-radius: 12px; padding: 14px 16px; cursor: pointer;
  background: var(--surface-control-fill); font-family: inherit; color: var(--ink-primary);
}
.share-format.is-selected { border-color: var(--ink-accent); background: color-mix(in srgb, var(--ink-accent) 10%, transparent); }
.share-format__label { font-size: 13.5px; font-weight: 700; }
.share-format__sub { font-size: 11.5px; color: var(--ink-muted); }
.share-dialog__label--row { display: flex; align-items: center; justify-content: space-between; }
.share-dialog__link { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--ink-accent); cursor: pointer; }
.share-dialog__sections { display: flex; flex-direction: column; gap: 8px; }
.share-section { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.share-section__tag { font-size: 11px; font-weight: 600; color: var(--ink-muted); }
.share-dialog__none { margin: 8px 0 0; font-size: 12px; color: var(--meaning-danger); }
/* HENG-174: Supply Chain sections list */
.share-dialog__sections-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.share-dialog__sections-head .share-dialog__label { margin: 0; }
.share-dialog__all { border: 0; background: transparent; padding: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--ink-accent); cursor: pointer; }
.share-dialog__sections { display: flex; flex-direction: column; gap: 6px; }
.share-section { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1.5px solid var(--line-control-border); border-radius: 10px; background: var(--surface-control-fill); font-size: 13.5px; color: var(--ink-primary); }
.share-section.is-checked { border-color: var(--ink-accent); background: color-mix(in srgb, var(--ink-accent) 10%, transparent); }
.share-section input { margin: 0; accent-color: var(--ink-accent); }
.share-section__sub { margin-left: auto; font-size: 11.5px; color: var(--ink-muted); }
.share-dialog__hint { margin: 8px 0 0; font-size: 12px; color: var(--meaning-danger); }
.share-dialog__buttons { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.share-dialog__buttons .btn.primary { margin-left: auto; }
.share-dialog__buttons .btn.primary[disabled] { opacity: 0.6; cursor: progress; }
.share-dialog__buttons .btn.secondary {
  padding: 11px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-control-border); background: var(--surface-control-fill); color: var(--ink-primary);
  font-family: var(--font-sans); font-size: 14px; font-weight: 700;
}
.share-dialog__buttons .btn.primary {
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  padding: 11px 22px; border: 1px solid transparent; border-radius: 999px;
  background: var(--cta-fill); color: var(--cta-ink); font-family: var(--font-sans); font-size: 14px; font-weight: 700;
}
.share-format:focus-visible, .share-dialog__buttons .btn:focus-visible, .share-dialog__close:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 2px; }
