/* ============================================================
   应用骨架：侧边栏 + 顶栏 + 内容区（桌面应用形态）
   ============================================================ */

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

/* ---------- 侧边栏 ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px 12px;
  z-index: 40;
  transition: background-color .35s var(--ease), border-color .35s var(--ease);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 18px;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-active) 100%);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.brand-name { font-size: 15.5px; font-weight: 600; letter-spacing: .5px; }
.brand-sub { font-size: 10.5px; color: var(--faint); letter-spacing: 1.6px; margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.nav-group { margin-bottom: 14px; }
.nav-caption {
  font-size: 11px; color: var(--faint); letter-spacing: 1.2px;
  padding: 0 12px 7px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  width: 100%; height: 40px; padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  transition: background-color .18s, color .18s;
  text-align: left;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item .icon { width: 19px; height: 19px; }
.nav-badge {
  margin-left: auto; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center;
}
.nav-item.active .nav-badge { background: var(--accent); }

/* 侧边栏底部用户卡 */
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; margin-top: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .18s, background-color .18s;
}
.side-user:hover { border-color: var(--border-strong); background: var(--surface-3); }
.side-user .su-meta { flex: 1; min-width: 0; }
.side-user .su-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 5px;
}
.side-user .su-sub { font-size: 11px; color: var(--faint); display: flex; align-items: center; gap: 4px; }
.side-user .su-actions { display: flex; gap: 2px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted);
  transition: background-color .16s, color .16s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ---------- 主区域 ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 30;
}
.tb-title { min-width: 110px; }
.tb-title h1 { font-size: 17px; font-weight: 600; }
.tb-title .tb-sub { font-size: 11.5px; color: var(--faint); margin-top: -1px; }

.tb-search {
  flex: 1; max-width: 380px;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  transition: border-color .16s, background-color .16s, box-shadow .16s;
  position: relative;
}
.tb-search:focus-within { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.tb-search input { flex: 1; border: 0; outline: none; background: transparent; min-width: 0; }
.tb-search kbd {
  font-size: 10.5px; color: var(--faint);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px;
  font-family: inherit;
}
.search-pop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 6px; max-height: 360px; overflow-y: auto; z-index: 60;
}
.search-group-label { font-size: 11px; color: var(--faint); padding: 8px 10px 4px; }
.search-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
}
.search-row:hover { background: var(--surface-3); }
.search-row .sr-sub { font-size: 11.5px; color: var(--faint); margin-left: auto; }

.tb-spacer { flex: 1; }
.tb-actions { display: flex; align-items: center; gap: 8px; }

.wallet-chip {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: border-color .16s;
}
.wallet-chip:hover { border-color: var(--border-strong); }
.wallet-chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.wallet-chip .dot.rp { background: var(--accent); }
.wallet-chip .dot.be { background: #3f7fc0; }
.wallet-chip .w-sep { width: 1px; height: 14px; background: var(--border); }

/* ---------- 内容滚动区 ---------- */
.view {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  position: relative;
}
.page { padding: 26px 28px 48px; max-width: 1320px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h2 { font-size: 21px; }
.page-head .ph-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.page-head .ph-actions { display: flex; gap: 10px; align-items: center; flex: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 600;
  margin: 24px 0 12px;
}
.section-title:first-child { margin-top: 0; }
.section-title .st-more { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); cursor: pointer; }
.section-title .st-more:hover { color: var(--accent); }
.section-title .icon { color: var(--accent); }

/* 侧边信息栏小卡 */
.side-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  box-shadow: var(--shadow-xs);
}
.side-card h4 { font-size: 13.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.side-card h4 .icon { color: var(--accent); width: 17px; height: 17px; }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center; padding: 56px 20px; color: var(--faint);
}
.empty-state .es-icon {
  width: 54px; height: 54px; margin: 0 auto 14px;
  border-radius: 16px; background: var(--surface-3);
  display: grid; place-items: center; color: var(--faint);
}
.empty-state p { font-size: 13px; }

/* ---------- 响应式兜底 ---------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 68px; }
  .brand .brand-text, .nav-caption, .nav-item span.label, .nav-badge,
  .side-user .su-meta, .side-user .su-actions { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .side-user { justify-content: center; }
  .page { padding: 20px 16px 40px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .wallet-chip .w-text { display: none; }
}
