/*
 * App shell: the menu (views/partials/sidebar.ejs) and the thin top bar (views/partials/nav.ejs), the same on
 * every signed-in page, the inbox included. Loaded after hd-ui.css, app.css and page CSS (inbox.css) so it
 * can place the inbox. Colours, type and radii are hd-ui tokens (--hd-*); behaviour is /js/shell.js.
 *
 * ≥992px  the menu is fixed on the left, in one of two states (class on .fx-side, from the fx_nav cookie):
 *           .rail  icons only (52px): names as tooltips, inbox views in a flyout, counts as badges
 *           .full  labels (240px)
 *         .rail.peek opens the full menu over the page for a moment (⌘K / the search icon in rail mode).
 * <992px  the menu is a drawer (always full) opened from the top bar's menu button or any [data-fx-menu].
 *
 * Top bar: hidden from 992px up on body.fx-nobar (the inbox); body.fx-nobar-all hides it at every width
 * (for a page whose own header has a [data-fx-menu] button).
 */
:root {
  --fx-side-w: 240px;
  --fx-rail-w: 52px;
  --fx-bar-h: 60px;
  /* Old shell names, kept for page CSS that still uses them */
  --fx-brand: var(--hd-accent);
  --fx-brand-hover: var(--hd-accent-hover);
  --fx-brand-bg: var(--hd-accent-bg);
  --fx-brand-ring: var(--hd-accent-ring);
  --fx-line: var(--hd-border);
  --fx-line-soft: var(--hd-border-soft);
  --fx-hover: var(--hd-hover);
  --fx-text: var(--hd-fg);
  --fx-text-2: var(--hd-fg-3);
  --fx-muted: var(--hd-muted);
  --fx-label: var(--hd-faint-2);
}

/* ---------- Page frame ---------- */
body.hd-body:has(> .fx-side) { background: var(--hd-surface); }
@media (min-width: 992px) {
  body.hd-body:has(> .fx-side.full) { padding-left: var(--fx-side-w); }
  body.hd-body:has(> .fx-side.rail) { padding-left: var(--fx-rail-w); }
  body.fx-nobar > .fx-bar { display: none; }
}
body.fx-nobar-all > .fx-bar { display: none; }
/* Full-screen pages (the inbox): the bar and the app fill the screen, nothing scrolls the body. */
body.fs-app .fx-bar { flex-shrink: 0; }
body.fs-app:has(> .fx-side) .sp { height: auto; flex: 1; min-height: 0; }

/* ---------- Menu: shared ---------- */
.fx-side {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 1001; width: var(--fx-side-w);
  background: var(--hd-bg-rail); border-right: 1px solid var(--hd-border);
  font-family: var(--hd-font); color: var(--hd-fg); -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
}
.fx-side *, .fx-side *::before, .fx-side *::after { box-sizing: border-box; }
.fx-side .hd-i { font-size: 16px; }
.fx-side .fx-item:not(.fx-child) > .hd-i, .fx-navtoggle .hd-i, .fx-rail-only .hd-i { --hd-icon-stroke: 6; }
.fx-side-in {
  height: 100%; display: flex; flex-direction: column; padding: 12px 10px 10px;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--hd-border-strong) transparent;
}
/* The menu scrolls on short screens; the footer (notice, trial card, workspace) stays pinned. */
.fx-side-scroll {
  flex: 1 1 auto; min-height: 140px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  margin: 0 -10px; padding: 0 10px; scrollbar-width: thin; scrollbar-color: var(--hd-border-strong) transparent;
}
.fx-side-foot { flex-shrink: 0; padding-top: 10px; }

.fx-brand-row { display: flex; align-items: center; gap: 8px; padding: 2px 0 12px; min-height: 44px; }
.fx-brand { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; padding: 0 8px; color: var(--hd-fg); text-decoration: none; white-space: nowrap; }
.fx-brand:hover { color: var(--hd-fg); text-decoration: none; }
.fx-dot { color: var(--hd-accent); font-weight: 700; }
.fx-side-close, .fx-navtoggle {
  display: none; align-items: center; justify-content: center; width: 32px; height: 32px; margin-left: auto; flex-shrink: 0;
  padding: 0; border: 0; border-radius: var(--hd-radius); background: none; color: var(--hd-muted); cursor: pointer; position: relative;
}
.fx-side-close:hover, .fx-navtoggle:hover { background: rgba(255, 255, 255, 0.7); color: var(--hd-fg); }
.fx-side-close .hd-i { font-size: 18px; }
.fx-navtoggle:focus-visible, .fx-side-close:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: -2px; }
.fx-navtoggle .fx-item-l { display: none; }
.fx-side.rail .fx-ic-rail, .fx-side.full .fx-ic-full { display: none; }

