/* The shell and its one nav: a bottom tab bar on phones (Mail · Automation · More), a left sidebar from 900 px with
   the app name, Write, the same three tabs and the sync line. */
.shell { min-height: 100vh; min-height: 100dvh; }
.content { min-width: 0; padding: 12px 16px 32px; }
/* Signed in, the phone tab bar is fixed at the bottom: keep the last row of every page clear of it. */
.shell:has(> .app-nav) .content { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

.app-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: stretch; justify-content: space-around;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.nav-brand, .nav-write, .nav-sync { display: none; }
.nav-tab {
  position: relative; flex: 1;
  display: grid; justify-items: center; align-content: center; gap: 3px;
  min-height: 48px;
  font: 500 12px var(--sans); color: var(--muted); text-decoration: none;
}
.nav-tab:hover { color: var(--text); }
.nav-tab[aria-current="page"] { color: var(--primary); }
.nav-label { display: grid; justify-items: center; gap: 3px; }
/* Phone: the count sits on the icon's shoulder. */
.nav-count {
  position: absolute; top: 6px; left: calc(50% + 6px);
  display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--primary); color: var(--on-primary);
  font: 600 11px/1 var(--sans); font-variant-numeric: tabular-nums;
}

@media (min-width: 900px) {
  .shell:has(> .app-nav) { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
  .content { padding: 24px 28px 40px; }
  .shell:has(> .app-nav) .content { padding-bottom: 40px; }
  .app-nav {
    position: sticky; top: 0; bottom: auto;
    flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 4px;
    height: 100vh; height: 100dvh;
    padding: 18px 12px;
    background: var(--side);
    border-top: 0; border-right: 1px solid var(--line);
  }
  .nav-brand { display: flex; gap: 8px; align-items: center; padding: 4px 10px 16px; font: 700 17px var(--sans); color: var(--text); text-decoration: none; }
  .nav-logo { width: 26px; height: 26px; border-radius: 8px; background: var(--primary); }
  .nav-write { display: inline-flex; margin: 0 0 14px; }
  .nav-tab {
    flex: none; display: flex; justify-content: space-between; align-items: center; gap: 10px;
    min-height: 40px; padding: 9px 10px; border-radius: var(--radius);
    font: 500 15px var(--sans); color: var(--text);
  }
  .nav-tab:hover { background: var(--weak); }
  .nav-tab[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
  .nav-label { display: flex; gap: 10px; align-items: center; }
  .nav-count { position: static; min-width: 0; height: auto; padding: 0; background: none; color: var(--muted); font: 500 13px var(--sans); }
  .nav-tab[aria-current="page"] .nav-count { color: var(--primary); }
  .nav-sync { display: block; margin-top: auto; padding: 10px; font-size: 13px; color: var(--muted); }
}
