.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-body {
  display: flex;
  min-height: 100vh;
}

.page-header {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-header .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-header .logo i {
  font-size: 17px;
  opacity: 0.9;
}

/* 页面内标题（order / credits / profile 等） */
.page-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: transparent;
  background: linear-gradient(180deg, #f7e9b6 0%, #d4af37 62%, #a5832f 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.page-title-sub {
  font-size: 12px;
  letter-spacing: 1.2px;
  color: var(--color-text-light);
  text-transform: uppercase;
  margin-top: 5px;
}

.page-header .header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header .header-user {
  color: var(--color-text-secondary);
  cursor: pointer;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border-soft);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 12px 0;
}

/* 侧边栏顶部品牌区（呼应登录页的金色徽标） */
.app-sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 24px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--color-border-soft);
}

.app-sidebar .sidebar-mark {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(158deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.04));
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--color-accent);
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 236, 180, 0.18);
}

.app-sidebar .sidebar-brand-text {
  min-width: 0;
}

.app-sidebar .sidebar-brand-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.app-sidebar .sidebar-brand-sub {
  font-size: 9px;
  letter-spacing: 1.4px;
  color: var(--color-text-light);
  text-transform: uppercase;
  white-space: nowrap;
}

.app-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 15px;
  border-right: 3px solid transparent;
}

.app-sidebar .nav-item:hover {
  background: var(--color-bg-gray);
  color: var(--color-text);
}

.app-sidebar .nav-item.active {
  background: var(--color-primary-light);
  color: var(--color-accent);
  font-weight: 600;
  border-right: 3px solid var(--color-primary);
}

.app-sidebar .nav-item .nav-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.app-main {
  flex: 1;
  /* flex item 默认 min-width:auto，会被内部大图（width:100%）的最小内容宽度撑开，
     导致页面出现横向滚动；置 0 后可正常收缩，消除横向溢出 */
  min-width: 0;
  margin-left: var(--sidebar-width);
  padding: 24px;
  min-height: 100vh;
}

body.page-home .app-main {
  padding: 0;
}

body.page-home .page-container {
  max-width: none;
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
}

.app-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tabbar-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-soft);
  z-index: 100;
}

.app-tabbar .tabbar-inner {
  display: flex;
  height: 100%;
}

.app-tabbar .tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-text-light);
  cursor: pointer;
  transition: color 0.2s;
  font-size: 11px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.app-tabbar .tab-item .tab-icon {
  font-size: 22px;
  line-height: 1;
}

.app-tabbar .tab-item.active {
  color: var(--color-accent);
}

.app-tabbar .tab-item.tab-highlight .tab-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-text-light);
  border: 1px solid var(--color-border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-top: -22px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}

.app-tabbar .tab-item.tab-highlight.active .tab-icon {
  background: linear-gradient(180deg, #f0d97e 0%, #c9a331 100%);
  color: var(--color-ink);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.38);
}

.app-tabbar .tab-item.tab-highlight {
  position: relative;
}

@media (max-width: 768px) {
  .app-sidebar {
    display: none;
  }

  .app-main {
    margin-left: 0;
    padding: 16px 0;
    padding-bottom: calc(var(--tabbar-height) + 16px);
    /* 用 clip 而非 hidden：hidden 会让 .app-main 变成滚动容器，
       导致页内 position:sticky 的 .page-header 相对它定位而失效 */
    overflow-x: clip;
  }

  body.page-home .app-main {
    padding: 0;
    padding-bottom: calc(var(--tabbar-height));
  }

  .app-tabbar {
    display: block;
  }

  .page-header {
    padding: 0 16px;
  }

  /* 左右留白，避免内容贴到屏幕边缘 */
  .page-container {
    padding: 12px 16px;
  }

  body.page-home .page-container {
    padding: 0;
  }
}