/* Search pill (full menu) */
.fx-search {
  display: flex; align-items: center; gap: 7px; padding: 0 10px; height: 34px; margin: 0 0 12px;
  border-radius: var(--hd-radius); background: rgba(255, 255, 255, 0.65); border: 1px solid transparent; transition: border-color 0.1s, background 0.1s;
}
.fx-search:hover { border-color: var(--hd-border-strong); }
.fx-search:focus-within { background: var(--hd-surface); border-color: var(--hd-accent); box-shadow: var(--hd-ring); }
.fx-search .hd-i { font-size: 14px; color: var(--hd-faint); }
.fx-search input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--hd-fg); -webkit-appearance: none; appearance: none;
}
.fx-search input::placeholder { color: var(--hd-faint-2); }
.fx-search input::-webkit-search-cancel-button { display: none; }
.fx-kbd {
  flex-shrink: 0; font-size: 10px; line-height: 1.4; color: var(--hd-faint-2); background: var(--hd-surface);
  border: 1px solid var(--hd-border); border-radius: 4px; padding: 1px 5px;
}
.fx-search:focus-within .fx-kbd { display: none; }
.fx-kbd-tip { opacity: 0.6; margin-left: 4px; }

/* Sections and items */
.fx-sec { margin-bottom: 4px; }
.fx-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--hd-faint-2); padding: 10px 8px 4px; }
.fx-item {
  position: relative; display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 5px 8px; margin: 0 0 1px;
  border-radius: var(--hd-radius); border: 0; background: none; font-family: inherit; font-size: 13.5px; font-weight: 500; line-height: 1.3;
  color: var(--hd-muted); text-align: left; text-decoration: none; cursor: pointer; transition: background 0.1s, color 0.1s;
}
.fx-item:hover { background: rgba(255, 255, 255, 0.6); color: var(--hd-fg); text-decoration: none; }
.fx-item:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: -2px; }
.fx-item.active { background: var(--hd-surface); color: var(--hd-fg); font-weight: 600; box-shadow: var(--hd-shadow-xs); }
.fx-item > .hd-i { color: var(--hd-muted); }
.fx-item:hover > .hd-i, .fx-item.active > .hd-i { color: var(--hd-fg); }
.fx-item-l { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fx-n { font-size: 12px; font-weight: 500; color: var(--hd-faint); font-variant-numeric: tabular-nums; }
.fx-item.active .fx-n { color: var(--hd-accent); }
.fx-badge:empty, .fx-n:empty { display: none; }
.fx-badge {
  min-width: 18px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--hd-accent); color: #fff;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
.fx-rail-only, .fx-sub-h { display: none; }
.fx-tip { display: inline; }

/* Inbox views: child items under Inbox, aligned with its label */
.fx-sub { margin: 0 0 2px; }
.fx-child { min-height: 28px; padding: 3px 8px 3px 33px; font-size: 13px; }
.fx-child.active { font-weight: 600; }
.fx-more > summary { list-style: none; }
.fx-more > summary::-webkit-details-marker { display: none; }
.fx-side .fx-chev { font-size: 12px; transition: transform 0.15s; }
.fx-more[open] > summary .fx-chev { transform: rotate(90deg); }

/* Trial / payment card (bottom of the menu) */
.fx-trial {
  position: relative; margin: 0 0 8px; padding: 12px; border-radius: var(--hd-radius-lg);
  background: var(--hd-surface); border: 1px solid var(--hd-border); color: var(--hd-muted);
}
.fx-trial[hidden] { display: none !important; }
.fx-trial.urgent { background: var(--hd-red-bg); border-color: #f6d5d0; color: var(--hd-red); }
.fx-trial-h { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; margin-bottom: 6px; }
.fx-trial-h .hd-i { font-size: 13px; }
.fx-trial-t { margin: 0; padding-right: 22px; font-size: 15px; font-weight: 600; line-height: 1.25; color: var(--hd-fg); }
.fx-trial.urgent .fx-trial-t { color: var(--hd-red); }
.fx-trial-s { margin: 3px 0 0; font-size: 12px; line-height: 1.4; }
.fx-trial-only { margin-top: 0; padding-right: 22px; }
.fx-trial-meter { height: 4px; margin: 10px 0 0; border-radius: 999px; background: var(--hd-hover); overflow: hidden; }
.fx-trial-meter > span { display: block; height: 100%; border-radius: 999px; background: var(--hd-accent); }
.fx-trial.urgent .fx-trial-meter > span { background: var(--hd-red); }
.fx-trial-cta {
  display: flex; align-items: center; justify-content: center; min-height: 32px; margin-top: 10px; padding: 0 10px;
  border-radius: var(--hd-radius-pill); background: var(--hd-accent); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none;
  transition: background 0.12s;
}
.fx-trial.urgent .fx-trial-cta { background: var(--hd-red); }
.fx-trial-cta:hover, .fx-trial-cta:focus-visible { color: #fff; text-decoration: none; background: var(--hd-accent-hover); }
.fx-trial.urgent .fx-trial-cta:hover { filter: brightness(0.9); background: var(--hd-red); }
.fx-trial-x {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 7px; background: transparent; color: inherit; opacity: 0.5; cursor: pointer;
}
.fx-trial-x:hover, .fx-trial-x:focus-visible { opacity: 1; background: var(--hd-hover); }
.fx-trial-x .hd-i { font-size: 14px; }
.fx-trial-mini { display: none; }

/* Test mode notice (outside production nothing reaches customers) */
.fx-notes { margin: 0 0 8px; }
.fx-mailmode {
  position: relative; display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--hd-radius);
  font-size: 12px; line-height: 1.4; color: var(--hd-amber); background: var(--hd-amber-bg); border: 1px solid #f3dfa6; outline: none;
}
.fx-mailmode .hd-i { font-size: 14px; margin-top: 1px; }

/* Workspace and account menu (bottom). An hd-menu that opens upwards. */
.fx-ws { display: block; border-top: 1px solid var(--hd-border); padding-top: 8px; }
.fx-ws-btn { display: flex; align-items: center; gap: 9px; padding: 6px 8px; min-height: 44px; border-radius: var(--hd-radius); }
.fx-ws-btn:hover, .fx-ws[open] > .fx-ws-btn { background: rgba(255, 255, 255, 0.6); }
.fx-ws-btn:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: -2px; }
.fx-ws-av {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--hd-surface); color: var(--hd-accent); font-size: 11px; font-weight: 700; box-shadow: var(--hd-shadow-xs);
}
.fx-ws-av.me { border-radius: 50%; }
.fx-ws-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.fx-ws-txt b { font-size: 13px; font-weight: 600; color: var(--hd-fg); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fx-ws-txt span { font-size: 12px; color: var(--hd-faint); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fx-side .fx-ws-chev { font-size: 14px; color: var(--hd-faint); }
.fx-ws .hd-menu-list { top: auto; bottom: calc(100% + 6px); left: 0; right: 0; min-width: 0; max-height: calc(100dvh - 80px); overflow-y: auto; }
.fx-ws-me { display: flex; align-items: center; gap: 10px; padding: 6px 9px 8px; min-width: 0; }
.fx-ws-me > div { min-width: 0; }
.fx-ws-me .hd-main-name, .fx-ws-me .hd-s-email { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fx-ws .hd-menu-head .hd-main-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Drawer scrim (narrow screens) */
.fx-scrim { display: none; }

/* Forms inside menus: a submit button that looks like a menu item (Sign out, Switch to…) */
.hd-menu-list > form { margin: 0; }
.hd-menu-list > form > button {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 6px 9px; margin: 0; border: 0; border-radius: var(--hd-radius);
  background: transparent; box-shadow: none; color: var(--hd-fg-2); font: inherit; font-weight: 400; text-align: left;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hd-menu-list > form > button:hover { background: var(--hd-hover); color: var(--hd-fg); }

/* ---------- Menu: rail (icons only, ≥992px) ---------- */
@media (min-width: 992px) {
  .fx-navtoggle { display: inline-flex; }
  .fx-side.rail:not(.peek) { width: var(--fx-rail-w); }
  .fx-side.rail:not(.peek) .fx-side-in,
  .fx-side.rail:not(.peek) .fx-side-scroll { overflow: visible; }
  .fx-side.rail:not(.peek) .fx-side-in { padding: 12px 6px 10px; align-items: stretch; }
  .fx-side.rail:not(.peek) .fx-side-scroll { margin: 0; padding: 0; }
  .fx-side.rail:not(.peek) .fx-brand-row { justify-content: center; padding: 0 0 10px; min-height: 40px; }
  .fx-side.rail:not(.peek) .fx-brand,
  .fx-side.rail:not(.peek) .fx-brand-row .hd-env,
  .fx-side.rail:not(.peek) .fx-search,
  .fx-side.rail:not(.peek) .fx-label { display: none; }
  .fx-side.rail:not(.peek) .fx-navtoggle { margin: 0; width: 40px; }
  .fx-side.rail:not(.peek) .fx-rail-only:not(.fx-child) { display: flex; }
  .fx-side.rail:not(.peek) .fx-sec { margin: 0; padding: 0 0 8px; }
  .fx-side.rail:not(.peek) .fx-sec + .fx-sec { padding-top: 6px; }

  /* Items: a 40×32 pill around the icon; the active one is white (the mockup) */
  .fx-side.rail:not(.peek) .fx-item:not(.fx-child) { justify-content: center; width: 40px; height: 32px; min-height: 0; margin: 0 0 2px; padding: 0; border-radius: 8px; }
  .fx-side.rail:not(.peek) .fx-item:not(.fx-child) > .hd-i { color: var(--hd-fg); }

  /* Names become tooltips (also the toggle's, the test-mode note's and the trial badge's) */
  .fx-side.rail:not(.peek) .fx-item:not(.fx-child) > .fx-item-l,
  .fx-side.rail:not(.peek) .fx-navtoggle > .fx-item-l,
  .fx-side.rail:not(.peek) .fx-tip {
    display: block; position: absolute; left: calc(100% + 10px); top: 50%; z-index: 30; flex: none; width: max-content; max-width: 240px;
    padding: 5px 9px; border-radius: 6px; background: var(--hd-dark); color: #fff; font-size: 12px; font-weight: 500; line-height: 1.35;
    white-space: normal; overflow: visible; text-overflow: clip; text-align: left; box-shadow: var(--hd-shadow-menu);
    opacity: 0; visibility: hidden; transform: translate(-4px, -50%); transition: opacity 0.12s, transform 0.12s, visibility 0.12s; pointer-events: none;
  }
  .fx-side.rail:not(.peek) .fx-item:not(.fx-child):hover > .fx-item-l,
  .fx-side.rail:not(.peek) .fx-item:not(.fx-child):focus-visible > .fx-item-l,
  .fx-side.rail:not(.peek) .fx-navtoggle:hover > .fx-item-l,
  .fx-side.rail:not(.peek) .fx-navtoggle:focus-visible > .fx-item-l,
  .fx-side.rail:not(.peek) :hover > .fx-tip,
  .fx-side.rail:not(.peek) :focus-visible > .fx-tip { opacity: 1; visibility: visible; transform: translate(0, -50%); transition-delay: 0.15s; }

  /* Counts become badges on the icon */
  .fx-side.rail:not(.peek) .fx-item:not(.fx-child) > .fx-n,
  .fx-side.rail:not(.peek) .fx-item:not(.fx-child) > .fx-badge {
    position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--hd-accent); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center;
    box-shadow: 0 0 0 2px var(--hd-bg-rail);
  }

  /* Inbox views: a flyout beside the Inbox icon (hover or keyboard focus) */
  .fx-side.rail:not(.peek) .fx-group { position: relative; }
  .fx-side.rail:not(.peek) .fx-group > .fx-item > .fx-item-l { display: none; }
  .fx-side.rail:not(.peek) .fx-sub {
    position: absolute; left: calc(100% + 8px); top: -6px; z-index: 40; width: 232px; margin: 0; padding: 6px;
    background: var(--hd-surface); border: 1px solid var(--hd-border); border-radius: var(--hd-radius-lg); box-shadow: var(--hd-shadow-menu);
    opacity: 0; visibility: hidden; transform: translateX(-4px); transition: opacity 0.12s, transform 0.12s, visibility 0.12s;
  }
  /* A bridge over the gap so the pointer can travel from the icon to the flyout */
  .fx-side.rail:not(.peek) .fx-sub::before { content: ''; position: absolute; top: 0; bottom: 0; left: -12px; width: 12px; }
  .fx-side.rail:not(.peek) .fx-group:hover > .fx-sub,
  .fx-side.rail:not(.peek) .fx-group:focus-within > .fx-sub { opacity: 1; visibility: visible; transform: none; transition-delay: 0.05s; }
  .fx-side.rail:not(.peek) .fx-sub-h { display: block; padding: 6px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--hd-faint); }
  .fx-side.rail:not(.peek) .fx-sub .fx-rail-only { display: flex; }
  .fx-side.rail:not(.peek) .fx-sub .fx-child { padding-left: 8px; }
  .fx-side.rail:not(.peek) .fx-sub .fx-item:hover { background: var(--hd-hover); }
  .fx-side.rail:not(.peek) .fx-sub .fx-item.active { background: var(--hd-sel); box-shadow: none; }

  /* Foot: test-mode note and trial card shrink to badges, the workspace menu to its avatar */
  .fx-side.rail:not(.peek) .fx-notes { margin: 0 0 6px; display: flex; justify-content: center; }
  .fx-side.rail:not(.peek) .fx-mailmode { justify-content: center; align-items: center; width: 40px; height: 32px; padding: 0; }
  .fx-side.rail:not(.peek) .fx-mailmode .hd-i { margin: 0; font-size: 16px; }
  .fx-side.rail:not(.peek) .fx-trial { margin: 0 0 6px; padding: 0; border: 0; background: none; display: flex; justify-content: center; }
  .fx-side.rail:not(.peek) .fx-trial > :not(.fx-trial-mini) { display: none; }
  .fx-side.rail:not(.peek) .fx-trial-mini {
    position: relative; display: flex; align-items: center; justify-content: center; width: 40px; height: 32px; border-radius: 8px;
    background: var(--hd-surface); color: var(--hd-fg); font-size: 12px; font-weight: 700; text-decoration: none; box-shadow: var(--hd-shadow-xs); outline: none;
  }
  .fx-side.rail:not(.peek) .fx-trial.urgent .fx-trial-mini { background: var(--hd-red-bg); color: var(--hd-red); }
  .fx-side.rail:not(.peek) .fx-trial-mini:focus-visible { outline: 2px solid var(--hd-accent); }
  .fx-side.rail:not(.peek) .fx-ws { padding-top: 8px; }
  .fx-side.rail:not(.peek) .fx-ws-btn { justify-content: center; width: 40px; padding: 6px 0; }
  .fx-side.rail:not(.peek) .fx-ws-txt,
  .fx-side.rail:not(.peek) .fx-ws-chev { display: none; }
  .fx-side.rail:not(.peek) .fx-ws .hd-menu-list { left: calc(100% + 10px); right: auto; bottom: 0; width: 260px; }

  /* Peek: the full menu over the page (⌘K or the search icon in rail mode) */
  .fx-side.rail.peek { box-shadow: 4px 0 28px rgba(36, 38, 34, 0.14); }
}

/* ---------- Top bar ---------- */
.fx-bar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: calc(var(--fx-bar-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 24px 0;
  background: var(--hd-surface); border-bottom: 1px solid var(--hd-border);
  font-family: var(--hd-font); font-size: 13px; color: var(--hd-fg); -webkit-font-smoothing: antialiased;
}
.fx-bar *, .fx-bar *::before, .fx-bar *::after { box-sizing: border-box; }
.fx-bar-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fx-bar-r { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.fx-burger {
  display: none; align-items: center; justify-content: center; width: 36px; height: 36px; margin-left: -6px; padding: 0;
  border: 0; border-radius: var(--hd-radius); background: none; color: var(--hd-muted); cursor: pointer;
}
.fx-burger:hover { background: var(--hd-hover); color: var(--hd-fg); }
.fx-burger .hd-i { font-size: 20px; }

.fx-crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.fx-crumb .parent { color: var(--hd-faint); text-decoration: none; white-space: nowrap; font-weight: 500; }
.fx-crumb a.parent:hover { color: var(--hd-fg); text-decoration: none; }
.fx-crumb .sep { width: 14px; height: 14px; font-size: 14px; color: var(--hd-border-strong); flex-shrink: 0; }
.fx-crumb .current { color: var(--hd-fg); font-size: var(--hd-text-lg); font-weight: 700; letter-spacing: -0.01em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* New email: the blue pill (Figma 2016:28) */
.fx-newbtn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px 0 12px; border-radius: var(--hd-radius-pill);
  border: 0; background: var(--hd-accent); color: #fff; font-family: var(--hd-font); font-size: 12px; font-weight: 500;
  text-decoration: none; white-space: nowrap; cursor: pointer; transition: background 0.12s;
}
.fx-newbtn:hover, .fx-newbtn:focus-visible { background: var(--hd-accent-hover); color: #fff; text-decoration: none; }
.fx-newbtn:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: 2px; }
.fx-newbtn .hd-i { font-size: 14px; }

.fx-acct > summary.fx-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--hd-accent-bg); color: var(--hd-accent); font-size: 12px; font-weight: 600; cursor: pointer; user-select: none;
}
.fx-acct > summary.fx-avatar:hover, .fx-acct[open] > summary.fx-avatar { background: #dde9f6; }
.fx-acct > summary.fx-avatar:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: 2px; }
.fx-acct .hd-menu-list { min-width: 230px; z-index: 60; }
.fx-acct .hd-menu-head .hd-tag { margin-top: 6px; }

/* ---------- Narrow screens: the menu is a drawer ---------- */
@media (max-width: 991.98px) {
  .fx-side {
    width: min(300px, 88vw); transform: translateX(-100%); visibility: hidden;
    transition: transform 0.24s ease, visibility 0.24s; box-shadow: none; border-right: 0;
  }
  .fx-side.open { transform: none; visibility: visible; box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12); }
  .fx-side-close { display: inline-flex; width: 36px; height: 36px; }
  .fx-scrim {
    display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(36, 38, 34, 0.32);
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
  }
  .fx-scrim.open { opacity: 1; pointer-events: auto; }
  body.fx-menu-open { overflow: hidden; }
  .fx-kbd { display: none; }
  .fx-item { min-height: 40px; font-size: 15px; padding: 7px 10px; }
  .fx-child { min-height: 38px; padding-left: 35px; font-size: 14px; }
  .fx-label { font-size: 11px; }
  .fx-search { height: 40px; }
  .fx-search input { font-size: 16px; } /* 16px stops iOS zooming on focus */

  .fx-bar { padding: env(safe-area-inset-top, 0px) 14px 0; --fx-bar-h: 56px; }
  .fx-burger { display: inline-flex; }
}
@media (max-width: 767.98px) {
  .fx-bar { --fx-bar-h: 52px; gap: 8px; }
  .fx-crumb .parent, .fx-crumb .sep { display: none; }
  .fx-crumb .current { font-size: 16px; }
  .fx-newbtn { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .fx-newbtn-l { display: none; }
  .fx-newbtn .hd-i { font-size: 18px; }
  .fx-acct > summary.fx-avatar { width: 36px; height: 36px; }
  /* Inbox on a phone: an open conversation (or customer) takes the whole screen; its own header has the back button. */
  body.fs-app:has(.sp.has-sel) .fx-bar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fx-side, .fx-scrim, .fx-sub, .fx-item-l, .fx-tip { transition: none !important; }
}
@media (pointer: coarse) {
  .fx-item { min-height: 40px; }
  .fx-child { min-height: 38px; }
}

/* Content pages sit at the menu's edge (left-aligned), not centred in the space. */
body:has(> .fx-side) main.hd { margin: 0; padding-left: 32px; padding-right: 32px; }
@media (max-width: 760px) {
  body:has(> .fx-side) main.hd { padding-left: 16px; padding-right: 16px; }
}

/* Touch / narrow: 36px tap targets in the shell's small controls and menus */
@media (max-width: 991.98px), (pointer: coarse) {
  .fx-brand { display: inline-flex; align-items: center; min-height: 36px; }
  .fx-trial-x { width: 36px; height: 36px; top: 0; right: 0; }
  .fx-trial-cta { min-height: 38px; }
  .fx-acct .hd-menu-list > a, .fx-acct .hd-menu-list form button,
  .fx-ws .hd-menu-list > a, .fx-ws .hd-menu-list form button { min-height: 38px; display: flex; align-items: center; }
}
@media (min-width: 992px) and (pointer: coarse) {
  .fx-side.rail:not(.peek) .fx-item:not(.fx-child) { height: 36px; }
}
