/* ==========================================================================
   长期记忆库 · app.css
   纯原生 CSS · 无外链 · 浅色/深色主题 · 精致克制的知识管理质感
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  --font-sans: "Microsoft YaHei UI", "PingFang SC", system-ui, -apple-system, "Segoe UI", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", "Consolas", "Liberation Mono", monospace;

  --sidebar-w: 248px;
  --detail-w: 384px;
  --header-h: 56px;
  --status-h: 30px;

  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --ease: cubic-bezier(0.2, 0.7, 0.25, 1);
  --dur: 180ms;

  /* light theme */
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --bg-sunken: #eef1f5;
  --bg-subtle: #f7f8fb;
  --bg-hover: #f0f2f7;
  --bg-active: #e9edf4;
  --text: #171b22;
  --text-2: #556173;
  --text-3: #8a95a6;
  --text-4: #aab3c1;
  --border: #e3e7ee;
  --border-strong: #d3dae4;
  --brand: #4d63dd;
  --brand-hover: #4053c9;
  --brand-soft: rgba(77, 99, 221, 0.09);
  --brand-soft-2: rgba(77, 99, 221, 0.16);
  --brand-border: rgba(77, 99, 221, 0.32);
  --danger: #d64545;
  --danger-soft: rgba(214, 69, 69, 0.1);
  --danger-border: rgba(214, 69, 69, 0.3);
  --success: #2c9a6b;
  --success-soft: rgba(44, 154, 107, 0.11);
  --warning: #b58125;
  --warning-soft: rgba(181, 129, 37, 0.12);
  --info: #3d7bd9;
  --canvas-bg: #f6f7fa;
  --canvas-dot: #dde2ea;
  --edge: #cfd6e2;
  --edge-hot: #93a2e6;
  --overlay: rgba(19, 24, 34, 0.38);
  --shadow-sm: 0 1px 2px rgba(23, 27, 34, 0.06), 0 1px 1px rgba(23, 27, 34, 0.03);
  --shadow-md: 0 5px 16px rgba(23, 27, 34, 0.08), 0 1px 3px rgba(23, 27, 34, 0.04);
  --shadow-lg: 0 20px 52px rgba(23, 27, 34, 0.17), 0 4px 14px rgba(23, 27, 34, 0.06);
  --focus-ring: 0 0 0 3px rgba(77, 99, 221, 0.22);
  --mark-bg: rgba(240, 184, 46, 0.3);
  --mark-text: #7a5410;
}

html[data-theme="dark"] {
  --bg: #0f1218;
  --bg-elevated: #161a21;
  --bg-sunken: #12161c;
  --bg-subtle: #1a1f27;
  --bg-hover: #1d232c;
  --bg-active: #232a34;
  --text: #e8ecf2;
  --text-2: #a7b0be;
  --text-3: #78828f;
  --text-4: #5c6673;
  --border: #252c36;
  --border-strong: #313a46;
  --brand: #7186ff;
  --brand-hover: #8395ff;
  --brand-soft: rgba(113, 134, 255, 0.12);
  --brand-soft-2: rgba(113, 134, 255, 0.2);
  --brand-border: rgba(113, 134, 255, 0.38);
  --danger: #f07171;
  --danger-soft: rgba(240, 113, 113, 0.12);
  --danger-border: rgba(240, 113, 113, 0.32);
  --success: #4fd39b;
  --success-soft: rgba(79, 211, 155, 0.12);
  --warning: #e0b055;
  --warning-soft: rgba(224, 176, 85, 0.12);
  --info: #6aa4f0;
  --canvas-bg: #0c0f14;
  --canvas-dot: #1d232c;
  --edge: #2c3542;
  --edge-hot: #5969a8;
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.42), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55), 0 6px 18px rgba(0, 0, 0, 0.35);
  --focus-ring: 0 0 0 3px rgba(113, 134, 255, 0.28);
  --mark-bg: rgba(240, 184, 46, 0.24);
  --mark-text: #f3ce7c;
}

/* ---------- 2. Reset / base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

h1, h2, h3, h4, h5, p { margin: 0; }
ul, ol { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
::selection { background: var(--brand-soft-2); }

/* hidden 属性必须始终生效（覆盖组件的 display 规则） */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1;
  color: var(--text-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border);
}

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-4); background-clip: content-box; }

/* ---------- 3. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 33px;
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform 120ms var(--ease);
  user-select: none;
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .icon { width: 15px; height: 15px; }

.btn.primary {
  color: #fff;
  background: var(--brand);
  border-color: transparent;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn.primary:hover { background: var(--brand-hover); }
html[data-theme="dark"] .btn.primary { color: #0d1117; font-weight: 600; }

.btn.ghost { color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn.outline {
  color: var(--text-2);
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn.outline:hover { border-color: var(--border-strong); color: var(--text); }

.btn.subtle { background: var(--bg-subtle); border-color: var(--border); color: var(--text-2); }
.btn.subtle:hover { background: var(--bg-hover); color: var(--text); }

.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }
.btn.danger:hover { background: rgba(214, 69, 69, 0.16); }
.btn.danger-solid { color: #fff; background: var(--danger); border-color: transparent; }
.btn.danger-solid:hover { filter: brightness(0.94); }

.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; gap: 5px; border-radius: 7px; }
.btn.sm .icon { width: 14px; height: 14px; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 33px;
  height: 33px;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease), transform 120ms var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:active { transform: translateY(0.5px); }
.icon-btn.sm { width: 27px; height: 27px; border-radius: 7px; }
.icon-btn.sm .icon { width: 15px; height: 15px; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- 4. App shell / header ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-header {
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px 0 10px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(var(--sidebar-w) - 12px);
  min-width: 0;
  transition: width var(--dur) var(--ease);
}
.sidebar-toggle { color: var(--text-3); }
.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #7488ff 0%, #5868ea 52%, #4756d0 100%);
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(71, 86, 208, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-svg { width: 23px; height: 23px; }
.brand-text { min-width: 0; }
.brand-title {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.brand-sub {
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.035em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.header-search { flex: 1; display: flex; justify-content: flex-start; min-width: 0; }
.search-wrap { position: relative; width: 348px; max-width: 100%; }
.search-input {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 34px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-input::placeholder { color: var(--text-4); }
.search-input:hover { border-color: var(--border-strong); }
.search-input:focus {
  outline: none;
  background: var(--bg-elevated);
  border-color: var(--brand-border);
  box-shadow: var(--focus-ring);
}
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.header-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.header-actions .btn.ghost {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.header-actions .btn.ghost:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.header-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
#btnTheme .icon { width: 17px; height: 17px; }
#btnTheme .icon-sun { display: none; }
#btnTheme .icon-moon { display: block; }
html[data-theme="dark"] #btnTheme .icon-sun { display: block; }
html[data-theme="dark"] #btnTheme .icon-moon { display: none; }
#btnTimeMachine.active-history {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand-border);
}

/* ---------- 5. Body layout ---------- */
.app-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--detail-w);
  transition: grid-template-columns 220ms var(--ease);
}
.app.sidebar-collapsed { --sidebar-w: 0px; }
.app.sidebar-collapsed .sidebar { opacity: 0; pointer-events: none; border-right-color: transparent; }
.app.sidebar-collapsed .brand { width: auto; }
.app.sidebar-collapsed .brand-text { display: none; }

/* ---------- 6. Sidebar ---------- */
.sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: opacity 160ms var(--ease);
}
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 16px 12px 10px; }
.side-section { margin-bottom: 22px; }
.side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 22px;
  padding: 0 4px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  color: var(--text-3);
}
.side-action {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-3);
  padding: 2px 4px;
  border-radius: 5px;
}
.side-action:hover { color: var(--brand); background: var(--brand-soft); }
.side-action .icon { width: 13px; height: 13px; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 0 3px; }
.stat-cell {
  padding: 9px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}
.stat-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-value .unit { font-size: 10.5px; font-weight: 500; color: var(--text-4); letter-spacing: 0; }
.stat-label { margin-top: 2px; font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.kind-filters { display: flex; flex-direction: column; gap: 1px; }
.kind-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  font-size: 12.5px;
  color: var(--text-2);
  border-radius: 7px;
  text-align: left;
  transition: background-color 130ms var(--ease), color 130ms var(--ease);
}
.kind-row:hover { background: var(--bg-hover); color: var(--text); }
.kind-row.active { background: var(--brand-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--brand-border); }
.kind-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--kind-color, var(--brand));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kind-color, var(--brand)) 14%, transparent);
}
.kind-row .kind-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind-row .kind-count { font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.kind-row.active .kind-count { color: var(--text-3); }
.kind-empty { padding: 4px 8px; font-size: 11.5px; color: var(--text-4); }

.tag-filters { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 3px; }
.tag-chip-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 8px;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 130ms var(--ease);
}
.tag-chip-sm:hover { border-color: var(--border-strong); color: var(--text); }
.tag-chip-sm.active { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-border); }
.tag-chip-sm .tag-count { color: var(--text-4); font-size: 10.5px; }
.tag-chip-sm.active .tag-count { color: var(--brand); opacity: 0.7; }

.switch-list { display: flex; flex-direction: column; gap: 2px; padding: 0 3px 6px; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 6px 6px 8px;
  font-size: 12.5px;
  color: var(--text-2);
  border-radius: 7px;
  cursor: pointer;
  user-select: none;
}
.switch-row:hover { background: var(--bg-hover); color: var(--text); }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track {
  position: relative;
  width: 30px;
  height: 18px;
  flex: 0 0 auto;
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--bg-elevated);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  transition: transform var(--dur) var(--ease);
}
.switch-row input:checked + .switch-track { background: var(--brand); border-color: var(--brand); }
.switch-row input:checked + .switch-track .switch-thumb { transform: translateX(12px); background: #fff; }
.switch-row input:focus-visible + .switch-track { box-shadow: var(--focus-ring); }

.sidebar-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 11px;
  color: var(--text-4);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}
.sidebar-foot .icon { width: 13px; height: 13px; }
.sidebar-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 7. Workspace / canvas ---------- */
.workspace {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--canvas-bg);
}
.workspace.history-mode .tree-viewport { filter: saturate(0.68) contrast(0.98); }

.history-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px 0 16px;
  font-size: 12px;
  color: var(--text-2);
  background: linear-gradient(90deg, var(--brand-soft), transparent 70%), var(--bg-elevated);
  border-bottom: 1px solid var(--brand-border);
  animation: slideDown 220ms var(--ease);
}
.history-banner > .icon { color: var(--brand); }
.history-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.history-text strong { font-size: 12.5px; color: var(--text); font-weight: 600; }
.history-text span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.history-lock {
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 999px;
}
.history-banner .btn { margin-left: auto; }

.canvas-area {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background-color: var(--canvas-bg);
  background-image: radial-gradient(circle at 1px 1px, var(--canvas-dot) 1px, transparent 0);
  background-size: 22px 22px;
  background-position: 10px 10px;
}

.tree-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.tree-viewport.dragging { cursor: grabbing; }
.tree-viewport.dragging .node-card { cursor: grabbing; }

.tree-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.tree-world.animate { transition: transform 240ms var(--ease); }

.tree-edges {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
}
.tree-edges path {
  fill: none;
  stroke: var(--edge);
  stroke-width: 1.6;
  transition: stroke 160ms var(--ease);
}
.tree-edges path.hot { stroke: var(--edge-hot); stroke-width: 2; }
.tree-edges path.selected-path { stroke: var(--brand); stroke-width: 2; opacity: 0.85; }

/* --- node cards --- */
.node-card {
  position: absolute;
  width: 244px;
  height: 78px;
  padding: 9px 11px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
  transition: box-shadow 160ms var(--ease), border-color 160ms var(--ease),
              transform 160ms var(--ease), opacity 160ms var(--ease);
}
.node-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  z-index: 3;
}
.node-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft-2), var(--shadow-md);
  z-index: 4;
}
.node-card.in-path { border-color: var(--brand-border); box-shadow: 0 0 0 1px var(--brand-border), var(--shadow-sm); }
.node-card.search-hit {
  border-color: rgba(206, 154, 36, 0.75);
  box-shadow: 0 0 0 3px var(--mark-bg), var(--shadow-sm);
}
html[data-theme="dark"] .node-card.search-hit { border-color: rgba(224, 176, 85, 0.7); }
.node-card.flash { animation: flashNode 1.15s var(--ease) 2; }
.node-card.focus-flash { animation: flashNode 1.15s var(--ease) 2; }
.node-card.is-archived { opacity: 0.58; border-style: dashed; }
.node-card.is-expired { opacity: 0.82; }
.node-card.is-context { opacity: 0.5; border-style: dashed; }
.node-card.is-expired .node-title { color: var(--text-2); }
.node-card.is-expired .node-icon { filter: grayscale(0.75); opacity: 0.75; }

