/*
 * layout.css — page chrome and navigation.
 *
 * Top header, nav links, mobile drawer, topbar layout, language
 * switcher, user account dropdown, nav unread badge, nav label
 * collapse at intermediate widths.
 *
 * v13.9.0 will replace most of this with a sidebar nav (per the
 * approved wireframes) — this file is the surface most affected
 * by the redesign.
 */
/* ─── Header chrome ───────────────────────────────────────────────────── */
.st-header { background: var(--st-bg); border-bottom: 1px solid var(--st-border); }
.st-brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 1.0625rem; color: var(--st-text);
  text-decoration: none;
}
.st-brand-mark {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--st-primary-soft);
  color: var(--st-primary);
}

/* ─── Nav links ──────────────────────────────────────────────────────── */
.st-nav-link {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--st-radius-pill);
  color: var(--st-text); font-size: 0.875rem;
  text-decoration: none;
  transition: background-color 120ms ease;
}
.st-nav-link:hover { background: var(--st-bg-soft); }
.st-nav-link-active {
  background: var(--st-primary-soft); color: var(--st-primary);
  font-weight: 500;
}
.st-nav-icon { width: 18px; height: 18px; flex-shrink: 0; }


/* ─── v13.7: Nav unread badge ─────────────────────────────────────────
 * Tiny circle next to the Messages nav-link icon that shows pending
 * sharing invites + unread notification count. */
.st-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 9px;
  background: var(--st-primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* ─── v13.6.1: Nav label collapse at intermediate widths ──────────────
 * Between 768px (above the mobile-drawer breakpoint) and 1023px there
 * isn't enough horizontal room for full nav labels + user-menu pill on
 * one row. v13.4.1 handled this with overflow-x: scroll, but on a
 * topbar with a hidden scrollbar, scrolled-off items are invisible —
 * which is how "Help" disappeared from the right edge.
 *
 * This rule shows icons-only between 768-1023px (tooltip via title=)
 * and restores full labels at ≥1024px. Anything still wider than the
 * topbar in icon-only mode falls through to overflow-x: auto, but in
 * practice all 7-8 icons fit comfortably at any tablet width. */
.st-nav-label { display: inline; }
@media (min-width: 768px) and (max-width: 1279px) {
  .st-nav-label { display: none; }
  .st-nav-link  { padding-left: 0.5rem; padding-right: 0.5rem; }
  /* v13.8.1: Help is the exception. The rest of the nav collapses to
     icon-only at intermediate desktop widths to fit 7-8 items on one
     row, but Help should stay legible — users go looking for it by
     name, not by icon recognition. The lang switcher already keeps
     its "EN" code at this width via a different class (.st-lang-code),
     so this brings Help into line with that behaviour. */
  .st-nav-link[href$="/help/"] .st-nav-label { display: inline; }
}

/* ─── Nav layout (desktop default + mobile drawer) ───────────────────── */
/*
 * IMPORTANT: This rule must NOT rely on Tailwind utilities on the <nav>
 * element. We previously had `class="st-nav flex items-center gap-1 flex-wrap"`
 * and that caused a serious bug — Tailwind's .flex utility outranks
 * `@media (max-width: 767px) .st-nav { display: none }` on specificity, so
 * the mobile drawer never closed and sat on top of the page intercepting
 * all taps. Now layout lives entirely in this .st-nav rule.
 *
 * Default (≥768px): hamburger hidden, nav flows inline.
 * < 768px:           hamburger visible, nav becomes a slide-down drawer.
 *
 * (We considered the CSS-only :target trick but it breaks back/forward
 * navigation; instead a tiny aria-expanded toggle script lives at the
 * bottom of view.php.)
 */
.st-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: nowrap;       /* v13.4.1: was 'wrap' — caused Help to drop to row 2 */
  min-width: 0;            /* allow flex shrinking when space tight */
}
/* Each link refuses to shrink so labels don't truncate weirdly. If the
   nav truly has more items than fit, the topbar will scroll horizontally
   rather than break the user-menu/hamburger out of position. */
.st-nav > * { flex-shrink: 0; }

