/* ==========================================================================
   Finance app shell: top bar chrome, navigation, view frame, auth screen.
   Generic components live in /shared/base.css — only shell-specific rules here.
   Sizes come from the --fs-* scale in tokens.css, never a literal px.
   ========================================================================== */

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

/* ------------------------------------------------------------- top bar ---- */
.topbar .brand { margin-right: auto; }
.seasonpick { display: flex; align-items: center; gap: 8px; }
/* No min-width: that pinned the box at 176px regardless of the season name,
   so a shorter name (or one padded with "(active)") left the native arrow
   stranded in a wide empty gap. width:auto lets the box hug whatever text is
   actually selected, same as every other native select in the app. */
.seasonpick select { width: auto; padding: 7px 10px; font-size: var(--fs-sm); }
.seasonpick label { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

/* user menu ---------------------------------------------------------------- */
.usermenu { position: relative; }
.usermenu > .btn { gap: 8px; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink);
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 214px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); padding: 6px; display: grid; gap: 2px;
}
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--rule-soft); margin-bottom: 4px; }
.menu .who b { display: block; font-size: var(--fs-sm); }
.menu .who span { display: block; font-size: var(--fs-xs); color: var(--ink-3); }
/* Only the email is long enough to ever need a mid-word break; the role
   ("admin") never should, so it gets its own line with normal wrapping. */
.menu .who .who-email { word-break: break-all; }
.menu .who .who-role { text-transform: capitalize; margin-top: 1px; }
.menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--ink); cursor: pointer;
  padding: 8px 11px; border-radius: 5px; font-size: var(--fs-sm); font-weight: 500;
}
.menu button:hover { background: var(--surface-2); }
.menu button .tag { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-3); }

/* ---------------------------------------------------------- app layout ---- */
.applayout { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 20px 64px; gap: 24px; }
/* The top bar grew a little with the larger type, so the sticky offset follows it. */
.sidebar { position: sticky; top: 66px; padding-top: 20px; align-self: start; }
.content { padding-top: 20px; }

.nav { display: grid; gap: 2px; }
.nav .divider { height: 1px; background: var(--rule-soft); margin: 8px 4px; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: 6px; text-decoration: none;
  color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav a .badge { margin-left: auto; }

/* Below 900px the sidebar becomes a horizontally scrolling tab strip. */
@media (max-width: 899px) {
  .applayout { padding-inline: 0; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; padding: 0;
    background: var(--surface); border-bottom: 1px solid var(--rule);
  }
  .nav {
    display: flex; gap: 4px; overflow-x: auto; padding: 8px 14px;
    scrollbar-width: thin; -webkit-overflow-scrolling: touch;
  }
  .nav .divider { width: 1px; height: auto; margin: 4px 4px; flex: none; }
  .nav a { padding: 7px 13px; border-radius: 100px; border: 1px solid var(--rule-soft); }
  .nav a[aria-current="page"] { border-color: transparent; }
  .content { padding-inline: 20px; }
}

/* --------------------------------------------------------- view frame ---- */
.pagehead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead .titles { margin-right: auto; min-width: 0; }
.pagehead h1 { font-size: var(--fs-xl); }
.pagehead .lede { margin-top: 4px; font-size: var(--fs-base); }

.viewbanner { margin-bottom: 14px; }
.viewerror { padding: 30px 20px; text-align: center; }
.viewerror h3 { margin-bottom: 6px; }
.viewerror p { color: var(--ink-3); max-width: 52ch; margin: 0 auto 14px; }
.viewskeleton { display: grid; gap: 12px; }

/* ------------------------------------------------------------- boot/auth --- */
.bootscreen {
  min-height: 60vh; display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center; color: var(--ink-3);
}
.authwrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
}
.authcard { width: min(430px, 100%); }
.authcard .brand { justify-content: center; margin-bottom: 18px; }
/* The sign-in card uses the round badge, which is square and wants more room. */
.authcard .brand .brandmark { height: 44px; width: auto; }
.authcard .panel-bd { display: grid; gap: 14px; }
.authcard .foot { margin-top: 14px; text-align: center; font-size: var(--fs-xs); color: var(--ink-3); }
.authcard .foot a { font-weight: 600; }
