﻿/* ==========================================================================
   Synapse5 Console · base.css
   基础层：设计令牌 / reset / 排版 / 应用外壳（侧栏+顶栏+移动底栏）/ 布局 / 工具类 / 打印
   组件层见 components.css；本文件不写业务组件。
   兼容基线：iOS Safari 16+ / HarmonyOS 7 ArkWeb / Android Chrome 110+ / Edge
   ========================================================================== */

/* --------------------------------------------------------------------------
   1) 设计令牌
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* 中性 9 阶 */
  --n-100: #edf3f8;
  --n-200: #dde8f1;
  --n-300: #c7d7e4;
  --n-400: #a3b8c8;
  --n-500: #7b93a5;
  --n-600: #587689;
  --n-700: #3a5265;
  --n-800: #163548;
  --n-900: #0a2032;

  /* 表面与文本 */
  --bg: var(--n-100);
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --surface-3: var(--n-100);
  --surface-inset: #eef4f8;
  --text: var(--n-800);
  --ink: var(--n-900);
  --muted: #4d667a; /* 深于 n-600，保证 --muted on --bg ≥ 5:1 */
  --faint: #536d78; /* 小字号辅助文字，≥4.5:1 on --bg */

  /* 线与描边 */
  --line: #d3e2ec;
  --line-strong: #b9d0dd;

  /* 主色与语义色 */
  --brand: #0c6b78;
  --brand-hover: #0a5a66;
  --brand-active: #084c56;
  --brand-soft: #e6f4f6;
  --brand-fg: #ffffff;
  --coral: #c2410c;
  --success: #0f766e;
  --warning: #8a5306;
  --danger: #b42318;
  --info: #0369a1;
  --success-bg: #d9f2ee;
  --warning-bg: #fdf0d0;
  --danger-bg: #fee4e2;
  --info-bg: #dbeefb;

  /* 字体 */
  --font: "HarmonyOS Sans SC", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei",
    "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;

  /* 字号阶 */
  --fs-12: 0.75rem;
  --fs-13: 0.8125rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;

  /* 间距（4 基准） */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  /* 圆角 */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-full: 999px;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(8, 38, 58, 0.06);
  --sh-2: 0 4px 16px -8px rgba(8, 38, 58, 0.18);
  --sh-3: 0 16px 48px -24px rgba(5, 30, 50, 0.45);

  /* 动效 */
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 260ms;
  --ease-1: cubic-bezier(0.2, 0.8, 0.3, 1);
  --ease-2: cubic-bezier(0.4, 0, 0.2, 1);

  /* 层级 */
  --z-content: 0;
  --z-sticky-th: 10;
  --z-toolbar: 20;
  --z-sidebar: 30;
  --z-topbar: 40;
  --z-scrim: 50;
  --z-drawer: 60;
  --z-tabbar: 70;
  --z-toast: 80;
  --z-modal: 90;
  --z-skip: 100;

  /* 外壳尺寸（同时保留旧变量名，便于旧规则/内联样式过渡） */
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;
  --tabbar-h: 56px;
  --gutter: 32px;
  --content-max: 1440px;
  --right-col: 280px;

  /* 旧变量别名（部分历史内联样式/脚本仍在用） */
  --maxw: 1440px;
  --header-h: 56px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --n-100: #eaf6fb;
  --n-200: #c4dbe7;
  --n-300: #93b2c4;
  --n-400: #2a5470;
  --n-500: #1d4058;
  --n-600: #163349;
  --n-700: #0f293d;
  --n-800: #0b2133;
  --n-900: #061624;

  --bg: var(--n-900);
  --surface: var(--n-800);
  --surface-2: var(--n-700);
  --surface-3: #143349;
  --surface-inset: #0b2133;
  --text: #d3e7f0;
  --ink: var(--n-100);
  --muted: var(--n-300);
  --faint: #7f9db0;

  --line: #1c3f56;
  --line-strong: #26536e;

  --brand: #4fd1c5;
  --brand-hover: #7ee8dd;
  --brand-active: #a7f3ec;
  --brand-soft: #0c3b3a;
  --brand-fg: #061624;
  --coral: #fdba74;
  --success: #4adebd;
  --warning: #fbbf24;
  --danger: #fca5a5;
  --info: #7dd3fc;
  --success-bg: #0c3b3a;
  --warning-bg: #3a2c0d;
  --danger-bg: #421a1a;
  --info-bg: #0c2f47;

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.25);
  --sh-2: 0 4px 16px -8px rgba(0, 0, 0, 0.4);
  --sh-3: 0 16px 48px -24px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   2) reset / 基础
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-16);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

