/* ==========================================================================
   墨卷 · 学习笔记管理台 — 设计系统 v3
   --------------------------------------------------------------------------
   设计语言：圆角艺术化（Material 3 / Arco 启发）
   · 单一 token 源：:root 定义默认，body[data-theme] 覆盖
   · 大圆角卡片、胶囊按钮、柔和分层阴影
   · 变更记录 = 顶部公告条（不占主界面）+ 时间线对话框
   结构：1 令牌 → 2 基础 → 3 布局 → 4 组件 → 5 区块 → 6 主题 → 7 响应式
   ========================================================================== */

/* ══════════════════════════════════════════════════════════════════════════
   1 · 设计令牌（默认 = Atelier 编辑部浅色）
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;

  /* 色板：浅色现代科技风（蓝主调 + 绿橙功能色） */
  --bg: #f6f8fb;
  --surface: #fbfcfe;
  --surface-strong: #ffffff;
  --surface-soft: #eef2f7;
  --ink: #14202e;
  --ink-muted: #5c6b7e;
  --ink-faint: #93a1b3;
  --line: rgba(20, 32, 46, .10);
  --line-strong: rgba(20, 32, 46, .18);
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --accent-ink: #1d4ed8;
  --success: #16a34a;
  --warning: #ea580c;
  --danger: #dc2626;
  --focus: #2563eb;

  /* 层次：圆角 + 阴影 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .04);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .05), 0 12px 32px rgba(0, 0, 0, .07);
  --shadow-3: 0 8px 24px rgba(0, 0, 0, .08), 0 24px 64px rgba(0, 0, 0, .10);
  --shadow-color: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);

  /* 字体：无衬线正文 + 衬线标题（编辑级排版） */
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: Georgia, "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-mono: "SFMono-Regular", Consolas, "JetBrains Mono", monospace;

  /* 尺寸 */
  --sidebar-width: 248px;
  --content-max: 1440px;
  --card-min: 300px;
  --density: 22px;
  --title-tracking: -.03em;
  --topbar-height: 64px;

  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

/* ══════════════════════════════════════════════════════════════════════════
   2 · 基础
   ══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: color .25s ease, background .25s ease;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a { color: inherit; text-decoration: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 1000;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: white;
  background: var(--ink);
  font-size: 13px;
  transition: top .2s;
}
.skip-link:focus { top: 16px; }

/* 小标签 */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.section-label > span:last-child { font-size: 11px; color: var(--ink-faint); }

/* ══════════════════════════════════════════════════════════════════════════
   3 · 布局骨架
   ══════════════════════════════════════════════════════════════════════════ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 clamp(20px, 3.2vw, 52px) 90px;
  transition: grid-template-columns .25s ease;
}
body.sidebar-collapsed .app-shell { grid-template-columns: 0 minmax(0, 1fr); }

.main-content {
  min-width: 0;
  padding: 44px 0 0 clamp(36px, 4.5vw, 72px);
}

.site-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 60px;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-faint);
}
.site-footer a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════════
   4 · 组件
   ══════════════════════════════════════════════════════════════════════════ */

/* —— 顶部导航 —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(300px, 580px) minmax(300px, 1fr);
  gap: 20px;
  align-items: center;
  min-height: var(--topbar-height);
  padding: 9px clamp(20px, 3vw, 48px);
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}

.global-search-area { min-width: 0; }

.brand { display: flex; align-items: center; gap: 11px; user-select: none; }
.brand-mark {
  display: flex;
  align-items: end;
  gap: 3px;
  padding: 7px;
  border-radius: 10px;
  background: #161617;
  color: white;
}
.brand-mark span { display: block; width: 4px; background: var(--accent); border-radius: 2px 2px 0 0; }
.brand-mark span:nth-child(1) { height: 11px; }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 14px; }
.brand strong, .brand > div:last-child > span { display: block; line-height: 1.05; }
.brand strong { font-size: 17px; letter-spacing: var(--title-tracking); }
.brand > div:last-child > span { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); }

/* 搜索框：精致胶囊，焦点时柔和发光 */
.global-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  cursor: text;
  transition: border-color .22s, box-shadow .22s, background .22s, transform .22s;
}
.global-search:hover { border-color: var(--line-strong); background: var(--surface-strong); }
.global-search:focus-within {
  border-color: var(--accent);
  background: var(--surface-strong);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent), var(--shadow-1);
  transform: translateY(-1px);
}
.global-search svg { flex-shrink: 0; width: 16px; height: 16px; fill: none; stroke: var(--ink-faint); stroke-width: 2.2; transition: stroke .2s; }
.global-search:focus-within svg { stroke: var(--accent); }
.global-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: 13.5px; outline: 0; }
.global-search input::placeholder { color: var(--ink-faint); }
.global-search kbd {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
  font: 600 10px/1 var(--font-body);
  letter-spacing: .02em;
  color: var(--ink-faint);
  box-shadow: 0 1px 0 var(--line);
}
.search-clear {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink-muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover { background: var(--accent-soft); color: var(--accent-ink); }
.search-meta { margin: 4px 4px 0; min-height: 14px; color: var(--ink-faint); font-size: 10px; line-height: 1.2; }

.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* —— 按钮 —— */
.button, .icon-button, .dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .18s;
}
.button:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.button:active { transform: translateY(1px); }

.button-primary { border-color: var(--accent); background: var(--accent); color: white; }
.button-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 30%, transparent); }

.button-secondary { border-color: var(--line-strong); background: transparent; }
.button-secondary.is-active { border-color: var(--accent); color: var(--accent-ink); }

.button-quiet, .button-link { border-color: transparent; background: transparent; }
.button-quiet:hover, .button-link:hover { background: var(--surface-soft); box-shadow: none; }
.button-link { text-decoration: none; }

.icon-button, .dialog-close { width: 38px; padding: 0; }
.dialog-close { font-size: 18px; }

/* —— 更多操作菜单 —— */
.action-menu, .advanced-filters { position: relative; }
.action-menu summary, .advanced-filters summary { list-style: none; }
.action-menu summary::-webkit-details-marker, .advanced-filters summary::-webkit-details-marker { display: none; }
.action-menu:not([open]) > .action-menu-panel { display: none; }

.action-menu-panel, .filter-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 65;
  width: 228px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  box-shadow: var(--shadow-3);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.action-menu-panel button, .action-menu-panel a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 51px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  transition: background .15s;
}
.action-menu-panel button:hover, .action-menu-panel a:hover { background: var(--surface-soft); }
.action-menu-panel small { font-size: 11px; color: var(--ink-faint); }

/* —— 侧栏 —— */
.sidebar {
  position: sticky;
  top: var(--topbar-height);
  align-self: start;
  max-height: calc(100vh - var(--topbar-height));
  padding: 30px 24px 40px 0;
  overflow: hidden;
  scrollbar-gutter: stable;
}
/* 侧栏头部：桌面端显示标题 + 右上角收起按钮 */
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
}
.sidebar-head > strong {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .02em;
  color: var(--ink);
}
.sidebar-head-actions { display: flex; gap: 5px; }
.sidebar-head .icon-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  color: var(--ink-faint);
  font-size: 14px;
}
.sidebar-head .icon-button:hover { color: var(--ink); background: var(--surface-soft); box-shadow: none; }
/* 桌面端：关闭按钮仅移动端抽屉使用 */
.sidebar-head #closeSidebar { display: none; }
.sidebar-scroll {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-height: calc(100vh - var(--topbar-height) - 34px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
body.sidebar-collapsed .sidebar { padding: 0; opacity: 0; pointer-events: none; }

.text-button {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  transition: color .15s;
}
.text-button:hover { color: var(--ink); }

/* 快捷入口 */
.smart-nav { display: flex; flex-direction: column; gap: 2px; }
.smart-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  text-align: left;
  transition: background .15s, color .15s;
}
.smart-nav-item:hover { background: var(--surface-soft); color: var(--ink); }
.smart-nav-item.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.smart-icon { width: 18px; text-align: center; font-size: 14px; opacity: .8; }
.smart-nav-item b {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 100px;
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
}
.smart-nav-item.is-active b { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-ink); }
.smart-nav-link { text-decoration: none; }

