/* ══════════════════════════════════════════════════════════════════════
   Responsive shell (V3.0 原型 navigation-v3.css 断点)
   ≥1180: 72 + 228 + content
   ≤1180: 68 + 212 compact；搜索收窄；Workspace 副行隐藏
   ≤1024: rail 保留，context 变为左侧抽屉（宽 240px）
   ≤760: 单列；rail 隐藏；顶栏行高 56px；hamburger 打开 context 抽屉
   Drawer classes (.rail-open / .context-open) are set by
   shell/navigation/navigation-state.js.
   ══════════════════════════════════════════════════════════════════════ */

/* ── ≤1180: compact rail + context ── */
@media (max-width: 1180px) {
  :root {
    --rail-w: 68px;
    --context-w: 212px;
  }
  .app-shell-v4 .v4-global-search {
    width: min(310px, 29vw);
  }
  .workspace-meta {
    display: none;
  }
}

/* ── ≤1024: context sidebar becomes a drawer left of the content ── */
@media (max-width: 1024px) {
  .app-shell-v4,
  .app-shell-v4.context-collapsed {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    grid-template-areas:
      "rail topbar"
      "rail main";
  }
  .context-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--rail-w);
    width: 240px;
    z-index: 120;
    transform: translateX(-110%);
    transition: transform 0.22s ease;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.28);
  }
  .app-shell-v4.context-open .context-sidebar {
    transform: translateX(0);
  }
  /* 折叠态在抽屉模式下复位（桌面折叠偏好不得锁死抽屉） */
  .app-shell-v4.context-collapsed .context-sidebar {
    width: 240px;
    padding: 18px 14px;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
  .context-collapse {
    display: none;
  }
}

/* ── ≤760: single column; rail hidden; hamburger opens context drawer ── */
@media (max-width: 760px) {
  :root {
    --topbar-h: 56px;
  }
  .app-shell-v4,
  .app-shell-v4.context-collapsed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--topbar-h) minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "main";
  }
  .primary-rail {
    display: none;
  }
  .context-sidebar {
    left: 0;
    width: min(86vw, 300px);
    transform: translateX(-105%);
  }
  .app-shell-v4.context-collapsed .context-sidebar {
    width: min(86vw, 300px);
  }
  .v4-mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .app-shell-v4 .v4-global-search {
    display: none;
  }
  .app-shell-v4 .v4-workspace-switch {
    display: none;
  }
  .compute-pill {
    display: none;
  }
  .app-shell-v4 .v4-topbar {
    padding-inline: 10px;
  }
  .app-shell-v4 .v4-topbar-right {
    margin-left: auto;
  }
  .app-shell-v4 .v4-breadcrumb-item:not(:last-child) {
    display: none;
  }
  .page-local-tabs {
    width: 100%;
    margin-top: 0;
  }
}

/* ── ≤640: compact topbar controls ── */
@media (max-width: 640px) {
  .app-shell-v4 .v4-topbar {
    gap: 8px;
    padding-inline: 12px;
  }
  .app-shell-v4 .v4-topbar-right {
    gap: 6px;
  }
  .top-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .user-avatar {
    width: 34px;
    height: 34px;
  }
  .user-name {
    display: none;
  }
  .app-shell-v4 .v4-main {
    padding: 16px 12px 40px;
  }
  .app-shell-v4 .v4-page-header {
    display: block;
    margin-bottom: 18px;
  }
  .app-shell-v4 .v4-page-title {
    font-size: 25px;
  }
  .app-shell-v4 .v4-page-desc {
    font-size: 14px;
  }
}
