/* ============================================================
 * service/base.css
 * 来源 app.css L1-L779 (基座/sidebar/brand) + L6283-L6400 (u-* 工具类)
 * ============================================================ */

/* ============================================================
 * PVE 静态原型公共样式
 * 基于 Tailwind CDN,这里只放 Tailwind 不便覆盖的细节
 * ============================================================ */

:root {
  --color-bg: #ffffff;
  --color-fg: #0f172a;
  --color-muted: #64748b;
  --color-muted-bg: #f1f5f9;
  --color-border: #e2e8f0;
  --color-primary: #2563eb;
  --color-primary-soft: rgba(37, 99, 235, 0.12);
  --color-destructive: #dc2626;
  --color-card: #ffffff;
  --color-sidebar: #fafafa;

  --stage-s1: #3b82f6;
  --stage-s2: #6366f1;
  --stage-s3: #8b5cf6;
  --stage-s4: #a855f7;
  --stage-s5: #d946ef;
  --stage-s6: #f97316;
  --stage-s7: #f59e0b;
  --stage-s8: #84cc16;
  --stage-s9: #10b981;
  --pve-sidebar-width: 242px;

  /* 键盘焦点环:仅 :focus-visible 命中(键盘 Tab)时显示 */
  --pve-focus-ring: 0 0 0 2px var(--color-primary-soft), 0 0 0 4px var(--color-primary);

  /* ============================================================
   * 重构 Phase A1：设计 token（仅追加，不替换）
   * 详见 pve-prd/REFACTOR_SPEC.md §2
   * ============================================================ */

  /* — 断点（CSS var 不能直接喂 @media，写在这里仅作为开发参考；
   *    实际 @media 仍写字面量，但要按这套标准断点。
   *    标 (sec) 的为次级断点，仅用于精修，新增样式优先用主断点）— */
  --bp-2xl:  1280px;       /* 大屏分栏 */
  --bp-xl:   1180px;       /* 桌面分栏 → 紧凑 */
  --bp-lg:   960px;        /* 中型平板 / 双栏 → 单栏过渡 */
  --bp-md:   860px;        /* 桌面 → 平板：双栏转单栏、stage 折叠 */
  --bp-sm:   768px;        /* 平板 → 平板竖屏 / 大屏手机：sidebar 切顶栏、表单字号锁 16 */
  --bp-sm2:  720px;        /* (sec) iPad 横屏精修 */
  --bp-xs:   640px;        /* 大屏手机 → 标准手机 */
  --bp-2xs:  480px;        /* 手机：紧凑布局 */
  --bp-3xs:  390px;        /* (sec) iPhone 12/13/14/15 标准 */
  --bp-4xs:  380px;        /* 极窄手机：再降字号 */
  --bp-5xs:  360px;        /* (sec) Android 小屏精修 */

  /* — z-index 分层（命名按数值层级 z10/z20/…，加语义注释；
   *    与现网真实层级一致，重构 Phase B1 仅做语义替换不改顺序）— */
  --z-base:             0;
  --z-sticky:          10;   /* sticky 工具条 / filter bar / pve-page-header 自身 */
  --z-overlay:         20;   /* pve-main-shell::before（切页覆盖层） */
  --z-stage-toast:     30;   /* stage-transition-toast */
  --z-modal:           40;   /* modal-backdrop */
  --z-dropdown:        50;   /* dropdown-menu / team-switch / exec-drawer */
  --z-mobile-backdrop: 55;   /* pve-mobile-backdrop */
  --z-sidebar:         60;   /* desktop / mobile 顶栏；team-switch-menu 同层 */
  --z-pager-mobile:    65;   /* 移动端分页器置顶覆盖（!important） */
  --z-sidebar-popover: 70;   /* sidebar-account-menu */
  --z-toast:           80;
  --z-confirm:         90;
  --z-mobile-sidebar: 1000;  /* sidebar-team-mobile-menu，全局最高 */

  /* — 间距阶梯（4 倍数） — */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* — 圆角 — */
  --r-xs:   6px;
  --r-sm:   8px;
  --r-md:   10px;
  --r-lg:   12px;
  --r-xl:   14px;
  --r-2xl:  16px;
  --r-pill: 999px;

  /* — 阴影（按层级语义） — */
  --shadow-card:    0 10px 22px -22px rgba(15, 23, 42, 0.18);
  --shadow-sticky:  0 6px 12px -12px rgba(15, 23, 42, 0.18);
  --shadow-popover: 0 12px 28px -16px rgba(15, 23, 42, 0.24);
  --shadow-modal:   0 24px 48px -24px rgba(15, 23, 42, 0.32);
  --shadow-soft:    0 1px 2px rgba(15, 23, 42, 0.06);

  /* — 玻璃感模糊 — */
  --blur-sticky: saturate(180%) blur(14px);
  --blur-card:   saturate(160%) blur(8px);

  /* — 过渡缓动 — */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 0.15s var(--ease-out);
  --t-base: 0.25s var(--ease-out);
  --t-slow: 0.5s  var(--ease-out);

  /* — 页头实时高度（由 app.js → syncPageHeaderHeight() 写入 main 元素覆盖） — */
  --page-header-h: 92px;
}