/* 分类树 */
.category-tree { display: flex; flex-direction: column; gap: 3px; }
.category-group { display: flex; flex-direction: column; }
.category-row, .subcategory-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  transition: background .15s;
}
.category-row { font-weight: 500; }
.category-row:hover, .subcategory-row:hover, .category-row.is-active, .subcategory-row.is-active { background: var(--surface-soft); }
.category-row b, .subcategory-row b {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  background: color-mix(in srgb, var(--surface-soft) 60%, transparent);
}
.subcategory-list { position: relative; margin-left: 8px; padding-left: 11px; border-left: 1px solid var(--line); }
.subcategory-row { font-size: 12px; padding-block: 5px; }

/* 标签云 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip, .note-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--surface-strong);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.tag-chip:hover, .tag-chip.is-active { border-color: var(--accent); background: var(--accent-soft); }

/* 数据来源卡 */
.source-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}
.source-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: #161617;
  color: white;
  font-size: 12px;
  font-weight: 700;
}
.source-card h3 { margin: 0 0 4px; font-size: 13px; }
.source-card p { margin: 0; font-size: 12px; color: var(--ink-muted); line-height: 1.65; }
.source-card .text-button { grid-column: 1 / -1; justify-self: start; }

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 69;
  width: 100vw;
  height: 100vh;
  border: 0;
  padding: 0;
  background: rgba(0, 0, 0, .25);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(2px);
  transition: opacity .2s;
}

/* —— Hero：编辑级杂志头版 —— */
.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px 64px;
  align-items: end;
  padding: 8px 0 44px;
  border-bottom: 1px solid var(--line);
}
.page-heading h1 {
  margin: 14px 0 16px;
  font-family: var(--font-display);
  font-size: clamp(38px, 5.2vw, 64px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: var(--title-tracking);
}
.page-heading h1 em { font-style: normal; color: var(--accent); }

.hero-copy { min-width: 0; }
.hero-lede {
  margin: 0;
  max-width: 640px;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: .02em;
}
/* 首字下沉：编辑级质感 */
.hero-lede .drop-cap {
  float: left;
  margin: 8px 10px 0 0;
  font-family: var(--font-display);
  font-size: 58px;
  font-weight: 700;
  line-height: .78;
  color: var(--ink);
  letter-spacing: -.02em;
}
.hero-actions { display: flex; gap: 10px; margin-top: 24px; }

.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 1px solid var(--line);
  padding-left: 36px;
  min-width: 148px;
}
.hero-stat { padding: 14px 0; border-bottom: 1px solid var(--line); }
.hero-stat:last-child { border-bottom: 0; }
.hero-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
}
.hero-stat span { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); }
/* 绿橙蓝三色功能分配：笔记=绿 / 项目=蓝 / 变更=橙 */
.hero-stat:nth-child(1) strong { color: var(--success); }
.hero-stat:nth-child(2) strong { color: var(--accent); }
.hero-stat:nth-child(3) strong { color: var(--warning); }

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 14%, transparent);
}

/* —— 区块标题 —— */
.library-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.library-head h2 { margin: 8px 0 0; font-family: var(--font-display); font-size: clamp(24px, 2.6vw, 32px); font-weight: 650; line-height: 1.1; letter-spacing: var(--title-tracking); }
.result-meta { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--ink-faint); }
.result-meta strong { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }

/* —— 统计卡 —— */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 22px;
}
.stat-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  min-height: 108px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-1);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat-card > span, .stat-card > small { color: var(--ink-muted); }
.stat-card > span { align-self: end; font-size: 12px; font-weight: 600; }
.stat-card > strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: -.02em;
}
.stat-card > small { font-family: var(--font-mono); font-size: 9px; letter-spacing: .05em; }

/* —— 筛选与工具栏 —— */
.library-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 6px 0 14px;
  border-bottom: 1px solid var(--line);
}
.quick-filters { display: flex; gap: 3px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-soft); }
.quick-filter {
  padding: 7px 16px;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background .18s, color .18s, box-shadow .18s;
}
.quick-filter:hover { color: var(--ink); }
.quick-filter.is-active { background: var(--surface-strong); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }

.toolbar-tail { display: flex; align-items: center; gap: 8px; }

select, input[type="text"], input[type="search"], input[type="url"], input[type="number"], textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 13px;
  outline: 0;
  transition: border-color .18s, box-shadow .18s;
}
select:focus, input:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--shadow-color); }
select {
  height: 38px;
  padding: 0 32px 0 12px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2398989d' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px;
}

.filter-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-faint);
  font-size: 12px;
  white-space: nowrap;
}
.filter-summary b { font-size: 14px; }
.filter-summary.is-active { border-color: var(--accent); color: var(--accent-ink); }
.filter-popover { display: none; flex-direction: column; gap: 10px; padding: 14px; min-width: 200px; }
.advanced-filters[open] .filter-popover { display: flex; }
.filter-popover label { display: flex; flex-direction: column; gap: 5px; }
.filter-popover label > span { font-size: 11px; color: var(--ink-faint); }

.view-switch { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); }
.view-switch button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-faint);
  transition: background .15s, color .15s;
}
.view-switch button[aria-pressed="true"] { background: var(--surface-soft); color: var(--ink); }
.view-switch svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

.active-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 12px;
  color: var(--accent-ink);
}
.active-filter-row button { padding: 2px 9px; border: 0; border-radius: 100px; background: transparent; color: var(--accent-ink); font-size: 11px; font-weight: 600; }
.active-filter-row button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* —— 笔记网格与卡片 —— */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
  gap: 12px;
  margin-top: 18px;
}
.notes-grid.is-list { grid-template-columns: 1fr; }

.note-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 300px;
  padding: var(--density);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.note-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--category-color, var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.note-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.note-card:hover::before { transform: scaleX(1); }
.note-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.card-kicker { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-faint); }
.category-path { font-size: 11px; color: var(--ink-faint); }
.featured-mark { display: none; font-size: 11px; font-weight: 600; color: var(--accent); }
.note-card.is-featured .featured-mark { display: inline; }

.note-card h3 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.note-card .summary {
  display: -webkit-box;
  margin: 0;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.75;
  letter-spacing: .015em;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.card-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-top: auto; padding-top: 8px; }
