/*
 * The app shell (layout "shell", partials in app/views/shell): the left rail
 * on desktop, the top bar and tab bar on phones, and the page header around
 * every signed-in page. Same family as the Studio and the sign-in pages
 * (studio.css, auth.css), at app scale: calm, hairlines, the ember to amber
 * sheen only where it means something (active page, focus, the plan meter).
 *
 * Every rule is scoped under .shell (the <body>) because Propshaft links all
 * stylesheets on every page. Shell colors are local tokens, "Day" by default
 * and "Night" under html.dark. Page content keeps its Tailwind classes, and
 * dark-mode.css still inverts their gray palette, so shell parts use their own
 * app- classes (not sh-: auth.css owns those) and never Tailwind gray utilities.
 */

.shell {
  --app-bg: #faf8f4;
  --app-rail: #f4f1ea;
  --app-surface: #ffffff;
  --app-raised: #ffffff;
  --app-ink: #16121c;
  --app-ink-2: #5a5364;
  --app-ink-3: #6f6878;
  --app-hair: rgba(22, 18, 28, 0.08);
  --app-hair-2: rgba(22, 18, 28, 0.14);
  --app-hover: rgba(22, 18, 28, 0.045);
  --app-press: rgba(22, 18, 28, 0.075);
  --app-accent: #b23a1c;
  --app-hot: #cc3a20;
  --app-focus: #e8553a;
  --app-ember: #ff5a3c;
  --app-amber: #ffa552;
  --app-sheen: linear-gradient(95deg, #ffe0b5 0%, #ffa552 42%, #ff5a3c 100%);
  --app-sheen-y: linear-gradient(180deg, #ffe0b5 0%, #ffa552 45%, #ff5a3c 100%);
  --app-lift: 0 0 0 1px var(--app-hair), 0 1px 2px rgba(22, 18, 28, 0.05);
  --app-menu-shadow: 0 0 0 1px var(--app-hair), 0 16px 40px -16px rgba(22, 18, 28, 0.22), 0 4px 10px -4px rgba(22, 18, 28, 0.08);
  --app-glass: rgba(250, 248, 244, 0.86);

  --app-rail-w: 240px;
  --app-top-h: 56px;
  --app-head-h: 64px;
  --app-tab-h: 58px;
  --app-max: 1180px;
  --app-gutter: 32px;

  --f-display: 'Wix Madefor Display', 'Inter', system-ui, sans-serif;
  --f-body: 'Wix Madefor Text', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --app-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  margin: 0;
  min-height: 100dvh;
  background: var(--app-bg);
  color: var(--color-gray-600);
  font-family: var(--f-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.dark .shell {
  --app-bg: #0b0910;
  --app-rail: #0e0b14;
  --app-surface: #16121d;
  --app-raised: #1a1522;
  --app-ink: #f6f2fa;
  --app-ink-2: #bab2c6;
  --app-ink-3: #8c8498;
  --app-hair: rgba(255, 255, 255, 0.075);
  --app-hair-2: rgba(255, 255, 255, 0.13);
  --app-hover: rgba(255, 255, 255, 0.05);
  --app-press: rgba(255, 255, 255, 0.08);
  --app-accent: #ffa552;
  --app-focus: #ffa552;
  --app-lift: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.4);
  --app-menu-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09), 0 20px 48px -16px rgba(0, 0, 0, 0.85);
  --app-glass: rgba(11, 9, 16, 0.82);
  color-scheme: dark;
}

/* The new fonts for page content too: one family across the app. */
.shell .font-display { font-family: var(--f-display); letter-spacing: -0.015em; }

.shell ::selection { background: var(--app-ember); color: #fff; }

/* ── Focus: an amber/ember ring on everything the shell draws ── */
.shell :is(.app-rail, .app-top, .app-tabs, .app-head, .app-menu, .app-skip) :focus-visible,
.shell .app-skip:focus-visible,
.shell .app-content :is(a, button, summary):focus-visible {
  outline: 2px solid var(--app-focus);
  outline-offset: 2px;
}
.shell .app-main:focus { outline: none; }

.shell .app-skip {
  position: fixed; left: 12px; top: -60px; z-index: 300;
  padding: 8px 14px; border-radius: 8px;
  background: var(--app-ink); color: var(--app-bg); font-size: 14px; font-weight: 600; text-decoration: none;
  transition: top 0.15s var(--app-ease);
}
.shell .app-skip:focus { top: 12px; }

/* ── Rail (desktop) ── */
.shell .app-rail {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--app-rail-w);
  display: flex; flex-direction: column;
  padding: 14px 12px max(12px, env(safe-area-inset-bottom));
  background: var(--app-rail);
  border-right: 1px solid var(--app-hair);
  color: var(--app-ink);
  font-size: 14px; line-height: 1.4;
}
.shell .app-rail__top { display: flex; align-items: center; height: 34px; padding: 0 8px; margin-bottom: 12px; }
.shell .app-logo { display: inline-flex; color: var(--app-ink); border-radius: 6px; transition: opacity 0.15s; }
.shell .app-logo:hover { opacity: 0.75; }
.shell .app-rail__foot { margin-top: auto; padding-top: 16px; display: grid; gap: 8px; }

/* On short windows the rail scrolls. A scroll container clips on both axes,
   so its menus stay inside the rail's width instead of overhanging it. */
@media (max-height: 620px) and (min-width: 1024px) {
  .shell .app-rail { overflow: hidden auto; scrollbar-width: none; }
  .shell .app-rail .app-menu { width: 100%; }
}

/* ── Workspace switcher ── */
.shell .app-ws { position: relative; }
.shell .app-ws__btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 48px; padding: 7px 10px 7px 8px;
  border: 1px solid var(--app-hair); border-radius: 10px;
  background: var(--app-surface); color: var(--app-ink);
  font: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 1px 2px rgba(22, 18, 28, 0.04);
  transition: border-color 0.15s var(--app-ease), background-color 0.15s var(--app-ease);
}
.shell .app-ws__btn:hover { border-color: var(--app-hair-2); }
.shell .app-ws.is-open .app-ws__btn { border-color: var(--app-hair-2); }
.shell .app-ws__btn > svg { flex: none; margin-left: auto; color: var(--app-ink-3); }
.shell .app-ws__text { display: grid; min-width: 0; gap: 1px; }
.shell .app-ws__domain { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.005em; }
.shell .app-ws__state { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: 11px; color: var(--app-ink-3); white-space: nowrap; }
.shell .app-ws__state i { width: 6px; height: 6px; border-radius: 50%; background: var(--app-ink-3); flex: none; }
.shell .app-ws__state--on i { background: var(--app-ember); animation: app-ping 2.4s ease-out infinite; }
.shell .app-ws__state--paused i { background: var(--app-amber); }

.shell .app-fav {
  flex: none; width: 24px; height: 24px; padding: 2px; border-radius: 7px;
  background: #fff; box-shadow: 0 0 0 1px var(--app-hair);
  object-fit: contain;
}
.shell .app-fav--letter {
  display: inline-grid; place-items: center; padding: 0;
  font-family: var(--f-display); font-size: 12px; font-weight: 700; color: #16121c;
  background: var(--app-sheen);
}

/* ── Menus (workspace switcher, account) ── */
.shell .app-menu {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0;
  width: max(100%, 256px); max-height: min(70dvh, 520px); overflow-y: auto;
  padding: 6px;
  border-radius: 12px; background: var(--app-raised); box-shadow: var(--app-menu-shadow);
  color: var(--app-ink); font-size: 14px; line-height: 1.4;
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(0.985); transform-origin: top left;
  transition: opacity 0.16s var(--app-ease), transform 0.18s var(--app-ease), visibility 0s linear 0.18s;
}
.shell .is-open > .app-menu {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.16s var(--app-ease), transform 0.18s var(--app-ease), visibility 0s;
}
.shell .app-menu__label { margin: 0; padding: 8px 10px 6px; font-family: var(--f-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--app-ink-3); }
.shell .app-menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px;
  border: 0; border-radius: 8px; background: none; color: var(--app-ink);
  font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color 0.12s var(--app-ease);
}
.shell .app-menu__item:hover, .shell .app-menu__item:focus-visible { background: var(--app-hover); }
.shell .app-menu__item:focus-visible { outline-offset: -2px; }
.shell .app-menu__item.is-muted { color: var(--app-ink-2); }
.shell .app-menu__item.is-muted .app-fav { opacity: 0.6; }
.shell .app-menu__item[aria-current] { font-weight: 600; }
.shell .app-menu__item .app-fav { width: 20px; height: 20px; border-radius: 6px; }
.shell .app-menu__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell .app-menu__icon { display: inline-flex; flex: none; color: var(--app-ink-3); }
.shell .app-menu__item:hover .app-menu__icon { color: var(--app-ink-2); }
.shell .app-menu__check { display: inline-flex; margin-left: auto; color: var(--app-ember); }
.shell .app-menu__hint { display: inline-flex; align-items: center; margin-left: auto; padding-left: 8px; font-family: var(--f-mono); font-size: 11px; color: var(--app-ink-3); white-space: nowrap; }
.shell .app-menu__sep { height: 1px; margin: 6px 4px; background: var(--app-hair); }
.shell .app-menu__me { display: grid; gap: 1px; padding: 8px 10px; border-radius: 8px; color: var(--app-ink); text-decoration: none; transition: background-color 0.12s var(--app-ease); }
.shell .app-menu__me:hover { background: var(--app-hover); }
.shell .app-menu__me-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell .app-menu__me-mail { font-size: 12.5px; color: var(--app-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell .app-menu__plan { padding: 4px 4px 2px; }
.shell .app-menu__theme { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; padding: 2px 4px 2px 10px; font-size: 14px; }

.shell .app-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--app-hover); box-shadow: inset 0 0 0 1px var(--app-hair); }
.shell .app-seg button {
  display: inline-grid; place-items: center; width: 30px; height: 26px;
  border: 0; border-radius: 6px; background: none; color: var(--app-ink-3); cursor: pointer;
  transition: background-color 0.15s var(--app-ease), color 0.15s var(--app-ease);
}
.shell .app-seg button:hover { color: var(--app-ink); }
.shell .app-seg button[aria-pressed="true"], .shell .app-seg button.active { background: var(--app-surface); color: var(--app-ink); box-shadow: var(--app-lift); }

