/* ══════════════════════════════════════════════════════════════════════
   Main Web Shell — double-layer navigation layout (V3.0 原型 navigation-v3.css)
   Rail 72px · Context 228px · Topbar 64px; content max 1600px.
   Breakpoints live in responsive.css; rail/context styling in navigation.css.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --rail-w: 72px;
  --context-w: 228px;
  --topbar-h: 64px;
}

/* 原型 body 为纯 var(--bg)（app.css v2 override），覆盖 styles.css 的渐变底色；
   顶部栏半透明 + blur 需要平底色才与原型一致 */
html {
  background: var(--bg);
}
body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.app-shell-v4 {
  display: grid;
  grid-template-columns: var(--rail-w) var(--context-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas:
    "rail context topbar"
    "rail context main";
  height: 100vh;
  overflow: hidden;
}

/* ── Primary rail (fixed, never scrolls) — V3.0 rail: #0b1713 both themes ──
   z-index 130: 抽屉模式下 rail 始终在 context 抽屉（120）之上（原型 rail 80 > sidebar 70） */
.primary-rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  overflow: hidden;
  background: #0b1713;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  color: #dce8e3;
  z-index: 130;
}

/* ── Context sidebar (current domain's second level, scrolls if long) ── */
.context-sidebar {
  grid-area: context;
  min-width: 0;
  overflow-y: auto;
  background: #13221d;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #dce8e3;
  padding: 18px 14px;
}

/* ── Topbar & main — scoped overrides so they beat v4-shell.css ── */
.app-shell-v4 .v4-topbar {
  grid-area: topbar;
  height: var(--topbar-h);
  gap: 12px;
  padding: 0 18px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.app-shell-v4 .v4-topbar-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.app-shell-v4 .v4-topbar-center {
  flex: none;
  min-width: 0;
}

.app-shell-v4 .v4-main {
  grid-area: main;
  min-height: 0;
  padding: 22px clamp(18px, 2.2vw, 34px) 52px;
  background: var(--bg);
}
.app-shell-v4 .v4-page-container {
  max-width: var(--content);
  margin: 0;
  padding: 0;
}

/* ── Page header — V3.0 原型 page-header 值 ── */
.app-shell-v4 .v4-page-header {
  margin: 2px 0 16px;
  align-items: center;
}
.app-shell-v4 .v4-page-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.app-shell-v4 .v4-page-desc {
  font-size: 13px;
  max-width: 900px;
}

/* ── Page-local tabs slot (between page header and content) ── */
.v4-page-local-tabs { margin: -5px 0 20px; }

/* ── Context sidebar collapsed (persisted via manyi-v3-context-collapsed) ── */
.app-shell-v4.context-collapsed {
  grid-template-columns: var(--rail-w) 0 minmax(0, 1fr);
}
.app-shell-v4.context-collapsed .context-sidebar {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  border-right: 0;
}
