/* ============================================================
   Meridian Design System — 参考实现 v1.1.0
   Web Design Skill 配套：tokens + 核心组件
   结构：1 字体 → 2 tokens → 3 基础 → 4 图标 → 5 组件 → 6 布局 → 7 动效降级
   ============================================================ */

/* ---------- 1. 字体（本地化 Inter，CJK 走系统栈） ---------- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('assets/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('assets/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('assets/fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 800; font-display: swap; src: url('assets/fonts/inter-latin-800-normal.woff2') format('woff2'); }

/* ---------- 2. Design Tokens ---------- */
:root {
  /* color: semantic (light) —— primitive 见 colors.json */
  --bg: #F7F6F3;
  --bg-subtle: #F0EEE9;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --surface-hover: #F0EEE9;
  --ink: #1C1B18;
  --ink-2: #5C574E;
  --ink-3: #8A847A;
  --inverse-ink: #F7F6F3;
  --line: #E5E2DA;
  --line-strong: #D3CEC2;

  --accent: #C25E41;
  --accent-fill: #A94A30;
  --accent-fill-hover: #8A3B26;
  --accent-text: #8A3B26;
  --accent-soft: #F5E2D9;
  --accent-ink: #8A3B26;

  --success: #2F7D5B;  --success-soft: #EAF4EF;
  --warning: #B54708;  --warning-soft: #FBF0E1;
  --danger: #B42318;   --danger-soft: #FBEAE8;
  --danger-fill: #B42318;
  --info: #175CD3;     --info-soft: #EAF1FC;

  --overlay: rgba(28, 27, 24, .44);
  --focus-ring: #A94A30;

  /* typography */
  --font-sans: 'Inter', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Cascadia Code', 'JetBrains Mono', 'SF Mono', ui-monospace, Consolas, monospace;

  --fs-display-2xl: 72px;  --lh-display: 1.05;  --ls-display: -0.03em;
  --fs-display-xl: 56px;   --fs-display-lg: 44px;
  --fs-display-md: 34px;   --fs-title-xl: 28px; --lh-title: 1.2;
  --fs-title-lg: 22px;     --fs-title-md: 18px; --lh-title-md: 1.35;
  --fs-title-sm: 16px;     --fs-body-lg: 17px;  --lh-body-lg: 1.65;
  --fs-body: 15px;         --lh-body: 1.6;
  --fs-body-sm: 13.5px;    --lh-body-sm: 1.55;
  --fs-caption: 12.5px;    --lh-caption: 1.5;
  --fs-overline: 12px;     --ls-overline: .08em;

  /* spacing (4px 网格) */
  --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; --sp-16: 64px;
  --sp-20: 80px; --sp-24: 96px; --sp-32: 128px;

  /* radius */
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 10px; --radius-xl: 16px; --radius-full: 999px;

  /* shadow */
  --shadow-xs: 0 1px 2px rgba(28,27,24,.06);
  --shadow-sm: 0 1px 2px rgba(28,27,24,.05), 0 2px 8px rgba(28,27,24,.05);
  --shadow-md: 0 2px 4px rgba(28,27,24,.05), 0 8px 24px rgba(28,27,24,.08);
  --shadow-lg: 0 4px 8px rgba(28,27,24,.06), 0 16px 48px rgba(28,27,24,.14);

  /* motion */
  --dur-instant: 80ms; --dur-fast: 160ms; --dur-base: 240ms; --dur-slow: 400ms; --dur-slower: 640ms;
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-entrance: cubic-bezier(0, 0, .2, 1);
  --ease-exit: cubic-bezier(.4, 0, 1, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  /* z */
  --z-dropdown: 100; --z-sticky: 200; --z-overlay: 300; --z-modal: 400; --z-toast: 500;

  /* layout */
  --sidebar-w: 248px; --topbar-h: 60px;
}

/* 深色主题：html[data-theme="dark"] */
[data-theme="dark"] {
  --bg: #161513; --bg-subtle: #1A1917; --surface: #201E1B; --surface-raised: #282521;
  --surface-hover: #2B2822;
  --ink: #F4F2ED; --ink-2: #B8B2A6; --ink-3: #7D776C; --inverse-ink: #1C1B18;
  --line: #35322C; --line-strong: #4A463E;
  --accent: #D97E5F; --accent-fill: #A94A30; --accent-fill-hover: #8A3B26;
  --accent-text: #E09377; --accent-soft: #3A2A23; --accent-ink: #E09377;
  --success: #5CA983; --success-soft: #1F2E27; --warning: #D99A4E; --warning-soft: #322818;
  --danger: #E07A6E; --danger-soft: #38201D; --danger-fill: #B42318; --info: #7BA7E8; --info-soft: #1E2A3C;
  --overlay: rgba(0, 0, 0, .56); --focus-ring: #D97E5F;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.3); --shadow-sm: 0 1px 2px rgba(0,0,0,.25), 0 2px 8px rgba(0,0,0,.25);
  --shadow-md: 0 2px 4px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 4px 8px rgba(0,0,0,.3), 0 16px 48px rgba(0,0,0,.5);
}

/* ---------- 3. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: var(--fs-body); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; line-height: var(--lh-title); letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--ink); }

/* 焦点可见性（只对键盘用户） */
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }

/* 字阶工具类 */
.t-display-2xl { font-size: var(--fs-display-2xl); line-height: 1.04; letter-spacing: var(--ls-display); font-weight: 700; }
.t-display-xl   { font-size: var(--fs-display-xl);  line-height: 1.06; letter-spacing: -0.028em; font-weight: 700; }
.t-display-lg   { font-size: var(--fs-display-lg);  line-height: 1.1;  letter-spacing: -0.025em; font-weight: 700; }
.t-display-md   { font-size: var(--fs-display-md);  line-height: 1.15; letter-spacing: -0.02em;  font-weight: 700; }
.t-title-xl     { font-size: var(--fs-title-xl); line-height: var(--lh-title); letter-spacing: -0.015em; font-weight: 650; }
.t-title-lg     { font-size: var(--fs-title-lg); line-height: 1.25; letter-spacing: -0.01em; font-weight: 600; }
.t-title-md     { font-size: var(--fs-title-md); line-height: var(--lh-title-md); letter-spacing: -0.005em; font-weight: 600; }
.t-title-sm     { font-size: var(--fs-title-sm); line-height: 1.4; font-weight: 600; }
.t-body-lg      { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.t-body-sm      { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); }
.t-caption      { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: 500; }
.t-overline     { font-size: var(--fs-overline); line-height: 1.4; letter-spacing: var(--ls-overline); font-weight: 600; text-transform: uppercase; }
.t-num          { font-variant-numeric: tabular-nums; }
.t-mono         { font-family: var(--font-mono); font-size: var(--fs-body-sm); }
.t-muted        { color: var(--ink-2); }
.t-faint        { color: var(--ink-3); }

/* ---------- 4. 图标（Lucide） ---------- */
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.15em; }
.ic-14 { width: 14px; height: 14px; } .ic-16 { width: 16px; height: 16px; }
.ic-20 { width: 20px; height: 20px; } .ic-24 { width: 24px; height: 24px; }
.ic-lg { width: 32px; height: 32px; stroke-width: 1.5; }

/* ---------- 5. 组件 ---------- */

/* 5.1 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 36px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: var(--fs-body); font-weight: 500; line-height: 1; cursor: pointer; white-space: nowrap;
  background: none; text-decoration: none; user-select: none;
  transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard), transform var(--dur-instant) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn .ic { width: 16px; height: 16px; }

.btn-primary { background: var(--accent-fill); color: #fff; }
.btn-primary:hover { background: var(--accent-fill-hover); text-decoration: none; }
/* 深色下主按钮 fill 恒用 600 阶 + 白字（对比度契约），btn-primary 无需覆写 */

.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink-3); background: var(--surface-hover); }

.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--ink); text-decoration: none; }

.btn-danger { background: var(--danger-fill); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }

.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-body-sm); gap: 6px; }
.btn-sm .ic { width: 14px; height: 14px; }
.btn-lg { height: 42px; padding: 0 18px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }

/* 5.2 表单 */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: var(--fs-caption); font-weight: 500; color: var(--ink-2); }
.label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: var(--lh-body); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 14%, transparent); }
.hint { font-size: var(--fs-body-sm); color: var(--ink-3); }
.hint-error { font-size: var(--fs-body-sm); color: var(--danger); display: flex; align-items: center; gap: 4px; }
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A847A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B8B2A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* 5.3 开关 */
.switch { position: relative; width: 36px; height: 20px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--line-strong); border-radius: var(--radius-full); transition: background-color var(--dur-base) var(--ease-standard); }
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; box-shadow: var(--shadow-xs);
  transition: transform var(--dur-base) var(--ease-spring);
}
.switch input:checked + .track { background: var(--accent-fill); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* 5.4 分段控件 */
.segmented { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-subtle); border-radius: var(--radius-md); }
.segmented button {
  height: 28px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: none;
  font-size: var(--fs-body-sm); font-weight: 500; color: var(--ink-2); cursor: pointer;
  transition: color var(--dur-fast), background-color var(--dur-fast), box-shadow var(--dur-fast);
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }

/* 5.5 徽章 / 标签 */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px;
  border-radius: var(--radius-full); font-size: var(--fs-caption); font-weight: 500; line-height: 1.5;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-soft-accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge-soft-success { background: var(--success-soft); color: var(--success); }
.badge-soft-warning { background: var(--warning-soft); color: var(--warning); }
.badge-soft-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-soft-info    { background: var(--info-soft); color: var(--info); }
.badge-outline { border: 1px solid var(--line-strong); color: var(--ink-2); background: transparent; }

/* 5.6 卡片 */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.card-pad { padding: var(--sp-5); }
.card-interactive { cursor: pointer; transition: box-shadow var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard); }
.card-interactive:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); border-color: var(--line-strong); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); }
.card-title { font-size: var(--fs-title-md); font-weight: 600; letter-spacing: -0.005em; }

/* 5.7 表格 */
.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-body-sm); }
.table th {
  padding: 10px 12px; text-align: left; font-size: var(--fs-caption); font-weight: 500; color: var(--ink-2);
  border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background-color var(--dur-instant) var(--ease-standard); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.is-selected { background: var(--accent-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table-compact th { padding: 6px 10px; }
.table-compact td { padding: 6px 10px; }
.table-compact td, .table-compact th { line-height: 1.4; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--ink); }
.ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 5.8 标签页 */
.tabs { display: flex; gap: var(--sp-5); border-bottom: 1px solid var(--line); }
.tab {
  position: relative; padding: 10px 2px 12px; border: 0; background: none; cursor: pointer;
  font-size: var(--fs-body); font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px;
  transition: color var(--dur-fast) var(--ease-standard);
}
.tab:hover { color: var(--ink); }
.tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0; transform: scaleX(0);
  transition: transform var(--dur-base) var(--ease-standard);
}
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab .count { font-size: var(--fs-caption); color: var(--ink-3); font-weight: 500; }

/* 5.9 面包屑 / 分页 */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-caption); color: var(--ink-3); }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); text-decoration: none; }
.crumbs .sep { color: var(--line-strong); }
.crumbs .current { color: var(--ink); font-weight: 500; }

.pager { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-body-sm); color: var(--ink-2); }
.pager button { min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--ink-2); cursor: pointer; font-size: var(--fs-body-sm); }
.pager button:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); }
.pager button[aria-current="page"] { border-color: var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; }
.pager button:disabled { opacity: .4; cursor: default; }

/* 5.10 Tooltip / Toast / Modal */
.tooltip {
  position: absolute; z-index: var(--z-dropdown); padding: 5px 8px;
  background: color-mix(in srgb, var(--ink) 94%, transparent); color: var(--inverse-ink);
  font-size: var(--fs-caption); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  max-width: 240px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); font-size: var(--fs-body-sm); position: relative; overflow: hidden;
}
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent-fill); }
.toast-success::before { background: var(--success); } .toast-error::before { background: var(--danger); }
.toast-warning::before { background: var(--warning); } .toast-info::before { background: var(--info); }
.toast .ic { width: 16px; height: 16px; margin-top: 1px; }

.modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay);
  display: grid; place-items: center; padding: var(--sp-6);
}
.modal {
  width: 100%; max-width: 560px; background: var(--surface-raised); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); animation: m-pop var(--dur-base) var(--ease-entrance) backwards;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-5) var(--sp-6) 0; }
.modal-title { font-size: var(--fs-title-lg); font-weight: 600; letter-spacing: -0.01em; }
.modal-body { padding: var(--sp-4) var(--sp-6); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-6) var(--sp-5); }

/* 5.11 头像 / 进度 / 骨架 / 空状态 */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-caption); font-weight: 600; flex: none; user-select: none;
}
.avatar-lg { width: 40px; height: 40px; font-size: var(--fs-body-sm); }

.progress { height: 4px; background: var(--bg-subtle); border-radius: var(--radius-full); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent-fill); border-radius: inherit; transition: width var(--dur-slow) var(--ease-standard); }

.skeleton { background: var(--bg-subtle); border-radius: var(--radius-sm); animation: pulse 1.4s var(--ease-standard) infinite; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  text-align: center; padding: var(--sp-16) var(--sp-6); color: var(--ink-2);
}
.empty .ic-lg { color: var(--ink-3); margin-bottom: var(--sp-2); }
.empty .t-title-sm { color: var(--ink); }

/* 5.12 KPI */
.kpi { display: flex; flex-direction: column; gap: var(--sp-1); }
.kpi .kpi-label { font-size: var(--fs-caption); font-weight: 500; color: var(--ink-2); }
.kpi .kpi-value { font-size: var(--fs-display-md); line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .kpi-value small { font-size: var(--fs-title-md); font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-left: 2px; }
.kpi .kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-caption); font-weight: 500; }
.kpi .delta-up { color: var(--success); } .kpi .delta-down { color: var(--danger); }

/* ---------- 6. 布局骨架 ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: var(--sp-4) var(--sp-3);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.nav-group { margin-top: var(--sp-5); }
.nav-group-title { padding: 0 10px; margin-bottom: var(--sp-2); color: var(--ink-3); }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px;
  border-radius: var(--radius-md); color: var(--ink-2); font-size: var(--fs-body-sm); font-weight: 500;
  text-decoration: none; transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.nav-item .ic { width: 18px; height: 18px; }
.nav-item:hover { background: var(--surface-hover); color: var(--ink); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-8); border-bottom: 1px solid var(--line); background: var(--bg);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.content { flex: 1; padding: var(--sp-8); min-width: 0; }
.content-narrow { max-width: 720px; margin: 0 auto; }

/* 容器（营销页） */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--sp-6); }
.section { padding: var(--sp-24) 0; }

/* ---------- 7. 动效编排与降级 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes m-pop { from { opacity: 0; transform: scale(.97); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

.anim-rise { animation: rise .5s var(--ease-entrance) backwards; }
.anim-fade { animation: fade .4s var(--ease-entrance) backwards; }
/* 入场编排：子元素依次延迟（默认可见，动画不跑时终态天然可见） */
.stagger > * { animation: rise .5s var(--ease-entrance) backwards; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; }
.stagger > *:nth-child(n+7) { animation-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* 自动化截图开关：?noanim */
html.no-anim *, html.no-anim *::before, html.no-anim *::after {
  animation: none !important; transition: none !important;
}

/* ---------- 8. 响应式 ---------- */
@media (max-width: 1023px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: var(--z-modal); background: var(--surface); transform: translateX(-100%); transition: transform var(--dur-base) var(--ease-standard); }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .content { padding: var(--sp-5); }
  .topbar { padding: 0 var(--sp-5); }
}
@media (max-width: 767px) {
  :root { --fs-display-2xl: 44px; --fs-display-xl: 38px; --fs-display-lg: 32px; --fs-display-md: 27px; --fs-title-xl: 24px; }
  .section { padding: var(--sp-16) 0; }
  .content { padding: var(--sp-4); }
}