.shell .app-badge {
  margin-left: auto; flex: none; padding: 2px 7px; border-radius: 99px;
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 500; color: var(--app-ink-2);
  background: var(--app-hover); box-shadow: inset 0 0 0 1px var(--app-hair);
}
.shell .app-badge--warm { color: #9a4a0b; background: rgba(255, 165, 82, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 165, 82, 0.35); }
.shell .app-badge--bad { color: #b42318; background: rgba(240, 68, 56, 0.1); box-shadow: inset 0 0 0 1px rgba(240, 68, 56, 0.25); }
html.dark .shell .app-badge--warm { color: #ffc58f; }
html.dark .shell .app-badge--bad { color: #fca5a5; }

/* ── Primary nav ── */
.shell .app-nav { margin-top: 14px; }
.shell .app-nav ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.shell .app-nav__item {
  position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: 8px; color: var(--app-ink-2); font-size: 14px; font-weight: 500; text-decoration: none;
  transition: background-color 0.15s var(--app-ease), color 0.15s var(--app-ease), box-shadow 0.15s var(--app-ease);
}
.shell .app-nav__item svg { flex: none; color: var(--app-ink-3); transition: color 0.15s var(--app-ease); }
.shell .app-nav__item:hover { background: var(--app-hover); color: var(--app-ink); }
.shell .app-nav__item:hover svg { color: var(--app-ink-2); }
.shell .app-nav__item[aria-current="page"] { background: var(--app-surface); color: var(--app-ink); font-weight: 600; box-shadow: var(--app-lift); }
.shell .app-nav__item[aria-current="page"] svg { color: var(--app-ink); }
.shell .app-nav__item[aria-current="page"]::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--app-sheen-y);
  box-shadow: 0 0 12px rgba(255, 106, 61, 0.45);
}
.shell .app-nav__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell .app-nav__meta { display: inline-flex; align-items: center; margin-left: auto; }

.shell .app-live {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 7px 2px 6px; border-radius: 99px;
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 500; color: var(--app-accent);
  background: rgba(255, 90, 60, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 90, 60, 0.2);
}
.shell .app-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--app-ember); animation: app-ping 2s ease-out infinite; }

