/* ============================================================
   App 壳层布局 — 顶栏 + 侧边栏 + 主内容
   ============================================================ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ============================================================
   顶栏
   ============================================================ */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
  z-index: var(--z-sticky);
}

.topbar .logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 16px;
  color: var(--brand-600);
  letter-spacing: 0.5px;
  cursor: pointer;
}

.topbar .logo-mark {
  width: 24px; height: 24px;
  background: var(--brand-500);
  color: var(--text-inverse);
  border-radius: 4px;
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
}

.topbar-search {
  flex: 1;
  max-width: 380px;
  margin-left: 20px;
  position: relative;
}
.topbar-search .input {
  padding-left: 30px;
  background: var(--bg-page);
  border-color: transparent;
  height: 32px;
}
.topbar-search .input:focus {
  background: var(--bg-elevated);
  border-color: var(--border-default);
}
.topbar-search .icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  display: flex; align-items: center;
}

.topbar-actions {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
}
.topbar-icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  position: relative;
}
.topbar-icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.topbar-icon-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px;
  background: var(--danger-fg);
  border-radius: 50%;
}
.topbar-vdivider {
  width: 1px; height: 22px;
  background: var(--border-subtle);
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.topbar-user:hover { background: var(--bg-hover); }
.topbar-user .name {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-subtle);
  padding: 16px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-section-title {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 12px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--fs-md);
  cursor: pointer;
  margin-bottom: 1px;
  position: relative;
  text-decoration: none;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--brand-50);
  color: var(--brand-600);
  font-weight: 500;
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--brand-500); border-radius: 0 2px 2px 0;
}
.nav-item .nav-label { flex: 1; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--bg-muted);
  color: var(--text-tertiary);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-badge {
  background: var(--brand-100);
  color: var(--brand-600);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  font-size: 11px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-subtle);
}
.sidebar-footer div + div { margin-top: 2px; }

/* ============================================================
   主内容区
   ============================================================ */
.main {
  overflow-y: auto;
  background: var(--bg-page);
}

.page-header {
  padding: 20px 28px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-page);
  position: sticky;
  top: 0;
  z-index: 5;
}

.page-title {
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
  font-family: var(--font-serif);
  letter-spacing: 0.3px;
}
.page-subtitle {
  font-size: var(--fs-md);
  color: var(--text-tertiary);
  margin: 0;
}
.page-header-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page-content {
  padding: 24px 28px 40px;
}

/* 面包屑 */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.breadcrumb a {
  color: var(--text-tertiary);
  cursor: pointer;
}
.breadcrumb a:hover { color: var(--brand-500); }
.breadcrumb .sep { color: var(--text-disabled); }

/* 响应式（小屏隐藏侧边栏 - 当前不打算做移动适配，但留个底） */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .topbar-search { display: none; }
  .topbar .logo span { display: none; }
}
