/* Mobile first: bottom navigation; from 960px: sidebar rail. */
.app-shell { min-height: 100vh; min-height: 100dvh; }

.sidebar { display: none; }

.main-col {
  padding-bottom: calc(var(--bottom-nav-h) + var(--s2) + env(safe-area-inset-bottom));
  min-width: 0;
}

main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s2) var(--s1);
}

.reading { max-width: var(--reading-width); margin: 0 auto; }

.bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--c-text-muted);
  text-decoration: none;
  text-align: center;
}
.bottom-nav a[aria-current="page"] { color: var(--c-teal); font-weight: 650; }
.bottom-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }

@media (min-width: 960px) {
  .bottom-nav { display: none; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    padding: var(--s2) var(--s1);
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    overflow-y: auto;
  }
  .main-col { margin-left: var(--sidebar-width); padding-bottom: var(--s4); }
  main { padding: var(--s4) var(--s3); }
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s0);
  padding: var(--s0);
  color: var(--c-text);
  text-decoration: none;
  font-weight: 650;
  line-height: 1.25;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--c-primary);
  color: var(--c-on-primary);
  font-weight: 700;
  font-size: 0.95rem;
  flex: none;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.side-nav li + li { margin-top: 0; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  text-decoration: none;
  font-weight: 550;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.side-nav a:hover { background: var(--c-surface-2); color: var(--c-text); }
.side-nav a[aria-current="page"] { background: var(--c-lavender); color: var(--c-lavender-text); }

.sidebar-foot {
  margin-top: auto;
  padding: var(--s1);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  background: var(--c-surface-2);
  border-radius: var(--radius);
}

.banner { padding: 10px var(--s1); font-size: var(--fs-sm); text-align: center; }
.banner-warn { background: var(--c-amber-tint); color: var(--c-amber-text); }