.node-main { display: flex; align-items: flex-start; gap: 9px; }
.node-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-top: 1px;
  font-size: 13.5px;
  line-height: 1;
  border-radius: 8px;
  background: var(--kind-soft, var(--bg-subtle));
  border: 1px solid var(--kind-border, var(--border));
}
.node-body { flex: 1; min-width: 0; }
.node-title {
  font-size: 12.8px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 1px;
}
.node-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}
.node-kind { color: var(--kind-color, var(--text-3)); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.node-meta-dot { opacity: 0.55; }
.node-time { font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.node-count {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 17px;
  padding: 0 6px;
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 550;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.node-toggle {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--text-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: all 140ms var(--ease);
  z-index: 2;
}
.node-toggle:hover { color: var(--brand); border-color: var(--brand-border); background: var(--brand-soft); }
.node-toggle .icon { width: 12px; height: 12px; transition: transform 160ms var(--ease); }
.node-card.collapsed .node-toggle .icon { transform: rotate(0deg); }
.node-card.expanded .node-toggle .icon { transform: rotate(90deg); }
.node-toggle.loading { pointer-events: none; color: transparent; }
.node-toggle.loading::after {
  content: "";
  width: 10px;
  height: 10px;
  border: 1.6px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.node-importance {
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 8px;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-sunken);
  overflow: hidden;
}
.node-importance > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--kind-color, var(--brand));
  transition: width 240ms var(--ease);
}
.node-state {
  position: absolute;
  top: -9px;
  right: 9px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
  color: var(--text-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.node-state.state-future { color: var(--info); border-color: rgba(61, 123, 217, 0.35); background: var(--bg-elevated); }
.node-state.state-expired { color: var(--text-3); }
.node-state.state-archived { color: var(--text-3); border-style: dashed; }

/* --- canvas toolbar / hint --- */
.tree-toolbar {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 10;
}
.toolbar-group { display: flex; align-items: center; gap: 1px; }
.toolbar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.tree-toolbar .btn { color: var(--text-2); }
.tree-toolbar .btn:hover { background: var(--bg-hover); color: var(--text); }
.zoom-level {
  min-width: 44px;
  height: 27px;
  padding: 0 4px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  border-radius: 7px;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.zoom-level:hover { background: var(--bg-hover); color: var(--text); }

.canvas-hint {
  position: absolute;
  left: 16px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  opacity: 0.92;
  pointer-events: none;
  z-index: 5;
}
.canvas-hint .icon { width: 13px; height: 13px; opacity: 0.8; }

/* --- loader / empty / error --- */
.tree-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 18px;
  opacity: 0.9;
}
.sk-card {
  width: 160px;
  height: 68px;
  border-radius: 12px;
  background: linear-gradient(100deg, var(--bg-subtle) 30%, var(--bg-elevated) 50%, var(--bg-subtle) 70%);
  background-size: 220% 100%;
  border: 1px solid var(--border);
  animation: shimmer 1.5s infinite linear;
  animation-delay: calc(var(--i) * 120ms);
}
.tree-empty,
.tree-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  text-align: center;
  animation: fadeIn 240ms var(--ease);
}
.empty-illustration { color: var(--border-strong); margin-bottom: 4px; }
.empty-illustration svg { width: 150px; height: 100px; }
.empty-node { fill: var(--bg-elevated); stroke: var(--border-strong); stroke-width: 1.2; }
.empty-node.faint { opacity: 0.55; }
.empty-line { stroke: var(--border-strong); }
.tree-empty h2, .tree-error h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.tree-empty p, .tree-error p { max-width: 380px; font-size: 12.5px; line-height: 1.7; color: var(--text-3); }
.empty-actions { display: flex; gap: 8px; margin-top: 10px; }
.error-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 50%;
}
.error-icon .icon { width: 19px; height: 19px; }
.tree-error .btn { margin-top: 10px; }

/* ---------- 8. Detail panel ---------- */
.detail-panel {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  overflow: hidden;
}
.detail-empty,
.detail-errorbox {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
}
.detail-empty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.detail-empty-icon .icon { width: 22px; height: 22px; }
.detail-empty h3, .detail-errorbox h3 { font-size: 14px; font-weight: 600; }
.detail-empty p, .detail-errorbox p { max-width: 250px; font-size: 12px; line-height: 1.7; color: var(--text-3); }
.detail-empty .btn { margin-top: 8px; }
.detail-skeleton { padding: 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.sk-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(100deg, var(--bg-subtle) 30%, var(--bg-hover) 50%, var(--bg-subtle) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s infinite linear;
}
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w70 { width: 70%; }
.sk-line.w80 { width: 80%; } .sk-line.w90 { width: 90%; }
.sk-line.tall { height: 22px; }
.sk-block {
  height: 110px;
  border-radius: 10px;
  background: linear-gradient(100deg, var(--bg-subtle) 30%, var(--bg-hover) 50%, var(--bg-subtle) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s infinite linear;
}
.sk-block.short { height: 64px; }

.detail-content { flex: 1; display: flex; flex-direction: column; min-height: 0; animation: fadeIn 200ms var(--ease); }

.detail-head { padding: 18px 18px 12px; flex: 0 0 auto; }
.detail-kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.kind-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--kind-color, var(--text-2));
  background: var(--kind-soft, var(--bg-subtle));
  border: 1px solid var(--kind-border, var(--border));
  border-radius: 999px;
}
.kind-chip .kind-emoji { font-size: 11.5px; line-height: 1; }
.state-chip {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.state-chip.state-future { color: var(--info); background: var(--bg-subtle); border-color: rgba(61, 123, 217, 0.32); }
.state-chip.state-expired { color: var(--text-3); border-style: dashed; }
.state-chip.state-archived { color: var(--text-3); border-style: dashed; }
.version-chip {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.detail-title {
  margin: 9px 0 5px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.012em;
  word-break: break-word;
}
.detail-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  font-size: 11.5px;
  color: var(--text-3);
}
.detail-sub .dot { opacity: 0.5; }
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.detail-actions .btn { border: 1px solid var(--border); background: var(--bg-elevated); box-shadow: var(--shadow-sm); }
.detail-actions .btn:not(.primary):hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text); }
.detail-actions .btn.primary { color: #fff; background: var(--brand); border-color: transparent; }
.detail-actions .btn.primary:hover { background: var(--brand-hover); }
html[data-theme="dark"] .detail-actions .btn.primary { color: #0d1117; }
.detail-actions .menu-wrap { position: relative; }

.detail-crumbs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
  padding: 0 18px 12px;
  font-size: 11.5px;
  color: var(--text-3);
}
.crumb {
  max-width: 130px;
  padding: 2px 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-radius: 5px;
  color: var(--text-3);
  transition: background-color 130ms var(--ease), color 130ms var(--ease);
}
.crumb:hover { color: var(--text); background: var(--bg-hover); }
.crumb.current { color: var(--text-2); font-weight: 600; }
.crumb-sep { display: inline-flex; color: var(--text-4); opacity: 0.7; }
.crumb-sep .icon { width: 11px; height: 11px; }

.detail-scroll { flex: 1; overflow-y: auto; padding: 0 18px 26px; }
.detail-section { margin-top: 18px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  color: var(--text-3);
}
.section-title .icon { width: 13px; height: 13px; }
.section-count {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 16px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.section-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  color: var(--text-3);
  padding: 2px 5px;
  border-radius: 5px;
}
.section-link:hover { color: var(--brand); background: var(--brand-soft); }
.section-link .icon { width: 12px; height: 12px; }

.meta-card {
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 14px; }
.meta-item { min-width: 0; }
.meta-item.wide { grid-column: 1 / -1; }
.meta-label { font-size: 10.5px; color: var(--text-4); margin-bottom: 2px; }
.meta-value { font-size: 12px; color: var(--text-2); word-break: break-word; line-height: 1.5; }
.meta-value.strong { color: var(--text); font-weight: 550; }
.meta-value.mono { font-family: var(--font-mono); font-size: 11px; }
.meta-value .sub { color: var(--text-4); font-size: 11px; }
.imp-row { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.imp-track { flex: 1; height: 5px; background: var(--bg-active); border-radius: 3px; overflow: hidden; }
.imp-fill { display: block; height: 100%; border-radius: 3px; background: var(--kind-color, var(--brand)); }
.imp-num { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.tag-chip:hover { border-color: var(--border-strong); color: var(--text); }

.content-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 0 8px; }
.content-body { font-size: 13px; }
.md { font-size: 13px; line-height: 1.78; color: var(--text); word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.1em 0 0.45em; font-weight: 650; line-height: 1.4; letter-spacing: -0.01em; }
.md h1 { font-size: 17px; } .md h2 { font-size: 15.5px; } .md h3 { font-size: 14px; } .md h4 { font-size: 13px; }
.md p { margin: 0.55em 0; }
.md ul, .md ol { margin: 0.5em 0; padding-left: 1.35em; }
.md li { margin: 0.18em 0; }
.md li > ul, .md li > ol { margin: 0.2em 0; }
.md code {
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.md pre {
  margin: 0.7em 0;
  padding: 11px 12px;
  overflow-x: auto;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  line-height: 1.6;
}
.md pre code { padding: 0; background: none; border: none; font-size: 11.5px; }
.md blockquote {
  margin: 0.7em 0;
  padding: 6px 12px;
  color: var(--text-2);
  background: var(--brand-soft);
  border-left: 3px solid var(--brand-border);
  border-radius: 0 8px 8px 0;
}
.md blockquote p { margin: 0.2em 0; }
.md a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.md hr { margin: 1em 0; border: none; border-top: 1px solid var(--border); }
.md strong { font-weight: 650; }
.md .md-empty { color: var(--text-4); font-size: 12px; }

.empty-block {
  padding: 14px;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
}
.edit-area { display: flex; flex-direction: column; gap: 8px; }
.edit-textarea {
  width: 100%;
  min-height: 230px;
  padding: 11px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
}
.edit-textarea:focus {
  outline: none;
  background: var(--bg-elevated);
  border-color: var(--brand-border);
  box-shadow: var(--focus-ring);
}
.edit-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.edit-hint { font-size: 11px; color: var(--text-4); }
.edit-foot-btns { display: flex; gap: 6px; }

.links-list { display: flex; flex-direction: column; gap: 1px; }
.link-group-label { margin: 8px 0 3px; font-size: 10.5px; color: var(--text-4); }
.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 130ms var(--ease);
}
.link-row:hover { background: var(--bg-hover); }
.link-kind {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 11px;
  border-radius: 6px;
  background: var(--kind-soft, var(--bg-subtle));
  border: 1px solid var(--kind-border, var(--border));
}
.link-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.link-title { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-meta { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-4); }
.relation-chip {
  padding: 0 6px;
  font-size: 10px;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.link-dir { color: var(--text-4); display: inline-flex; }
.link-dir .icon { width: 12px; height: 12px; }
.link-del {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--text-4);
  border-radius: 6px;
  opacity: 0;
  transition: all 130ms var(--ease);
}
.link-row:hover .link-del { opacity: 1; }
.link-del:hover { color: var(--danger); background: var(--danger-soft); }
.link-del .icon { width: 13px; height: 13px; }

.versions-list { display: flex; flex-direction: column; gap: 1px; }
.version-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border-radius: 8px;
  transition: background-color 130ms var(--ease);
}
.version-row:hover { background: var(--bg-hover); }
.version-badge {
  min-width: 27px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: center;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.version-row.current .version-badge { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-border); }
.version-main { flex: 1; min-width: 0; }
.version-title { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.version-title .current-chip { font-size: 9.5px; color: var(--brand); background: var(--brand-soft); padding: 0 5px; border-radius: 999px; }
.version-meta { margin-top: 1px; font-size: 10.5px; color: var(--text-4); }
.version-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 130ms var(--ease); }
.version-row:hover .version-actions, .version-row.current .version-actions { opacity: 1; }
.version-actions .icon-btn { width: 24px; height: 24px; }
.version-actions .icon-btn .icon { width: 13px; height: 13px; }

.access-row { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 12px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; }
.access-stat { display: flex; flex-direction: column; gap: 1px; }
.access-stat .k { font-size: 10.5px; color: var(--text-4); }
.access-stat .v { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.meta-json { margin-top: 12px; }
.meta-json summary {
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 6px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}
.meta-json summary::-webkit-details-marker { display: none; }
.meta-json summary:hover { background: var(--bg-hover); color: var(--text); }
.meta-json summary::before { content: "›"; display: inline-block; transition: transform 130ms var(--ease); }
.meta-json[open] summary::before { transform: rotate(90deg); }
.json-pre {
  margin: 6px 0 0;
  padding: 10px 12px;
  max-height: 220px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.detail-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 11px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(181, 129, 37, 0.28);
  border-radius: 9px;
}
.detail-note .icon { width: 14px; height: 14px; margin-top: 1px; }

/* dropdown menu */
.menu-wrap { position: relative; }
.menu-popover {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  min-width: 168px;
  padding: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  animation: popIn 140ms var(--ease);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  font-size: 12.5px;
  color: var(--text-2);
  border-radius: 6px;
  text-align: left;
}
.menu-item:hover { background: var(--bg-hover); color: var(--text); }
.menu-item .icon { width: 14px; height: 14px; color: var(--text-3); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .icon { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; margin: 4px 2px; background: var(--border); }

/* ---------- 9. Search popover ---------- */
.search-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 620px;
  max-width: calc(100vw - 40px);
  max-height: min(66vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 80;
  animation: popIn 150ms var(--ease);
}
.search-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
.search-status .took { font-variant-numeric: tabular-nums; color: var(--text-4); }
.search-results { overflow-y: auto; flex: 1; padding: 4px; }
.search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 120ms var(--ease);
}
.search-result:hover { background: var(--bg-hover); }
.search-result.active { background: var(--brand-soft); }
.sr-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sr-kind {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 10.5px;
  border-radius: 5px;
  background: var(--kind-soft, var(--bg-subtle));
  border: 1px solid var(--kind-border, var(--border));
}
.sr-title { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sr-title mark, .sr-snippet mark { color: var(--mark-text); background: var(--mark-bg); border-radius: 2px; padding: 0 1px; }
.sr-score { display: flex; align-items: center; gap: 6px; align-self: center; }
.sr-score-bar { width: 42px; height: 3px; border-radius: 2px; background: var(--bg-active); overflow: hidden; }
.sr-score-bar i { display: block; height: 100%; background: var(--brand); border-radius: 2px; }
.sr-score-num { font-size: 10px; color: var(--text-4); font-variant-numeric: tabular-nums; min-width: 24px; text-align: right; }
.sr-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-4); }
.sr-meta .kind-label { color: var(--kind-color, var(--text-3)); font-weight: 550; }
.sr-snippet {
  grid-column: 1 / -1;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-empty { padding: 30px 20px; text-align: center; font-size: 12px; color: var(--text-3); }
.search-empty .icon { width: 20px; height: 20px; display: block; margin: 0 auto 8px; opacity: 0.5; }
.search-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  font-size: 10.5px;
  color: var(--text-4);
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}
.search-footer .keys { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.search-loading { display: flex; align-items: center; gap: 8px; padding: 18px 16px; font-size: 12px; color: var(--text-3); }
.spinner {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 1.8px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 650ms linear infinite;
}

/* ---------- 10. Timeline drawer ---------- */
.drawer-overlay { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; justify-content: flex-end; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(12, 15, 21, 0.16); animation: fadeIn 160ms var(--ease); }
.timeline-drawer {
  position: relative;
  display: flex;
  flex-direction: column;
  height: min(400px, 56vh);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -16px 50px rgba(15, 20, 30, 0.2);
  animation: slideUp 240ms var(--ease);
  overflow: hidden;
}
.drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px 12px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.drawer-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 9px;
}
.drawer-title-wrap h2 { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; }
.drawer-sub { font-size: 11px; color: var(--text-3); }
.basis-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.basis-btn {
  height: 25px;
  padding: 0 10px;
  font-size: 11.5px;
  color: var(--text-3);
  border-radius: 6px;
  transition: all 140ms var(--ease);
}
.basis-btn:hover { color: var(--text); }
.basis-btn.active { color: var(--text); background: var(--bg-elevated); box-shadow: var(--shadow-sm); font-weight: 550; }
.drawer-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.timeline-body { flex: 1; overflow-y: auto; padding: 4px 18px 20px; }
.timeline-day { position: sticky; top: 0; z-index: 2; background: color-mix(in srgb, var(--bg-elevated) 92%, transparent); backdrop-filter: blur(6px); }
.timeline-day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 2px 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
}
.timeline-day-head .weekday { font-size: 10.5px; font-weight: 400; color: var(--text-4); }
.timeline-day-head .day-count { margin-left: auto; font-size: 10px; font-weight: 400; color: var(--text-4); }
.timeline-item {
  display: grid;
  grid-template-columns: 46px 9px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 8px 8px;
  margin: 0 -8px;
  border-radius: 9px;
  cursor: pointer;
  transition: background-color 130ms var(--ease);
}
.timeline-item:hover { background: var(--bg-hover); }
.timeline-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); padding-top: 1px; font-variant-numeric: tabular-nums; }
.timeline-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--kind-color, var(--text-4)); box-shadow: 0 0 0 3px var(--kind-soft, transparent); }
.timeline-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.timeline-title { font-size: 12.5px; font-weight: 550; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.timeline-preview { margin-top: 1px; font-size: 11px; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.timeline-badges { display: flex; align-items: center; gap: 4px; }
.timeline-badges .kind-chip { height: 18px; padding: 0 6px; font-size: 10px; }
.timeline-badges .state-chip { height: 18px; padding: 0 6px; font-size: 9.5px; }
.timeline-empty { padding: 40px 20px; text-align: center; font-size: 12px; color: var(--text-3); }
.timeline-empty .icon { width: 22px; height: 22px; display: block; margin: 0 auto 8px; opacity: 0.45; }
.timeline-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px 0; font-size: 11px; color: var(--text-4); }

/* ---------- 11. Modal / dialog ---------- */
.modal-root { position: fixed; inset: 0; z-index: 120; pointer-events: none; }
.modal-root:not(:empty) { pointer-events: auto; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  animation: fadeIn 150ms var(--ease);
  overflow-y: auto;
}
.modal {
  width: var(--modal-w, 560px);
  max-width: 100%;
  max-height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: popIn 180ms var(--ease);
  overflow: hidden;
}
.modal:focus { outline: none; }
.modal.lg { --modal-w: 760px; }
.modal.sm { --modal-w: 430px; }
.modal.xl { --modal-w: 880px; }
.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 0;
}
.modal-head-main { flex: 1; min-width: 0; }
.modal-title { font-size: 16px; font-weight: 650; letter-spacing: -0.012em; line-height: 1.4; }
.modal-sub { margin-top: 2px; font-size: 11.5px; color: var(--text-3); }
.modal-close { margin: -3px -6px 0 0; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; }
.modal-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}
.modal-foot .foot-left { margin-right: auto; font-size: 11.5px; color: var(--text-3); }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.field-label .req { color: var(--danger); font-weight: 500; }
.field-hint { font-size: 10.5px; color: var(--text-4); line-height: 1.5; }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea { border-color: var(--danger-border); box-shadow: 0 0 0 3px var(--danger-soft); }
.field-error { font-size: 10.5px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-4); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}
.select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.textarea { height: auto; min-height: 84px; padding: 8px 10px; line-height: 1.65; resize: vertical; }
.textarea.code { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; }
.input[type="datetime-local"] { font-variant-numeric: tabular-nums; }
.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1; }
.range-row { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.range { flex: 1; height: 4px; appearance: none; background: var(--bg-active); border-radius: 2px; accent-color: var(--brand); cursor: pointer; }
.range::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--brand);
  box-shadow: var(--shadow-sm);
}
.range-value {
  min-width: 38px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  text-align: right;
}
.form-advanced { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.form-advanced summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  font-size: 11.5px;
  color: var(--text-3);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.form-advanced summary::-webkit-details-marker { display: none; }
.form-advanced summary::before { content: "›"; transition: transform 140ms var(--ease); }
.form-advanced[open] summary::before { transform: rotate(90deg); }
.form-advanced summary:hover { color: var(--text); }
.form-advanced-body { padding-top: 10px; }
.form-error {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 9px 11px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: 8px;
}
.form-error .icon { width: 14px; height: 14px; margin-top: 1px; flex: 0 0 auto; }
.tag-input-wrap { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px 8px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: text; min-height: 34px; align-items: center; }
.tag-input-wrap:focus-within { border-color: var(--brand); box-shadow: var(--focus-ring); }
.tag-input-wrap .tag-chip { padding: 1px 7px; }
.tag-input-wrap .tag-x { margin-left: 1px; opacity: 0.55; cursor: pointer; border: none; background: none; color: inherit; padding: 0; font-size: 11px; display: inline-flex; }
.tag-input-wrap .tag-x:hover { opacity: 1; color: var(--danger); }
.tag-input {
  flex: 1;
  min-width: 90px;
  height: 22px;
  border: none;
  background: none;
  font-size: 12px;
  outline: none;
}

/* confirm */
.confirm-body { display: flex; flex-direction: column; gap: 12px; }
.confirm-message { font-size: 12.5px; line-height: 1.7; color: var(--text-2); }
.confirm-message strong { color: var(--text); font-weight: 600; }
.confirm-details {
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.confirm-details code { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-2); }
.confirm-warn {
  display: flex;
  gap: 7px;
  padding: 9px 11px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: 8px;
}
.confirm-warn .icon { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; }

/* time machine */
.tm-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tm-quick .btn { border: 1px solid var(--border); background: var(--bg-elevated); }
.tm-quick .btn:hover { border-color: var(--brand-border); color: var(--brand); background: var(--brand-soft); }
.tm-current {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.tm-current strong { color: var(--text-2); font-weight: 600; }
.tm-preview { margin-top: 12px; padding: 11px 12px; font-size: 11.5px; line-height: 1.65; color: var(--text-3); background: var(--brand-soft); border: 1px solid var(--brand-border); border-radius: 9px; }

/* node picker */
.picker-search-wrap { position: relative; margin-bottom: 10px; }
.picker-search-wrap .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 15px; height: 15px; }
.picker-search { padding-left: 32px; }
.picker-results { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.picker-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 120ms var(--ease);
}
.picker-item:hover, .picker-item.active { background: var(--brand-soft); }
.picker-item .node-icon { width: 24px; height: 24px; font-size: 12px; margin: 0; }
.picker-main { flex: 1; min-width: 0; }
.picker-title { font-size: 12.5px; font-weight: 550; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.picker-meta { font-size: 10.5px; color: var(--text-4); }
.picker-empty { padding: 24px; text-align: center; font-size: 12px; color: var(--text-3); }
.picker-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 8px;
}

/* version preview */
.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 11.5px;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.preview-meta strong { color: var(--text-2); font-weight: 600; }
.preview-content { font-size: 12.5px; }

/* settings */
.settings-layout { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 20px; min-height: 380px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; align-content: start; }
.settings-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  font-size: 12.5px;
  color: var(--text-2);
  border-radius: 7px;
  text-align: left;
}
.settings-tab:hover { background: var(--bg-hover); color: var(--text); }
.settings-tab.active { background: var(--brand-soft); color: var(--brand); font-weight: 550; }
.settings-tab .icon { width: 15px; height: 15px; }
.settings-pane { min-width: 0; }
.settings-section { margin-bottom: 22px; }
.settings-section:last-child { margin-bottom: 0; }
.settings-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text);
}
.settings-section-desc { margin: -4px 0 10px; font-size: 11.5px; line-height: 1.6; color: var(--text-3); }
.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-main { flex: 1; min-width: 0; }
.settings-row-title { font-size: 12.5px; color: var(--text); font-weight: 500; }
.settings-row-desc { margin-top: 2px; font-size: 11px; line-height: 1.55; color: var(--text-3); }
.settings-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.kv-list { display: flex; flex-direction: column; gap: 1px; }
.kv-row { display: flex; align-items: baseline; gap: 12px; padding: 6px 2px; border-bottom: 1px dashed var(--border); font-size: 11.5px; }
.kv-row:last-child { border-bottom: none; }
.kv-key { flex: 0 0 112px; color: var(--text-4); }
.kv-val { flex: 1; min-width: 0; color: var(--text-2); font-family: var(--font-mono); font-size: 11px; word-break: break-all; }
.code-block { position: relative; margin-top: 8px; }
.code-block pre {
  margin: 0;
  padding: 11px 13px;
  max-height: 250px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  white-space: pre;
}
.code-block .copy-btn { position: absolute; top: 7px; right: 7px; }
.settings-code-label { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 0; font-size: 11.5px; color: var(--text-2); font-weight: 550; }
.settings-code-label .icon { width: 13px; height: 13px; color: var(--text-3); }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.theme-option {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: all 140ms var(--ease);
}
.theme-option:hover { border-color: var(--border-strong); }
.theme-option.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft-2); }
.theme-option .theme-swatch { height: 30px; border-radius: 5px; border: 1px solid var(--border); }
.theme-option .theme-name { font-size: 12px; color: var(--text-2); font-weight: 550; }
.theme-option.active .theme-name { color: var(--brand); }
.swatch-light { background: linear-gradient(135deg, #fff 0 60%, #eef1f6 60% 100%); }
.swatch-dark { background: linear-gradient(135deg, #1b2029 0 60%, #0e1116 60% 100%); }
.swatch-auto { background: linear-gradient(135deg, #fff 0 50%, #161a21 50% 100%); }
.token-row { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.token-row .input { flex: 1; font-family: var(--font-mono); font-size: 11.5px; }
.shortcuts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px; border-bottom: 1px dashed var(--border); font-size: 12px; color: var(--text-2); }
.shortcut-row .keys { display: flex; gap: 3px; }
.import-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.import-controls .select { width: auto; min-width: 150px; }
.file-btn { position: relative; overflow: hidden; display: inline-flex; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.backup-list { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; max-height: 160px; overflow-y: auto; }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 6px; font-size: 11.5px; color: var(--text-2); border-radius: 6px; }
.backup-row:hover { background: var(--bg-hover); }
.backup-row .backup-name { font-family: var(--font-mono); font-size: 10.5px; }
.backup-row .backup-meta { color: var(--text-4); font-size: 10.5px; }
.settings-auth-note { display: flex; gap: 7px; padding: 10px 12px; margin-top: 10px; font-size: 11.5px; line-height: 1.6; color: var(--text-3); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 8px; }
.settings-auth-note .icon { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; }
.settings-auth-note.on { background: var(--success-soft); border-color: rgba(44, 154, 107, 0.3); color: var(--success); }

/* ---------- 12. Toast ---------- */
.toast-root {
  position: fixed;
  right: 18px;
  bottom: calc(var(--status-h) + 14px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 200px;
  max-width: 400px;
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 200ms var(--ease);
}
.toast.leaving { animation: toastOut 160ms var(--ease) forwards; }
.toast-icon { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 auto; border-radius: 50%; }
.toast-icon .icon { width: 13px; height: 13px; }
.toast.success .toast-icon { color: var(--success); background: var(--success-soft); }
.toast.error .toast-icon { color: var(--danger); background: var(--danger-soft); }
.toast.warn .toast-icon { color: var(--warning); background: var(--warning-soft); }
.toast.info .toast-icon { color: var(--info); background: rgba(61, 123, 217, 0.12); }
.toast-msg { flex: 1; }
.toast-close { color: var(--text-4); display: grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; }
.toast-close:hover { color: var(--text); background: var(--bg-hover); }
.toast-close .icon { width: 12px; height: 12px; }

/* ---------- 13. Status bar ---------- */
.status-bar {
  flex: 0 0 var(--status-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  z-index: 30;
  user-select: none;
}
.status-left, .status-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.status-center { flex: 1; min-width: 0; text-align: center; color: var(--text-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-center kbd { margin: 0 1px; }
.status-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.status-sep { color: var(--text-4); opacity: 0.6; }
.status-health .health-dot, .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.health-dot.off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.pulse-dot { animation: pulse 1.6s infinite; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- 14. App error ---------- */
.app-error {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  animation: fadeIn 200ms var(--ease);
}
.app-error-card {
  width: 460px;
  max-width: 100%;
  padding: 30px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.app-error-card .error-icon { margin: 0 auto 14px; width: 44px; height: 44px; }
.app-error-card .error-icon .icon { width: 22px; height: 22px; }
.app-error-card h1 { font-size: 19px; font-weight: 650; letter-spacing: -0.015em; }
.app-error-card p { margin-top: 7px; font-size: 12.5px; line-height: 1.7; color: var(--text-3); }
.app-error-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.app-error-detail {
  margin-top: 14px;
  padding: 10px 12px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
}
.app-error-help { margin-top: 18px; text-align: left; font-size: 11.5px; color: var(--text-3); }
.app-error-help summary { cursor: pointer; user-select: none; }
.app-error-help pre {
  margin-top: 8px;
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  color: var(--text-2);
}

/* ---------- 15. Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(4px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -130% 0; } }
@keyframes flashNode {
  0%, 100% { box-shadow: 0 0 0 0 var(--brand-soft-2), var(--shadow-sm); }
  40% { box-shadow: 0 0 0 6px var(--brand-soft-2), var(--shadow-md); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 16. Responsive ---------- */
@media (max-width: 1500px) {
  :root { --detail-w: 366px; }
  .search-wrap { width: 310px; }
}
@media (max-width: 1360px) {
  :root { --sidebar-w: 232px; --detail-w: 348px; }
  .search-wrap { width: 270px; }
  .header-actions .btn-timeline span { display: none; }
  .header-actions .btn-timeline { width: 33px; padding: 0; }
}
@media (max-width: 1180px) {
  .brand-sub { display: none; }
  .header-search { flex: 1; }
  .search-wrap { width: 100%; max-width: 300px; }
  .header-actions .btn.ghost span { display: none; }
  .header-actions .btn.ghost { width: 33px; padding: 0; }
}
@media (max-width: 1024px) {
  :root { --sidebar-w: 216px; --detail-w: 320px; }
  .detail-head { padding: 14px 14px 10px; }
  .detail-crumbs { padding: 0 14px 10px; }
  .detail-scroll { padding: 0 14px 20px; }
  .header-actions .btn.primary span { display: none; }
  .header-actions .btn.primary { width: 33px; padding: 0; }
  .search-wrap { max-width: 230px; }
  .modal-backdrop { padding: 16px; }
  .settings-layout { grid-template-columns: 148px minmax(0, 1fr); gap: 14px; }
}
@media (max-width: 860px) {
  .detail-panel { display: none; }
  .app-body { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .app.sidebar-collapsed .app-body { grid-template-columns: minmax(0, 1fr); }
  .header-search { display: none; }
}

/* ==========================================================================
   17. 美术重构 ·「月下雾图书馆」公共界面
   --------------------------------------------------------------------------
   浅色 = 羊皮纸与月光；深色 = 深夜天文台。
   只覆写皮肤（色彩 / 字体 / 装饰 / 阴影），不改 JS 依赖的定位与尺寸契约：
   .node-card 恒为 244×78，树布局由 tree.js 的 CARD_W/CARD_H 计算。
   ========================================================================== */

/* ---------- 17.1 表面令牌（仅本层使用，不动全局色板） ---------- */
:root {
  --mh-surface-head: linear-gradient(180deg, rgba(255, 253, 248, 0.95), rgba(248, 243, 233, 0.9));
  --mh-surface-side: linear-gradient(180deg, rgba(252, 248, 240, 0.95), rgba(243, 236, 222, 0.9));
  --mh-surface-card: linear-gradient(180deg, #fffdf8 0%, #f7f0e1 100%);
  --mh-surface-soft: linear-gradient(180deg, #fbf7ee, #f2e9d8);
  --mh-surface-toolbar: rgba(251, 247, 238, 0.9);
  --mh-surface-input: #fffdf8;
  --mh-surface-foot: rgba(246, 241, 231, 0.78);
  --mh-surface-modal: linear-gradient(180deg, #fffdf8 0%, #faf4e8 100%);
  --mh-surface-detail: linear-gradient(180deg, #fffdf8 0%, #fbf5e9 100%);
  --mh-line-soft: rgba(169, 119, 42, 0.18);
  --mh-line: rgba(169, 119, 42, 0.30);
  --mh-line-strong: rgba(169, 119, 42, 0.52);
  --mh-inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --mh-shadow-card: 0 1px 1px rgba(74, 58, 102, 0.05), 0 10px 24px -18px rgba(74, 58, 102, 0.55);
  --mh-shadow-float: 0 18px 48px -24px rgba(74, 58, 102, 0.55), 0 2px 8px rgba(74, 58, 102, 0.06);
  --mh-hover-bg: rgba(169, 119, 42, 0.075);
  --mh-active-bg: rgba(169, 119, 42, 0.15);
  --mh-halo: 0 0 0 1px var(--mh-line-strong), 0 0 0 5px rgba(169, 119, 42, 0.10);
  --mh-node-spine: color-mix(in srgb, var(--kind-color, var(--mh-gold)) 44%, var(--mh-gold));
  --mh-kind-ink: color-mix(in srgb, var(--kind-color, var(--mh-gold)) 55%, var(--text));
  --mh-kind-tint: color-mix(in srgb, var(--kind-color, var(--mh-gold)) 11%, var(--mh-paper));
  --mh-kind-edge: color-mix(in srgb, var(--kind-color, var(--mh-gold)) 34%, var(--mh-gold));
  --mh-decor-filter: none;
}

html[data-theme="dark"] {
  --mh-surface-head: linear-gradient(180deg, rgba(29, 23, 39, 0.95), rgba(20, 16, 28, 0.92));
  --mh-surface-side: linear-gradient(180deg, rgba(29, 23, 40, 0.96), rgba(19, 15, 27, 0.94));
  --mh-surface-card: linear-gradient(180deg, #241d32 0%, #1a1524 100%);
  --mh-surface-soft: linear-gradient(180deg, #201a2b, #171220);
  --mh-surface-toolbar: rgba(31, 25, 43, 0.9);
  --mh-surface-input: #1f1929;
  --mh-surface-foot: rgba(19, 16, 25, 0.78);
  --mh-surface-modal: linear-gradient(180deg, #241d32 0%, #1b1525 100%);
  --mh-surface-detail: linear-gradient(180deg, #1e1828 0%, #181320 100%);
  --mh-line-soft: rgba(224, 189, 116, 0.14);
  --mh-line: rgba(224, 189, 116, 0.26);
  --mh-line-strong: rgba(224, 189, 116, 0.46);
  --mh-inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --mh-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.45), 0 12px 28px -18px rgba(0, 0, 0, 0.9);
  --mh-shadow-float: 0 22px 60px -26px rgba(0, 0, 0, 0.95), 0 2px 10px rgba(0, 0, 0, 0.35);
  --mh-hover-bg: rgba(224, 189, 116, 0.085);
  --mh-active-bg: rgba(224, 189, 116, 0.16);
  --mh-halo: 0 0 0 1px var(--mh-line-strong), 0 0 0 5px rgba(224, 189, 116, 0.14);
  --mh-node-spine: color-mix(in srgb, var(--kind-color, var(--mh-gold)) 40%, var(--mh-gold));
  --mh-kind-ink: color-mix(in srgb, var(--kind-color, var(--mh-gold)) 48%, #fff);
  --mh-kind-tint: color-mix(in srgb, var(--kind-color, var(--mh-gold)) 14%, #1c1725);
  --mh-kind-edge: color-mix(in srgb, var(--kind-color, var(--mh-gold)) 30%, var(--mh-gold));
}

/* 键盘焦点：金色细环，深浅两套都清晰 */
:focus-visible {
  outline: 2px solid var(--mh-gold);
  outline-offset: 2px;
}

/* ---------- 17.2 顶栏 · 馆名牌匾 ---------- */
.app-header {
  flex-basis: var(--header-h);
  gap: 16px;
  padding: 0 16px 0 10px;
  background: var(--mh-surface-head);
  border-bottom: 1px solid var(--mh-line-soft);
  box-shadow: var(--mh-inner-highlight), 0 12px 30px -26px rgba(74, 58, 102, 0.7);
  position: relative;
  z-index: 40;
}

.app-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--mh-line) 12%, var(--mh-gold-line) 50%, var(--mh-line) 88%, transparent);
  pointer-events: none;
}

.brand {
  gap: 11px;
  width: calc(var(--sidebar-w) - 2px);
}

.brand-mark {
  width: 38px;
  height: 38px;
  color: var(--mh-gold);
  background:
    radial-gradient(circle at 34% 26%, rgba(224, 189, 116, 0.3), transparent 58%),
    radial-gradient(circle at 70% 82%, rgba(111, 85, 184, 0.42), transparent 62%),
    linear-gradient(160deg, #2a2140 0%, #191224 62%, #120d1b 100%);
  border: 1px solid rgba(224, 189, 116, 0.5);
  border-radius: 50%;
  box-shadow:
    0 0 0 3px rgba(169, 119, 42, 0.10),
    0 0 18px -4px rgba(224, 189, 116, 0.35),
    0 6px 16px -6px rgba(20, 14, 30, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.brand-mark img,
.brand-mark .brand-svg {
  width: 28px;
  height: 28px;
  display: block;
  filter: drop-shadow(0 0 4px rgba(224, 189, 116, 0.45));
}

.brand-title {
  font-family: var(--mh-font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.075em;
  line-height: 1.1;
  color: var(--text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

html[data-theme="dark"] .brand-title {
  text-shadow: 0 0 18px rgba(224, 189, 116, 0.18);
}

.brand-sub {
  margin-top: 3px;
  font-family: var(--mh-font-display);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.155em;
  text-transform: uppercase;
  color: var(--mh-gold-ink);
  line-height: 1.2;
}

.sidebar-toggle {
  color: var(--mh-gold-ink);
  opacity: 0.75;
}

.sidebar-toggle:hover {
  opacity: 1;
}

/* 搜索：索引卡片 */
.search-wrap {
  width: 360px;
}

.search-input {
  height: 36px;
  padding: 0 36px;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  color: var(--text);
  background: var(--mh-surface-input);
  border: 1px solid var(--mh-line);
  border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(74, 58, 102, 0.05), 0 1px 0 rgba(255, 255, 255, 0.5);
}

.search-input::placeholder {
  color: var(--mh-ink-faint);
  letter-spacing: 0.05em;
}

.search-input:hover {
  border-color: var(--mh-line-strong);
}

.search-input:focus {
  background: var(--mh-paper);
  border-color: var(--mh-gold);
  box-shadow: 0 0 0 3px var(--mh-gold-glow), inset 0 1px 2px rgba(74, 58, 102, 0.04);
}

.search-icon {
  left: 12px;
  color: var(--mh-gold-ink);
  opacity: 0.85;
}

.search-kbd {
  right: 10px;
  color: var(--mh-gold-ink);
  background: var(--mh-surface-input);
  border-color: var(--mh-line);
  box-shadow: 0 1px 0 var(--mh-line-soft);
}

/* 视图切换（样式由 admin.css 定义，这里用更高优先级套用同一套皮） */
body .view-switch {
  padding: 3px;
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 11px;
  box-shadow: var(--mh-inner-highlight);
}

body .view-switch-btn {
  height: 28px;
  padding: 0 11px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
  border-radius: 8px;
}

body .view-switch-btn:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
}

body .view-switch-btn.active {
  color: var(--text);
  background: var(--mh-surface-card);
  box-shadow: 0 0 0 1px var(--mh-line), 0 2px 6px -3px rgba(74, 58, 102, 0.4);
  font-weight: 600;
}

body .view-switch-btn[data-view="admin"].active {
  color: var(--mh-gold-ink);
}

body .view-switch-btn .icon {
  width: 14px;
  height: 14px;
}

/* 顶栏按钮 */
.header-actions {
  gap: 7px;
}

.header-actions .btn.ghost {
  color: var(--mh-ink-soft);
  background: var(--mh-surface-input);
  border-color: var(--mh-line-soft);
  box-shadow: 0 1px 1px rgba(74, 58, 102, 0.05);
}

.header-actions .btn.ghost:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
  border-color: var(--mh-line);
}

.header-divider {
  background: var(--mh-line-soft);
}

.icon-btn {
  color: var(--mh-ink-soft);
}

.icon-btn:hover {
  color: var(--mh-gold-ink);
  background: var(--mh-hover-bg);
}

#btnTheme .icon {
  color: var(--mh-gold-ink);
}

/* ---------- 17.3 按钮 · 蜡封与烫金 ---------- */
.btn {
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 9px;
}

.btn.primary {
  color: #f7e8c2;
  background: linear-gradient(180deg, #5f4a92 0%, #4b3a78 54%, #3b2c60 100%);
  border: 1px solid rgba(224, 189, 116, 0.30);
  box-shadow:
    inset 0 1px 0 rgba(240, 209, 142, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 6px 16px -8px rgba(58, 42, 92, 0.8);
  text-shadow: 0 1px 1px rgba(20, 14, 30, 0.45);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #6d56a6 0%, #57438a 54%, #453370 100%);
}

html[data-theme="dark"] .btn.primary {
  color: #241a10;
  font-weight: 600;
  background: linear-gradient(180deg, #f0d18e 0%, #dcb76c 52%, #c99a48 100%);
  border-color: rgba(240, 209, 142, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 8px 22px -10px rgba(224, 189, 116, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .btn.primary:hover {
  background: linear-gradient(180deg, #f7dfa8 0%, #e5c37c 52%, #d2a351 100%);
}

.btn.ghost {
  color: var(--mh-ink-soft);
}

.btn.ghost:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
}

.btn.outline,
.btn.subtle {
  color: var(--mh-ink-soft);
  background: var(--mh-surface-input);
  border-color: var(--mh-line-soft);
  box-shadow: 0 1px 1px rgba(74, 58, 102, 0.05);
}

.btn.outline:hover,
.btn.subtle:hover {
  color: var(--text);
  border-color: var(--mh-line);
  background: var(--mh-hover-bg);
}

.btn.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.btn.sm {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
}

/* 键帽 */
kbd {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  color: var(--mh-gold-ink);
  background: var(--mh-surface-input);
  border: 1px solid var(--mh-line);
  border-radius: 5px;
  box-shadow: 0 1px 0 var(--mh-line-soft);
}

/* ---------- 17.4 侧栏 · 阅览室目录 ---------- */
.sidebar {
  background: var(--mh-surface-side);
  border-right: 1px solid var(--mh-line-soft);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  backdrop-filter: blur(14px) saturate(1.08);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.35), 14px 0 34px -30px rgba(74, 58, 102, 0.6);
}

html[data-theme="dark"] .sidebar {
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03), 16px 0 40px -32px rgba(0, 0, 0, 0.95);
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .detail-panel {
  border-color: var(--mh-line);
}

.sidebar-scroll {
  padding: 16px 13px 8px;
}

.side-section {
  margin-bottom: 20px;
  position: relative;
}

.side-heading {
  height: auto;
  padding: 0 3px;
  margin-bottom: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mh-gold-ink);
  gap: 8px;
}

.side-heading::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  transform: rotate(45deg);
  border: 1px solid var(--mh-line-strong);
  background: var(--mh-gold-soft);
}

.side-heading span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-heading::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: -5px;
  height: 1px;
  background: linear-gradient(90deg, var(--mh-line), transparent 92%);
  pointer-events: none;
}

.side-heading .side-action {
  position: relative;
  z-index: 1;
}

.side-action {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
  padding: 2px 5px;
  border-radius: 5px;
}

.side-action:hover {
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
}

/* 概览 · 四枚书签 */
.stats-grid {
  gap: 8px;
  padding: 0 1px;
}

.stat-cell {
  position: relative;
  padding: 9px 10px 8px;
  background: var(--mh-surface-card);
  border: 1px solid var(--mh-line-soft);
  border-radius: 12px;
  box-shadow: 0 1px 1px rgba(74, 58, 102, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.stat-cell::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--mh-gold-line), transparent);
}

.stat-value {
  font-family: var(--mh-font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
}

.stat-value .unit {
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--mh-ink-faint);
}

.stat-label {
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--mh-ink-soft);
}

/* 记忆类型 */
.kind-filters {
  gap: 2px;
}

.kind-row {
  position: relative;
  padding: 5px 8px;
  font-size: 12.5px;
  color: var(--mh-ink-soft);
  border-radius: 8px;
}

.kind-row:hover {
  background: var(--mh-hover-bg);
  color: var(--text);
}

.kind-row.active {
  color: var(--text);
  background: linear-gradient(90deg, var(--mh-active-bg), transparent 92%);
  box-shadow: inset 0 0 0 1px var(--mh-line);
}

.kind-row.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--mh-gold-bright), var(--mh-gold));
}

.kind-dot {
  width: 7px;
  height: 7px;
  background: var(--kind-color, var(--brand));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--kind-color, var(--brand)) 22%, transparent);
}

.kind-row .kind-count {
  font-size: 10.5px;
  color: var(--mh-ink-faint);
}

.kind-empty {
  font-size: 11.5px;
  color: var(--mh-ink-faint);
  letter-spacing: 0.04em;
}

/* 标签 · 烫金小签 */
.tag-filters {
  gap: 6px;
  padding: 0 1px;
}

.tag-chip-sm {
  padding: 3px 9px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--mh-ink-soft);
  background: var(--mh-surface-input);
  border: 1px solid var(--mh-line-soft);
  border-radius: 999px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.tag-chip-sm:hover {
  color: var(--text);
  border-color: var(--mh-line-strong);
  background: var(--mh-hover-bg);
}

.tag-chip-sm.active {
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
  border-color: var(--mh-line-strong);
  box-shadow: inset 0 0 0 1px var(--mh-line-soft);
}

.tag-chip-sm .tag-count,
.tag-chip-sm.active .tag-count {
  color: var(--mh-ink-faint);
  font-size: 10px;
}

/* 开关 · 星轨滑扣 */
.switch-list {
  gap: 3px;
  padding: 0 1px 8px;
}

.switch-row {
  padding: 6px 4px 6px 7px;
  font-size: 12px;
  color: var(--mh-ink-soft);
  border-radius: 8px;
}

.switch-row:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
}

.switch-track {
  width: 31px;
  height: 18px;
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line);
  box-shadow: inset 0 1px 2px rgba(74, 58, 102, 0.12);
}

.switch-thumb {
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: linear-gradient(180deg, #fffdf8, #efe4cf);
  border: 1px solid var(--mh-line-soft);
  box-shadow: 0 1px 2px rgba(74, 58, 102, 0.28);
}

.switch-row input:checked + .switch-track {
  background: linear-gradient(180deg, var(--mh-seal-2), var(--mh-seal));
  border-color: rgba(76, 58, 120, 0.5);
  box-shadow: inset 0 1px 0 rgba(224, 189, 116, 0.35), 0 0 0 3px rgba(76, 58, 120, 0.08);
}

.switch-row input:checked + .switch-track .switch-thumb {
  background: linear-gradient(180deg, #f6e3b8, #d9b972);
  border-color: rgba(169, 119, 42, 0.5);
  box-shadow: 0 1px 3px rgba(20, 14, 30, 0.35);
  transform: translateX(13px);
}

html[data-theme="dark"] .switch-row input:checked + .switch-track {
  background: linear-gradient(180deg, #e6c886, #c99a48);
  border-color: rgba(240, 209, 142, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 0 3px rgba(224, 189, 116, 0.1);
}

html[data-theme="dark"] .switch-row input:checked + .switch-track .switch-thumb {
  background: linear-gradient(180deg, #2a2138, #191325);
  border-color: rgba(19, 16, 25, 0.6);
}

.sidebar-foot {
  gap: 7px;
  padding: 10px 15px;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--mh-ink-faint);
  border-top: 1px solid var(--mh-line-soft);
  background: transparent;
}

.sidebar-foot .icon {
  width: 12px;
  height: 12px;
  color: var(--mh-gold-ink);
  opacity: 0.8;
}

/* 侧栏页脚 · 月相落款 */
.side-signature {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 15px 7px;
  opacity: 0.92;
  user-select: none;
}

.side-signature .sig-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-family: var(--mh-font-display);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mh-gold-ink);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.side-signature .sig-rule {
  display: none;
}

.side-signature .sig-phases {
  width: 72px;
  height: 11px;
  flex: 0 0 auto;
  background: var(--mh-decor-phases) no-repeat center / contain;
  opacity: 0.85;
}

.side-signature .sig-hat {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  opacity: 0.75;
}

/* ---------- 17.5 画布 · 天文台穹顶 ---------- */
.workspace {
  background: var(--canvas-bg);
}

.canvas-area {
  background-color: var(--canvas-bg);
  background-image:
    radial-gradient(circle at 1px 1px, var(--canvas-dot) 1px, transparent 0),
    radial-gradient(1100px 680px at 82% -18%, var(--mh-glow-warm), transparent 62%),
    radial-gradient(900px 640px at 0% 104%, var(--mh-glow-cool), transparent 62%);
  background-size: 26px 26px, auto, auto;
  background-position: 12px 12px, center, center;
}

/* 氛围层：星野 / 月轮 / 地平雾 / 烫金角花 */
.canvas-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.canvas-stars {
  position: absolute;
  inset: -6% -4% -10% -4%;
  background-image:
    radial-gradient(1.5px 1.5px at 18% 22%, var(--mh-star), transparent 62%),
    radial-gradient(1.2px 1.2px at 72% 14%, var(--mh-star), transparent 62%),
    radial-gradient(1.7px 1.7px at 44% 38%, var(--mh-star-cool), transparent 62%),
    radial-gradient(1.1px 1.1px at 88% 52%, var(--mh-star), transparent 62%),
    radial-gradient(1.5px 1.5px at 62% 76%, var(--mh-star-cool), transparent 62%),
    radial-gradient(1.1px 1.1px at 12% 66%, var(--mh-star), transparent 62%),
    radial-gradient(1.3px 1.3px at 33% 88%, var(--mh-star), transparent 62%),
    radial-gradient(1.2px 1.2px at 79% 34%, var(--mh-star-cool), transparent 62%),
    radial-gradient(1px 1px at 8% 42%, var(--mh-star), transparent 62%);
  background-size: auto;
  background-repeat: no-repeat;
  opacity: 0.85;
}

/* 深夜：叠一层真实的银河照片，羊皮纸模式下完全不使用照片，保证纸面温暖 */
html[data-theme="dark"] .canvas-stars {
  background-image:
    radial-gradient(1.5px 1.5px at 18% 22%, var(--mh-star), transparent 62%),
    radial-gradient(1.2px 1.2px at 72% 14%, var(--mh-star), transparent 62%),
    radial-gradient(1.7px 1.7px at 44% 38%, var(--mh-star-cool), transparent 62%),
    radial-gradient(1.1px 1.1px at 88% 52%, var(--mh-star), transparent 62%),
    radial-gradient(1.5px 1.5px at 62% 76%, var(--mh-star-cool), transparent 62%),
    radial-gradient(1.1px 1.1px at 12% 66%, var(--mh-star), transparent 62%),
    radial-gradient(1.3px 1.3px at 33% 88%, var(--mh-star), transparent 62%),
    var(--mh-img-hero);
  background-size: auto, auto, auto, auto, auto, auto, auto, cover;
  background-position: center, center, center, center, center, center, center, 54% 38%;
  opacity: 0.75;
  filter: saturate(0.9) contrast(1.05) brightness(0.85);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.55) 48%, rgba(0, 0, 0, 0.16) 88%, transparent 100%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.55) 48%, rgba(0, 0, 0, 0.16) 88%, transparent 100%);
}

/* 星图底纹（羊皮纸侧的水印星座） */
.canvas-atmosphere::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -30px;
  width: 340px;
  height: 255px;
  background: var(--mh-decor-constellation) no-repeat center / contain;
  opacity: 0.13;
  pointer-events: none;
}

html[data-theme="dark"] .canvas-atmosphere::after {
  opacity: 0.16;
  right: -30px;
  bottom: -20px;
}

.canvas-moon {
  position: absolute;
  top: 54px;
  left: 46px;
  right: auto;
  width: 252px;
  height: 252px;
  border-radius: 0;
  background: var(--mh-decor-moon) center / contain no-repeat;
  box-shadow: none;
  opacity: 0.6;
  filter: drop-shadow(0 0 24px rgba(169, 119, 42, 0.16));
  -webkit-mask-image: none;
  mask-image: none;
}

html[data-theme="dark"] .canvas-moon {
  opacity: 0.72;
  filter: drop-shadow(0 0 30px rgba(224, 189, 116, 0.2));
}

html[data-theme="light"] .canvas-moon {
  opacity: 0.8;
  filter: drop-shadow(0 0 20px rgba(169, 119, 42, 0.22));
}

.canvas-moon::after {
  display: none;
}

/* 星图版框：一圈极细烫金线，把画布收成一张星图 */
.canvas-atmosphere::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid var(--mh-line-soft);
  border-radius: 2px;
  pointer-events: none;
}

html[data-theme="dark"] .canvas-atmosphere::before {
  border-color: rgba(224, 189, 116, 0.16);
}

.canvas-fog {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 52%, var(--mh-canvas-veil) 88%, var(--mh-canvas-veil) 100%),
    radial-gradient(900px 420px at 42% 108%, var(--mh-canvas-veil), transparent 70%),
    radial-gradient(120% 80% at 50% 50%, transparent 58%, var(--mh-vignette) 100%);
  opacity: 0.9;
}

html[data-theme="dark"] .canvas-fog {
  background:
    linear-gradient(180deg, rgba(13, 10, 18, 0) 46%, rgba(9, 7, 13, 0.72) 92%),
    radial-gradient(900px 420px at 42% 108%, rgba(38, 29, 58, 0.55), transparent 72%),
    radial-gradient(120% 80% at 50% 50%, transparent 46%, rgba(0, 0, 0, 0.55) 100%);
  opacity: 1;
}

.canvas-ornament {
  position: absolute;
  width: 44px;
  height: 44px;
  background: var(--mh-decor-corner) no-repeat center / contain;
  opacity: 0.38;
}

html[data-theme="dark"] .canvas-ornament {
  opacity: 0.3;
}

.canvas-ornament.tl { top: 12px; left: 12px; }
.canvas-ornament.tr { top: 12px; right: 12px; transform: scaleX(-1); }
.canvas-ornament.bl { bottom: 12px; left: 12px; transform: scaleY(-1); }
.canvas-ornament.br { bottom: 12px; right: 12px; transform: scale(-1, -1); }

/* 星轨连线 */
.tree-edges path {
  stroke: color-mix(in srgb, var(--mh-gold) 55%, transparent);
  stroke-width: 1.25;
}

html[data-theme="dark"] .tree-edges path {
  stroke: color-mix(in srgb, var(--mh-gold) 38%, transparent);
}

.tree-edges path.hot {
  stroke: var(--mh-gold);
  stroke-width: 1.6;
  filter: drop-shadow(0 0 3px rgba(224, 189, 116, 0.35));
}

.tree-edges path.selected-path {
  stroke: color-mix(in srgb, var(--brand) 70%, var(--mh-gold));
  stroke-width: 1.7;
  opacity: 0.9;
}

/* ---------- 17.6 记忆卡片 · 书脊与烫金细框 ---------- */
.node-card {
  /* 尺寸契约：CARD_W = 244 / CARD_H = 78，勿改 */
  width: 244px;
  height: 78px;
  padding: 9px 11px 12px;
  background: var(--mh-surface-card);
  border: 1px solid color-mix(in srgb, var(--mh-gold) 36%, transparent);
  border-left: 3px solid var(--mh-node-spine);
  border-radius: 12px;
  box-shadow: var(--mh-shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

html[data-theme="dark"] .node-card {
  border-color: var(--mh-line);
}

.node-card::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--mh-gold-line), transparent);
  pointer-events: none;
}

.node-card:hover {
  border-color: var(--mh-line-strong);
  border-left-color: var(--mh-gold);
  box-shadow: var(--mh-shadow-float), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transform: translateY(-2px);
}

.node-card.selected {
  border-color: var(--mh-line-strong);
  border-left-color: var(--mh-gold-bright);
  box-shadow: var(--mh-halo), var(--mh-shadow-float);
}

.node-card.in-path {
  border-color: var(--mh-line);
  box-shadow: inset 0 0 0 1px var(--mh-gold-soft), var(--mh-shadow-card);
}

.node-card.search-hit {
  border-color: var(--mh-gold);
  box-shadow: 0 0 0 3px var(--mh-gold-soft), 0 0 18px -6px rgba(224, 189, 116, 0.55), var(--mh-shadow-card);
}

.node-card.is-archived {
  opacity: 0.6;
  border-style: dashed;
  border-left-style: solid;
}

.node-card.is-expired .node-title {
  color: var(--mh-ink-soft);
}

.node-card.is-expired .node-icon {
  filter: grayscale(0.65);
  opacity: 0.7;
}

.node-title {
  font-family: var(--mh-font-display);
  font-size: 13.4px;
  font-weight: 600;
  letter-spacing: 0.012em;
  line-height: 1.35;
  color: var(--text);
}

.node-meta {
  margin-top: 4px;
  font-size: 10.5px;
  letter-spacing: 0.01em;
  color: var(--mh-ink-soft);
}

.node-kind {
  font-weight: 600;
  color: var(--mh-kind-ink);
}

.node-icon {
  width: 26px;
  height: 26px;
  font-size: 13px;
  background: var(--mh-kind-tint);
  border: 1px solid var(--mh-kind-edge);
  border-radius: 8px;
}

.node-count {
  height: 16px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
  border: 1px solid var(--mh-line-soft);
}

.node-importance {
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 2px;
  background: color-mix(in srgb, var(--mh-gold) 16%, transparent);
}

.node-importance > i {
  background: linear-gradient(90deg, var(--mh-node-spine), var(--mh-gold));
}

.node-toggle {
  width: 20px;
  height: 20px;
  color: var(--mh-gold-ink);
  background: var(--mh-surface-card);
  border: 1px solid var(--mh-line);
  box-shadow: 0 1px 3px rgba(74, 58, 102, 0.18);
}

.node-toggle:hover {
  color: var(--text);
  background: var(--mh-gold-soft);
  border-color: var(--mh-line-strong);
}

.node-state {
  top: -9px;
  padding: 1px 7px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--mh-ink-faint);
  background: var(--mh-surface-card);
  border: 1px solid var(--mh-line-soft);
  box-shadow: 0 1px 2px rgba(74, 58, 102, 0.12);
}

.node-state.state-future {
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 34%, transparent);
}

.node-state.state-archived,
.node-state.state-expired {
  color: var(--mh-ink-faint);
}

/* 画布浮件 */
.tree-toolbar {
  top: 16px;
  right: 18px;
  padding: 4px;
  background: var(--mh-surface-toolbar);
  border: 1px solid var(--mh-line-soft);
  border-radius: 12px;
  box-shadow: var(--mh-shadow-float), var(--mh-inner-highlight);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  z-index: 10;
}

.toolbar-sep {
  background: var(--mh-line-soft);
}

.tree-toolbar .btn {
  color: var(--mh-ink-soft);
  letter-spacing: 0.04em;
}

.tree-toolbar .btn:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
}

.zoom-level {
  min-width: 46px;
  color: var(--mh-gold-ink);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.zoom-level:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
}

.canvas-hint {
  left: 18px;
  bottom: 16px;
  padding: 5px 10px;
  gap: 7px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
  background: var(--mh-surface-toolbar);
  border: 1px solid var(--mh-line-soft);
  border-radius: 8px;
  box-shadow: var(--mh-inner-highlight);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 1;
}

.canvas-hint .icon {
  color: var(--mh-gold-ink);
  opacity: 0.75;
}

/* 加载骨架 */
.sk-card {
  background: linear-gradient(100deg, var(--mh-surface-soft) 30%, var(--mh-surface-card) 50%, var(--mh-surface-soft) 70%);
  background-size: 220% 100%;
  border: 1px solid var(--mh-line-soft);
}

/* 空态 / 错误态 */
.tree-empty,
.tree-error {
  gap: 10px;
  z-index: 3;
}

/* 空态插画：JS 会注入旧的节点示意图，这里统一用 CSS 手绘插画替代，不改 JS */
.empty-illustration {
  width: 246px;
  height: 167px;
  margin-bottom: 6px;
  color: var(--mh-line-strong);
  background: var(--mh-decor-empty) no-repeat center / contain;
  filter: drop-shadow(0 10px 24px rgba(74, 58, 102, 0.12));
}

.empty-illustration svg,
.empty-illustration img {
  display: none;
}

.tree-empty h2,
.tree-error h2 {
  font-family: var(--mh-font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text);
}

.tree-empty p,
.tree-error p {
  max-width: 380px;
  font-size: 12.5px;
  line-height: 1.95;
  letter-spacing: 0.015em;
  color: var(--mh-ink-soft);
  text-wrap: pretty;
}

.tree-empty h2::after {
  content: "";
  display: block;
  width: 84px;
  height: 1px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, transparent, var(--mh-gold), transparent);
  opacity: 0.9;
}

.empty-actions {
  gap: 10px;
  margin-top: 14px;
}

.error-icon {
  width: 42px;
  height: 42px;
  color: var(--danger);
  background: radial-gradient(circle at 50% 40%, var(--danger-soft), transparent 72%);
  border: 1px solid var(--danger-border);
  border-radius: 50%;
}

/* 历史视角横幅 */
.history-banner {
  height: 44px;
  padding: 0 16px;
  font-size: 11.5px;
  color: var(--mh-ink-soft);
  background:
    linear-gradient(90deg, var(--mh-gold-soft), transparent 62%),
    var(--mh-surface-head);
  border-bottom: 1px solid var(--mh-line);
  box-shadow: var(--mh-inner-highlight);
}

.history-banner > .icon {
  color: var(--mh-gold-ink);
}

.history-text strong {
  font-family: var(--mh-font-display);
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--text);
}

.history-lock {
  padding: 1px 8px;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
  border: 1px solid var(--mh-line);
  border-radius: 999px;
}

.workspace.history-mode .tree-viewport {
  filter: saturate(0.72) contrast(0.98) sepia(0.08);
}

/* ---------- 17.7 详情面板 · 手稿页 ---------- */
.detail-panel {
  position: relative;
  isolation: isolate;
  background-color: var(--mh-paper);
  background-image:
    radial-gradient(460px 320px at 108% -8%, var(--mh-glow-warm), transparent 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 46%),
    var(--mh-surface-detail);
  border-left: 1px solid var(--mh-line-soft);
  box-shadow: -18px 0 44px -38px rgba(74, 58, 102, 0.55);
}

html[data-theme="dark"] .detail-panel {
  background-image:
    radial-gradient(1.4px 1.4px at 22% 9%, rgba(224, 189, 116, 0.36), transparent 60%),
    radial-gradient(1.1px 1.1px at 74% 18%, rgba(179, 156, 245, 0.3), transparent 60%),
    radial-gradient(1px 1px at 48% 5%, rgba(224, 189, 116, 0.26), transparent 60%),
    radial-gradient(1.2px 1.2px at 88% 34%, rgba(224, 189, 116, 0.2), transparent 60%),
    radial-gradient(460px 340px at 108% -8%, rgba(224, 189, 116, 0.15), transparent 68%),
    radial-gradient(380px 280px at -10% 104%, rgba(179, 156, 245, 0.1), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%);
  background-repeat: no-repeat;
  background-color: var(--mh-paper);
  box-shadow: -18px 0 44px -36px rgba(0, 0, 0, 0.9);
}

/* 纸张纤维（浅色时叠在纸面上，深色时只留极淡的绒感） */
.detail-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--mh-img-paper) center top / cover no-repeat;
  opacity: 0.065;
  mix-blend-mode: multiply;
  pointer-events: none;
}

html[data-theme="dark"] .detail-panel::before {
  opacity: 0.05;
  mix-blend-mode: soft-light;
}

/* 书页装订阴影 */
.detail-panel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 16px;
  z-index: 0;
  background: linear-gradient(90deg, rgba(74, 58, 102, 0.09), rgba(74, 58, 102, 0.03) 45%, transparent);
  pointer-events: none;
}

html[data-theme="dark"] .detail-panel::after {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.18) 45%, transparent);
}

.detail-watermark {
  position: absolute;
  z-index: 0;
  top: 108px;
  right: -38px;
  width: 252px;
  height: 192px;
  background: var(--mh-decor-constellation) no-repeat center / contain;
  opacity: 0.12;
  pointer-events: none;
}

html[data-theme="dark"] .detail-watermark {
  opacity: 0.11;
}

.detail-empty,
.detail-errorbox,
.detail-skeleton,
.detail-content {
  position: relative;
  z-index: 1;
}

.detail-empty,
.detail-errorbox {
  gap: 9px;
  padding: 30px;
}

.detail-empty-icon {
  position: relative;
  width: auto;
  height: auto;
  margin-bottom: 2px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--mh-line-strong);
}