/* 全局焦点环兜底::where() 优先级为 0,任何已有的更具体规则均可覆盖,不破坏既有视觉 */
:where(button, a, input, select, textarea, [role="button"], [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--pve-focus-ring);
  border-radius: inherit;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--color-fg);
  background: var(--color-bg);
  font-size: 16.8px;
  /* iOS/Android 横竖屏切换时不要自动放大字号 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* iOS Safari 地址栏伸缩时让 100% 高度更稳定 */
html {
  height: -webkit-fill-available;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  /* 全局关闭点击灰色高亮，按钮自定义 :active 反馈 */
  -webkit-tap-highlight-color: transparent;
}

/* iOS Safari 聚焦输入框时若字号 <16px 会强制放大整页；
   在移动端把表单元素提到 16px，桌面端不受影响 */
@media (max-width: 768px) {
  input,
  textarea,
  select {
    font-size: 16px;
  }
}

.pve-main-shell {
  position: relative;
}

.pve-main-shell::before {
  content: '';
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--pve-sidebar-width, 242px);
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.72) 0%, rgba(255, 255, 255, 0.92) 100%),
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.46) 50%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, left 0.22s ease;
  z-index: var(--z-overlay);
}

html.pve-nav-entering .pve-main-shell::before,
html.pve-nav-leaving .pve-main-shell::before {
  opacity: 1;
}

.pve-main-shell > .pve-main-layer-soft,
.pve-main-shell > .pve-main-layer-content {
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease;
  will-change: opacity, transform, filter;
}

.pve-stagger-item {
  transition: opacity 0.24s ease, transform 0.24s ease, filter 0.24s ease;
  transition-delay: calc(var(--pve-stagger-index, 0) * 28ms);
  will-change: opacity, transform, filter;
}

html.pve-nav-entering .pve-main-shell > .pve-main-layer-soft,
html.pve-nav-leaving .pve-main-shell > .pve-main-layer-soft {
  opacity: 0.94;
  transform: translateY(2px);
  filter: saturate(0.985);
}

html.pve-nav-entering .pve-main-shell > .pve-main-layer-content,
html.pve-nav-leaving .pve-main-shell > .pve-main-layer-content {
  opacity: 0.78;
  transform: translateY(8px);
  filter: saturate(0.95);
}

html.pve-nav-entering .pve-stagger-item {
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  filter: saturate(0.92);
}

html.pve-nav-leaving .pve-main-shell {
  cursor: progress;
}

.pve-sidebar-shell,
#pve-sidebar,
.pve-mobile-trigger,
.pve-mobile-backdrop,
#pve-toast-host {
  transform: none !important;
  filter: none !important;
}

