/* 全站外壳：顶部导航 + AI 悬浮按钮。**唯一一份**，各页面只留 HTML 结构。
 *
 * 之前的样子：紫渐变导航条（#667eea→#764ba2）内联在 10 个页面里各一份，
 * 压在白底蓝字的页面之上；studio 与 ops 页面下面还各有一条自己的白色 .topbar，
 * 于是屏幕上同时出现两条导航、两处「红壶助手」、五种主色。
 *
 * 现在：导航跟页面同一套 token（console.css 的 --primary/--panel/--line），
 * 白底、细边、系统字体；emoji 图标换成线性 SVG（emoji 在 Windows 与 iOS 上
 * 长得完全不一样，而且没法跟着主色变）。
 *
 * 为什么不是干脆删掉这条导航只留 .topbar：.topbar 是页面级的（studio 有搜索框、
 * ops 有心跳点），而「监控中心 / 成品库 / 运维后台」是站级的。两层都要，
 * 但得看起来像一个产品。
 */

.unified-navbar {
  position: sticky; top: 0; z-index: var(--z-chrome, 40);
  background: var(--panel, #fff);
  border-bottom: 1px solid var(--line, #e2e8f0);
  color: var(--text, #0f172a);
}
.navbar-container {
  max-width: 1440px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 16px; height: 52px;
}

/* 品牌：一个色块 + 站名。色块用主色，是全站唯一一处大面积主色 */
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; letter-spacing: -.01em;
  color: var(--text, #0f172a); text-decoration: none; white-space: nowrap;
}
.brand-icon {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--primary, #2563eb); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; letter-spacing: 0;
}

.navbar-links { display: flex; gap: 2px; flex: 1; justify-content: flex-start; margin-left: 8px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border-radius: var(--r-sm, 6px);
  color: var(--muted, #475569); font-size: 13.5px; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.nav-link:hover { background: var(--bg, #f8fafc); color: var(--text, #0f172a); text-decoration: none; }
.nav-link.active { background: var(--primary-soft, #eff6ff); color: var(--primary, #2563eb); font-weight: 600; }
.nav-link .nav-icon { width: 16px; height: 16px; flex: none; }
.nav-link .nav-icon svg { width: 100%; height: 100%; display: block; }

.navbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-sm, 6px);
  border: 1px solid transparent; background: transparent;
  color: var(--muted, #475569); cursor: pointer; position: relative;
  transition: background-color .15s, color .15s;
}
.nav-btn:hover { background: var(--bg, #f8fafc); color: var(--text, #0f172a); }
.nav-btn svg { width: 18px; height: 18px; }
.nav-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 8px; height: 8px; border-radius: 999px;
  background: var(--err, #b91c1c); color: #fff;
  font-size: 10px; line-height: 1; padding: 0;
}

.nav-menu-toggle, .nav-link:focus-visible, .nav-btn:focus-visible {
  outline-color: var(--primary, #2563eb);
}
.nav-menu-toggle:focus-visible, .nav-btn:focus-visible, .nav-link:focus-visible {
  outline: 2px solid var(--primary, #2563eb); outline-offset: 2px;
}

/* 手机：链接收进菜单。菜单是白色卡片，不再是半透明紫块 */
.nav-menu-toggle {
  display: none; border: 1px solid var(--line-strong, #cbd5e1);
  background: var(--panel, #fff); color: var(--text, #0f172a);
  border-radius: var(--r-sm, 6px);
  width: 40px; min-width: 40px; height: 40px;
  align-items: center; justify-content: center; cursor: pointer;
}
.nav-menu-toggle svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .unified-navbar { padding-top: env(safe-area-inset-top); }
  .navbar-container {
    height: 52px; min-height: 52px; gap: 8px;
    padding: 0 max(12px, env(safe-area-inset-left)) 0 max(12px, env(safe-area-inset-right));
  }
  .navbar-brand { min-width: 0; flex: 1 1 auto; }
  .navbar-brand .brand-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-menu-toggle { display: inline-flex; order: 3; }
  .navbar-links {
    display: none; position: absolute;
    top: calc(52px + env(safe-area-inset-top)); left: 12px; right: 12px;
    z-index: var(--z-chrome-pop, 45);
    padding: 6px; flex-direction: column; gap: 2px; margin: 0;
    border: 1px solid var(--line, #e2e8f0); border-radius: var(--r, 10px);
    background: var(--panel, #fff); box-shadow: var(--shadow-lg);
  }
  .navbar-links.is-open { display: flex; }
  .nav-link { min-height: 44px; padding: 0 12px; font-size: 14px; }
  .navbar-actions { flex: 0 0 auto; gap: 2px; }
  .nav-menu-toggle[aria-expanded="true"] { background: var(--primary-soft, #eff6ff); border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
}

/* AI 悬浮窗的样式在 ai_assistant.css（同一套 token），这里不再覆盖。 */

/* 右侧详情层。首屏只留一行结论，长文本进这里，避免整页往下堆。
   层级用 --z-overlay：盖住导航，仍低于图片查看器和提示条。 */
.sheet-back {
  position: fixed; inset: 0; z-index: var(--z-overlay, 1000);
  background: rgba(15, 23, 42, .45);
  display: flex; justify-content: flex-end;
}
.sheet-back[hidden] { display: none; }
.sheet {
  width: min(480px, 100%); height: 100%;
  background: var(--panel, #fff); color: var(--text, #0f172a);
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(15, 23, 42, .18));
  display: flex; flex-direction: column;
  animation: sheet-in .2s ease;
}
.sheet.sheet-wide { width: min(960px, 100%); }
@keyframes sheet-in { from { transform: translateX(16px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
}
.sheet-h {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line, #e2e8f0);
}
.sheet-h h2 {
  margin: 0; font-size: 16px; line-height: 1.35; flex: 1; min-width: 0;
  overflow-wrap: anywhere;
}
.sheet-x {
  flex: none; width: 44px; height: 44px; border-radius: var(--r-sm, 6px);
  border: 1px solid var(--line, #e2e8f0); background: var(--panel, #fff);
  color: var(--text, #0f172a); font-size: 20px; line-height: 1; cursor: pointer;
}
.sheet-x:focus-visible { outline: 2px solid var(--primary, #2563eb); outline-offset: 2px; }
.sheet-body {
  flex: 1; overflow: auto; padding: 16px 18px 28px;
  font-size: 14px; line-height: 1.6;
}
.sheet-body p { margin: 0 0 12px; }
.sheet-f {
  padding: 12px 16px; border-top: 1px solid var(--line, #e2e8f0);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.sheet-f a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: var(--r-sm, 6px); background: var(--primary, #2563eb); color: #fff;
  text-decoration: none; font-size: 14px; font-weight: 600;
}
.sheet-f a.ghost {
  background: var(--panel, #fff); color: var(--text, #0f172a);
  border: 1px solid var(--line-strong, #cbd5e1);
}
@media print {
  .sheet-back { display: none !important; }
  .sheet-source[hidden] { display: block !important; }
}