.detail-empty-icon::before {
  content: "";
  position: absolute;
  inset: -16% -14%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--mh-gold-soft), transparent 68%);
  pointer-events: none;
}

.detail-empty-icon img {
  position: relative;
  display: block;
  width: 168px;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(74, 58, 102, 0.14));
}

.detail-empty h3,
.detail-errorbox h3 {
  font-family: var(--mh-font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text);
}

.detail-empty h3::after {
  content: "";
  display: block;
  width: 68px;
  height: 1px;
  margin: 10px auto 0;
  background: linear-gradient(90deg, transparent, var(--mh-gold), transparent);
  opacity: 0.9;
}

.detail-empty p,
.detail-errorbox p {
  max-width: 280px;
  font-size: 12px;
  line-height: 1.9;
  color: var(--mh-ink-soft);
  text-wrap: balance;
}

.detail-empty .btn {
  margin-top: 10px;
}

.detail-head {
  padding: 20px 20px 14px;
  position: relative;
}

.detail-head::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--mh-line), var(--mh-line-soft) 60%, transparent);
}

.detail-kicker {
  gap: 6px;
}

.kind-chip {
  height: 22px;
  padding: 0 9px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--mh-kind-ink);
  background: var(--mh-kind-tint);
  border: 1px solid var(--mh-kind-edge);
}

