/**
 * 主导航底栏 — 与首页 index 一致（六宫格 SVG + 金色当前项）
 * 各页引入后，页面内请勿再重复定义 .tabbar / .tab / .tab-link（避免覆盖）
 *
 * 使用 position:fixed 贴视口底，兼容 Telegram 等内嵌浏览器（其对 body 整页 flex+overflow:hidden
 * + 100dvh 支持不完整时，会把文档流底栏挤出可视区，表现为「导航栏没了」）。
 * 个别 WebView 若出现底栏随内容滚动，可换系统浏览器打开；主内容区请保留 padding-bottom 为底栏留空。
 */
.tabbar {
  position: fixed;
  bottom: 0;
  /* 水平居中且宽度 ≤450px：用 calc+min，避免「left:0 + right:0 + width:100% + max-width + margin:auto」
   * 在部分桌面 Chrome 中对 fixed 过约束算出宽度为 0，整栏不显示。 */
  left: calc(50vw - min(225px, 50vw));
  right: auto;
  width: min(450px, 100vw);
  max-width: 100%;
  box-sizing: border-box;
  background: #fff;
  border-top: 1px solid #ebeff5;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: calc(72px + env(safe-area-inset-bottom, 0px));
  min-height: calc(72px + env(safe-area-inset-bottom, 0px));
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 2000;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  text-decoration: none;
  padding: 2px 0 0;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tab-link {
  text-decoration: none;
  color: inherit;
}

.tab svg {
  width: 34px;
  height: 34px;
  stroke: #334155;
  fill: none;
  stroke-width: 2;
  opacity: 1;
  flex-shrink: 0;
  transform: translateY(-1px);
  transition: width 0.18s ease, height 0.18s ease, stroke 0.18s ease;
}

.tab.active {
  color: #c9a227;
}

.tab.active svg {
  width: 40px;
  height: 40px;
  stroke: #c9a227;
}

/* 后台「基础设置」上传的底栏自定义图标（替换默认 SVG）
 * 与首页快捷入口一致：固定槽位 + 内层 img cover，避免 WebView 里图片撑破 flex。 */
.tab.tab-has-custom-icon > svg:first-of-type {
  display: none !important;
}
.tab.tab-has-custom-icon {
  min-width: 0;
  /* flex 默认 min-height:auto 会按子项内容最小高度算，大图会把整栏顶爆（Telegram WebView 常见） */
  min-height: 0;
}
.tab-icon-slot {
  box-sizing: border-box;
  width: 34px !important;
  height: 34px !important;
  min-width: 0;
  min-height: 0;
  max-width: 34px !important;
  max-height: 34px !important;
  flex: 0 0 34px;
  flex-shrink: 0;
  flex-grow: 0;
  /* Telegram / 部分 WebKit 对 replaced 子项用百分比高度会按固有像素撑栏，用 grid + 固定 px 更稳 */
  display: grid;
  place-items: center;
  overflow: hidden;
  line-height: 0;
  pointer-events: none;
  position: relative;
  opacity: 1;
  transform: translateY(-1px);
  transition: width 0.18s ease, height 0.18s ease, max-width 0.18s ease, max-height 0.18s ease, flex-basis 0.18s ease;
}
.tab-icon-slot img {
  box-sizing: border-box;
  width: 34px !important;
  height: 34px !important;
  max-width: 34px !important;
  max-height: 34px !important;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  display: block;
  opacity: 1;
  transition: width 0.18s ease, height 0.18s ease, max-width 0.18s ease, max-height 0.18s ease;
}
.tab.active .tab-icon-slot {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  flex: 0 0 40px;
}
.tab.active .tab-icon-slot img {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
}

/* ========== 顶栏白区：与 index.html .header 一致（padding 10px 14px 8px）==========
 * 引入本文件的各主导航页，顶栏容器为 .phone 下首个 header 或合约品牌条 .ct-brand / 资产 .hd。
 * 主标题字号、字重与首页 .brand-name 对齐：18px / 600 / letter-spacing -0.02em */
/* 须含 safe-area-inset-top：勿用四值 padding 简写顶掉 layout-desktop 的安全区，否则刘海机返回键顶到状态栏无法点 */
.phone > header.top,
.phone > header.hd,
.phone > header.so-top,
.phone > header.tf-head,
.phone > header.pnl-top {
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 8px;
}

.phone > .ct-brand {
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 8px;
}

.phone > .hd {
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 8px;
}

.phone .page-inner {
  padding-top: 0;
}

.phone .page-inner > .top {
  margin-left: 0;
  margin-right: 0;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: #fff;
  border-bottom: 1px solid #ebeff5;
}

.phone > header.top h1,
.phone > header.hd .hd-title,
.phone > header.tf-head h1,
.phone > header.so-top .so-pair h1,
.phone > .ct-brand .ct-brand-title,
.phone .page-inner > .title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.phone > header.pnl-top {
  align-items: center;
  gap: 18px;
}

.phone > header.pnl-top .pnl-tab {
  font-size: 15px;
  font-weight: 600;
  padding-bottom: 7px;
  margin-bottom: -1px;
}