.note-meta { font-size: 11px; color: var(--ink-faint); }
.status-row { display: flex; gap: 4px; }
.status-pill {
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.status-pill.published, .status-pill.healthy { color: var(--success); background: color-mix(in srgb, var(--success) 10%, transparent); }
.status-pill.draft, .status-pill.unchecked { color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }
.status-pill.archived { color: var(--ink-faint); background: var(--surface-soft); }
.status-pill.broken { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* 列表视图 */
.notes-grid.is-list .note-card {
  display: grid;
  grid-template-columns: minmax(200px, .8fr) minmax(260px, 1.2fr) minmax(160px, .6fr) auto;
  grid-template-rows: auto 1fr;
  gap: 7px 22px;
  align-items: center;
  min-height: 108px;
  padding: 17px 20px;
}
.notes-grid.is-list .note-card h3 { grid-column: 1; grid-row: 1 / 3; align-self: center; font-size: 17px; margin: 0; }
.notes-grid.is-list .summary { grid-column: 2; grid-row: 1 / 3; -webkit-line-clamp: 2; }
.notes-grid.is-list .card-kicker { grid-column: 3; align-self: end; }
.notes-grid.is-list .card-footer { grid-column: 3; margin: 0; padding: 0; }
.notes-grid.is-list .note-tags { grid-column: 4; grid-row: 1 / 3; flex-direction: column; align-items: flex-end; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 64px 20px;
  text-align: center;
  color: var(--ink-faint);
}
.empty-state > div:first-child { font-size: 46px; line-height: 1; color: var(--line-strong); }
.empty-state h3 { margin: 0; font-size: 18px; color: var(--ink-muted); }
.empty-state p { margin: 0; font-size: 14px; }

/* ══════════════════════════════════════════════════════════════════════════
   5 · 区块
   ══════════════════════════════════════════════════════════════════════════ */

/* —— 5.1 变更记录：顶部菜单栏通知 —— */
.notification-menu { position: relative; }
.notification-menu summary { list-style: none; }
.notification-menu summary::-webkit-details-marker { display: none; }
.notification-menu:not([open]) > .notification-panel { display: none; }

.notification-bell {
  position: relative;
  width: 38px;
  min-width: 38px;
  padding: 0;
}
.notification-bell svg { width: 18px; height: 18px; }
.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 100px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--surface-strong);
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 65;
  width: 340px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
  box-shadow: var(--shadow-3);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.notification-head h2 { margin: 4px 0 12px; font-size: 16px; font-weight: 650; line-height: 1.2; }
.notification-panel .changelog-switch { margin-bottom: 12px; width: fit-content; }
.notification-panel .changelog-status { margin: 0 0 10px; padding: 0; color: var(--ink-muted); font-size: 12.5px; line-height: 1.6; }

.notification-preview { list-style: none; margin: 0 0 12px; padding: 0; }
.notification-preview li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.5;
}
.notification-preview li time { flex-shrink: 0; font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.notification-preview li span { color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.notification-open-all { width: 100%; justify-content: center; border-radius: var(--radius); font-size: 13px; }

.changelog-switch {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
}
.changelog-tab {
  padding: 7px 15px;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: color .18s, background .18s, box-shadow .18s;
}
.changelog-tab:hover { color: var(--ink); }
.changelog-tab.is-active { background: var(--surface-strong); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }

/* —— 5.2 变更记录：时间线对话框 —— */
.timeline-dialog {
  width: min(760px, calc(100vw - 40px));
  max-height: min(82vh, 760px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.timeline-dialog::backdrop { background: rgba(0, 0, 0, .35); backdrop-filter: blur(4px); }
.timeline-dialog[open] { display: flex; flex-direction: column; }

.timeline-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 26px 28px 18px;
  border-bottom: 1px solid var(--line);
}
.timeline-dialog-header h2 { margin: 6px 0 0; font-size: 22px; font-weight: 650; line-height: 1.15; letter-spacing: var(--title-tracking); }

.timeline-dialog-switch {
  display: flex;
  gap: 3px;
  padding: 4px;
  margin: 18px 28px 0;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  align-self: flex-start;
}

.changelog-status { margin: 14px 28px 6px; color: var(--ink-faint); font-size: 12.5px; line-height: 1.6; }

.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 10px 28px 28px;
  overflow-y: auto;
  max-height: calc(82vh - 190px);
}
.timeline::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 28px;
  left: 37px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom, transparent, var(--line) 5%, var(--line) 95%, transparent);
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 22px;
  padding-bottom: 16px;
  opacity: 0;
  transform: translateY(14px);
  animation: timeline-in .45s cubic-bezier(.22, .61, .36, 1) forwards;
  animation-delay: calc(var(--timeline-index, 0) * 55ms);
}
@keyframes timeline-in { to { opacity: 1; transform: translateY(0); } }

.timeline-rail { flex-shrink: 0; width: 28px; display: flex; justify-content: center; }
.timeline-dot {
  position: relative;
  z-index: 1;
  display: block;
  width: 12px;
  height: 12px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
  transition: transform .2s, box-shadow .2s;
}
.timeline-item:hover .timeline-dot { transform: scale(1.2); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 20%, transparent); }

.timeline-card {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-1);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.timeline-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }

.timeline-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.timeline-meta time { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .03em; color: var(--ink-muted); }
.timeline-commit {
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--surface-soft);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}
.timeline-commit.is-current { background: var(--accent-soft); color: var(--accent-ink); }

.timeline-card h3 { margin: 0 0 5px; font-size: 15.5px; font-weight: 650; line-height: 1.35; }
.timeline-card p { margin: 0; color: var(--ink-muted); font-size: 13px; line-height: 1.75; letter-spacing: .015em; }
.timeline-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.timeline-tag {
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--surface-soft);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.timeline-tag:hover { background: var(--accent-soft); color: var(--accent-ink); }

.timeline-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 44px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}
.timeline-empty strong { font-size: 15px; color: var(--ink-muted); }
.timeline-empty span { font-size: 13px; color: var(--ink-faint); }

/* —— 5.3 GitHub 项目区 —— */
.project-section { padding-top: 56px; }
.project-sync-line { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.project-sync-line p { margin: 0; font-size: 13px; color: var(--ink-muted); }
.project-freshness {
  position: relative;
  font-size: 11px;
  color: var(--ink-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.project-freshness.is-fresh { color: var(--success); }
.project-freshness.is-current { color: var(--warning); }
.project-freshness.is-stale { color: var(--danger); }
.project-freshness.is-unknown { color: var(--ink-faint); }

.project-trace-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.6;
}
.project-trace-mark { flex-shrink: 0; font-size: 18px; line-height: 1; color: var(--ink-faint); }
.project-trace-note strong { display: block; margin-bottom: 2px; }
.project-trace-note p { margin: 0; color: var(--ink-muted); }
.project-trace-note > a { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.project-trace-note > a:hover { color: var(--accent); }

.project-spotlight { margin-top: 24px; }
.project-spotlight-main { margin-bottom: 20px; }
.project-spotlight-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.project-spotlight-kicker code { font-size: 11px; color: var(--ink-faint); }
.project-spotlight-main h3 { margin: 0 0 8px; font-size: 20px; font-weight: 650; line-height: 1.25; }
.project-spotlight-intro { margin: 0; color: var(--ink-muted); font-size: 14px; line-height: 1.75; letter-spacing: .015em; }
.project-spotlight-audience { margin: 12px 0 0; font-size: 13px; }
.project-spotlight-capabilities { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.project-spotlight-capabilities li { padding: 5px 12px; border-radius: 100px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; }
.project-spotlight-actions { display: flex; gap: 10px; margin-top: 16px; }

.project-readme-guide {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}
.project-readme-guide h4 { margin: 6px 0 0; font-size: 14px; }
.project-readme-guide p { margin: 4px 0 0; font-size: 12px; color: var(--ink-muted); }
.project-readme-guide ol { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.project-readme-guide li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  font-size: 13px;
  transition: background .15s, transform .15s;
}
.project-readme-guide li a:hover { background: var(--surface); transform: translateX(2px); }
.project-readme-guide li a span:last-child { margin-left: auto; font-size: 12px; color: var(--ink-faint); }

.project-summary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 24px;
}
.project-summary article {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 20px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-1);
  text-align: center;
  transition: transform .2s, box-shadow .2s;
}
.project-summary article:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.project-summary article > span { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.project-summary article > strong { font-size: 30px; font-weight: 700; line-height: 1.1; margin: 4px 0; letter-spacing: -.02em; }
.project-summary article > small { font-size: 11px; color: var(--ink-muted); }

.project-maintenance-focus { margin-top: 26px; }
.project-maintenance-intro { margin-bottom: 14px; }
.project-maintenance-intro h3 { margin: 6px 0 0; font-size: 18px; font-weight: 650; line-height: 1.2; }
.project-maintenance-intro p { margin: 4px 0 0; font-size: 13px; color: var(--ink-muted); }
.project-maintenance-list { display: flex; flex-direction: column; gap: 7px; }
.project-maintenance-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-1);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.project-maintenance-item:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.project-maintenance-item.is-active { border-left: 3px solid var(--accent); }
.project-maintenance-item.is-recent { border-left: 3px solid var(--warning); }
.maintenance-item-mark { display: none; }
.maintenance-item-copy { flex: 1; min-width: 0; }
.maintenance-item-copy strong { display: block; font-size: 14px; }
.maintenance-item-copy small { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-faint); }
.maintenance-item-arrow { font-size: 14px; color: var(--ink-faint); }

.project-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}
.project-filter-tabs {
  position: relative;
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
}
.project-tab-indicator {
  position: absolute;
  top: 4px;
  left: var(--project-tab-left, 4px);
  width: var(--project-tab-width, 80px);
  height: calc(100% - 8px);
  border-radius: 100px;
  background: var(--surface-strong);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
  transition: left .22s, width .22s;
  pointer-events: none;
}
.project-tab {
  position: relative;
  z-index: 1;
  padding: 8px 17px;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: color .18s;
}
.project-tab:hover { color: var(--ink); }
.project-tab.is-active { color: var(--ink); }
.project-profile-link { flex-shrink: 0; font-size: 12px; color: var(--ink-faint); text-decoration: underline; text-underline-offset: 3px; }