.kind-chip .kind-emoji {
  font-size: 11px;
}

.state-chip {
  height: 22px;
  padding: 0 9px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--mh-ink-faint);
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
}

.state-chip.state-future {
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 30%, transparent);
  background: color-mix(in srgb, var(--info) 9%, transparent);
}

.state-chip.state-expired,
.state-chip.state-archived {
  border-style: dashed;
  color: var(--mh-ink-faint);
}

.version-chip {
  height: 22px;
  padding: 0 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 5px;
}

.detail-title {
  margin: 10px 0 6px;
  font-family: var(--mh-font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: var(--text);
}

.detail-sub {
  gap: 6px 9px;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--mh-ink-soft);
}

.detail-actions {
  gap: 6px;
  margin-top: 13px;
}

.detail-actions .btn {
  height: 29px;
  padding: 0 10px;
  font-size: 11.5px;
  background: var(--mh-surface-input);
  border: 1px solid var(--mh-line-soft);
  box-shadow: 0 1px 1px rgba(74, 58, 102, 0.05);
}

.detail-actions .btn:not(.primary):hover {
  color: var(--text);
  background: var(--mh-hover-bg);
  border-color: var(--mh-line);
}

.detail-actions .btn.primary {
  color: #f7e8c2;
  background: linear-gradient(180deg, #5f4a92, #453370);
  border-color: rgba(224, 189, 116, 0.3);
  box-shadow: inset 0 1px 0 rgba(240, 209, 142, 0.45), 0 5px 14px -8px rgba(58, 42, 92, 0.8);
}

html[data-theme="dark"] .detail-actions .btn.primary {
  color: #241a10;
  background: linear-gradient(180deg, #f0d18e, #d3a656);
  box-shadow: 0 6px 16px -9px rgba(224, 189, 116, 0.6);
}

.detail-crumbs {
  gap: 1px;
  padding: 10px 20px 12px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--mh-ink-faint);
}

.crumb {
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--mh-ink-faint);
}