/* 桌面端:外层 #pve-sidebar 容器与 --pve-sidebar-width 联动,
 * 保证收起态 (.pve-sidebar-shell.collapsed → 48px) 时外层 flex item 同步缩窄,
 * 让兄弟 <main class="flex-1"> 立刻吃掉剩余空间,避免中间出现空白条带。
 *
 * 关键:用 flex 简写而不是 width。
 *   - <main> 是 .flex-1 即 flex: 1 1 0%,会去吃剩余空间;
 *   - 但 #pve-sidebar 自身没显式 flex,浏览器默认 flex: 0 1 auto,main size = auto
 *     (即 max-content),会被里面的 .pve-sidebar-shell 子元素撑成 ~242px,
 *     即便 .collapsed 把 aside 缩到 48px,外层 div 仍按 max-content 卡在原宽度,
 *     main 永远只能拿 (100% - 242px) 的剩余,中间出现空白带。
 *   - flex: 0 0 var(--pve-sidebar-width) 把 main size 锁成变量值,且禁止伸缩,
 *     PVE.applySidebarState 改变量时,这层立刻同步。
 *
 * 移动端 mobile.css 的 max-width:768px 媒体查询会用 position:fixed 覆盖,不受影响。 */
#pve-sidebar {
  flex: 0 0 var(--pve-sidebar-width, 242px);
  width: var(--pve-sidebar-width, 242px);
  min-width: 0;
  transition: flex-basis 0.22s ease, width 0.22s ease;
}

/* 切换页面瞬间(异步 renderSidebar 尚未完成)预占侧边栏宽度,避免主区横向跳动 */
#pve-sidebar:empty {
  flex: 0 0 var(--pve-sidebar-width, 242px);
  width: var(--pve-sidebar-width, 242px);
  height: 100vh; /* 旧浏览器兜底 */
  height: 100dvh;
  background: linear-gradient(180deg, #f5f6fa 0%, #eff1f6 100%);
  border-right: 1px solid #e5e7eb;
}

@media (max-width: 768px) {
  .pve-main-shell::before {
    left: 0;
  }
}

/* 关闭多种滚动条,只保留主区 */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  scrollbar-width: none;
}

/* 通用骨架 */
.skeleton-row {
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 自定义阶段色 utility */
.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 9999px;
  color: white;
}
.stage-s1 { background: var(--stage-s1); }
.stage-s2 { background: var(--stage-s2); }
.stage-s3 { background: var(--stage-s3); }
.stage-s4 { background: var(--stage-s4); }
.stage-s5 { background: var(--stage-s5); }
.stage-s6 { background: var(--stage-s6); }
.stage-s7 { background: var(--stage-s7); }
.stage-s8 { background: var(--stage-s8); }
.stage-s9 { background: var(--stage-s9); }

.stage-soft-s1 { background: rgba(59, 130, 246, 0.12); color: var(--stage-s1); }
.stage-soft-s2 { background: rgba(99, 102, 241, 0.12); color: var(--stage-s2); }
.stage-soft-s3 { background: rgba(139, 92, 246, 0.12); color: var(--stage-s3); }
.stage-soft-s4 { background: rgba(168, 85, 247, 0.12); color: var(--stage-s4); }
.stage-soft-s5 { background: rgba(217, 70, 239, 0.12); color: var(--stage-s5); }
.stage-soft-s6 { background: rgba(249, 115, 22, 0.12); color: var(--stage-s6); }
.stage-soft-s7 { background: rgba(245, 158, 11, 0.12); color: var(--stage-s7); }
.stage-soft-s8 { background: rgba(132, 204, 22, 0.12); color: var(--stage-s8); }
.stage-soft-s9 { background: rgba(16, 185, 129, 0.12); color: var(--stage-s9); }

/* 侧边栏导航选中态 */
.nav-active {
  background: #dde0e9;
  color: #020617;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.pve-sidebar-shell {
  width: 242px;
  flex-shrink: 0;
  height: 100vh; /* 旧浏览器兜底 */
  height: 100dvh;
  border-right: 1px solid #e5e7eb;
  background: linear-gradient(180deg, #f5f6fa 0%, #eff1f6 100%);
  display: flex;
  flex-direction: column;
  transition: width 0.22s ease;
}

.pve-sidebar-scroll {
  flex: 1;
  overflow: auto;
  padding: 12px 10px 24px;
}

.sidebar-brand-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 12px 18px;
}

