/* ============================================================
   GEO V4.5 — 全局布局 (顶部导航 + 左侧菜单 + 面包屑 + 内容区)
   ============================================================ */

/* ---------- App 容器 (一屏根) ---------- */
.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: var(--topnav-height) 1fr;
  /* NOTE: 不要用 100vw/100vh：Windows 滚动条是插入式(17px)，100vw 会让 .app-shell
     宽度比视口内实际可用宽度多 17px，从而右侧卡片/表格最后一列被 html/body overflow:hidden 裁掉。
     html/body 已经有 height/width:100vh/100vw，这里 100% 直接继承祖宗层已经扣除滚动条的盒子尺寸，
     等于「真实可视内框」，彻底消除横溢 17px 伪裁切。*/
  height: 100%;
  width: 100%;
  overflow-x: hidden;      /* ← 阻断任何子元素撑大外壳 */
}

/* ---------- 顶部导航 ---------- */
.topnav {
  display: flex;
  align-items: center;
  height: var(--topnav-height);
  width: 100%;             /* ← 占满父级宽度 */
  min-width: 0;            /* ← 允许被 grid/flex 父级约束收缩到 0，防止撑爆外壳 */
  padding: 0 var(--sp-4);  /* ← 原 sp-8(32px) 改 sp-4(16px)，减少左右留白 */
  background: var(--color-bg-secondary);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--color-border-normal);
  position: relative;
  z-index: 30;
  /* 注意：不要 overflow:hidden —— 会裁掉 user-chip / brand-switch 的 dropdown
     以及 topnav-icon-btn 的 tooltip。子元素各自有 min-width:0 + overflow:hidden 防止撑爆外壳，
     外层 .app-shell 的 overflow-x:hidden 是最终防线。 */
}

.topnav::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(134, 201, 140, 0.5) 50%,
    transparent 100%);
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;            /* ← 允许收缩到 0 */
  flex-shrink: 1;          /* ← 允许被压缩 */
  overflow: visible;       /* ← 必须 visible，否则裁掉 geo-brand-switch 的下拉菜单（absolute 定位在 topnav-brand 外部） */
}

.topnav-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, var(--color-primary-400), var(--color-primary-700));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #04131c;
  font-size: 18px;
  box-shadow: var(--shadow-glow-primary), inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative;
}
.topnav-logo::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 12px;
  border: 1px solid rgba(134, 201, 140, 0.35);
  opacity: 0.6;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-name-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.brand-geo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-text-primary);
}
.brand-ver {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-semantic-success);
  letter-spacing: 0.05em;
}
.brand-agent {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  letter-spacing: 0.08em;
  line-height: 1.2;
}

/* 一级模块菜单 */
.topnav-modules {
  display: flex;
  align-items: center;
  gap: 2px;                 /* ← 原 var(--sp-1)=4px 改 2px 更紧凑 */
  margin-left: 12px;       /* ← 原 var(--sp-8)=32px 改 12px */
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.topnav-modules > * {
  white-space: nowrap;
}
.module-tab {
  position: relative;
  padding: 8px 12px;        /* ← 原 10px 18px 减小到 8px 12px */
  border-radius: var(--radius-md);
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  background: transparent;
  border: none;
  transition: all var(--dur-normal) var(--ease-out-expo);
  white-space: nowrap;
  font-family: inherit;
  /* ↓ 新增：允许按钮被压缩 */
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-tab:hover {
  color: var(--color-text-primary);
  background: rgba(134, 201, 140, 0.06);
}
.module-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg,
    rgba(61, 143, 66, 0.22) 0%,
    rgba(134, 201, 140, 0.08) 100%);
  box-shadow: inset 0 1px 0 rgba(134, 201, 140, 0.25);
}
.module-tab.active::after {
  content: "";
  position: absolute;
  left: 20%; right: 20%;
  bottom: -18px;
  height: 2px;
  background: linear-gradient(90deg,
    transparent, var(--color-primary-400), transparent);
  border-radius: 2px;
}
.module-tab .module-index {
  display: inline-block;
  margin-right: 6px;
  font-family: var(--font-display);
  font-size: var(--fs-caption);
  color: var(--color-primary-400);
  opacity: 0.7;
}
.module-tab.active .module-index { opacity: 1; }