.crumb:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
}

.crumb.current {
  color: var(--mh-gold-ink);
  font-weight: 600;
}

.crumb-sep {
  color: var(--mh-line-strong);
  opacity: 1;
}

.detail-scroll {
  padding: 0 20px 30px;
}

.detail-section {
  margin-top: 20px;
}

.section-head {
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--mh-line-soft);
}

.section-title {
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mh-gold-ink);
}

.section-title::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  transform: rotate(45deg);
  border: 1px solid var(--mh-line-strong);
}

.section-title .icon {
  width: 12px;
  height: 12px;
  color: var(--mh-gold-ink);
}

.section-count {
  min-width: 18px;
  height: 16px;
  font-size: 9.5px;
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
  border: 1px solid var(--mh-line-soft);
}

.section-link {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
  padding: 2px 5px;
}

.section-link:hover {
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
}

.meta-card {
  padding: 13px 13px 12px;
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(74, 58, 102, 0.04);
}

.meta-label {
  margin-bottom: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mh-ink-faint);
}

.meta-value {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--mh-ink-soft);
}

.meta-value.strong {
  color: var(--text);
  font-weight: 550;
}

.meta-value.mono {
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.meta-value .sub {
  font-size: 10.5px;
  color: var(--mh-ink-faint);
}

.imp-track {
  height: 4px;
  background: color-mix(in srgb, var(--mh-gold) 14%, transparent);
  box-shadow: inset 0 0 0 1px var(--mh-line-soft);
}

.imp-fill {
  background: linear-gradient(90deg, var(--mh-node-spine), var(--mh-gold));
}

.imp-num {
  font-size: 10.5px;
  color: var(--mh-gold-ink);
}

.tag-list {
  gap: 6px;
}

.tag-chip {
  padding: 2px 9px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--mh-ink-soft);
  background: var(--mh-surface-input);
  border: 1px solid var(--mh-line-soft);
  border-radius: 999px;
}