.sidebar-brand {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.sidebar-brand-mark {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  flex-shrink: 0;
  background: linear-gradient(to bottom right, #3B82F6, #60A5FA);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.sidebar-brand-mark::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 5px;
  width: 11px;
  height: 11px;
  border-radius: 9999px;
  border: 2px solid rgba(255, 255, 255, 0.98);
  border-right-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(-28deg);
}

.sidebar-brand-mark::after {
  content: '';
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.98);
}

.sidebar-brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand-title {
  font-size: 21px;
  line-height: 1;
  font-weight: 800;
  color: #0a1220;
  letter-spacing: -0.03em;
}

.sidebar-brand-subtitle {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.2;
  color: #7f90a8;
}

.sidebar-brand-toggle {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.sidebar-brand-toggle:hover {
  background: rgba(226, 232, 240, 0.95);
  color: #111827;
}

.sidebar-top-action {
  padding-bottom: 16px;
}

.sidebar-new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.sidebar-new-chat:hover {
  background: #f8fafc;
  border-color: #dbe2ea;
  transform: translateY(-1px);
}

.sidebar-block {
  margin-top: 22px;
}

.sidebar-block > .sidebar-section-title {
  display: block;
  padding: 0 12px;
  margin-bottom: 12px;
}

.sidebar-section-title {
  font-size: 11px;
  line-height: 1.2;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #111827;
  transition: background 0.18s ease, color 0.18s ease;
}

.sidebar-nav-item:hover {
  background: rgba(15, 23, 42, 0.045);
}

.sidebar-nav-item.nav-active {
  background: rgba(59, 130, 246, 0.10);
  color: #1d4ed8;
}

.sidebar-nav-item.nav-active::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, #3b82f6, #6366f1);
}

.sidebar-nav-item.nav-active .sidebar-nav-icon-wrap {
  color: #1d4ed8;
}

.sidebar-nav-item.nav-active .sidebar-nav-meta {
  color: #1d4ed8;
  opacity: 0.65;
}

.sidebar-nav-item-sub {
  padding-left: 28px;
}

.sidebar-nav-item-sub .sidebar-nav-icon-wrap {
  color: #94a3b8;
}

.sidebar-nav-item-sub .sidebar-nav-label {
  font-weight: 500;
  color: #475569;
}

.sidebar-nav-icon-wrap {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  flex-shrink: 0;
}

.sidebar-nav-item.nav-active .sidebar-nav-icon-wrap {
  color: #1d4ed8;
}

.sidebar-nav-icon {
  width: 18px;
  height: 18px;
}

.sidebar-nav-copy {
  flex: 1;
  min-width: 0;
}

.sidebar-nav-label-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.sidebar-nav-label {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
  color: inherit;
}

.sidebar-nav-item.nav-active .sidebar-nav-label {
  font-weight: 700;
}

.sidebar-nav-meta {
  font-size: 10.5px;
  color: #b8c1cc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.sidebar-hint-card {
  margin-top: 12px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.72);
}

.sidebar-nav-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 4px 0;
  padding-left: 18px;
  position: relative;
}

.sidebar-nav-children::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: rgba(203, 213, 225, 0.7);
}

.sidebar-nav-subitem {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px 10px 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  color: #475569;
  position: relative;
}

.sidebar-nav-subitem:hover {
  background: rgba(15, 23, 42, 0.045);
  color: #0f172a;
}

.sidebar-nav-subitem.nav-active {
  background: rgba(59, 130, 246, 0.10);
  color: #1d4ed8;
  font-weight: 600;
}

.sidebar-nav-subitem-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.sidebar-nav-subitem-pin {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: #2563eb;
  transform: rotate(35deg);
}

.sidebar-nav-subitem-pinned {
  background: rgba(59, 130, 246, 0.08);
  border: 1px dashed rgba(59, 130, 246, 0.35);
  margin-bottom: 4px;
}

.sidebar-nav-subitem-pinned.nav-active {
  background: rgba(59, 130, 246, 0.14);
  border-style: solid;
  border-color: rgba(59, 130, 246, 0.55);
}

.sidebar-nav-subitem-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.sidebar-nav-subitem-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav-subitem-more {
  color: #94a3b8;
  font-style: italic;
}
.sidebar-nav-subitem-more:hover {
  color: #475569;
  background: rgba(148, 163, 184, 0.08);
}
.sidebar-nav-subitem-more-icon {
  width: 14px;
  height: 14px;
  color: currentColor;
  flex-shrink: 0;
}