img {
  height: auto;
}

svg {
  display: block;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--brand);
  text-decoration: none;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}

code,
kbd,
samp,
pre {
  font-family: var(--mono);
  font-size: 0.92em;
}

code {
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--ink);
  word-break: break-word;
}

pre {
  overflow: auto;
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--surface-3);
}

hr {
  height: 1px;
  margin: var(--sp-5) 0;
  border: 0;
  background: var(--line);
}

ul,
ol {
  margin: 0;
  padding: 0;
}

li {
  margin: 0;
}

strong,
b {
  font-weight: 650;
  color: var(--ink);
}

small {
  font-size: var(--fs-12);
}

time {
  font-variant-numeric: tabular-nums;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--brand);
  color: var(--brand-fg);
}

/* 焦点环：任何可聚焦元素都有可见环（键盘用户） */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* 滚动条（桌面 Chromium/Edge；Safari 用默认） */
@media (min-width: 1024px) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--n-400) transparent;
  }

  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  ::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: var(--r-full);
    background: var(--n-400);
    background-clip: padding-box;
  }
}

/* --------------------------------------------------------------------------
   3) 无障碍：跳转链接 / 屏幕阅读器
   -------------------------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: var(--z-skip);
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--surface);
  font-size: var(--fs-14);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--dur-1) var(--ease-1);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--surface);
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   4) 应用外壳：侧栏 + 顶栏 + 内容 + 移动底栏
   -------------------------------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.app-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---- 侧栏 ---- */
.sidebar {
  position: sticky;
  top: 0;
  z-index: var(--z-sidebar);
  display: flex;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 16px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.sidebar__brand:hover {
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
}

.brand-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: var(--fs-14);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-text small {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-5 {
  color: var(--brand);
}

/* 导航 */
.sidebar .site-nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-3) 8px var(--sp-4);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nav-group {
  margin: var(--sp-4) 0 var(--sp-1);
  padding: 0 10px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-group:first-child {
  margin-top: var(--sp-1);
}

.site-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-md);
  color: var(--n-700);
  font-size: var(--fs-14);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--dur-1) var(--ease-1), color var(--dur-1) var(--ease-1);
}

[data-theme="dark"] .site-nav a {
  color: var(--n-200);
}

.site-nav a svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: 0.85;
}

.site-nav a:hover {
  background: var(--surface-3);
  color: var(--ink);
  text-decoration: none;
}

.site-nav a:active {
  background: var(--surface-inset);
}

.site-nav a[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 650;
}

.site-nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -8px;
  width: 2px;
  border-radius: var(--r-full);
  background: var(--brand);
}

/* 侧栏底部 */
.sidebar__foot {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) 12px calc(var(--sp-3) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}

.sidebar__foot .status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--success);
  vertical-align: middle;
}

.sidebar__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar__version {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

/* ---- 顶栏 ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(8, 38, 58, 0.02);
}

[data-theme="dark"] .topbar {
  box-shadow: none;
}

.topbar__lead {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--sp-2);
}

.topbar__title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.topbar__page {
  display: none;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--fs-14);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: clamp(200px, 26vw, 320px);
  height: 34px;
  margin-left: var(--sp-4);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--faint);
  font-size: var(--fs-13);
}

.topbar__search kbd {
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  font-size: 10.5px;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
  flex: 0 0 auto;
}

.icon-btn {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  transition: background var(--dur-1) var(--ease-1), color var(--dur-1) var(--ease-1);
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* 主题按钮：沿用 app.js 的 .theme-toggle 类 */
.theme-toggle {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  transition: background var(--dur-1) var(--ease-1), color var(--dur-1) var(--ease-1);
}

.theme-toggle:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-moon {
  display: none;
}

.theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

/* 用户区（未识别时显示占位） */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-13);
  max-width: 190px;
}

.avatar {
  display: inline-flex;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-fg);
  font-size: var(--fs-12);
  font-weight: 700;
}

.user-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 顶栏状态条（企业感：关键状态一眼可见） */
.topbar__status {
  display: none;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
  color: var(--muted);
  font-size: var(--fs-12);
}

.topbar__status .status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--success);
}

/* 移动端汉堡 */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  margin-left: -8px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
}