.tag-chip:hover {
  color: var(--text);
  border-color: var(--mh-line-strong);
}

.content-head {
  margin: 20px 0 9px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--mh-line-soft);
}

.content-head .section-title {
  font-size: 10px;
}

.md {
  font-family: var(--mh-font-reading);
  font-size: 13.2px;
  line-height: 1.92;
  letter-spacing: 0.008em;
  color: var(--text);
}

.md h1,
.md h2,
.md h3,
.md h4 {
  font-family: var(--mh-font-display);
  letter-spacing: 0.03em;
  color: var(--text);
}

.md h1 {
  font-size: 17px;
}

.md h2 {
  font-size: 15.5px;
}

.md h3 {
  font-size: 14px;
}

.md h4 {
  font-size: 13px;
}

.md code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
  border: 1px solid var(--mh-line-soft);
}

.md pre {
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 10px;
}

.md blockquote {
  padding: 7px 13px;
  color: var(--mh-ink-soft);
  background: linear-gradient(90deg, var(--mh-gold-soft), transparent 88%);
  border-left: 2px solid var(--mh-gold);
  border-radius: 0 8px 8px 0;
}

.md a {
  color: var(--mh-gold-ink);
  text-decoration-color: var(--mh-line-strong);
  text-underline-offset: 3px;
}