.project-panel { margin-top: 22px; }
.commit-scope { margin: 0 0 16px; font-size: 12px; color: var(--ink-faint); line-height: 1.5; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr)); gap: 14px; }
.project-grid.is-entering .project-card { animation: project-card-in .35s ease-out both; }
@keyframes project-card-in { from { opacity: 0; transform: translateY(12px); } }

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-1);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.project-card.is-maintenance-active { border-left: 3px solid var(--accent); }
.project-card.is-maintenance-recent { border-left: 3px solid var(--warning); }
.project-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.project-card.is-maintenance-active:hover { border-left-width: 3px; }

.project-card-top { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-faint); }
.project-repo-mark { font-size: 16px; }
.project-card h3 { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.25; }
.project-card > p { flex: 1; margin: 0; color: var(--ink-muted); font-size: 13px; line-height: 1.75; letter-spacing: .015em; }
.project-pages-target { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-faint); }
.project-pages-target code { font-size: 11px; font-family: var(--font-mono); }
.project-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.project-badges span { padding: 3px 10px; border-radius: 100px; background: var(--surface-soft); color: var(--ink-muted); font-size: 11px; }
.project-upstream { font-size: 12px; color: var(--ink-faint); }
.project-upstream a { color: var(--accent-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.project-upstream a:hover { color: var(--accent); }
.project-maintenance-line { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.maintenance-dot { width: 7px; height: 7px; border-radius: 50%; }
.project-maintenance-line.is-active { color: var(--accent); }
.project-maintenance-line.is-active .maintenance-dot { background: var(--accent); }
.project-maintenance-line.is-recent { color: var(--warning); }
.project-maintenance-line.is-recent .maintenance-dot { background: var(--warning); }
.project-card footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-faint);
}
.project-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.project-card-links { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
/* 项目卡片操作链接：蓝色高亮，一眼可识别可点 */
.project-card footer a {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ink);
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.project-card footer a:hover { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
/* 主操作「打开网站」：独立一行全宽实心按钮 */
.project-card footer a.project-open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 14px;
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
}
.project-card footer a.project-open:hover { background: var(--accent-ink); color: var(--bg); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }

.project-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 20px; text-align: center; color: var(--ink-faint); }

.project-work-items { margin-top: 4px; }
.project-work-items-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.project-work-items-head h3 { margin: 6px 0 0; font-size: 22px; line-height: 1.2; }
.project-work-items-count { font-size: 30px; font-weight: 750; color: var(--accent); }
.project-work-items-list { display: grid; gap: 9px; }
.project-work-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-strong); box-shadow: var(--shadow-1); }
.project-work-item-main { min-width: 0; }
.project-work-item-meta { display: flex; gap: 9px; align-items: center; color: var(--ink-faint); font-size: 11px; }
.work-item-kind { color: var(--accent-ink); font-weight: 750; }
.project-work-item h4 { margin: 5px 0 7px; font-size: 15px; line-height: 1.4; }
.project-work-item h4 a { color: var(--ink); text-decoration: none; }
.project-work-item h4 a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.project-work-item > time { flex: 0 0 auto; color: var(--ink-faint); font-size: 11px; }
.project-work-item-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.project-work-item-tags span { padding: 3px 8px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-muted); font-size: 10px; }

/* —— 5.3.5 已部署站点轮播 —— */
.pages-carousel { margin: 34px 0 8px; }
.pages-carousel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.pages-carousel-head h2 { margin: 6px 0 0; font-size: 24px; font-weight: 650; line-height: 1.15; letter-spacing: var(--title-tracking); }
.pages-carousel-controls { display: flex; gap: 8px; }
.carousel-arrow {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--ink-muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, box-shadow .2s, transform .2s;
}
.carousel-arrow:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.pages-carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  -webkit-overflow-scrolling: touch;
}
.pages-carousel-track::-webkit-scrollbar { height: 6px; }
.pages-carousel-track::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--line-strong); }
.pages-carousel-card {
  flex: 0 0 min(400px, 78vw);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-1);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.pages-carousel-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.pages-carousel-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pages-carousel-card-mark {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
}
.pages-carousel-card-top code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 11px var(--font-mono); color: var(--ink-faint); }
.pages-carousel-card h3 { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 650; line-height: 1.25; letter-spacing: -.01em; }
.pages-carousel-card > p { margin: 0; color: var(--ink-muted); font-size: 13px; line-height: 1.75; letter-spacing: .015em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pages-carousel-card-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.pages-carousel-card-badges span { padding: 3px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-muted); font-size: 11px; font-weight: 600; }
.pages-carousel-card-actions { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.pages-carousel-card-actions a { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; color: var(--accent-ink); transition: background .15s, color .15s; }
.pages-carousel-card-actions a:hover { background: var(--accent-soft); }
.pages-carousel-card-actions a.pages-carousel-open { background: var(--accent); color: var(--bg); box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent); }
.pages-carousel-card-actions a.pages-carousel-open:hover { background: var(--accent-ink); color: var(--bg); }
.pages-carousel-activity { color: var(--ink-faint); font-size: 11px; }
.pages-carousel-dots { display: flex; justify-content: center; gap: 7px; margin-top: 16px; }
.carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition: width .25s, background .25s;
}
.carousel-dot.is-active { width: 22px; background: var(--accent); }

/* —— 5.4 README 导览带 —— */
.readme-strip { margin-top: 60px; padding: 34px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.readme-strip-heading { margin-bottom: 24px; }
.readme-strip-heading h2 { margin: 6px 0 0; font-size: 24px; font-weight: 650; line-height: 1.15; letter-spacing: var(--title-tracking); }
.readme-strip-heading p { margin: 8px 0 0; color: var(--ink-muted); font-size: 14px; line-height: 1.75; letter-spacing: .015em; }

.readme-link-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.readme-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-1);
  text-align: left;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.readme-link:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.readme-link-index {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
}
.readme-link strong { display: block; font-size: 14px; }
.readme-link small { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-faint); }
.readme-link-arrow { margin-left: auto; font-size: 16px; color: var(--ink-faint); flex-shrink: 0; }

