/* === 公共基础样式 === */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Segoe UI', sans-serif;
  background: #f0f2f5; color: #333; min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

/* === 平台色条 === */
.platform-bar { height: 4px; }
.platform-bar.ios { background: #4a90d9; }
.platform-bar.android { background: #27ae60; }
.platform-bar.web { background: #9b59b6; }

.global-nav-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.global-nav-group::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: max(100%, 150px);
  height: 8px;
  z-index: 1001;
}
.global-nav-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #666;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.global-nav-group:hover .global-nav-trigger,
.global-nav-group:focus-within .global-nav-trigger,
.global-nav-group.open .global-nav-trigger {
  background: #f3f6fb;
  border-color: #dbe7fb;
  color: #1a73e8;
}
.global-nav-group.active .global-nav-trigger { background: #1a73e8; color: #fff; }
.global-nav-menu {
  position: absolute;
  top: 34px;
  left: 0;
  min-width: 150px;
  padding: 6px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0,0,0,.14);
  z-index: 1002;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
}
.global-nav-group:hover .global-nav-menu,
.global-nav-group:focus-within .global-nav-menu,
.global-nav-group.open .global-nav-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.global-nav-menu-item {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 7px;
  color: #333;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.global-nav-menu-item:hover { background: #f3f6fb; color: #1a73e8; }
.global-nav-menu-item.active { background: #e8f0fe; color: #1a73e8; }
.global-nav-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  color: #666;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.global-nav-home:hover { background: #f3f6fb; color: #1a73e8; }
.global-nav-home.active { background: #1a73e8; color: #fff; }

/* === 导航右侧（common.js 一次性写好，登录后只切 hidden） === */
#globalNavRight { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; margin-left: auto; }
#globalNavRight [hidden] { display: none !important; }
/* 老友全站顶栏（laoyou.tech/static/topbar.js）挂上后 <html> 带 ly-topbar：名字、待办、驾驶舱、退出已在顶栏里，这里藏掉免得重复；
   顶栏没加载出来时照旧显示（didu 2026-10-15 统一头部） */
html.ly-topbar #globalNavUser, html.ly-topbar #globalNavRight a[data-site], html.ly-topbar #globalLogoutBtn { display: none !important; }
/* 导航链接不可拖：按住手一抖 Chrome 会当成拖链接，不跳转（common.js 同时设 draggable=false） */
#globalNav a { -webkit-user-drag: none; }
/* 导航自成布局边界：首页列表重绘、未处理数变化、头像加载都不挪动导航链接（杜总 10-14 首页点导航时好时坏） */
#globalNav { contain: layout style; }
#globalPlatformNav { font-variant-numeric: tabular-nums; }
#globalNavRight { flex-shrink: 0; min-height: 28px; }
.global-nav-user { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: #666; }
.global-nav-avatar { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
img.global-nav-avatar { object-fit: cover; }
.global-nav-avatar-text {
  display: inline-flex; align-items: center; justify-content: center;
  background: #e8f0fe; color: #1a73e8; font-size: 12px; font-weight: 600;
}
.global-nav-name { overflow: hidden; text-overflow: ellipsis; }
#globalNavRight .global-nav-link { color: #1a73e8; text-decoration: none; border-radius: 999px; padding: 3px 6px; }
/* 当前所在页面的链接（common.js 标 aria-current）：和左侧「首页」选中一样的蓝底白字，一眼看出「已经在这一页」 */
#globalNavRight a[aria-current="page"] { background: #1a73e8; color: #fff; font-weight: 600; padding: 3px 10px; }

/* === 全局搜索 === */
#globalSearchInput:focus { border-color: #1a73e8; }
#globalSearchPanel { display: none; }
#globalSearchPanel.open {
  display: block; position: absolute; top: 40px; right: 0;
  width: 340px; max-width: 86vw; background: #fff;
  border: 1px solid #e8e8e8; border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14); max-height: 64vh; overflow-y: auto; z-index: 1001;
}
.gs-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid #f2f2f2; cursor: pointer;
}
.gs-row:last-child { border-bottom: none; }
.gs-row:hover { background: #f3f6fb; }
.gs-id { flex-shrink: 0; font-size: 12px; font-weight: 700; color: #1a73e8; }
.gs-title { flex: 1; min-width: 0; font-size: 13px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-badge { flex-shrink: 0; font-size: 11px; color: #888; background: #f0f2f5; border-radius: 6px; padding: 2px 7px; }
.gs-msg { padding: 12px; font-size: 13px; color: #999; }

@media (max-width: 640px) {
  #globalNav {
    gap: 8px !important;
    padding: 8px 10px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    overflow: visible !important;
    z-index: 1200 !important;
  }
  #globalNav > a:first-child {
    max-width: 126px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #globalPlatformNav {
    order: 3;
    flex: 1 0 100% !important;
    gap: 4px !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
    padding-top: 2px;
  }
  #globalPlatformNav::-webkit-scrollbar { display: none; }
  .global-nav-group { position: static; }
  .global-nav-home,
  .global-nav-trigger {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
  }
  .global-nav-menu {
    top: calc(100% - 2px);
    left: 10px;
    right: 10px;
    width: auto;
    min-width: 0;
    z-index: 1202;
  }
  .global-nav-group::before { display: none; }
  #globalSearch {
    margin-left: auto;
    flex: 1 1 128px !important;
    min-width: 112px;
  }
  #globalSearchInput {
    width: 100% !important;
    max-width: none !important;
    height: 36px;
    font-size: 14px !important;
  }
  #globalSearchPanel.open {
    left: 0;
    right: auto;
    width: min(340px, calc(100vw - 20px));
    z-index: 1203;
  }
  #globalNavRight {
    flex: 0 0 auto;
    gap: 2px 4px !important;
    max-width: 100%;
    font-size: 12px !important;
  }
  #globalNavRight { flex-wrap: wrap; }
  #globalNavRight .global-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 7px;
    border-radius: 8px;
    font-size: 14px;
    -webkit-tap-highlight-color: rgba(26,115,232,.15);
  }
  #globalNavRight .global-nav-link:active { background: #e8f0fe; }
  #globalNavRight a[aria-current="page"] { padding: 0 10px; }
  #globalNavRight a[aria-current="page"]:active { background: #1557b0; }
  .global-nav-name { max-width: 46px; }
  .global-nav-menu-item {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 15px;
  }
}

/* === 二级导航与 AI 驾驶舱页一致（didu 2026-10-15）===
   最上方是老友全站顶栏，这一行只做 OPS 的二级导航：不铺满、不吸顶，收在 980px 内容宽度里（与驾驶舱 .wrap 同宽），
   下面一条细线；灰字，当前项浅灰底加粗。写在文件末尾覆盖上面的蓝色胶囊样式与 common.js 里的行内样式。 */
#globalNav {
  position: static !important;
  max-width: 980px;
  margin: 24px auto 16px;
  padding: 0 16px 12px !important;
  background: linear-gradient(#e5e7eb, #e5e7eb) center bottom / calc(100% - 32px) 1px no-repeat !important;
  border-bottom: 0 !important;
}
#globalPlatformNav { gap: 4px !important; }
.global-nav-home,
.global-nav-trigger {
  height: auto;
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  color: #6b7280;
  font-size: 14px;
  font-weight: 400;
}
.global-nav-home:hover,
.global-nav-group:hover .global-nav-trigger,
.global-nav-group:focus-within .global-nav-trigger,
.global-nav-group.open .global-nav-trigger { background: transparent; color: #111; }
.global-nav-home.active,
.global-nav-group.active .global-nav-trigger { background: #efefed; color: #111; font-weight: 600; }
#globalNavRight .global-nav-link { color: #6b7280; border-radius: 6px; padding: 5px 10px; font-size: 14px; }
#globalNavRight .global-nav-link:hover { color: #111; }
#globalNavRight a[aria-current="page"] { background: #efefed; color: #111; font-weight: 600; padding: 5px 10px; }
@media (max-width: 640px) {
  #globalNav { margin: 14px auto 12px; padding: 0 16px 10px !important; }
  .global-nav-home, .global-nav-trigger { min-height: 36px; }
}