.md hr {
  border-top: 1px solid var(--mh-line-soft);
}

.md .md-empty {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--mh-ink-faint);
  letter-spacing: 0.04em;
}

.empty-block {
  padding: 16px;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--mh-ink-faint);
  background: var(--mh-surface-soft);
  border: 1px dashed var(--mh-line);
  border-radius: 12px;
}

.edit-textarea {
  min-height: 230px;
  padding: 12px 13px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
  background: var(--mh-surface-input);
  border: 1px solid var(--mh-line);
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(74, 58, 102, 0.05);
}

.edit-textarea:focus {
  outline: none;
  border-color: var(--mh-gold);
  box-shadow: 0 0 0 3px var(--mh-gold-glow);
  background: var(--mh-paper);
}

.edit-hint {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
}

.link-group-label {
  margin: 9px 0 4px;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mh-gold-ink);
}

.link-row {
  padding: 6px 8px;
  border-radius: 9px;
}

.link-row:hover {
  background: var(--mh-hover-bg);
}

.link-kind {
  width: 23px;
  height: 23px;
  font-size: 11px;
  background: var(--mh-kind-tint);
  border: 1px solid var(--mh-kind-edge);
  border-radius: 7px;
}

.link-title {
  font-size: 11.5px;
  color: var(--text);
}

.link-meta {
  font-size: 10px;
  color: var(--mh-ink-faint);
}

.relation-chip {
  padding: 0 6px;
  font-size: 9.5px;
  letter-spacing: 0.05em;
  color: var(--mh-ink-faint);
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
}

.link-del:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.version-row {
  padding: 7px 8px;
  border-radius: 9px;
}

.version-row:hover {
  background: var(--mh-hover-bg);
}

.version-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--mh-ink-faint);
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
}

.version-row.current .version-badge {
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
  border-color: var(--mh-line);
}

.version-title {
  font-size: 11.5px;
  color: var(--mh-ink-soft);
}

.version-title .current-chip {
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
}

.version-meta {
  font-size: 10px;
  color: var(--mh-ink-faint);
}

.access-row {
  padding: 11px 13px;
  gap: 7px 18px;
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 12px;
}

.access-stat .k {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mh-ink-faint);
}

.access-stat .v {
  font-size: 11.5px;
  color: var(--mh-ink-soft);
}

.meta-json summary {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
}

.meta-json summary:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
}

.json-pre {
  padding: 11px 13px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--mh-ink-soft);
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 12px;
}

.detail-note {
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 28%, transparent);
  border-radius: 10px;
}

/* ---------- 17.8 搜索浮层 · 卡片目录 ---------- */
.search-popover {
  width: 640px;
  background: var(--mh-surface-modal);
  border: 1px solid var(--mh-line);
  border-radius: 16px;
  box-shadow: var(--mh-shadow-float), 0 0 0 1px var(--mh-line-soft);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  backdrop-filter: blur(18px) saturate(1.1);
}

.search-popover::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--mh-gold-line), transparent);
}

.search-status {
  padding: 8px 14px;
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--mh-gold-ink);
  background: var(--mh-surface-soft);
  border-bottom: 1px solid var(--mh-line-soft);
}

.search-status .took {
  color: var(--mh-ink-faint);
  letter-spacing: 0.06em;
}

.search-results {
  padding: 6px;
}

.search-result {
  padding: 9px 11px;
  border-radius: 10px;
}

.search-result:hover {
  background: var(--mh-hover-bg);
}

.search-result.active {
  background: linear-gradient(90deg, var(--mh-gold-soft), transparent 92%);
  box-shadow: inset 2px 0 0 var(--mh-gold);
}

.sr-kind {
  width: 20px;
  height: 20px;
  font-size: 10px;
  background: var(--mh-kind-tint);
  border: 1px solid var(--mh-kind-edge);
  border-radius: 6px;
}

.sr-title {
  font-family: var(--mh-font-display);
  font-size: 12.8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.sr-title mark,
.sr-snippet mark {
  color: var(--mark-text);
  background: var(--mark-bg);
  border-radius: 2px;
  padding: 0 2px;
}

.sr-score-bar {
  height: 2px;
  background: color-mix(in srgb, var(--mh-gold) 16%, transparent);
}

.sr-score-bar i {
  background: linear-gradient(90deg, var(--mh-gold), var(--mh-gold-bright));
}

.sr-score-num {
  font-size: 9.5px;
  color: var(--mh-gold-ink);
}

.sr-meta {
  font-size: 10px;
  color: var(--mh-ink-faint);
}

.sr-snippet {
  font-size: 11px;
  line-height: 1.7;
  color: var(--mh-ink-soft);
}

.search-empty {
  padding: 34px 22px;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--mh-ink-faint);
}

.search-footer {
  padding: 7px 14px;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--mh-ink-faint);
  background: var(--mh-surface-soft);
  border-top: 1px solid var(--mh-line-soft);
}

.search-loading {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
}

.spinner {
  border-color: var(--mh-line);
  border-top-color: var(--mh-gold);
}

/* 下拉菜单 */
.menu-popover {
  min-width: 176px;
  padding: 6px;
  background: var(--mh-surface-modal);
  border: 1px solid var(--mh-line);
  border-radius: 12px;
  box-shadow: var(--mh-shadow-float);
}

.menu-item {
  padding: 6px 9px;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--mh-ink-soft);
  border-radius: 7px;
}

.menu-item:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
}

.menu-item .icon {
  color: var(--mh-gold-ink);
  opacity: 0.8;
}

.menu-item.danger,
.menu-item.danger .icon {
  color: var(--danger);
}

.menu-sep {
  background: var(--mh-line-soft);
}

/* ---------- 17.9 时间线抽屉 · 年代记 ---------- */
.drawer-backdrop {
  background: rgba(12, 8, 20, 0.28);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.timeline-drawer {
  background: var(--mh-surface-modal);
  border-top: 1px solid var(--mh-line);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -24px 60px -30px rgba(20, 14, 30, 0.6), var(--mh-inner-highlight);
}

.timeline-drawer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -1px;
  width: 180px;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--mh-gold-bright), transparent);
  pointer-events: none;
}

.drawer-head {
  gap: 18px;
  padding: 13px 18px 13px 20px;
  border-bottom: 1px solid var(--mh-line-soft);
}

.drawer-icon {
  width: 34px;
  height: 34px;
  color: var(--mh-gold-ink);
  background: radial-gradient(circle at 36% 28%, var(--mh-gold-soft), transparent 70%);
  border: 1px solid var(--mh-line);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--mh-gold-soft);
}

.drawer-title-wrap h2 {
  font-family: var(--mh-font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.drawer-sub {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--mh-ink-faint);
}

.basis-switch {
  padding: 3px;
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 10px;
}

.basis-btn {
  height: 26px;
  padding: 0 11px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
  border-radius: 7px;
}

.basis-btn:hover {
  color: var(--text);
}

.basis-btn.active {
  color: var(--text);
  background: var(--mh-surface-input);
  box-shadow: 0 0 0 1px var(--mh-line-soft), 0 1px 3px rgba(74, 58, 102, 0.12);
  font-weight: 550;
}

.drawer-actions .icon-btn {
  color: var(--mh-ink-faint);
}

.timeline-body {
  padding: 6px 20px 22px;
}

.timeline-day {
  background: color-mix(in srgb, var(--mh-paper) 90%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.timeline-day-head {
  padding: 12px 2px 7px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mh-gold-ink);
  border-bottom: 1px dashed var(--mh-line-soft);
  margin-bottom: 4px;
}

.timeline-day-head .weekday,
.timeline-day-head .day-count {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--mh-ink-faint);
}

.timeline-item {
  grid-template-columns: 48px 9px minmax(0, 1fr) auto;
  padding: 8px 9px;
  margin: 0 -9px;
  border-radius: 9px;
}

.timeline-item:hover {
  background: var(--mh-hover-bg);
}

.timeline-time {
  font-size: 10.5px;
  color: var(--mh-ink-faint);
}

.timeline-dot {
  background: var(--mh-node-spine);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kind-color, var(--mh-gold)) 12%, transparent);
}