.nav-toggle:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.nav-toggle__bars,
.nav-toggle .bars {
  position: relative;
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after,
.nav-toggle .bars::before,
.nav-toggle .bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.nav-toggle__bars::before,
.nav-toggle .bars::before {
  top: -6px;
}

.nav-toggle__bars::after,
.nav-toggle .bars::after {
  top: 6px;
}

/* 侧栏折叠（桌面按钮切换；app.js 写 <html data-sidebar="collapsed">） */
.sidebar-collapse {
  display: inline-flex;
}

[data-sidebar="collapsed"] .app-shell {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}

[data-sidebar="collapsed"] .sidebar .brand-text,
[data-sidebar="collapsed"] .sidebar .nav-group,
[data-sidebar="collapsed"] .sidebar__meta span:not(.status-dot),
[data-sidebar="collapsed"] .sidebar .site-nav a span {
  display: none;
}

[data-sidebar="collapsed"] .sidebar .site-nav a {
  justify-content: center;
  padding: 0;
}

[data-sidebar="collapsed"] .sidebar__brand {
  justify-content: center;
  padding: 0;
}

/* ---- 内容区 ---- */
.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-6) var(--sp-7);
  min-width: 0;
}

/* 兼容旧页面里的 .container 嵌套 */
.page > .container,
.page .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* ---- 页脚 ---- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 14px var(--sp-6);
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  color: var(--muted);
  font-size: 11.5px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-brand svg {
  width: 18px;
  height: 18px;
  border-radius: 5px;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.footer-meta p {
  margin: 0;
}

/* ---- 移动端底栏 ---- */
.mobile-tabs {
  display: none;
}

.tabbar {
  display: none;
}

/* ---- 遮罩（移动抽屉） ---- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-scrim);
  background: rgba(5, 30, 50, 0.45);
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease-2);
}

.scrim[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   5) 响应式外壳
   断点：<480 手机 / 480–759 大手机 / 760–1023 平板 / 1024–1279 折叠侧栏 / ≥1280 展开
   -------------------------------------------------------------------------- */
@media (max-width: 1439px) {
  :root {
    --gutter: 24px;
  }

  .page {
    padding: var(--sp-4) var(--sp-5) var(--sp-6);
  }
}

@media (max-width: 1279px) {
  .app-shell {
    grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
  }

  .sidebar .brand-text,
  .sidebar .nav-group,
  .sidebar .site-nav a span,
  .sidebar__meta .status-text {
    display: none;
  }

  .sidebar .site-nav a {
    justify-content: center;
    padding: 0;
  }

  .sidebar__brand {
    justify-content: center;
    padding: 0;
  }

  .topbar__search {
    display: none;
  }
}

@media (max-width: 1023px) {
  :root {
    --gutter: 16px;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-drawer);
    width: min(280px, 84vw);
    height: 100vh;
    height: 100dvh;
    border-right: 1px solid var(--line);
    box-shadow: var(--sh-3);
    transform: translateX(-100%);
    transition: transform var(--dur-3) var(--ease-2);
    will-change: transform;
  }

  .sidebar .brand-text,
  .sidebar .nav-group,
  .sidebar .site-nav a span {
    display: flex;
  }

  .sidebar .site-nav a {
    justify-content: flex-start;
    padding: 0 10px;
  }

  .sidebar__brand {
    justify-content: flex-start;
    padding: 0 16px;
  }

  .app-shell.nav-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.nav-open .scrim {
    display: block;
    opacity: 1;
  }

  .sidebar-collapse {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .topbar {
    padding: 0 var(--sp-4);
    padding-top: env(safe-area-inset-top);
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
  }

  .topbar__page {
    display: block;
  }

  .breadcrumb {
    display: none;
  }

  .topbar__status {
    display: none;
  }

  .page {
    padding: var(--sp-4) var(--sp-4) calc(var(--tabbar-h) + var(--sp-6) + env(safe-area-inset-bottom));
  }

  .site-footer {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  }

  .footer-inner {
    padding: 12px var(--sp-4);
  }

  .footer-meta {
    display: none;
  }

  /* 移动端底部 tabbar */
  .mobile-tabs,
  .tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-tabbar);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-tabs a,
  .tabbar a {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: 10.5px;
    text-decoration: none;
  }

  .mobile-tabs a svg,
  .tabbar a svg {
    width: 21px;
    height: 21px;
  }

  .mobile-tabs a[aria-current="page"],
  .tabbar a[aria-current="page"] {
    color: var(--brand);
    font-weight: 650;
  }

  .mobile-tabs a[aria-current="page"]::before,
  .tabbar a[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 22px;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--brand);
    transform: translateX(-50%);
  }
}