/* 右上操作区 */
.topnav-actions {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-shrink: 0;
  /* 不要 margin-left:auto —— 会和 .topnav-modules 的 flex:1 抢剩余空间，
     modules 的 flex:1 膨胀后自然把 actions 推到最右边 */
}
.topnav-icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all var(--dur-fast) var(--ease-out-expo);
  font-size: 16px;
}
.topnav-icon-btn:hover {
  color: var(--color-primary-400);
  background: rgba(134, 201, 140, 0.1);
  border-color: var(--color-border-strong);
  transform: translateY(-1px);
}
.notif-dot {
  position: absolute;
  top: 8px; right: 10px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-semantic-danger);
  box-shadow: 0 0 8px var(--color-semantic-danger);
}

.user-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--color-border-subtle);
  cursor: pointer;
  transition: all var(--dur-fast);
  position: relative;        /* ← 给下拉做定位 */
  flex-shrink: 0;
}
.user-chip:hover {
  border-color: var(--color-border-strong);
}
.geo-user-caret {
  font-size: 10px;
  opacity: .5;
  transition: transform .2s;
}
.user-chip.open .geo-user-caret {
  transform: rotate(180deg);
}
.geo-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-normal);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.2);
  padding: 8px;
  z-index: 100;
  animation: geoUserDD .18s ease-out;
}
@keyframes geoUserDD {
  from { opacity:0; transform:translateY(-4px); }
  to   { opacity:1; transform:translateY(0); }
}
.user-chip.open .geo-user-dropdown {
  display: block;
}
.geo-user-section-title {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  padding: 6px 10px 4px;
}
.geo-user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--color-text-primary);
  text-decoration: none;
  transition: background .15s;
}
.geo-user-menu-item:hover {
  background: rgba(61, 143, 66, 0.15);
  color: var(--color-semantic-success);
}
.geo-user-menu-icon {
  width: 20px; text-align: center; color: var(--color-text-tertiary);
}
.geo-user-divider {
  height: 1px;
  background: var(--color-border-subtle);
  margin: 6px 8px;
}
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent-amber), #d97706);
  display: flex; align-items: center; justify-content: center;
  color: #1a0f00;
  font-weight: 700;
  font-size: var(--fs-body-sm);
  flex-shrink: 0;
}
.user-name {
  font-size: var(--fs-body-sm);
  color: var(--color-text-primary);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- 主体区 (侧边栏 + 主内容) ---------- */
.app-main {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 0;
  height: calc(100vh - var(--topnav-height));
}

/* ---------- 左侧二级菜单 ---------- */
.sidebar {
  background: var(--color-bg-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--color-border-normal);
  display: flex;
  flex-direction: column;
  padding: var(--sp-4) var(--sp-3) var(--sp-4);
  overflow: hidden;
}
.sidebar-module-title {
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  font-family: var(--font-display);
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--color-primary-400);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.sidebar-module-title::before {
  content: "";
  width: 3px; height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--color-primary-400), var(--color-primary-700));
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: var(--fs-body-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--dur-normal) var(--ease-out-expo);
  position: relative;
}
.sidebar-link:hover {
  color: var(--color-text-primary);
  background: rgba(148, 163, 184, 0.06);
  border-color: var(--color-border-subtle);
  transform: translateX(2px);
}
.sidebar-link.active {
  color: #ffffff;
  background: linear-gradient(90deg,
    rgba(61, 143, 66, 0.25) 0%,
    rgba(61, 143, 66, 0.08) 70%,
    transparent 100%);
  border-color: var(--color-border-strong);
  box-shadow: inset 2px 0 0 var(--color-primary-400);
}
.sidebar-link .icon {
  width: 18px;
  font-size: 15px;
  text-align: center;
  flex-shrink: 0;
  color: var(--color-primary-400);
  opacity: 0.8;
}
.sidebar-link .menu-count {
  margin-left: auto;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--color-semantic-danger-bg);
  color: var(--color-semantic-danger);
  font-size: var(--fs-micro);
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-link.active .menu-count {
  background: var(--color-semantic-danger);
  color: #fff;
}

/* 侧边栏底部 Agent 状态 */
.sidebar-footer {
  /* credits-card 已 fixed 到左下角，这里占位不显示卡片 */
  height: 0;
  padding: 0;
  margin-top: 0;
  border: none;
  background: transparent;
  overflow: visible;
}
.sidebar-footer::before { content: none; }
.sidebar-footer-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h3);
  color: var(--color-text-primary);
  margin-bottom: var(--sp-1);
  position: relative;
}
.sidebar-footer-desc {
  font-size: var(--fs-caption);
  color: var(--color-text-secondary);
  margin-bottom: var(--sp-3);
  position: relative;
}
.agent-status {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-caption);
  position: relative;
}
.agent-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-semantic-success);
  box-shadow: 0 0 10px var(--color-semantic-success);
  animation: pulse-dot 1.8s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.3); opacity: 0.6; }
}