.timeline-title {
  font-family: var(--mh-font-display);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.timeline-preview {
  font-size: 10.5px;
  color: var(--mh-ink-faint);
}

.timeline-empty {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
}

.timeline-foot {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
}

/* ---------- 17.10 对话框 · 手稿封面 ---------- */
.modal-backdrop {
  padding: 28px;
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(224, 189, 116, 0.14), transparent 62%),
    radial-gradient(900px 520px at 100% 110%, rgba(111, 85, 184, 0.10), transparent 66%),
    var(--overlay);
  -webkit-backdrop-filter: blur(7px) saturate(0.92);
  backdrop-filter: blur(7px) saturate(0.92);
}

.modal {
  position: relative;
  background: var(--mh-surface-modal);
  border: 1px solid var(--mh-line);
  border-radius: 18px;
  box-shadow: 0 30px 80px -36px rgba(20, 14, 30, 0.65), var(--mh-inner-highlight);
}

.modal::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--mh-line-soft);
  border-radius: 13px;
  pointer-events: none;
}

.modal-head {
  padding: 20px 22px 0;
  position: relative;
}

.modal-title {
  font-family: var(--mh-font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: var(--text);
}

.modal-sub {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.65;
  letter-spacing: 0.02em;
  color: var(--mh-ink-soft);
}

.modal-close {
  color: var(--mh-ink-faint);
}

.modal-close:hover {
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
}

.modal-body {
  padding: 16px 22px;
}

.modal-foot {
  gap: 9px;
  padding: 14px 22px;
  border-top: 1px solid var(--mh-line-soft);
  background: var(--mh-surface-soft);
}

.modal-foot .foot-left {
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--mh-ink-faint);
}

/* 表单 */
.form-grid {
  gap: 14px 16px;
}

.field {
  gap: 6px;
}

.field-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--mh-gold-ink);
}

.field-hint {
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--mh-ink-faint);
}

.field-error {
  font-size: 10px;
  color: var(--danger);
}

.input,
.select,
.textarea {
  height: 35px;
  padding: 0 11px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--mh-surface-input);
  border: 1px solid var(--mh-line);
  border-radius: 9px;
  box-shadow: inset 0 1px 2px rgba(74, 58, 102, 0.05);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--mh-ink-faint);
  letter-spacing: 0.02em;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--mh-line-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--mh-gold);
  box-shadow: 0 0 0 3px var(--mh-gold-glow);
}

.textarea {
  min-height: 88px;
  padding: 9px 11px;
  line-height: 1.7;
}

.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--mh-gold-ink) 50%),
    linear-gradient(135deg, var(--mh-gold-ink) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field.invalid .input,
.field.invalid .select,
.field.invalid .textarea {
  border-color: var(--danger-border);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.range {
  height: 3px;
  background: color-mix(in srgb, var(--mh-gold) 18%, transparent);
  accent-color: var(--mh-gold);
}

.range-value {
  color: var(--mh-gold-ink);
  font-size: 10.5px;
}

.form-advanced {
  border-top: 1px solid var(--mh-line-soft);
}

.form-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: 9px;
}

.tag-input-wrap {
  padding: 6px 9px;
  background: var(--mh-surface-input);
  border: 1px solid var(--mh-line);
  border-radius: 9px;
  box-shadow: inset 0 1px 2px rgba(74, 58, 102, 0.05);
}

.tag-input {
  color: var(--text);
}

.confirm-message {
  font-size: 12px;
  line-height: 1.8;
  color: var(--mh-ink-soft);
}

.confirm-details {
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 10px;
}

.confirm-warn {
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 28%, transparent);
  border-radius: 9px;
}

/* 时间机器 / 节点选择 / 版本预览 */
.tm-quick .btn:hover {
  color: var(--mh-gold-ink);
  border-color: var(--mh-line);
  background: var(--mh-gold-soft);
}

.tm-current {
  color: var(--mh-ink-soft);
}

.tm-preview {
  padding: 11px 13px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--mh-ink-soft);
  background: var(--mh-gold-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 10px;
}

.picker-search-wrap .icon {
  color: var(--mh-gold-ink);
}

.picker-results {
  gap: 2px;
}

.picker-item {
  border-radius: 9px;
}

.picker-item:hover,
.picker-item.active {
  background: var(--mh-hover-bg);
}

.picker-title {
  font-family: var(--mh-font-display);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.picker-meta {
  font-size: 10px;
  color: var(--mh-ink-faint);
}

.picker-empty {
  font-size: 11.5px;
  color: var(--mh-ink-faint);
}

.picker-selected {
  background: var(--mh-gold-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 9px;
}

.preview-meta {
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 10px;
}

.preview-content {
  font-size: 12px;
}

/* 设置面板（公共视图内） */
.settings-nav {
  gap: 3px;
}

.settings-tab {
  border-radius: 8px;
  color: var(--mh-ink-soft);
}

.settings-tab.active {
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
  box-shadow: inset 0 0 0 1px var(--mh-line-soft);
  font-weight: 600;
}

.settings-section-title {
  font-family: var(--mh-font-display);
  letter-spacing: 0.05em;
  color: var(--text);
}

.settings-section-desc {
  color: var(--mh-ink-faint);
}

.settings-row {
  border-bottom: 1px dashed var(--mh-line-soft);
}

.settings-row-title {
  font-size: 12px;
  color: var(--text);
}

.settings-row-desc {
  color: var(--mh-ink-faint);
}

.kv-row {
  border-bottom: 1px dashed var(--mh-line-soft);
}

.kv-key {
  letter-spacing: 0.04em;
  color: var(--mh-ink-faint);
}

.kv-val {
  color: var(--mh-ink-soft);
}

.settings-code-label {
  color: var(--mh-ink-soft);
  letter-spacing: 0.03em;
}

.code-block {
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 10px;
}

.theme-options {
  gap: 10px;
}

.theme-option {
  border: 1px solid var(--mh-line-soft);
  border-radius: 10px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.theme-option:hover {
  border-color: var(--mh-line);
}

.theme-option.active {
  border-color: var(--mh-gold);
  box-shadow: 0 0 0 2px var(--mh-gold-soft);
}

.swatch-light {
  background: linear-gradient(135deg, #fbf7ee 0 58%, #e8dcc6 58% 100%);
}

.swatch-dark {
  background: linear-gradient(135deg, #241d32 0 58%, #100c1a 58% 100%);
}

.swatch-auto {
  background: linear-gradient(135deg, #fbf7ee 0 50%, #16111f 50% 100%);
}

.token-row {
  gap: 7px;
}

.shortcut-row {
  border-bottom: 1px dashed var(--mh-line-soft);
  font-size: 11.5px;
  color: var(--mh-ink-soft);
}

.file-btn,
.import-controls {
  gap: 8px;
}

.backup-list {
  gap: 2px;
}

.backup-row {
  border-radius: 8px;
  color: var(--mh-ink-soft);
}

.backup-row:hover {
  background: var(--mh-hover-bg);
}

.backup-row .backup-name {
  color: var(--mh-gold-ink);
}

.backup-row .backup-meta {
  color: var(--mh-ink-faint);
}

.settings-auth-note {
  padding: 11px 13px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--mh-ink-soft);
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 10px;
}

/* ---------- 17.11 Toast · 书签 ---------- */
.toast-root {
  right: 20px;
  bottom: calc(var(--status-h) + 16px);
  gap: 9px;
}

.toast {
  min-width: 210px;
  max-width: 420px;
  padding: 11px 14px 11px 13px;
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0.015em;
  color: var(--text);
  background: var(--mh-surface-modal);
  border: 1px solid var(--mh-line);
  border-left: 2px solid var(--mh-gold);
  border-radius: 10px;
  box-shadow: var(--mh-shadow-float), var(--mh-inner-highlight);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warn {
  border-left-color: var(--warning);
}

.toast.info {
  border-left-color: var(--mh-gold);
}

.toast-icon {
  width: 19px;
  height: 19px;
}

.toast.success .toast-icon {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 17%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 32%, transparent);
}

.toast.error .toast-icon {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 17%, transparent);
  box-shadow: 0 0 0 1px var(--danger-border);
}

.toast.warn .toast-icon {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 34%, transparent);
}

.toast.info .toast-icon {
  color: var(--mh-gold-ink);
  background: var(--mh-gold-soft);
  box-shadow: 0 0 0 1px var(--mh-line);
}

.toast-close {
  color: var(--mh-ink-faint);
}

.toast-close:hover {
  color: var(--text);
  background: var(--mh-hover-bg);
}

/* ---------- 17.12 状态栏 · 藏书票 ---------- */
.status-bar {
  gap: 16px;
  padding: 0 16px;
  font-size: 10.5px;
  letter-spacing: 0.045em;
  color: var(--mh-ink-faint);
  background: var(--mh-surface-head);
  border-top: 1px solid var(--mh-line-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

html[data-theme="dark"] .status-bar {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.status-left,
.status-right {
  gap: 11px;
}

.status-center {
  color: var(--mh-ink-faint);
  letter-spacing: 0.06em;
}

.status-center kbd {
  height: 16px;
  min-width: 16px;
  padding: 0 4px;
  font-size: 9.5px;
  color: var(--mh-gold-ink);
  background: transparent;
  border-color: var(--mh-line-soft);
  box-shadow: none;
}

.status-item {
  gap: 5px;
}

.status-sep {
  color: var(--mh-line-strong);
  opacity: 1;
}

.status-health .health-dot {
  width: 5px;
  height: 5px;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.health-dot.off {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.pulse-dot {
  width: 5px;
  height: 5px;
  background: var(--mh-gold);
  box-shadow: 0 0 0 3px var(--mh-gold-soft);
}

/* ---------- 17.13 启动失败页 ---------- */
.app-error {
  background:
    radial-gradient(1000px 600px at 50% -10%, var(--mh-glow-warm), transparent 62%),
    var(--mh-img-hero) center 30% / cover no-repeat,
    var(--bg);
}

.app-error::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--mh-canvas-veil);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.app-error-card {
  position: relative;
  width: 470px;
  padding: 34px 30px;
  background: var(--mh-surface-modal);
  border: 1px solid var(--mh-line);
  border-radius: 18px;
  box-shadow: 0 30px 80px -36px rgba(20, 14, 30, 0.6), var(--mh-inner-highlight);
}

.app-error-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--mh-line-soft);
  border-radius: 13px;
  pointer-events: none;
}

.app-error-card h1 {
  font-family: var(--mh-font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.app-error-card p {
  font-size: 12px;
  line-height: 1.8;
  color: var(--mh-ink-soft);
}

.app-error-detail {
  font-size: 10px;
  color: var(--mh-ink-soft);
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 9px;
}

.app-error-help {
  font-size: 10.5px;
  color: var(--mh-ink-faint);
}

.app-error-help pre {
  font-size: 10px;
  color: var(--mh-ink-soft);
  background: var(--mh-surface-soft);
  border: 1px solid var(--mh-line-soft);
  border-radius: 9px;
}

/* ---------- 17.14 装饰动效（克制、可关闭） ---------- */
@keyframes mhFogDrift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-22px, 10px, 0); }
}

@keyframes mhMoonBreath {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.022) rotate(0.6deg); }
}

.canvas-moon {
  animation: mhMoonBreath 18s ease-in-out infinite;
}

.canvas-fog {
  animation: mhFogDrift 42s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .canvas-moon,
  .canvas-fog {
    animation: none !important;
  }
}

/* ---------- 17.15 响应式（覆盖本层固定宽度，保持 1024–1920 可用） ---------- */
@media (max-width: 1500px) {
  .search-wrap { width: 318px; }
  .brand-title { font-size: 16px; letter-spacing: 0.06em; }
  .node-title { font-size: 13px; }
}

@media (max-width: 1360px) {
  .search-wrap { width: 276px; }
  .brand-sub { letter-spacing: 0.2em; }
  .canvas-moon { width: 380px; height: 380px; top: -110px; right: -70px; }
}

@media (max-width: 1180px) {
  .search-wrap { width: 100%; max-width: 300px; }
  .brand-title { font-size: 15.5px; }
  .tree-toolbar { top: 12px; right: 14px; }
  .canvas-ornament { width: 36px; height: 36px; }
}

@media (max-width: 1024px) {
  .search-wrap { max-width: 236px; }
  .brand { gap: 9px; }
  .brand-mark { width: 33px; height: 33px; }
  .brand-title { font-size: 15px; letter-spacing: 0.05em; }
  .detail-head { padding: 16px 15px 12px; }
  .detail-head::after { left: 15px; right: 15px; }
  .detail-crumbs { padding: 8px 15px 10px; }
  .detail-scroll { padding: 0 15px 22px; }
  .detail-watermark { width: 210px; height: 160px; right: -40px; }
  .timeline-body { padding: 6px 16px 20px; }
  .drawer-head { padding: 12px 14px 12px 16px; }
}

@media (max-width: 860px) {
  .canvas-moon { display: none; }
  .canvas-ornament { display: none; }
  .brand-mark { width: 32px; height: 32px; }
}

@media (max-height: 850px) {
  .side-signature { display: none; }
}

@media (max-height: 640px) {
  .side-heading { margin-bottom: 8px; }
  .side-section { margin-bottom: 16px; }
}
