/* 全局应用外壳、响应式导航、Toast / Modal / ActionSheet 样式 */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
}

/* 顶部导航栏：桌面端常驻 3 导航 + 品牌；移动端自动精简为顶栏标题/返回 */
.top-header {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--header-height);
  background-color: rgba(250, 248, 244, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.top-header-inner {
  max-width: var(--content-wide);
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-sub);
  background-color: var(--surface-warm);
  transition: background-color 0.15s ease;
}

.back-btn:hover {
  background-color: var(--border);
  color: var(--ink);
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.brand-seal {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background-color: var(--red);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  flex-shrink: 0;
  box-shadow: 0 4px 10px -4px rgba(185, 28, 28, 0.45);
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.03em;
}

.mobile-page-title {
  display: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.desktop-nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-sub);
  transition: all 0.15s ease;
}

.desktop-nav-item:hover {
  background-color: var(--surface-warm);
  color: var(--ink);
}

.desktop-nav-item.active {
  background-color: var(--red-soft);
  color: var(--red);
  font-weight: 700;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background-color: var(--red);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.app-main {
  flex: 1;
  width: 100%;
}

/* 移动端底部横向 3 Tab（左图标 + 右文字 + 柔和朱砂红胶囊高亮） */
.mobile-tabbar {
  display: none;
}

@media (max-width: 767px) {
  .top-header {
    height: 52px;
  }

  .top-header-inner {
    padding: 0 14px;
  }

  .desktop-nav {
    display: none;
  }

  .top-header.is-subpage .brand-btn {
    display: none;
  }

  .top-header.is-subpage .mobile-page-title {
    display: block;
  }

  .app-main.has-mobile-tabbar {
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 8px);
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(28, 25, 23, 0.04);
  }

  .mobile-tab-item {
    position: relative;
    flex: 1;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-sub);
    transition: all 0.15s ease;
  }

  .mobile-tab-item.active {
    background-color: var(--red-soft);
    color: var(--red);
    font-weight: 700;
  }

  .mobile-tab-badge {
    margin-left: 2px;
  }
}

/* 全局 Toast */
.jb-toast {
  position: fixed;
  left: 50%;
  top: 76px;
  transform: translateX(-50%);
  z-index: 300;
  padding: 10px 18px;
  border-radius: 999px;
  background-color: rgba(28, 25, 23, 0.88);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

/* 全局模态弹窗 */
.jb-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 250;
  background-color: rgba(28, 25, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.jb-modal-card {
  width: 100%;
  max-width: 380px;
  background-color: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.jb-modal-title {
  padding: 20px 20px 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.jb-modal-body {
  padding: 6px 22px 20px;
  font-size: 14px;
  color: var(--ink-sub);
  line-height: 1.65;
  text-align: center;
}

.jb-modal-actions {
  display: flex;
  border-top: 1px solid var(--border);
}

.jb-modal-btn {
  flex: 1;
  height: 46px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-sub);
  transition: background-color 0.15s ease;
}

.jb-modal-btn:hover {
  background-color: var(--bg-page);
}

.jb-modal-btn-confirm {
  color: var(--red);
  font-weight: 700;
}

.jb-modal-btn + .jb-modal-btn {
  border-left: 1px solid var(--border);
}

/* 全局操作菜单 ActionSheet */
.jb-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 240;
  background-color: rgba(28, 25, 23, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.jb-sheet-panel {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-page);
  border-radius: 18px 18px 0 0;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .jb-sheet-mask {
    align-items: center;
    padding: 20px;
  }

  .jb-sheet-panel {
    border-radius: 16px;
    padding: 14px;
  }
}

.jb-sheet-title {
  text-align: center;
  font-size: 13px;
  color: var(--ink-muted);
  padding: 4px 0 10px;
}

.jb-sheet-group {
  background-color: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.jb-sheet-item {
  width: 100%;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.jb-sheet-item:hover {
  background-color: var(--bg-page);
}

.jb-sheet-item + .jb-sheet-item {
  border-top: 1px solid var(--border-soft);
}

.jb-sheet-item.danger {
  color: var(--red);
}

.jb-sheet-cancel {
  width: 100%;
  height: 46px;
  margin-top: 10px;
  border-radius: 12px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-sub);
}

.jb-sheet-cancel:hover {
  background-color: var(--surface-warm);
}