.team-switch {
  position: relative;
  display: inline-flex;
  z-index: var(--z-dropdown);
}
.team-switch-trigger {
  cursor: pointer;
  border: none;
  background: transparent;
}
.team-switch-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: var(--z-sidebar);
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 14px 30px -18px rgba(15, 23, 42, 0.35);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
}
.team-switch-menu.open {
  display: flex;
}
.team-switch-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}
.team-switch-option:hover {
  background: #f1f5f9;
}
.team-switch-option.is-active {
  background: #eff6ff;
}
.team-switch-option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.team-switch-option.is-disabled:hover {
  background: transparent;
}
.team-switch-empty {
  padding: 12px 8px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}
.team-switch-option-avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.team-switch-option-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.team-switch-option-name {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  line-height: 1.2;
}
.team-switch-option-meta {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.2;
  margin-top: 2px;
}

.other-history-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 6px;
}
.other-history-toggle:hover {
  background: #f8fafc;
}

.pve-sidebar-shell.collapsed .sidebar-nav-children {
  display: none;
}


/* ============================================================
 * 8. UTILITIES（Phase A2 追加，详见 pve-prd/REFACTOR_SPEC.md §7）
 * 通用工具类，命名空间 `u-*`。
 * 设计原则：
 *   - 不跟既有 .pve-* / 模块层 class 重名
 *   - 不依赖具体页面结构
 *   - 单一职责，可与 Tailwind 工具类混用
 * ============================================================ */

/* — 横向滚动容器（移动端 tab 条 / chip 组 / filter 行通用） — */
.u-scroll-x {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.u-scroll-x::-webkit-scrollbar { display: none; }
.u-scroll-x > * {
  flex: 0 0 auto;
  scroll-snap-align: start;
  white-space: nowrap;
}
/* 横滑容器内"钉左侧"的元素（如 workflow 的"全部"tab） */
.u-scroll-x > .u-is-pinned,
.u-scroll-x > .is-pinned {
  position: sticky;
  left: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 8px 0 12px -10px rgba(15, 23, 42, 0.18);
}

/* — 纵向滚动容器（细滚动条 / 隐藏滚动条 alias） — */
.u-scroll-y { overflow-y: auto; overflow-x: hidden; }
.u-scroll-y,
.u-scroll-y * { scrollbar-width: thin; }
.u-no-scrollbar { scrollbar-width: none; }
.u-no-scrollbar::-webkit-scrollbar { display: none; }

/* — sticky 吸顶 / 吸底（统一三件套，见 §5.2） — */
.u-sticky-top {
  position: sticky;
  top: var(--page-header-h, 92px);
  z-index: var(--z-sticky);
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: var(--blur-sticky);
  backdrop-filter: var(--blur-sticky);
  box-shadow: var(--shadow-sticky);
}
.u-sticky-bottom {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: var(--blur-sticky);
  backdrop-filter: var(--blur-sticky);
  box-shadow: 0 -6px 12px -12px rgba(15, 23, 42, 0.18);
}

/* — 居中三连 — */
.u-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.u-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.u-inline-center {
  display: inline-flex;
  align-items: center;
}

/* — 文本截断 — */
.u-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.u-truncate-2,
.u-truncate-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.u-truncate-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.u-truncate-3 { -webkit-line-clamp: 3; line-clamp: 3; }

/* — 移动端点击高亮清除 — */
.u-no-tap-highlight {
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

/* — 全屏定位（modal/drawer 自定义场景用） — */
.u-fixed-cover {
  position: fixed;
  inset: 0;
}

/* — 状态类（约定俗成，与既有 .active/.open/.collapsed 共存） — */
.is-disabled,
[aria-disabled="true"].is-disabled {
  pointer-events: none;
  opacity: 0.5;
}
.is-loading {
  cursor: progress;
  opacity: 0.7;
}

/* ============================================================
 * Sidebar 视觉精修层(覆盖原规则的关键属性)
 *   - 间距、字重、色阶、active 视觉一致性
 *   - 团队方向区块层级
 *   - 底部账户区
 * ============================================================ */

/* 整体背景:更细腻的双色系,降低与右侧主区的对比 */
.pve-sidebar-shell {
  background: linear-gradient(180deg, #f6f7fb 0%, #eef0f6 100%);
  border-right-color: #e6e9ef;
}
.pve-sidebar-scroll {
  padding: 10px 10px 20px;
}

/* 侧边栏右侧滚动条：PC 端比项目通用的 .thin-scroll(8px) 再细一档(6px)，
   颜色与 .thin-scroll 保持一致(#cbd5e1)，hover 时加深，未滚动时淡出 */
@media (min-width: 769px) {
  .pve-sidebar-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.55) transparent;
  }
  .pve-sidebar-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  .pve-sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
  }
  .pve-sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
  }
  .pve-sidebar-scroll:hover::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.65);
  }
  .pve-sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: #64748b;
  }
}