/* ─── Topbar layout (v13.4 / v13.7.2) ────────────────────────────────
 * The topbar is brand | nav | user-menu | hamburger. Nav stretches to
 * push user-menu and hamburger toward the right edge. On desktop the
 * user dropdown is always top-right regardless of nav-link count. On
 * mobile, nav becomes a drawer (hidden until tapped); user-menu and
 * hamburger remain in the topbar.
 *
 * v13.7.2 fix: dropped overflow-x:auto from the nav. With v13.6.1's
 * label-collapse at 768-1023px (and now 768-1279px), the nav fits
 * comfortably on any desktop width. The overflow-x rule was clipping
 * absolutely-positioned dropdowns (lang switcher menu) which made them
 * appear broken. Without overflow-x, dropdowns extend below the nav as
 * intended.
 */
.st-topbar { flex-wrap: nowrap; }
.st-topbar > .st-nav {
  flex: 1 1 auto;
  min-width: 0;
}
.st-topbar > .st-user-menu-topbar { flex: 0 0 auto; }
.st-topbar > .st-nav-toggle      { flex: 0 0 auto; }

.st-nav-toggle {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  border: 1px solid var(--st-border);
  border-radius: 10px;
  background: var(--st-bg);
  color: var(--st-text);
  cursor: pointer;
  padding: 0;
  /* Hit target ≥ 44px for iOS guidelines */
}
.st-nav-toggle:hover { background: var(--st-bg-soft); }
.st-nav-toggle svg { width: 22px; height: 22px; }

@media (max-width: 767px) {
  .st-header { position: relative; }
  .st-header > div {
    /* Brand on left, user-menu + hamburger on right; nav becomes a drawer */
    flex-wrap: nowrap;
  }
  .st-nav-toggle { display: inline-flex; }

  /* On narrow phones, hide the user's display name to save space — only
     the user icon + caret stay. Tapping still opens the dropdown. */
  .st-topbar > .st-user-menu-topbar .st-user-name { display: none; }

  /* Drawer: hidden by default; reveals when JS sets data-open="true". */
  .st-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
    background: var(--st-bg);
    border-bottom: 1px solid var(--st-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    padding: 0.5rem 1rem 1rem;
    z-index: 50;
  }
  .st-nav[data-open="true"] { display: flex; }

  /* Each nav link is a full-width row with comfortable tap target */
  .st-nav .st-nav-link {
    width: 100%;
    padding: 0.75rem 0.875rem;
    border-radius: 8px;
    font-size: 1rem;
    justify-content: flex-start;
  }
  /* Reveal labels in the drawer — covers both the legacy `span.hidden`
     pattern and v13.6.1's `.st-nav-label` (which is hidden at 768-1023px
     desktop widths but should always be visible in the mobile drawer). */
  .st-nav .st-nav-link span.hidden { display: inline !important; }
  .st-nav .st-nav-link .st-nav-label { display: inline !important; }

  /* Hide the dot separator in the drawer */
  .st-nav > .st-muted { display: none; }
  .st-nav > form { width: 100%; }
  .st-nav > form .st-btn { width: 100%; justify-content: flex-start; }
  /* Note: in v13.3 the user-menu lived inside .st-nav and required
     in-drawer styling here. In v13.4 it moved to the topbar permanently,
     so those rules were removed. */
}


/* ── Language switcher ────────────────────────────────────────── */
.st-lang { position: relative; display: inline-block; }
.st-lang-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  background: white;
  border: 1px solid var(--st-border);
  border-radius: 999px;
  font-size: 0.8125rem; font-weight: 500;
  color: var(--st-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  line-height: 1;
}
.st-lang-btn:hover {
  border-color: var(--st-border-strong);
  background: var(--st-bg-soft);
}
.st-lang-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--st-primary-soft);
  border-color: var(--st-primary);
}
.st-lang-flag { font-size: 1.05rem; line-height: 1; display: inline-block; }
.st-lang-code { letter-spacing: 0.04em; }
.st-lang-caret { color: var(--st-soft); transition: transform 0.15s; flex-shrink: 0; }
.st-lang-btn[aria-expanded="true"] .st-lang-caret { transform: rotate(180deg); }

