/* =============================================================
   Shell · 应用骨架：侧栏 / 顶栏 / 内容区 / 页面头
   ============================================================= */

/* 背景 shader canvas */
#bg-canvas {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  opacity: 0.5; pointer-events: none;
}

.app-shell {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ---------------- 顶部横向导航 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: 0 var(--content-pad-x);
  background: rgba(252, 253, 255, 0.85);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 6px 22px rgba(31,35,41,0.04);
}
.top-left { display: flex; align-items: center; gap: 26px; min-width: 0; }
.top-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 6px 16px rgba(var(--brand-rgb), 0.34), inset 0 1px 0 rgba(255,255,255,0.25);
}
.brand-mark .msym { font-size: 24px; }
.brand-text h1 { font-size: 18px; line-height: 22px; font-weight: var(--fw-bold); color: var(--text-strong); letter-spacing: -0.01em; }
.brand-text span { font-size: var(--fs-xs); color: var(--text-faint); font-weight: var(--fw-medium); }

.top-nav {
  display: flex; align-items: center; gap: 4px;
  height: 44px; padding: 4px;
  border: 1px solid var(--border-strong); border-radius: var(--r-full);
  background: var(--gray-50);
}
.top-nav-item {
  height: 36px; padding: 0 16px; border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-muted);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.top-nav-item .msym { font-size: 19px; color: var(--text-faint); transition: color var(--t-fast); }
.top-nav-item:hover { color: var(--text); }
.top-nav-item:hover .msym { color: var(--text-muted); }
.top-nav-item.active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-xs); }
.top-nav-item.active .msym { color: var(--brand-600); }

.top-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); min-width: 0; }
.global-search {
  display: flex; align-items: center; gap: var(--sp-2);
  width: 340px; max-width: 32vw;
  height: 40px; padding: 0 14px;
  background: var(--gray-50); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  color: var(--text-faint); transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.global-search:focus-within { background: var(--surface); border-color: var(--brand-500); box-shadow: var(--ring-brand); }
.global-search .msym { font-size: 19px; }
.global-search input { flex: 1; border: none; outline: none; background: none; font-size: var(--fs-sm); color: var(--text-strong); }

.top-right .icon-btn { position: relative; }
.top-right .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--danger-500); border: 1.5px solid var(--surface);
}
.top-account {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 3px 12px 3px 4px; border-radius: var(--r-full);
  transition: background var(--t-fast);
}
.top-account:hover { background: var(--gray-75); }
.top-account .account-meta strong { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-strong); max-width: 96px; }

.content {
  flex: 1;
  padding: var(--sp-6) var(--content-pad-x) var(--sp-9);
  width: 100%;
}
.content-inner { max-width: var(--content-max); margin: 0 auto; width: 100%; }

/* ---------------- 页面头 ---------------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.page-head .page-titles { min-width: 0; }
.page-head .eyebrow {
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--brand-600); margin-bottom: 6px;
}
.page-head h1 { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: var(--fw-bold); letter-spacing: -0.02em; }
.page-head .page-sub { font-size: var(--fs-base); color: var(--text-muted); margin-top: 6px; }
.page-head .page-actions { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }

/* 统计条 */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-4); display: flex; align-items: center; gap: var(--sp-3);
  box-shadow: var(--shadow-xs); transition: box-shadow var(--t-base), transform var(--t-base);
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-icon {
  width: 42px; height: 42px; border-radius: var(--r-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-50); color: var(--brand-600);
}
.stat-icon.green { background: var(--success-50); color: var(--success-600); }
.stat-icon.orange { background: var(--warning-50); color: var(--warning-600); }
.stat-icon.violet { background: #f3edff; color: #6d28d9; }
.stat-meta .stat-value { font-size: 22px; font-weight: var(--fw-bold); color: var(--text-strong); line-height: 1.1; }
.stat-meta .stat-label { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  :root { --content-pad-x: 22px; }
  .brand-text { display: none; }
  .global-search { width: 240px; }
}
@media (max-width: 900px) {
  .top-nav-item span { display: none; }
  .top-nav-item { min-width: 44px; padding: 0 12px; }
  .global-search input { display: none; }
  .global-search { width: 40px; padding: 0; justify-content: center; }
  .top-account .account-meta { display: none; }
}
@media (max-width: 640px) {
  .topbar { gap: var(--sp-2); }
  .page-head { flex-direction: column; align-items: flex-start; }
}