/* Brand 区:压缩上下空间,副标题字距更稳 */
.sidebar-brand-shell {
  padding: 14px 12px 16px;
}
.sidebar-brand-title {
  font-size: 19px;
  letter-spacing: -0.02em;
}
.sidebar-brand-subtitle {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: #8a99b3;
}
.sidebar-brand-toggle:hover {
  background: rgba(15, 23, 42, 0.05);
  color: #0f172a;
}

/* "新对话"按钮:从浅卡片升级为品牌色 CTA,作为主行动锚点 */
.sidebar-top-action {
  padding-bottom: 14px;
}
.sidebar-new-chat {
  min-height: 40px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: #ffffff;
  box-shadow: 0 6px 14px -8px rgba(59, 130, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  letter-spacing: 0.01em;
}
.sidebar-new-chat:hover {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  border-color: transparent;
  box-shadow: 0 10px 22px -10px rgba(59, 130, 246, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.sidebar-new-chat > i {
  opacity: 0.95;
}

/* 分区标题:更克制的灰阶 + 字距,用于和 nav 拉开层级 */
.sidebar-section-title {
  font-size: 10.5px;
  color: #9aa6ba;
  letter-spacing: 0.12em;
}
.sidebar-block {
  margin-top: 18px;
}
.sidebar-block > .sidebar-section-title {
  margin-bottom: 8px;
  padding: 0 14px;
}

/* 导航项:间距更紧 + 图标包更轻盈 + active 用更柔和的蓝 */
.sidebar-nav-list {
  gap: 2px;
}
.sidebar-nav-item {
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #1f2937;
  font-weight: 500;
}
.sidebar-nav-item:hover {
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
}
.sidebar-nav-item.nav-active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.06) 100%);
  color: #1d4ed8;
  font-weight: 600;
}
.sidebar-nav-item.nav-active::before {
  left: 3px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3b82f6, #6366f1);
  box-shadow: 0 2px 6px -1px rgba(59, 130, 246, 0.4);
}
.sidebar-nav-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #64748b;
}
.sidebar-nav-item:hover .sidebar-nav-icon-wrap {
  color: #0f172a;
}
.sidebar-nav-item.nav-active .sidebar-nav-icon-wrap {
  background: rgba(59, 130, 246, 0.14);
  color: #2563eb;
}
.sidebar-nav-icon {
  width: 16px;
  height: 16px;
}
.sidebar-nav-label {
  font-size: 13.5px;
}
.sidebar-nav-meta {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: #b0b9c9;
  text-transform: uppercase;
  font-weight: 600;
}
.sidebar-nav-item.nav-active .sidebar-nav-meta {
  color: #6366f1;
}

/* 子项(历史对话):更紧凑、更柔的 hover */
.sidebar-nav-children::before {
  background: rgba(15, 23, 42, 0.08);
}
.sidebar-nav-subitem {
  font-size: 12.5px;
  color: #64748b;
  border-radius: 8px;
}
.sidebar-nav-subitem:hover {
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
}
.sidebar-nav-subitem.nav-active {
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
  font-weight: 500;
}
.sidebar-nav-subitem-dot {
  box-shadow: 0 0 0 2px #ffffff;
}