.st-lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 180px;
  background: white;
  border: 1px solid var(--st-border);
  border-radius: 12px;
  box-shadow: 0 8px 28px -6px rgba(15, 23, 42, 0.15),
              0 2px 6px rgba(15, 23, 42, 0.05);
  padding: 0.3rem;
  display: none;
  z-index: 50;
}
.st-lang-menu-open { display: block; animation: stLangFade 0.12s ease-out; }
@keyframes stLangFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.st-lang-item-form { margin: 0; }
.st-lang-item {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; padding: 0.5rem 0.7rem;
  background: transparent; border: 0;
  border-radius: 8px;
  font-size: 0.875rem; color: var(--st-text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.1s;
}
.st-lang-item:hover { background: var(--st-bg-soft); }
.st-lang-item-active { background: var(--st-primary-soft); color: var(--st-primary); font-weight: 500; }
.st-lang-item-active:hover { background: var(--st-primary-soft); }
.st-lang-name { flex: 1; }
.st-lang-code-muted { font-size: 0.75rem; color: var(--st-soft); letter-spacing: 0.04em; }
.st-lang-item-active .st-lang-code-muted { color: var(--st-primary); opacity: 0.7; }
.st-lang-check { color: var(--st-primary); font-weight: 600; margin-left: 0.2rem; }

/* ── User account dropdown ────────────────────────────────────── */
/*
 * Display-name + chevron in the nav, opens a popover with Profile +
 * Logout. Visually mirrors .st-lang so the two dropdowns feel like
 * siblings.
 *
 * Mobile (<768px): when the dropdown sits inside the slide-down
 * drawer, the popover collapses to a flat list (no nested overlays
 * in cramped space). See the @media block at the bottom of this file.
 */
.st-user-menu { position: relative; display: inline-block; }
.st-user-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  background: white;
  border: 1px solid var(--st-border);
  border-radius: 999px;
  font-size: 0.8125rem; font-weight: 500;
  color: var(--st-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  line-height: 1;
}
.st-user-btn:hover {
  border-color: var(--st-border-strong);
  background: var(--st-bg-soft);
}
.st-user-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--st-primary-soft);
  border-color: var(--st-primary);
}
.st-user-btn .st-nav-icon { width: 16px; height: 16px; }
.st-user-name {
  max-width: 12rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.st-user-caret { color: var(--st-soft); transition: transform 0.15s; flex-shrink: 0; }
.st-user-btn[aria-expanded="true"] .st-user-caret { transform: rotate(180deg); }

.st-user-menu-list {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px;
  background: white;
  border: 1px solid var(--st-border);
  border-radius: 12px;
  box-shadow: 0 8px 28px -6px rgba(15, 23, 42, 0.15),
              0 2px 6px rgba(15, 23, 42, 0.05);
  padding: 0.3rem;
  display: none;
  z-index: 50;
}
.st-user-menu-open { display: block; animation: stLangFade 0.12s ease-out; }
.st-user-item-form { margin: 0; }
.st-user-item {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; padding: 0.55rem 0.7rem;
  background: transparent; border: 0;
  border-radius: 8px;
  font-size: 0.875rem; color: var(--st-text);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.1s;
}
.st-user-item:hover { background: var(--st-bg-soft); }
.st-user-item .st-nav-icon { width: 16px; height: 16px; color: var(--st-soft); }


/* ════════════════════════════════════════════════════════════════════
 * v13.9.0 — sidebar shell layout for authenticated users
 *
 * Desktop (≥768px): two-column grid — fixed-width sidebar on the left,
 *                   flexible content on the right.
 * Mobile  (<768px): no sidebar; content takes full width with a fixed
 *                   top header (brand + hamburger) + a fixed bottom
 *                   tab bar.
 *
 * The shell is opt-in: only authenticated layouts render <body class="st-has-shell">
 * and wrap content in <div class="st-app-shell">. Logged-out pages
 * keep using the original .st-header / .st-topbar markup unchanged.
 * ════════════════════════════════════════════════════════════════════ */

body.st-has-shell {
  background: var(--st-bg-soft);
}

.st-app-shell {
  display: grid;
  grid-template-columns: var(--st-sidebar-w) 1fr;
  min-height: 100vh;
  position: relative;
}
.st-app-shell.is-collapsed {
  grid-template-columns: var(--st-sidebar-w-collapsed) 1fr;
}

/* ─── Sidebar (desktop) ────────────────────────────────────────── */
.st-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  /* v13.10.8: align-self: start so the sidebar doesn't stretch to
     match the (potentially much taller) main-content row in the
     CSS grid. Without this, the grid cell stretches the sidebar to
     full row height and `position: sticky` has no room to operate —
     the sidebar effectively scrolls with the page. With align-self,
     the sidebar stays at its declared 100vh and sticky pins it to
     the top of the viewport as the user scrolls. */
  align-self: start;
  background: var(--st-bg-sidebar);
  border-right: 1px solid var(--st-border-soft);
  z-index: 20;
}
.st-sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--st-space-4) var(--st-space-3);
  gap: var(--st-space-1);
  /* v13.10.3: removed `overflow-y: auto` so dropdowns rendered from the
     footer (user menu, language switcher) can extend out beyond the
     sidebar's bounds. Scrolling moved down to .st-sidebar-nav so the
     middle nav links still scroll if the list is too long, while brand
     and footer stay anchored. */
  overflow: visible;
}
.st-sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--st-space-2);
  padding: var(--st-space-2) var(--st-space-3);
  font-weight: var(--st-weight-semi);
  font-size: var(--st-text-md);
  color: var(--st-text);
  text-decoration: none;
  margin-bottom: var(--st-space-3);
}
.st-sidebar-brand .st-brand-mark {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--st-radius-sm);
  background: var(--st-primary-soft);
  color: var(--st-primary);
  flex-shrink: 0;
}
.st-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  /* v13.10.3: scroll the nav portion only, so the brand (top) and
     footer (bottom, with user menu + lang switcher) stay anchored
     and dropdowns rendered from the footer aren't clipped by an
     overflow container. */
  overflow-y: auto;
}
.st-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--st-space-3);
  padding-top: var(--st-space-3);
  border-top: 1px solid var(--st-border-soft);
}

