#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  background: var(--bg-app);
}

.app-top-bar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--top-bar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + var(--safe-area-bottom) + 16px);
}

/* Bottom nav (mobile) */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  padding-bottom: var(--safe-area-bottom);
}

.screen {
  padding: var(--space-md);
  animation: screenFadeIn 300ms ease;
  min-height: calc(100vh - var(--top-bar-height) - var(--nav-height));
  min-height: calc(100dvh - var(--top-bar-height) - var(--nav-height));
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

.screen--no-nav {
  min-height: calc(100vh - var(--top-bar-height));
  min-height: calc(100dvh - var(--top-bar-height));
  padding-bottom: var(--space-md);
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

.screen--full {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  max-width: none;
}

.screen-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══ Tablet (640px+) ═══ */
@media (min-width: 640px) {
  .screen {
    padding: var(--space-lg);
  }
}

/* ═══ Desktop (1024px+) — Sidebar layout ═══ */
@media (min-width: 1024px) {
  #app {
    flex-direction: row;
    min-height: 100vh;
  }

  /* Sidebar nav */
  .app-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    width: var(--sidebar-width);
    border-top: none;
    border-right: 1px solid var(--border-light);
    padding-bottom: 0;
    z-index: var(--z-nav);
    background: var(--bg-card);
  }

  /* Main content area pushed right */
  .app-top-bar {
    margin-left: var(--sidebar-width);
  }

  .app-content {
    margin-left: var(--sidebar-width);
    padding-bottom: var(--space-xl);
  }

  .screen {
    padding: var(--space-xl);
    min-height: calc(100vh - var(--top-bar-height));
    min-height: calc(100dvh - var(--top-bar-height));
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
  }
}
