/* ==========================================================================
   Layout — the mobile app shell: header, scrolling page, bottom tab bar.
   Constrained to a phone-width column so it also looks intentional on desktop.
   ========================================================================== */

.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-max);
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--bg);
  background-image: var(--bg-tint);
}

@media (min-width: 560px) {
  .app-shell {
    min-height: 100dvh;
    box-shadow: var(--shadow-lg);
  }
}

/* --- Header -------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) var(--sp-4) 0;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}

.app-header[data-scrolled='true'] { border-bottom-color: var(--border); }

.app-header__title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
  letter-spacing: -0.02em;
}

.app-header__sub { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-medium); }

.app-header__actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-md);
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast);
}
.icon-btn:active { transform: scale(.92); }

/* --- Page ---------------------------------------------------------------- */
.page {
  flex: 1 1 auto;
  padding: var(--sp-4) var(--sp-4) calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-8));
  animation: fade-in var(--dur) var(--ease);
}

.page--flush { padding-inline: 0; }
.page--full  { padding-bottom: calc(var(--safe-bottom) + var(--sp-6)); }

.section { margin-block: var(--sp-6) var(--sp-3); }
.section:first-child { margin-top: var(--sp-2); }

.section__title {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-black);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--sp-3);
}
.section__title .grow { text-align: right; }

/* --- Bottom tab bar ------------------------------------------------------ */
.tabbar {
  position: fixed;
  bottom: 0;
  z-index: var(--z-tabbar);
  width: 100%;
  max-width: var(--app-max);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--border);
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--tabbar-h);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: var(--fw-bold);
  letter-spacing: .02em;
  transition: color var(--dur-fast);
}

.tabbar__icon { font-size: 21px; line-height: 1; transition: transform var(--dur) var(--ease); }

.tabbar__item[aria-current='page'] { color: var(--brand-500); }
.tabbar__item[aria-current='page'] .tabbar__icon { transform: translateY(-2px) scale(1.12); }

/* --- Centered / full-bleed screens (lock, onboarding) -------------------- */
.screen {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + var(--sp-6)) var(--sp-5) calc(var(--safe-bottom) + var(--sp-6));
}
.screen--center { justify-content: center; }