/* Sidebar links (also reused inside the mobile drawer) */
.st-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
  padding: var(--st-space-2) var(--st-space-3);
  border-radius: var(--st-radius-sm);
  color: var(--st-text);
  font-size: var(--st-text-base);
  text-decoration: none;
  transition: background var(--st-duration-fast) var(--st-ease),
              color var(--st-duration-fast) var(--st-ease);
  position: relative;
}
.st-sidebar-link:hover {
  background: rgba(17, 24, 39, 0.04);
}
.st-sidebar-link.is-active {
  background: var(--st-primary-soft);
  color: var(--st-primary);
  font-weight: var(--st-weight-medium);
}
.st-sidebar-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: currentColor;
}
.st-sidebar-label {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.st-sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--st-radius-pill);
  background: var(--st-primary);
  color: white;
  font-size: var(--st-text-xs);
  font-weight: var(--st-weight-semi);
  flex-shrink: 0;
}

/* Sidebar collapse toggle — small chevron sitting on the right edge */
.st-sidebar-collapse {
  position: absolute;
  top: 24px;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--st-border);
  background: var(--st-bg);
  color: var(--st-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--st-shadow-sm);
  transition: transform var(--st-duration-fast) var(--st-ease);
  z-index: 21;
}
.st-sidebar-collapse:hover {
  background: var(--st-primary-soft);
  color: var(--st-primary);
}
.st-app-shell.is-collapsed .st-sidebar-collapse svg {
  transform: rotate(180deg);
}

/* When collapsed, hide labels — keep icons + center them */
.st-app-shell.is-collapsed .st-sidebar-label,
.st-app-shell.is-collapsed .st-sidebar-brand-text,
.st-app-shell.is-collapsed .st-user-name,
.st-app-shell.is-collapsed .st-user-caret {
  display: none;
}
.st-app-shell.is-collapsed .st-sidebar-link,
.st-app-shell.is-collapsed .st-sidebar-brand,
.st-app-shell.is-collapsed .st-user-btn {
  justify-content: center;
}
.st-app-shell.is-collapsed .st-sidebar-badge {
  position: absolute;
  top: 4px;
  right: 4px;
}

/* User menu inside the sidebar — opens UPWARD because it's at the bottom */
.st-user-menu-sidebar {
  position: relative;
}
.st-user-btn-sidebar {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
  padding: var(--st-space-2) var(--st-space-3);
  border-radius: var(--st-radius-sm);
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--st-text);
  font: inherit;
  font-size: var(--st-text-base);
  cursor: pointer;
  text-align: left;
  transition: background var(--st-duration-fast) var(--st-ease);
}
.st-user-btn-sidebar:hover {
  background: rgba(17, 24, 39, 0.04);
}
.st-user-menu-sidebar .st-user-menu-list {
  position: absolute;
  /* v13.10.4: explicitly reset `top` here — the default
     .st-user-menu-list rule (used in the topbar variant) sets
     `top: calc(100% + 6px)` to open DOWNWARD. Without `top: auto`,
     both top and bottom would apply and the top constraint would
     win, making the sidebar dropdown render BELOW the button (off
     the bottom of the sidebar) instead of above. */
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  background: var(--st-bg);
  border: 1px solid var(--st-border-soft);
  border-radius: var(--st-radius);
  box-shadow: var(--st-shadow-popover);
  z-index: 25;
  overflow: hidden;
}
.st-user-menu-sidebar .st-user-menu-list.st-user-menu-open {
  display: block;
}