/* ---------- 算力积分卡片（fixed 左下角浮动，无卡片壳） ---------- */
.credits-card {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 150;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--color-bg-secondary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-normal);
  border-radius: 10px;
}
.credits-card::before { content: none; }
.credits-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.credits-title {
  display: flex;
  align-items: center; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; color: var(--color-primary-400); text-transform: uppercase;
}
.credits-icon {
  font-size: 12px;
  color: var(--color-primary-400);
  filter: drop-shadow(0 0 6px rgba(134, 201, 140, 0.6));
}
.credits-refresh {
  font-size: 12px;
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: color 0.2s, transform 0.4s;
  user-select: none;
}
.credits-refresh:hover {
  color: var(--color-text-primary);
  transform: rotate(180deg);
}
.credits-balance {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.credits-num {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 800; line-height: 1; color: var(--color-text-primary);
  letter-spacing: -0.02em;
}
.credits-total {
  font-family: var(--font-body); font-size: 11px; color: var(--color-text-tertiary);
}
.credits-bar {
  height: 4px; border-radius: 3px; background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
  position: relative;
}
.credits-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg,
    var(--color-primary-400) 0%,
    var(--color-semantic-success) 100%);
  box-shadow: 0 0 8px rgba(134, 201, 140, 0.5);
  transition: width 0.6s ease;
}
.credits-foot {
  display: flex;
  align-items: center;
  justify-content: space-between; gap: 4px; } 
.credits-note {
  font-size: 10px; color: var(--color-text-tertiary); flex: 1; white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.credits-recharge {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 16px;
  border: 1px solid var(--color-primary-400);
  background: rgba(134, 201, 140, 0.1);
  color: var(--color-primary-400);
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}
.credits-recharge:hover {
  background: var(--color-primary-400);
  color: #04131c;
  box-shadow: 0 0 14px rgba(134, 201, 140, 0.5);
}

/* ---------- 充值弹窗 ---------- */
.credits-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(4, 19, 28, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.credits-modal-mask.open {
  opacity: 1;
  visibility: visible;
}
.credits-modal {
  width: 560px;
  height: 560px;              /* ← 固定大小，大气 */
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 20px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--color-bg-deep);
  border: 1px solid var(--color-border-strong);
  box-shadow:
    0 30px 60px -15px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(134, 201, 140, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s var(--ease-out-expo);
}
.credits-modal-mask.open .credits-modal {
  transform: translateY(0) scale(1);
}
.credits-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-tertiary);
  font-size: 18px;
  border: 1px solid transparent;
  transition: all 0.2s;
  background: transparent;
  z-index: 2;
}
.credits-modal-close:hover {
  color: var(--color-text-primary);
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--color-border-subtle);
}
.credits-modal-head {
  padding: 24px 28px 0;
  text-align: center;
  flex-shrink: 0;
}
.credits-modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}
.credits-modal-sub {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* 档位 Tab */
.credits-tiers {
  display: flex;
  gap: 6px;
  padding: 18px 28px 0;
  flex-shrink: 0;
}
.credits-tier-btn {
  flex: 1;
  padding: 11px 8px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  font-family: inherit;
}
.credits-tier-btn:hover {
  color: var(--color-text-primary);
  background: rgba(148, 163, 184, 0.12);
}
.credits-tier-btn.active {
  background: linear-gradient(135deg,
    rgba(134, 201, 140, 0.18) 0%,
    rgba(61, 143, 66, 0.12) 100%);
  border-color: var(--color-primary-400);
  color: var(--color-primary-400);
  box-shadow: 0 0 16px rgba(134, 201, 140, 0.2);
}

/* 套餐内容 —— flex:1 吃剩余空间，两列 grid 省高度 */
.credits-plan {
  padding: 18px 28px;
  flex: 1;
  min-height: 0;
}
.credits-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 18px;
}
.credits-feature {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13.5px;
  color: var(--color-text-primary);
  line-height: 1.35;
}
.credits-feature-text .main {
  color: var(--color-text-primary);
}
.credits-feature-text .dim {
  color: var(--color-text-tertiary);
  margin-left: 2px;
  font-size: 12px;
}
.credits-feature-emoji {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.credits-feature-emoji.gold {
  background: rgba(244, 185, 66, 0.12);
}
.credits-feature-emoji.green {
  background: rgba(134, 201, 140, 0.12);
}
.credits-feature-text .main {
  color: var(--color-text-primary);
}
.credits-feature-text .dim {
  color: var(--color-text-tertiary);
  margin-left: 4px;
}

/* 付费周期 */
.credits-periods {
  display: flex;
  gap: 12px;
  padding: 0 28px 16px;
  flex-shrink: 0;
}
.credits-period-btn {
  flex: 1;
  padding: 14px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--color-border-subtle);
  background: rgba(148, 163, 184, 0.04);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s;
  font-family: inherit;
  position: relative;
}
.credits-period-btn:hover {
  border-color: var(--color-primary-400);
  background: rgba(134, 201, 140, 0.05);
}
.credits-period-btn.active {
  border-color: var(--color-primary-400);
  background: rgba(134, 201, 140, 0.1);
  box-shadow: 0 0 14px rgba(134, 201, 140, 0.15);
}
.credits-period-label {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-bottom: 3px;
}
.credits-period-price {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
}
.credits-period-price .currency {
  font-size: 14px;
  font-weight: 500;
  margin-right: 2px;
}
.credits-period-orig {
  font-size: 12px;
  color: var(--color-text-tertiary);
  text-decoration: line-through;
  margin-left: 4px;
  font-weight: 400;
}
.credits-period-badge {
  position: absolute;
  top: -8px;
  right: 10px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary-400), #2fd9a5);
  color: #04131c;
  font-weight: 700;
}

