.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(12, 14, 26, 0.6), rgba(8, 9, 16, 0.4));
  backdrop-filter: blur(8px);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 22px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.brand__sigil {
  width: 38px; height: 38px;
  flex: none;
  color: var(--gold);
  filter: drop-shadow(0 0 10px rgba(201, 169, 106, 0.45));
}
.brand__name {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.brand__sub {
  font-size: var(--fs-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; overflow-y: auto; flex: 1; }
.nav__label {
  font-size: var(--fs-xs);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 18px 12px 8px;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.nav__item:hover { color: var(--text); background: var(--line-soft); }
.nav__item.is-active {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(201, 169, 106, 0.14), transparent);
  box-shadow: inset 2px 0 0 var(--gold);
}
.nav__num {
  width: 26px; height: 26px;
  flex: none;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 0.82rem;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 50%;
}
.nav__item.is-active .nav__num { background: var(--gold); color: var(--void); border-color: var(--gold); }
.nav__dot { margin-left: auto; font-size: var(--fs-xs); color: var(--faint); }

.sidebar__foot {
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.userchip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.userchip__avatar {
  width: 32px; height: 32px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--violet), var(--violet-deep));
  color: #fff; font-weight: 700; font-size: 0.8rem;
}
.userchip__name { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.iconbtn:hover { background: var(--line-soft); color: var(--gold); }

/* ── Main column ────────────────────────────────────────────── */
.main { position: relative; min-width: 0; }
.reading-progress {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: 2px;
  z-index: 40;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--gold), var(--violet));
  box-shadow: 0 0 12px var(--violet-glow);
}

.page { padding: 56px clamp(20px, 5vw, 72px) 96px; max-width: 1180px; margin: 0 auto; }
.page--reader { max-width: 1320px; }

/* ── Mobile ─────────────────────────────────────────────────── */
.menu-toggle { display: none; }

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: min(86vw, var(--sidebar-w));
    transform: translateX(-102%);
    transition: transform 0.4s var(--ease-out);
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .reading-progress { left: 0; }
  .menu-toggle {
    display: grid; place-items: center;
    position: fixed; top: 16px; left: 16px; z-index: 30;
    width: 44px; height: 44px;
    border-radius: var(--r-sm);
    color: var(--gold);
    background: rgba(17, 19, 36, 0.85);
    border: 1px solid var(--line);
    backdrop-filter: blur(8px);
  }
  .page { padding: 72px 20px 80px; }
}