/* Content area */
.st-content {
  padding: var(--st-space-8);
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.st-content-footer {
  padding: var(--st-space-6) var(--st-space-8);
  margin-top: var(--st-space-12);
  max-width: 1280px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Mobile (<768px) — bottom tab bar + top header + drawer ──── */
.st-mobile-topbar { display: none; }
.st-mobile-tabs { display: none; }
.st-mobile-drawer { display: none; }

@media (max-width: 767px) {
  /* Hide the desktop sidebar */
  .st-sidebar { display: none; }

  /* Single-column shell, content gets the full width */
  .st-app-shell {
    grid-template-columns: 1fr;
  }

  /* Top header — brand + hamburger */
  .st-mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--st-topbar-h);
    padding: 0 var(--st-space-4);
    background: var(--st-bg);
    border-bottom: 1px solid var(--st-border-soft);
    position: sticky;
    top: 0;
    z-index: 15;
  }
  .st-mobile-topbar .st-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--st-space-2);
    font-weight: var(--st-weight-semi);
    font-size: var(--st-text-md);
    color: var(--st-text);
    text-decoration: none;
  }
  .st-mobile-topbar .st-brand-mark {
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--st-radius-sm);
    background: var(--st-primary-soft);
    color: var(--st-primary);
  }
  .st-mobile-topbar .st-nav-toggle {
    background: transparent;
    border: 0;
    padding: var(--st-space-2);
    color: var(--st-text);
    cursor: pointer;
    border-radius: var(--st-radius-sm);
  }
  .st-mobile-topbar .st-nav-toggle:hover {
    background: rgba(17, 24, 39, 0.04);
  }

  /* Bottom tab bar — primary nav at thumb-zone */
  .st-mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--st-mobile-tab-h);
    background: var(--st-bg);
    border-top: 1px solid var(--st-border-soft);
    z-index: 15;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .st-mobile-tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    color: var(--st-text-muted);
    text-decoration: none;
    font-size: 10px;
    position: relative;
    transition: color var(--st-duration-fast) var(--st-ease);
  }
  .st-mobile-tab.is-active {
    color: var(--st-primary);
  }
  .st-mobile-tab-icon {
    width: 22px; height: 22px;
  }
  .st-mobile-tab-label {
    font-size: 10px;
    font-weight: var(--st-weight-medium);
    line-height: 1;
    white-space: nowrap;
  }
  .st-mobile-tab-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 16px);
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: var(--st-radius-pill);
    background: var(--st-danger);
    color: white;
    font-size: 9px;
    font-weight: var(--st-weight-semi);
    line-height: 14px;
    text-align: center;
  }

  /* Hamburger drawer — slides in from the right, holds secondary nav */
  .st-mobile-drawer {
    display: none;
    position: fixed;
    top: var(--st-topbar-h);
    right: 0;
    width: min(280px, 80vw);
    bottom: var(--st-mobile-tab-h);
    background: var(--st-bg);
    border-left: 1px solid var(--st-border-soft);
    box-shadow: var(--st-shadow-popover);
    padding: var(--st-space-4) var(--st-space-3);
    z-index: 14;
    overflow-y: auto;
    flex-direction: column;
    gap: 2px;
  }
  .st-mobile-drawer[data-open="true"] {
    display: flex;
    animation: stDrawerSlide 180ms var(--st-ease);
  }
  @keyframes stDrawerSlide {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
  }
  .st-mobile-drawer-footer {
    margin-top: auto;
    padding-top: var(--st-space-3);
    border-top: 1px solid var(--st-border-soft);
    display: flex;
    align-items: center;
    gap: var(--st-space-2);
  }

  /* Content gets bottom padding so the tab bar doesn't cover it */
  .st-content {
    padding: var(--st-space-4);
    padding-bottom: calc(var(--st-mobile-tab-h) + var(--st-space-6) + env(safe-area-inset-bottom, 0));
  }
  .st-content-footer {
    padding: var(--st-space-4);
    padding-bottom: calc(var(--st-mobile-tab-h) + var(--st-space-4) + env(safe-area-inset-bottom, 0));
  }
}
