.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 22px;
}
.brand { font-family: var(--font-sans); font-weight: 600; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand .dot { color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 7px 12px; border-radius: var(--r-sm); color: var(--ink-soft);
  font-size: 0.92rem; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.topbar .who { color: var(--muted); font-size: 0.88rem;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hamburger + in-menu sign-out: hidden on desktop, shown in the mobile query. */
.nav-toggle { display: none; flex: none; width: 38px; height: 38px; cursor: pointer;
  align-items: center; justify-content: center; font-size: 1.15rem; line-height: 1;
  color: var(--ink-soft); background: none; border: 1px solid var(--line); border-radius: var(--r-sm); }
.nav-signout { display: none; }

.main { max-width: var(--maxw); margin: 0 auto; padding: 26px 20px 60px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 70% -10%, var(--accent-soft), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 380px; }

/* ── Mobile navigation: collapse the topbar links into a hamburger menu ── */
@media (max-width: 900px) {
  .topbar-inner { gap: 12px; height: 56px; }
  .brand { flex: 1; font-size: 1.05rem; }
  .nav-toggle { display: inline-flex; }
  .topbar .who, .logout-desktop { display: none; }
  .nav {
    position: absolute; top: 56px; left: 0; right: 0; z-index: 30;
    flex-direction: column; gap: 2px; flex: none; display: none;
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.10);
    padding: 8px 12px; max-height: calc(100dvh - 56px); overflow-y: auto;
  }
  .app-shell.nav-open .nav { display: flex; }
  .nav a { padding: 12px; font-size: 1rem; }
  .nav-signout { display: block; width: 100%; text-align: left; margin-top: 6px; padding: 12px;
    background: none; border: none; border-top: 1px solid var(--line);
    color: var(--ink-soft); font: inherit; font-weight: 500; cursor: pointer; }
  .main { padding: 18px 14px 48px; }
}

@media (max-width: 640px) {
  .page-head { align-items: stretch; }
  .page-head .row { flex-wrap: wrap; }
  h1 { font-size: 1.45rem; }
}