/* CTA 按钮 */
.credits-modal-cta {
  padding: 0 28px 20px;
  flex-shrink: 0;
}
.credits-cta-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s;
  background: linear-gradient(135deg,
    var(--color-primary-400) 0%,
    #2fd9a5 100%);
  color: #04131c;
  box-shadow:
    0 8px 24px rgba(134, 201, 140, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.credits-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 32px rgba(134, 201, 140, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.credits-cta-btn:active {
  transform: translateY(0);
}
.credits-cta-btn.secondary {
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-primary);
  box-shadow: none;
}
.credits-cta-btn.secondary:hover {
  background: rgba(148, 163, 184, 0.15);
  border-color: var(--color-border-strong);
}

/* ---------- 内容区 (面包屑 + 可滚动内容) ---------- */
.content-wrap {
  display: grid;
  grid-template-rows: var(--breadcrumb-height) 1fr;
  min-height: 0;
  /* 修复：仅纵向裁切（防止 .page-scroll 超出 app-main 纵向边界），
     横向改为 auto —— 避免 TRAE 预览窗口窄屏时，metrics-grid / page-actions 金色按钮被 overflow:hidden 硬裁右侧 */
  overflow-y: hidden;
  overflow-x: auto;
}

.breadcrumb {
  display: flex;
  align-items: center;
  padding: 0 var(--sp-8);
  gap: var(--sp-2);
  font-size: var(--fs-caption);
  color: var(--color-text-tertiary);
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-comp-bg-subtle);
  flex-shrink: 0;
  min-width: 0;
}
.breadcrumb-sep {
  color: var(--color-text-tertiary);
  opacity: 0.4;
}
.breadcrumb-current {
  color: var(--color-text-primary);
  font-weight: 500;
}
.breadcrumb-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur-fast);
}
.breadcrumb-link:hover { color: var(--color-primary-400); }

/* 可滚动内容容器 — 页面实现方在其内部排版
   NOTE: 必须使用视口硬算的确定高度，不得依赖 Grid 1fr 的匿名格子 height:100%
   — 否则 Grid 子项的百分比高度解析会在部分浏览器下超过可视区域，
     导致 .page-scroll 底部被 html/body overflow:hidden 裁切，用户"显示不全"。 */
.page-scroll {
  overflow-y: auto;
  /* 修复：overflow-x 从 hidden → auto，窄屏时 metrics-grid / page-actions 金色按钮
     横向溢出时出现翡翠色横滚动条，不再被裁切 */
  overflow-x: auto;
  padding: var(--sp-6) var(--sp-8) var(--sp-8);
  /* 确定性高度：视口 - 顶导航 64 - 面包屑 40 */
  height: calc(100vh - var(--topnav-height) - var(--breadcrumb-height));
  min-height: 0;
  min-width: 0;   /* 防止 grid 子项被 min-width:auto 撑爆 */
  width: 100%;    /* 防止重建的壳子在沙盒内被窄化 */
  max-width: 100%;
  max-height: calc(100vh - var(--topnav-height) - var(--breadcrumb-height));
  position: relative;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
/* .page-scroll 横滚动条样式（翡翠色）—— 与 components.css .table-wrap 风格一致 */
.page-scroll.scroll-area::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}
.page-scroll.scroll-area::-webkit-scrollbar-thumb {
  background: rgba(134, 201, 140, 0.2);
}
.page-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(134, 201, 140, 0.45);
}