.readme-strip-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 20px; font-size: 12px; color: var(--ink-faint); }
.readme-strip-footer a { color: var(--accent-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.readme-strip-footer a:hover { color: var(--accent); }
.readme-strip-note { width: 100%; font-size: 11px; }

/* —— 5.5 本地内容概览 —— */
.local-overview { padding-top: 56px; }
.local-overview-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.local-overview-head h2 { margin: 6px 0 0; font-size: 24px; font-weight: 650; line-height: 1.15; letter-spacing: var(--title-tracking); }
.local-overview-head p { margin: 6px 0 0; color: var(--ink-muted); font-size: 13px; line-height: 1.6; }
.local-overview-head code { padding: 2px 6px; border-radius: 6px; background: var(--surface-soft); font-size: 12px; }

.focus-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.focus-label { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }

.continue-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow-1);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.continue-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.focus-card-copy h2 { margin: 6px 0 0; font-size: 15px; font-weight: 650; line-height: 1.2; }
.focus-card-copy p { margin: 4px 0 0; font-size: 12px; color: var(--ink-muted); }
.focus-card-action { flex-shrink: 0; padding: 8px 15px; border: 1px solid var(--line); border-radius: 100px; background: transparent; color: var(--ink); font-size: 12px; white-space: nowrap; transition: background .15s; }
.focus-card-action:hover { background: var(--surface-soft); }

.attention-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--warning) 22%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--warning) 5%, var(--surface-strong));
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.attention-card:hover { transform: translateY(-2px); border-color: var(--warning); box-shadow: var(--shadow-2); }
.attention-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--warning) 13%, transparent);
  color: var(--warning);
  font-size: 16px;
  font-weight: 700;
}
.attention-card h2 { margin: 4px 0 0; font-size: 15px; font-weight: 650; }
.attention-card p { margin: 2px 0 0; font-size: 12px; color: var(--ink-muted); }
.attention-arrow { margin-left: auto; font-size: 18px; color: var(--ink-faint); }

/* —— 5.6 知识地图与项目关系图 —— */
.knowledge-map { margin-top: 16px; }
.knowledge-map-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 16px; }
.knowledge-map-heading h3 { margin: 6px 0 0; font-size: 18px; font-weight: 650; line-height: 1.2; }
.knowledge-map-heading p { margin: 4px 0 0; color: var(--ink-muted); font-size: 13px; }

.knowledge-map-controls { display: flex; align-items: center; gap: 8px; }
.map-control { display: flex; align-items: center; gap: 6px; }
.map-control > span { font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.map-control input, .map-control select { height: 34px; font-size: 12px; }
.map-control input { width: 160px; padding: 0 9px; }
.map-control-actions { display: flex; gap: 4px; }
.map-control-actions button { padding: 5px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; color: var(--ink-muted); font-size: 12px; transition: background .15s; }
.map-control-actions button:hover { background: var(--surface-soft); }
.map-control-actions button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }

.knowledge-map-status { margin: 0 0 12px; color: var(--ink-faint); font-size: 12px; }
.knowledge-map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px; font-size: 11px; color: var(--ink-faint); }
.knowledge-map-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 3px; vertical-align: middle; }
.knowledge-map-legend [data-map-kind="domain"]::before,
.knowledge-map-legend [data-project-map-kind="account"]::before { background: var(--accent); }
.knowledge-map-legend [data-map-kind="category"]::before,
.knowledge-map-legend [data-map-kind="note"]::before,
.knowledge-map-legend [data-project-map-kind="repository"]::before { background: var(--ink); }
.knowledge-map-legend [data-map-kind="project"]::before,
.knowledge-map-legend [data-project-map-kind="language"]::before { background: var(--focus); }
.knowledge-map-legend [data-map-kind="tag"]::before,
.knowledge-map-legend [data-project-map-kind="upstream"]::before { background: var(--warning); }
.knowledge-map-legend [data-project-map-kind="capability"]::before { background: var(--success); }
.map-edge-key { font-size: 11px; }
.map-edge-key.explicit::before { background: var(--accent); }
.map-edge-key.derived::before { background: var(--line-strong); }

.knowledge-map-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.knowledge-map-stage { position: relative; min-height: 440px; background: var(--surface-strong); overflow: hidden; }
.knowledge-map-stage svg { display: block; width: 100%; height: 100%; }

.knowledge-map-inspector {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  padding: 16px;
  border-left: 1px solid var(--line);
  overflow-y: auto;
}
.map-inspector-heading { display: flex; justify-content: space-between; align-items: center; }
.map-inspector-heading h4 { margin: 0; font-size: 13px; }
.map-inspector-heading span { font-size: 11px; color: var(--ink-faint); }
.knowledge-map-detail { color: var(--ink-muted); font-size: 12px; line-height: 1.6; }
.map-accessible-heading { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--ink-faint); }
.map-accessible-heading h4 { margin: 0; font-size: 12px; }
.knowledge-map-node-list { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.knowledge-map-node-list button { padding: 5px 9px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-muted); text-align: left; transition: background .15s; }
.knowledge-map-node-list button:hover { background: var(--surface-soft); }
.knowledge-map-node-list button.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.knowledge-map-node-list button small { display: block; font-size: 10px; color: var(--ink-faint); }

.knowledge-map-empty, .project-map-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-faint);
  font-size: 14px;
}