.shell .app-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 99px;
  font-family: var(--f-mono); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums;
  color: var(--app-ink-2); background: var(--app-press);
}
.shell .app-count--hot { color: #fff; background: var(--app-hot); }

/* ── Rail bottom: changelog, plan, account ── */
.shell .app-news {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px;
  border-radius: 8px; color: var(--app-ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none;
  transition: background-color 0.15s var(--app-ease), color 0.15s var(--app-ease);
}
.shell .app-news svg { flex: none; color: var(--app-ink-3); }
.shell .app-news:hover { background: var(--app-hover); color: var(--app-ink); }
.shell .app-news .app-count { margin-left: auto; }

.shell .app-plan {
  display: grid; gap: 7px; padding: 12px;
  border-radius: 12px; background: var(--app-surface); box-shadow: var(--app-lift);
  color: var(--app-ink); text-decoration: none;
  transition: box-shadow 0.15s var(--app-ease);
}
.shell a.app-plan:hover { box-shadow: 0 0 0 1px var(--app-hair-2), 0 2px 6px -2px rgba(22, 18, 28, 0.08); }
.shell .app-plan__label { font-family: var(--f-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--app-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell .app-plan__count { font-size: 13px; color: var(--app-ink-2); }
.shell .app-plan__count b { margin-right: 2px; font-family: var(--f-mono); font-size: 15px; font-weight: 600; color: var(--app-ink); font-variant-numeric: tabular-nums; }
.shell .app-meter { position: relative; display: block; height: 4px; border-radius: 4px; background: var(--app-press); overflow: hidden; }
.shell .app-meter i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--app-sheen); min-width: 4px; }
html.dark .shell .app-meter i { box-shadow: 0 0 10px rgba(255, 106, 61, 0.55); }
.shell .app-plan__note { font-size: 12px; color: var(--app-ink-3); }
.shell .app-plan__cta { display: inline-flex; align-items: center; gap: 4px; justify-self: start; font-size: 13px; font-weight: 600; color: var(--app-accent); text-decoration: none; }
.shell .app-plan__cta svg { transition: transform 0.15s var(--app-ease); }
.shell .app-plan__cta:hover svg, .shell a.app-plan:hover .app-plan__cta svg { transform: translateX(2px); }
.shell .app-plan--none { box-shadow: 0 0 0 1px rgba(255, 90, 60, 0.35), 0 8px 24px -16px rgba(255, 90, 60, 0.6); }
.shell .app-plan--compact { box-shadow: none; background: var(--app-hover); }

.shell .app-account { position: relative; }
.shell .app-account__btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px;
  border: 0; border-radius: 10px; background: none; color: var(--app-ink);
  font: inherit; text-align: left; cursor: pointer;
  transition: background-color 0.15s var(--app-ease);
}
.shell .app-account__btn:hover, .shell .app-account.is-open .app-account__btn, .shell .app-account.is-current .app-account__btn { background: var(--app-hover); }
.shell .app-account__btn > svg { flex: none; margin-left: auto; color: var(--app-ink-3); }
.shell .app-account__text { display: grid; min-width: 0; gap: 1px; }
.shell .app-account__name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell .app-account__sub { font-size: 12px; color: var(--app-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell .app-account--rail .app-menu { top: auto; bottom: calc(100% + 6px); transform-origin: bottom left; transform: translateY(4px) scale(0.985); }
.shell .app-account--rail.is-open .app-menu { transform: none; }

.shell .app-avatar {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--app-sheen); color: #16121c;
  font-family: var(--f-display); font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  box-shadow: 0 0 0 1px var(--app-hair);
}
.shell .app-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.shell .app-add-site {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border-radius: 10px; background: var(--app-ink); color: var(--app-bg); font-size: 14px; font-weight: 600; text-decoration: none;
}
.shell .app-add-site svg { flex: none; }
.shell .app-add-site span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Main column and page header ── */
.shell .app-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 100dvh; margin-left: var(--app-rail-w); overflow-x: clip; }

/* The frosted glass lives on ::before, not on the header: a backdrop-filter
   on the header would make it the containing block of its position: fixed
   children, so a confirmation modal in the :page_actions slot would be sized
   to the header. z-index 45 sits above the rail (40), so such a modal (z-200
   inside this layer) still covers the whole window, and below the page's own
   modals (z-50 and up). */
.shell .app-head {
  position: sticky; top: 0; z-index: 45;
  border-bottom: 1px solid var(--app-hair);
}
.shell .app-head::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--app-glass);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
}
.shell .app-head__in {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; max-width: calc(var(--app-max) + 2 * var(--app-gutter)); min-height: calc(var(--app-head-h) - 1px);
  margin: 0 auto; padding: 12px var(--app-gutter);
}
.shell .app-head--flush .app-head__in { max-width: none; }
.shell .app-head__title { min-width: 0; color: var(--app-ink); }
.shell .app-head__title h1 {
  margin: 0; font-family: var(--f-display); font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em;
  color: var(--app-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shell .app-head__title p { margin: 2px 0 0; font-size: 13px; line-height: 1.4; color: var(--app-ink-2); }
.shell .app-head__actions { display: flex; align-items: center; gap: 8px; flex: none; }

.shell .app-content { flex: 1; width: 100%; max-width: calc(var(--app-max) + 2 * var(--app-gutter)); margin: 0 auto; padding: 24px var(--app-gutter) 64px; }
.shell .app-content--flush { max-width: none; padding: 0; }

/* Anchored sections (/me#emails) land below the sticky header. */
.shell .app-content [id] { scroll-margin-top: calc(var(--app-head-h) + 16px); }

/* ── Phone top bar and tab bar ── */
.shell .app-top, .shell .app-tabs { display: none; }

@media (max-width: 1023.98px) {
  /* Safe-area insets need viewport-fit=cover, which the shell layout sets. */
  .shell { --app-gutter: 16px; --app-top-full: calc(var(--app-top-h) + env(safe-area-inset-top)); }
  .shell .app-rail { display: none; }
  .shell .app-main {
    margin-left: 0;
    padding: 0 env(safe-area-inset-right) calc(var(--app-tab-h) + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  }

  /* The phone bars sit at z-35: above the page's sticky bits (z-30), below
     its overlays (the article details backdrop is z-40), which dim them like
     they dimmed the old header. */
  .shell .app-top {
    position: sticky; top: 0; z-index: 35;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: var(--app-top-full);
    padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    background: var(--app-glass);
    -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--app-hair);
    color: var(--app-ink); font-size: 14px;
  }
  .shell .app-top .app-ws { min-width: 0; flex: 0 1 auto; }
  .shell .app-top .app-ws__btn { min-height: 42px; padding: 4px 8px 4px 4px; border-color: transparent; background: none; box-shadow: none; }
  .shell .app-top .app-ws__btn:hover, .shell .app-top .app-ws.is-open .app-ws__btn { background: var(--app-hover); border-color: transparent; }
  .shell .app-top .app-ws__btn > svg { margin-left: 2px; }
  .shell .app-top .app-menu { width: min(320px, calc(100vw - 24px)); max-height: calc(100dvh - var(--app-top-full) - var(--app-tab-h) - env(safe-area-inset-bottom) - 20px); }
  .shell .app-top .app-account { flex: none; }
  .shell .app-top .app-account__btn { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .shell .app-top .app-account__btn:hover, .shell .app-top .app-account.is-open .app-account__btn { background: var(--app-hover); }
  .shell .app-top .app-account.is-current .app-account__btn { background: none; }
  .shell .app-top .app-account .app-menu { left: auto; right: 0; transform-origin: top right; }

  .shell .app-tabs {
    position: fixed; inset: auto 0 0 0; z-index: 35;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    height: calc(var(--app-tab-h) + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--app-glass);
    -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--app-hair);
  }
  .shell .app-tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 0; color: var(--app-ink-3); font-size: 11px; font-weight: 500; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s var(--app-ease);
  }
  .shell .app-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .shell .app-tab:focus-visible { outline-offset: -4px; border-radius: 10px; }
  .shell .app-tab[aria-current="page"] { color: var(--app-ink); font-weight: 600; }
  .shell .app-tab[aria-current="page"]::before {
    content: ''; position: absolute; top: -1px; left: 50%; width: 28px; height: 2px; margin-left: -14px;
    border-radius: 0 0 2px 2px; background: var(--app-sheen); box-shadow: 0 0 10px rgba(255, 106, 61, 0.5);
  }

  /* z-index still applies to a static flex item: drop it so the header makes
     no layer over the top bar's menus. */
  .shell .app-head { position: static; z-index: auto; border-bottom: 0; }
  .shell .app-head::before { content: none; }
  .shell .app-head__in { min-height: 0; padding-top: 18px; padding-bottom: 2px; align-items: flex-start; }
  .shell .app-head--flush .app-head__in { padding-bottom: 12px; }
  .shell .app-head__title h1 { font-size: 20px; white-space: normal; }
  .shell .app-content { padding-top: 16px; padding-bottom: 32px; }
  .shell .app-content--flush { padding: 0; }

  .shell .app-content [id] { scroll-margin-top: calc(var(--app-top-full) + 12px); }

  /* Page bits that stick under the old 64px header stick under the top bar. */
  .shell .app-content .top-16 { top: var(--app-top-full); }

  /* The article details panel slides in from the right edge. */
  .shell #article-sidebar-panel { padding-right: env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom); }

  /* Toasts sit above the tab bar. */
  .shell #noticePopup {
    right: max(12px, env(safe-area-inset-right)); left: max(12px, env(safe-area-inset-left));
    bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom) + 12px);
  }
}

@keyframes app-ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 90, 60, 0.55); }
  70%, 100% { box-shadow: 0 0 0 6px rgba(255, 90, 60, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .shell :is(.app-rail, .app-top, .app-tabs, .app-head, .app-menu, .app-skip),
  .shell :is(.app-rail, .app-top, .app-tabs, .app-head, .app-menu) *,
  .shell :is(.app-rail, .app-top, .app-tabs, .app-head, .app-menu) *::before {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}