/* 页面头部 (标题 + 右上操作) */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
}
.page-title {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  /* 修复：窄屏时让标题侧先收缩（flex:1），操作按钮侧(flex-shrink:0)保持全宽，
     避免"启动 Agent 全自动作业"金色按钮右半被 .page-scroll overflow:hidden 裁切。 */
  flex: 1;
  min-width: 0;
}
.page-title h1 {
  font-family: var(--font-display);
  /* 自适应：8px clamp 下界防止窄屏溢出，3vw 跟随视口缩，28px 是大屏上限 */
  font-size: clamp(18px, 2.4vw, var(--fs-h1));
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
  line-height: var(--lh-tight);
  white-space: nowrap;
}
@media (max-width: 768px) {
  .page-title h1 { white-space: normal; }
}
.page-title h1 .accent {
  background: linear-gradient(135deg, var(--color-primary-400), var(--color-accent-amber));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-subtitle {
  font-size: var(--fs-body-sm);
  color: var(--color-text-secondary);
  max-width: 720px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}
/* 窄屏（TRAE preview iframe 等）允许操作按钮换行，不挤压标题 */
@media (max-width: 1100px) {
  .page-header { flex-wrap: wrap; }
  .page-actions { flex-shrink: 1; flex-wrap: wrap; }
}

@media (max-width: 768px) {
  html:has(meta[name="geo-page"]:is([content="overview"], [content="question-pool"], [content="detection-task"], [content="hotwords"], [content="website-baseline"])) {
    --topnav-height: 104px;
    .topnav { display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:60px 44px;padding:0 12px; }
    .topnav-brand { gap:8px; }
    .topnav-logo { flex-shrink:0; }
    .brand-text, .topnav-actions > div.topnav-icon-btn, .user-chip > .user-name { display:none; }
    .topnav-modules { grid-column:1 / -1;grid-row:2;margin:0;overflow-x:auto; }
    .module-tab { flex-shrink:0;padding:8px;font-size:12px; }
    .module-tab > span[style] { display:none; }
    .topnav-actions { grid-column:2;grid-row:1;gap:4px; }
    .geo-brand-switch { margin-left:0; }
    .geo-brand-trigger { min-width:0;max-width:160px; }
    .user-chip { padding:4px; }
    .app-main { grid-template-columns:minmax(0,1fr);grid-template-rows:48px minmax(0,1fr); }
    .sidebar { padding:4px 8px;border-right:0;border-bottom:1px solid var(--color-border-normal); }
    .sidebar-module-title, .sidebar-footer { display:none; }
    .sidebar-menu { flex-direction:row;overflow-x:auto;overflow-y:hidden; }
    .sidebar-link { flex-shrink:0;padding:6px 8px;gap:4px;font-size:12px;white-space:nowrap; }
    .breadcrumb { padding:0 16px;white-space:nowrap;overflow-x:auto; }
    .page-scroll { height:calc(100vh - var(--topnav-height) - var(--breadcrumb-height) - 48px);max-height:calc(100vh - var(--topnav-height) - var(--breadcrumb-height) - 48px);padding:20px 16px 32px; }
    .page-title h1 { font-size:24px;letter-spacing:0; }
    .page-actions { gap:8px; }
    .tabs { max-width:100%;overflow-x:auto; }
    .tab-item { flex-shrink:0; }
    .metrics-grid, .metrics-grid.row-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .section-grid-2, .section-grid-3 { grid-template-columns:minmax(0,1fr); }
  }
}

/* ============================================================
   主题切换过渡 — 让颜色跳变变成丝滑动画
   ============================================================ */
html.theme-transitioning * {
  transition: background-color 0.28s ease,
              background 0.28s ease,
              border-color 0.28s ease,
              color 0.28s ease,
              box-shadow 0.28s ease,
              fill 0.28s ease,
              stroke 0.28s ease !important;
}
/* 以下元素不做过渡（否则会显得迟钝） */
html.theme-transitioning .bg-halo,
html.theme-transitioning .metric-card::after,
html.theme-transitioning .card::before,
html.theme-transitioning .modal-mask,
html.theme-transitioning canvas { transition: none !important; }