@media (max-width: 479px) {
  .page {
    padding: var(--sp-3) var(--sp-3) calc(var(--tabbar-h) + var(--sp-5) + env(safe-area-inset-bottom));
  }

  .user-chip__name {
    display: none;
  }

  .user-chip {
    padding-right: 4px;
  }
}

/* 横屏手机：底栏压缩，只留图标 */
@media (max-width: 1023px) and (max-height: 480px) and (orientation: landscape) {
  :root {
    --tabbar-h: 48px;
  }

  .mobile-tabs a,
  .tabbar a {
    font-size: 0;
    gap: 0;
  }
}

/* --------------------------------------------------------------------------
   6) 面包屑 / 页头（外壳级）
   -------------------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: var(--fs-13);
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--line-strong);
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--ink);
}

.breadcrumb li[aria-current="page"] {
  color: var(--ink);
  font-weight: 650;
}

/* 页头（内容区第一块） */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin: 0 0 var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
}

.page-head__main {
  min-width: 0;
}

.page-head__eyebrow {
  margin: 0 0 4px;
  color: var(--faint);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.page-head h1,
.page-head__title {
  margin: 0;
  font-size: var(--fs-24);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-head__desc {
  max-width: 60ch;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--fs-14);
}

.page-head__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

@media (max-width: 760px) {
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-3);
  }

  .page-head__actions {
    width: 100%;
  }

  .page-head__actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .page-head h1,
  .page-head__title {
    font-size: var(--fs-20);
  }
}

/* --------------------------------------------------------------------------
   7) 工具类
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.stack--tight {
  gap: var(--sp-2);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.grid {
  display: grid;
  gap: var(--sp-5);
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid--sidebar {
  grid-template-columns: minmax(0, 1fr) var(--right-col);
  align-items: start;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-5);
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
}

.muted {
  color: var(--muted);
}

.faint {
  color: var(--faint);
}

.num {
  font-variant-numeric: tabular-nums;
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spacer {
  flex: 1 1 auto;
}

.divider {
  height: 1px;
  border: 0;
  background: var(--line);
}

.text-sm {
  font-size: var(--fs-13);
}

.text-xs {
  font-size: var(--fs-12);
}

.hidden,
[hidden] {
  display: none !important;
}

@media (max-width: 1023px) {
  .grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid--sidebar {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .grid--2,
  .grid--3,
  .two-col,
  .three-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid {
    gap: var(--sp-4);
  }
}

/* --------------------------------------------------------------------------
   8) 公开页（start.html）：无侧栏的轻外壳
   -------------------------------------------------------------------------- */
.app-shell--public {
  display: block;
}

.public-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  background:
    radial-gradient(1200px 400px at 20% -10%, var(--brand-soft), transparent 60%),
    var(--bg);
}

.public-topbar {
  display: flex;
  height: var(--topbar-h);
  align-items: center;
  gap: 12px;
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.public-main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--sp-7) var(--sp-5);
  flex: 1 1 auto;
}

.public-foot {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-12);
  text-align: center;
}

@media (max-width: 760px) {
  .public-main {
    padding: var(--sp-5) var(--sp-4);
  }
}

/* --------------------------------------------------------------------------
   9) 打印：只留内容
   -------------------------------------------------------------------------- */
@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #fff;
    --surface-3: #f4f4f4;
    --text: #1a1a1a;
    --ink: #000;
    --muted: #444;
    --line: #ccc;
    --line-strong: #999;
  }

  html,
  body {
    background: #fff;
    color: #1a1a1a;
  }

  .sidebar,
  .topbar,
  .mobile-tabs,
  .tabbar,
  .scrim,
  .skip-link,
  .toast,
  .site-footer,
  .page-head__actions,
  .sidebar-collapse {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  a {
    color: #1a1a1a;
    text-decoration: underline;
  }

  .card,
  .stat-card,
  .table-wrap,
  .callout {
    break-inside: avoid;
    box-shadow: none !important;
  }
}

/* --------------------------------------------------------------------------
   10) 减少动效 / 高对比
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: var(--n-500);
    --line-strong: var(--n-600);
    --muted: var(--n-700);
  }
}

/* 移动端面包屑隐藏（必须在 .breadcrumb 基础规则之后，避免被后者覆盖） */
@media (max-width: 1023px) {
  .breadcrumb {
    display: none;
  }
}
/* breadcrumb-hide-fix */