/* 图谱 SVG 需要显式指定填充与描边；否则浏览器会把形状按默认黑色实心绘制，遮住节点文字。 */
[data-map-kind="domain"], [data-project-map-kind="account"] { --map-kind-color: var(--accent); }
[data-map-kind="category"] { --map-kind-color: #8c6fa8; }
[data-map-kind="note"] { --map-kind-color: #397c96; }
[data-map-kind="project"], [data-project-map-kind="language"] { --map-kind-color: var(--focus); }
[data-map-kind="tag"], [data-project-map-kind="upstream"] { --map-kind-color: var(--warning); }
[data-project-map-kind="repository"] { --map-kind-color: var(--ink); }
[data-project-map-kind="capability"] { --map-kind-color: var(--success); }

.knowledge-map-stage,
.project-map-stage {
  background-color: var(--surface);
  background-image: radial-gradient(color-mix(in srgb, var(--line-strong) 55%, transparent) .7px, transparent .7px);
  background-size: 18px 18px;
  touch-action: none;
}
.project-map-effects {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#projectMapGraph { position: relative; z-index: 2; }

#knowledgeMapGraph,
#projectMapGraph { cursor: grab; user-select: none; }
#knowledgeMapGraph.panning,
#knowledgeMapGraph.dragging-node,
#projectMapGraph.panning,
#projectMapGraph.dragging-node { cursor: grabbing; }

.knowledge-map-edge,
.project-map-edge {
  stroke: color-mix(in srgb, var(--ink-faint) 54%, transparent);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}
.knowledge-map-edge.explicit,
.project-map-edge.explicit {
  stroke: color-mix(in srgb, var(--accent) 68%, var(--ink-muted));
  stroke-width: 1.8;
  marker-end: url(#knowledgeMapArrow);
}
.project-map-edge.explicit { marker-end: url(#projectMapArrow); }
.knowledge-map-edge.derived,
.project-map-edge.derived { stroke-dasharray: 2 3; }
.project-map-edge.structural { opacity: .08; }
.project-map-edge.structural.is-connected { opacity: .55; stroke-width: 1.8; }
.project-map-edge:not(.structural) { opacity: .32; }
.project-map-edge:not(.structural).is-connected,
.project-map-edge.explicit { opacity: .88; }
.knowledge-map-edge.search-related,
.project-map-edge.search-related { stroke: var(--accent-ink); stroke-width: 2.4; }
.knowledge-map-edge.search-context,
.project-map-edge.search-context,
.knowledge-map-node.search-context,
.project-map-node.search-context { opacity: .38; }

.knowledge-map-node,
.project-map-node { cursor: pointer; outline: none; }
.knowledge-map-node-hit-area,
.project-map-node-hit-area { fill: transparent; pointer-events: all; }
.knowledge-map-node-shape,
.project-map-node-shape {
  fill: var(--surface-strong);
  fill: var(--map-kind-color);
  fill-opacity: .16;
  stroke: var(--map-kind-color);
  stroke-width: 1.7;
  vector-effect: non-scaling-stroke;
  transition: fill 160ms ease, stroke-width 160ms ease;
}
.knowledge-map-node:hover .knowledge-map-node-shape,
.knowledge-map-node:focus-visible .knowledge-map-node-shape,
.knowledge-map-node.selected .knowledge-map-node-shape,
.knowledge-map-node.search-match .knowledge-map-node-shape,
.project-map-node:hover .project-map-node-shape,
.project-map-node:focus-visible .project-map-node-shape,
.project-map-node.selected .project-map-node-shape,
.project-map-node.search-match .project-map-node-shape {
  fill: var(--map-kind-color);
  fill-opacity: .32;
  stroke-width: 3;
  filter: drop-shadow(0 2px 4px color-mix(in srgb, var(--ink) 16%, transparent));
  transform: scale(1.08);
  transform-box: fill-box;
  transform-origin: center;
}
.knowledge-map-node.search-match .knowledge-map-node-shape,
.project-map-node.search-match .project-map-node-shape {
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--map-kind-color) 45%, transparent));
}
.knowledge-map-node:hover .knowledge-map-node-shape,
.knowledge-map-node:focus-visible .knowledge-map-node-shape,
.knowledge-map-node.selected .knowledge-map-node-shape,
.knowledge-map-node.search-match .knowledge-map-node-shape,
.project-map-node:hover .project-map-node-shape,
.project-map-node:focus-visible .project-map-node-shape,
.project-map-node.selected .project-map-node-shape,
.project-map-node.search-match .project-map-node-shape {
  fill-opacity: .32 !important;
}
.knowledge-map-node-label,
.project-map-node-label {
  fill: var(--ink);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 650;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-linejoin: round;
  stroke-width: 3.5px;
  text-anchor: middle;
  pointer-events: none;
}
.knowledge-map-edge-label {
  fill: var(--ink-faint);
  font-family: var(--font-body);
  font-size: 8px;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-linejoin: round;
  stroke-width: 4px;
  text-anchor: middle;
  pointer-events: none;
}

/* 借鉴 OpenWrite 的工作区比例：图谱保持整幅探索空间，检查器放到底部避免挤压节点。 */
.knowledge-map-workspace {
  grid-template-columns: minmax(0, 1fr);
  min-height: 620px;
  border-radius: 6px;
  background: var(--surface-soft);
}
.knowledge-map-stage,
.project-map-stage {
  min-height: clamp(620px, 68vh, 760px);
  border-right: 0;
  border-bottom: 1px solid var(--line);
}
#knowledgeMapGraph,
#projectMapGraph {
  height: clamp(620px, 68vh, 760px);
}
.knowledge-map-inspector {
  display: grid;
  max-height: 244px;
  padding: 16px 18px;
  overflow: hidden;
  grid-template-columns: minmax(260px, .75fr) minmax(0, 1.25fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0 24px;
  border-top: 0;
  border-left: 0;
  background: var(--surface-strong);
}
.knowledge-map-inspector .map-inspector-heading { grid-column: 1; grid-row: 1; }
.knowledge-map-inspector .knowledge-map-detail { grid-column: 1; grid-row: 2; min-height: 0; overflow: auto; }
.knowledge-map-inspector .map-accessible-heading { grid-column: 2; grid-row: 1; }
.knowledge-map-inspector .knowledge-map-node-list { grid-column: 2; grid-row: 2; min-height: 0; overflow: auto; }

/* —— 5.7 对话框 —— */
dialog {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow-3);
}
dialog::backdrop { background: rgba(0, 0, 0, .3); backdrop-filter: blur(4px); }

.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.dialog-header h2 { margin: 6px 0 0; font-size: 20px; font-weight: 650; line-height: 1.2; }
.appearance-dialog > p { margin: -6px 0 20px; color: var(--ink-muted); font-size: 13px; }
.theme-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.theme-option:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.theme-option.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent), var(--shadow-1); }
.theme-option strong, .theme-option small { display: block; line-height: 1.2; }
.theme-option strong { font-size: 13px; }
.theme-option small { margin-top: 2px; font-size: 11px; color: var(--ink-muted); }
.theme-swatch { flex-shrink: 0; display: flex; align-items: flex-end; gap: 2px; width: 42px; height: 42px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); }
.theme-swatch i { display: block; width: 6px; border-radius: 2px 2px 0 0; }
.swatch-atelier { background: #f5f5f7; }
.swatch-atelier i:nth-child(1) { background: #1d1d1f; }
.swatch-atelier i:nth-child(2) { background: #0071e3; }
.swatch-atelier i:nth-child(3) { background: #d7d0c3; }
.swatch-command { background: #080d11; border-radius: 0; }
.swatch-command i:nth-child(1) { background: #72e5a4; }
.swatch-command i:nth-child(2) { background: #49bdd0; }
.swatch-command i:nth-child(3) { background: #19232a; }
.swatch-atlas { background: #eef2e8; border-radius: 12px; }
.swatch-atlas i:nth-child(1) { background: #80659a; border-radius: 7px; }
.swatch-atlas i:nth-child(2) { background: #4c8060; border-radius: 7px; }
.swatch-atlas i:nth-child(3) { background: #e5bd66; border-radius: 7px; }
.swatch-blueprint { background: #edf4fe; border-color: #2669bd; }
.swatch-blueprint i { border: 1px solid #2669bd; background: transparent; }
.swatch-spectrum { background: #0c1020; border-radius: 9px; }
.swatch-spectrum i:nth-child(1) { background: #8d70ff; }
.swatch-spectrum i:nth-child(2) { background: #22b8c7; }
.swatch-spectrum i:nth-child(3) { background: #f06f8c; }

.detail-hero { margin-bottom: 20px; }
.detail-hero h2 { margin: 8px 0; font-size: 22px; font-weight: 650; line-height: 1.2; }
.detail-hero p { color: var(--ink-muted); font-size: 14px; line-height: 1.8; letter-spacing: .015em; }
.detail-body { display: flex; flex-direction: column; gap: 16px; }
.detail-body h3 { margin: 0 0 6px; font-size: 13px; }
.detail-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; }
.detail-facts dt { font-size: 11px; color: var(--ink-faint); }
.detail-facts dd { margin: 0; font-weight: 500; }
.detail-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

.editor-dialog { max-width: 720px; }
.form-notice { margin: -6px 0 16px; color: var(--ink-faint); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-wide { grid-column: 1 / -1; }
.check-field { display: flex; align-items: center; gap: 8px; }
.field > span { font-size: 11px; color: var(--ink-faint); }
.field input, .field textarea, .field select { padding: 9px 11px; }
.field textarea { resize: vertical; }
.form-error { margin: 8px 0 0; color: var(--danger); font-size: 12px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Toast */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 200;
  padding: 12px 24px;
  border-radius: 100px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  box-shadow: var(--shadow-3);
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  white-space: nowrap;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ══════════════════════════════════════════════════════════════════════════
   6 · 五套主题（仅覆盖 token）
   ══════════════════════════════════════════════════════════════════════════ */

/* —— Atelier：浅色现代科技 · 蓝绿橙功能色 —— */
body[data-theme="atelier"] {
  --bg: #f6f8fb;
  --surface: #fbfcfe;
  --surface-strong: #ffffff;
  --surface-soft: #eef2f7;
  /* 文字三层：标题墨蓝 → 正文灰蓝 → 弱文字退隐 */
  --ink: #0c1a2b;
  --ink-muted: #55677c;
  --ink-faint: #9aa8ba;
  --line: rgba(20, 32, 46, .10);
  --line-strong: rgba(20, 32, 46, .18);
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --accent-ink: #1d4ed8;
  --success: #16a34a;
  --warning: #ea580c;
  --danger: #dc2626;
  --focus: #2563eb;
  --shadow-1: 0 1px 2px rgba(20, 32, 46, .05), 0 4px 14px rgba(20, 32, 46, .05);
  --shadow-2: 0 2px 6px rgba(20, 32, 46, .06), 0 14px 36px rgba(20, 32, 46, .08);
  --shadow-3: 0 10px 28px rgba(20, 32, 46, .10), 0 28px 70px rgba(20, 32, 46, .12);
}
body[data-theme="atelier"] .brand-mark { background: #14202e; }
body[data-theme="atelier"] .brand-mark span { background: linear-gradient(180deg, #2563eb, #16a34a); }
body[data-theme="atelier"] .pulse-dot { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 15%, transparent); }

/* —— Command：高密度开发者控制台 —— */
body[data-theme="command"] {
  color-scheme: dark;
  --bg: #080d11;
  --surface: #0e151a;
  --surface-strong: #111a20;
  --surface-soft: #19232a;
  --ink: #e8f5ee;
  --ink-muted: #7e978e;
  --ink-faint: #4d6159;
  --line: #233139;
  --line-strong: #3a4b53;
  --accent: #72e5a4;
  --accent-soft: #123927;
  --accent-ink: #9af5c0;
  --success: #72e5a4;
  --warning: #f0b65b;
  --danger: #ff7373;
  --focus: #49bdd0;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, .3);
  --shadow-3: 0 10px 32px rgba(0, 0, 0, .4);
  --font-body: "SFMono-Regular", Consolas, "Microsoft YaHei", monospace;
  --font-display: var(--font-body);
}
body[data-theme="command"] .brand strong::before { content: "> "; color: var(--accent); }
body[data-theme="command"] .note-card { min-height: 280px; }
body[data-theme="command"] .note-card h3 { font-size: 16px; }
body[data-theme="command"] .note-card::before { height: 2px; }
body[data-theme="command"] .theme-option.is-active,
body[data-theme="command"] .note-card:hover { box-shadow: 5px 5px 0 color-mix(in srgb, var(--accent) 22%, transparent); }
body[data-theme="command"] .pages-carousel-card { border-radius: var(--radius); border: 1px solid var(--line-strong); box-shadow: 4px 4px 0 rgba(0, 0, 0, .25); }
body[data-theme="command"] .pages-carousel-card:hover { box-shadow: 6px 6px 0 color-mix(in srgb, var(--accent) 25%, transparent); }
body[data-theme="blueprint"] .pages-carousel-card { box-shadow: 4px 4px 0 rgba(38, 105, 189, .1); }
body[data-theme="blueprint"] .pages-carousel-card:hover { box-shadow: 6px 6px 0 rgba(38, 105, 189, .14); }
body[data-theme="atlas"] .pages-carousel-card { border-radius: var(--radius-xl); }

/* —— Atlas：柔和知识地图 —— */
body[data-theme="atlas"] {
  --bg: #eef2e8;
  --surface: #f6f8f2;
  --surface-strong: #fcfdf9;
  --surface-soft: #e5eadf;
  --ink: #243229;
  --ink-muted: #61705f;
  --ink-faint: #96a094;
  --line: #d4ddce;
  --line-strong: #b5c4b1;
  --accent: #80659a;
  --accent-soft: #ebe1f1;
  --accent-ink: #634578;
  --success: #4c8060;
  --warning: #a16a20;
  --danger: #b24e58;
  --focus: #466f8f;
  --radius-sm: 14px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-1: 0 2px 8px rgba(53, 76, 59, .06);
  --shadow-2: 0 8px 24px rgba(53, 76, 59, .08);
  --shadow-3: 0 16px 48px rgba(53, 76, 59, .12);
  --font-display: "Avenir Next", "Segoe UI", "Microsoft YaHei", sans-serif;
  --sidebar-width: 280px;
  --card-min: 300px;
  --density: 26px;
}
body[data-theme="atlas"] .brand-mark { border-radius: 14px 5px 14px 14px; }
body[data-theme="atlas"] .note-card:nth-child(3n + 1) { --category-color: #80659a !important; }
body[data-theme="atlas"] .note-card:nth-child(3n + 2) { --category-color: #4c8060 !important; }
body[data-theme="atlas"] .note-card:nth-child(3n) { --category-color: #d29b42 !important; }
body[data-theme="atlas"] .note-card::before { right: 0; bottom: 0; top: auto; height: 5px; transform: scaleX(0); transform-origin: center; border-radius: 0; }
body[data-theme="atlas"] .note-card:hover::before { transform: scaleX(1); }

/* —— Blueprint：工程蓝图 —— */
body[data-theme="blueprint"] {
  --bg: #edf4fe;
  --surface: #f4f8ff;
  --surface-strong: #f9fbff;
  --surface-soft: #e0ecfb;
  --ink: #0f3562;
  --ink-muted: #4f6c94;
  --ink-faint: #8fa4c0;
  --line: #aec6e5;
  --line-strong: #7197c7;
  --accent: #2669bd;
  --accent-soft: #d6e7fb;
  --accent-ink: #174f95;
  --success: #1e7770;
  --warning: #a0631b;
  --danger: #a7324a;
  --focus: #d34772;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --shadow-1: 3px 3px 0 rgba(38, 105, 189, .08);
  --shadow-2: 5px 5px 0 rgba(38, 105, 189, .1);
  --shadow-3: 8px 8px 0 rgba(38, 105, 189, .12);
  --font-body: Arial, "Microsoft YaHei", sans-serif;
  --font-display: "Arial Narrow", Arial, "Microsoft YaHei", sans-serif;
}
body[data-theme="blueprint"] .brand-mark { border: 2px solid var(--ink); background: transparent; color: var(--ink); }
body[data-theme="blueprint"] .page-heading h1,
body[data-theme="blueprint"] .library-head h2 { text-transform: uppercase; }
body[data-theme="blueprint"] .note-card::after {
  content: "+";
  position: absolute;
  right: 10px;
  bottom: 6px;
  color: var(--line-strong);
  font-family: var(--font-mono);
  font-size: 16px;
}

/* —— Spectrum：深空能量场 · 玻璃拟态 —— */
body[data-theme="spectrum"] {
  color-scheme: dark;
  /* 深空三层递进：背景最暗 → 卡片略亮 → 强调最亮 */
  --bg: #0a0d18;
  --surface: #10162a;
  --surface-strong: #161d36;
  --surface-soft: #1a2242;
  /* 文字三层明暗：标题纯白 → 正文柔白 → 弱文字退隐 */
  --ink: #f5f7ff;
  --ink-muted: #a8b2d1;
  --ink-faint: #6a7392;
  --line: #232c4a;
  --line-strong: #3a4670;
  /* 紫色 accent + 柔和光晕 */
  --accent: #8d70ff;
  --accent-soft: #241d4d;
  --accent-ink: #c4b5fd;
  --success: #4ade9e;
  --warning: #fbbf5a;
  --danger: #f4728f;
  --focus: #5ac5e7;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-1: 0 2px 8px rgba(0, 0, 0, .28);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, .38);
  --shadow-3: 0 18px 56px rgba(0, 0, 0, .5);
  --font-display: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  --sidebar-width: 272px;
  --card-min: 320px;
  --density: 24px;
}
body[data-theme="spectrum"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 12% 8%, rgba(125, 92, 255, .14), transparent 55%),
    radial-gradient(ellipse 60% 45% at 88% 30%, rgba(34, 184, 199, .10), transparent 50%),
    radial-gradient(ellipse 55% 45% at 50% 100%, rgba(236, 94, 143, .07), transparent 55%);
}
body[data-theme="spectrum"] .topbar { background: rgba(10, 13, 24, .82); }
body[data-theme="spectrum"] .brand-mark,
body[data-theme="spectrum"] .source-icon,
body[data-theme="spectrum"] .button-primary { background: linear-gradient(135deg, #7658ef, #27a9c1); box-shadow: 0 4px 20px rgba(141, 112, 255, .35); }
body[data-theme="spectrum"] .button-primary:hover { box-shadow: 0 6px 28px rgba(141, 112, 255, .5); }
/* 视觉重心：主标题纯白 + 紫色微光 */
body[data-theme="spectrum"] .page-heading h1 { color: #ffffff; text-shadow: 0 0 40px rgba(141, 112, 255, .28); }
body[data-theme="spectrum"] .page-heading h1 em { color: #c4b5fd; }
/* 轮播卡片深空渐变 + 光晕 */
body[data-theme="spectrum"] .pages-carousel-card { background: linear-gradient(150deg, var(--surface-strong), color-mix(in srgb, var(--surface) 82%, #7d5cff)); }
body[data-theme="spectrum"] .pages-carousel-card:hover { box-shadow: 0 12px 40px rgba(141, 112, 255, .25), var(--shadow-2); }
body[data-theme="spectrum"] .pages-carousel-card-mark { background: rgba(141, 112, 255, .18); }
body[data-theme="spectrum"] .pages-carousel-card-actions a.pages-carousel-open { background: linear-gradient(135deg, #7658ef, #27a9c1); box-shadow: 0 4px 18px rgba(141, 112, 255, .4); }
body[data-theme="spectrum"] .note-card { background: linear-gradient(145deg, var(--surface-strong), color-mix(in srgb, var(--surface) 88%, #7d5cff)); }
body[data-theme="spectrum"] .note-card::before { background: linear-gradient(90deg, #8d70ff, #22b8c7, #f06f8c); }
body[data-theme="spectrum"] .timeline-card,
body[data-theme="spectrum"] .project-card,
body[data-theme="spectrum"] .stat-card,
body[data-theme="spectrum"] .notification-panel { background: color-mix(in srgb, var(--surface-strong) 88%, transparent); backdrop-filter: blur(12px); }

/* ══════════════════════════════════════════════════════════════════════════
   7 · 响应式
   ══════════════════════════════════════════════════════════════════════════ */

/* 窄桌面：侧栏收起为抽屉 */
@media (max-width: 1260px) {
  .topbar { grid-template-columns: auto minmax(260px, 1fr) auto; gap: 14px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar-head { margin-bottom: 18px; }
  .sidebar-head-actions { display: flex; gap: 6px; }
  .sidebar-head #closeSidebar { display: inline-flex; }
  body.sidebar-open .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 70;
    flex-direction: column;
    width: min(320px, 92vw);
    height: 100vh;
    max-height: 100vh;
    padding: 22px 20px 28px;
    border-right: 1px solid var(--line);
    background: var(--surface-strong);
    overflow: hidden;
  }
  body.sidebar-open .sidebar-scroll { flex: 1; max-height: none; overflow-y: auto; }
  body.sidebar-open .sidebar-scrim { display: block; opacity: 1; pointer-events: auto; }
  .main-content { padding: 30px 0 0; }
  .page-heading { flex-direction: column; align-items: flex-start; gap: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .knowledge-map-workspace { grid-template-columns: 1fr; }
  .knowledge-map-inspector { border-left: 0; border-top: 1px solid var(--line); }
  .project-summary { grid-template-columns: repeat(2, 1fr); }
  .project-toolbar { flex-direction: column; align-items: flex-start; }
  .project-filter-tabs { overflow-x: auto; max-width: 100%; scrollbar-width: thin; }
  .page-heading { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: row; gap: 24px; border-left: 0; padding-left: 0; }
  .hero-stat { padding: 0; border-bottom: 0; }
}

@media (max-width: 720px) {
  .topbar { grid-template-columns: auto 1fr; gap: 10px; padding: 10px 16px; }
  .global-search-area { order: 1; grid-column: 1 / -1; }
  .brand strong { font-size: 15px; }
  .page-heading h1 { font-size: 28px; }
  .top-actions #newNoteButton {
    position: fixed;
    right: 16px;
    bottom: 20px;
    z-index: 60;
    height: 46px;
    padding: 0 20px;
    border-radius: 100px;
    box-shadow: var(--shadow-3);
  }
  .top-actions .appearance-button,
  .top-actions .mobile-menu span + span { display: none; }
  .top-actions .mobile-menu { padding: 0 11px; }
  .library-toolbar { flex-direction: column; align-items: flex-start; }
  .pages-carousel-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .pages-carousel-card { flex-basis: 80vw; }
  .toolbar-tail { width: 100%; justify-content: space-between; }
  .notes-grid { grid-template-columns: 1fr; }
  .project-summary { grid-template-columns: repeat(2, 1fr); }
  .project-work-item { align-items: flex-start; flex-direction: column; gap: 8px; }
  .project-work-item > time { align-self: flex-end; }
  .notes-grid.is-list .note-card { grid-template-columns: 1fr; gap: 6px; min-height: 0; }
  .notes-grid.is-list .note-card h3 { grid-column: auto; grid-row: auto; }
  .notes-grid.is-list .summary { grid-column: auto; grid-row: auto; }
  .notes-grid.is-list .card-kicker { grid-column: auto; }
  .notes-grid.is-list .card-footer { grid-column: auto; }
  .notes-grid.is-list .note-tags { grid-column: auto; flex-direction: row; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .focus-row { grid-template-columns: 1fr; }
  .project-summary { grid-template-columns: repeat(2, 1fr); }
  .readme-link-list { grid-template-columns: 1fr; }
  .knowledge-map-controls { flex-wrap: wrap; }
  .map-control input { width: 120px; }
  .knowledge-map-stage,
  .project-map-stage { min-height: 430px; }
  #knowledgeMapGraph,
  #projectMapGraph { height: 430px; }
  .knowledge-map-inspector { max-height: 300px; grid-template-columns: 1fr; grid-template-rows: auto minmax(110px, auto) auto minmax(0, 1fr); gap: 0; }
  .knowledge-map-inspector .map-inspector-heading,
  .knowledge-map-inspector .knowledge-map-detail,
  .knowledge-map-inspector .map-accessible-heading,
  .knowledge-map-inspector .knowledge-map-node-list { grid-column: 1; }
  .knowledge-map-inspector .map-inspector-heading { grid-row: 1; }
  .knowledge-map-inspector .knowledge-map-detail { grid-row: 2; }
  .knowledge-map-inspector .map-accessible-heading { grid-row: 3; }
  .knowledge-map-inspector .knowledge-map-node-list { grid-row: 4; }
  .timeline-dialog, dialog.timeline-dialog:modal { width: 100vw; max-width: none; max-height: 100dvh; border-radius: 0; }
  .timeline-dialog-header { padding: 20px 18px 14px; }
  .timeline-dialog-switch { margin: 14px 18px 0; }
  .changelog-status { margin: 12px 18px 4px; }
  .timeline { padding: 8px 18px 22px; }
  .timeline::before { left: 27px; }
  .changelog-tab { padding: 7px 13px; font-size: 12px; }
}

@media (max-width: 430px) {
  .stats-grid, .project-summary { grid-template-columns: 1fr; }
  .stat-card { min-height: 90px; }
  .page-heading h1 { font-size: 26px; }
  .project-tab { padding: 7px 12px; font-size: 12px; }
  .notification-panel { width: calc(100vw - 32px); }
  .hero-lede { font-size: 14px; }
  .hero-lede .drop-cap { font-size: 44px; margin-top: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .timeline-item { opacity: 1; transform: none; }
}
