/* ==================== 设计变量 ==================== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.08);
  --accent: #8b5cf6;
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-hover: #f4f4f5;
  --bg-sidebar: #ffffff;
  --bg-input: #f4f4f5;
  --bg-elevated: #ffffff;
  --bg-subtle: #f4f4f5;
  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --text-faint: #d4d4d8;
  --border: #e4e4e7;
  --border-light: #f4f4f5;
  --border-strong: #d4d4d8;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 56px rgba(0,0,0,0.14), 0 8px 16px rgba(0,0,0,0.06);
  --shadow-glow: 0 0 0 3px var(--primary-soft);
  --radius-xs: 5px;
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;
  --sidebar-width: 264px;
  --header-height: 60px;
  --danger: #e5484d;
  --danger-soft: rgba(229,72,77,0.08);
  --success: #30a46c;
  --success-soft: rgba(48,164,108,0.08);
  --warning: #f5a623;
  --warning-soft: rgba(245,166,35,0.1);
  --transition: 0.18s cubic-bezier(0.4,0,0.2,1);
  --transition-fast: 0.12s ease;
}

[data-theme="dark"] {
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --primary-light: #a5b4fc;
  --primary-soft: rgba(129,140,248,0.12);
  --accent: #a78bfa;
  --bg: #09090b;
  --bg-card: #18181b;
  --bg-hover: #27272a;
  --bg-sidebar: #0f0f11;
  --bg-input: #1f1f23;
  --bg-elevated: #1c1c1f;
  --bg-subtle: #1a1a1d;
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-faint: #3f3f46;
  --border: #27272a;
  --border-light: #1f1f23;
  --border-strong: #3f3f46;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.55);
  --shadow-xl: 0 20px 56px rgba(0,0,0,0.65);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  transition: background var(--transition), color var(--transition);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  letter-spacing: -0.01em;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; transition: all var(--transition); }
input, textarea { font-family: inherit; outline: none; border: none; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--primary-soft); color: var(--primary); }
[data-lucide] { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }

.reading-progress { position: fixed; top: 0; left: 0; height: 2px; background: var(--primary); width: 0%; z-index: 9999; transition: width 0.1s ease; }

.icon-only { width: 34px; height: 34px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); flex-shrink: 0; }
.icon-only:hover { background: var(--bg-hover); color: var(--text); }
.icon-only.sm { width: 28px; height: 28px; }
.icon-only.sm [data-lucide] { width: 14px; height: 14px; }
.icon-only.active { background: var(--primary-soft); color: var(--primary); }

.header { height: var(--header-height); background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 16px; z-index: 100; position: relative; }
.header-left { display: flex; align-items: center; gap: 10px; }
.sidebar-toggle { display: none; }
.logo { font-size: 15px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; white-space: nowrap; letter-spacing: -0.02em; }
.logo-mark { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg-card); display: flex; align-items: center; justify-content: center; }
.logo-mark [data-lucide] { width: 15px; height: 15px; }
.logo-text { font-weight: 600; }
.header-center { flex: 1; display: flex; justify-content: center; max-width: 460px; margin: 0 auto; }
.search-box { width: 100%; display: flex; align-items: center; background: var(--bg-input); border-radius: var(--radius); padding: 0 10px; border: 1px solid transparent; transition: all var(--transition); height: 36px; }
.search-box:focus-within { border-color: var(--border-strong); background: var(--bg-card); box-shadow: var(--shadow-glow); }
.search-icon { color: var(--text-muted); width: 15px; height: 15px; }
.search-box input { flex: 1; background: none; color: var(--text); padding: 0 8px; font-size: 13.5px; }
.search-box input::placeholder { color: var(--text-muted); }
.search-kbd { font-size: 10px; font-weight: 500; color: var(--text-muted); background: var(--bg-card); border: 1px solid var(--border); padding: 1px 5px; border-radius: var(--radius-xs); font-family: inherit; line-height: 1.4; }
.search-clear { width: 20px; height: 20px; border-radius: var(--radius-xs); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.search-clear:hover { background: var(--bg-hover); color: var(--text); }
.search-clear [data-lucide] { width: 12px; height: 12px; }
.header-right { display: flex; align-items: center; gap: 4px; }

.user-switcher { position: relative; }
.user-switcher-btn { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: var(--radius-full); background: var(--bg-input); border: 1px solid transparent; color: var(--text); font-weight: 500; font-size: 13px; height: 36px; transition: all var(--transition); }
.user-switcher-btn:hover { border-color: var(--border-strong); background: var(--bg-card); }
.user-switcher-btn.active { border-color: var(--primary); box-shadow: var(--shadow-glow); background: var(--bg-card); }
.user-avatar { width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--text); color: var(--bg-card); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.user-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-arrow { color: var(--text-muted); width: 14px; height: 14px; }
.user-dropdown { position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xl); padding: 5px; z-index: 200; display: none; animation: dropdownIn 0.15s ease; }
.user-dropdown.show { display: block; }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.user-dropdown-label { font-size: 11px; font-weight: 500; color: var(--text-muted); padding: 6px 8px 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.user-dropdown-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text); transition: background var(--transition-fast); }
.user-dropdown-item:hover { background: var(--bg-hover); }
.user-dropdown-item.active { background: var(--primary-soft); color: var(--primary); }
.user-dropdown-item .user-avatar { width: 22px; height: 22px; font-size: 10px; }
.user-dropdown-item .user-item-name { flex: 1; }
.user-dropdown-item .user-item-count { font-size: 11px; color: var(--text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.user-dropdown-item.active .user-item-count { color: var(--primary); }
.user-item-rename { width: 22px; height: 22px; border-radius: var(--radius-xs); display: none; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; margin-left: 2px; }
.user-item-rename [data-lucide] { width: 13px; height: 13px; }
.user-dropdown-item:hover .user-item-rename { display: flex; }
.user-dropdown-item:hover .user-item-count { display: none; }
.user-item-rename:hover { color: var(--primary); background: var(--primary-soft); }
.user-dropdown-item.active .user-item-rename { color: var(--primary); }
.user-dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }
.user-dropdown-add { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--primary); transition: background var(--transition-fast); }
.user-dropdown-add:hover { background: var(--primary-soft); }
.user-dropdown-add .add-icon { width: 22px; height: 22px; border-radius: var(--radius-full); background: var(--primary-soft); display: flex; align-items: center; justify-content: center; }
.user-dropdown-add .add-icon [data-lucide] { width: 13px; height: 13px; }

.main { display: flex; height: calc(100vh - var(--header-height)); overflow: hidden; }
.sidebar { width: var(--sidebar-width); background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; transition: margin-left var(--transition); }
.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-width)); }
.sidebar-header { padding: 14px 12px 10px; display: flex; align-items: center; justify-content: space-between; }
.sidebar-title { font-weight: 600; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.sidebar-actions { display: flex; gap: 1px; }
.tree-container { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.tree { font-size: 13.5px; }
.tree-node { user-select: none; }
.tree-row { display: flex; align-items: center; padding: 5px 8px; border-radius: var(--radius-sm); cursor: pointer; gap: 6px; white-space: nowrap; transition: background var(--transition-fast); position: relative; margin-bottom: 1px; color: var(--text-secondary); }
.tree-row:hover { background: var(--bg-hover); color: var(--text); }
.tree-row.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.tree-row.active .tree-icon { color: var(--primary); }
.tree-row.active .tree-count { background: var(--bg-card); color: var(--primary); }
.tree-arrow { width: 14px; text-align: center; color: var(--text-muted); flex-shrink: 0; transition: transform var(--transition); display: flex; align-items: center; justify-content: center; }
.tree-arrow [data-lucide] { width: 12px; height: 12px; }
.tree-arrow.expanded { transform: rotate(90deg); }
.tree-arrow.invisible { visibility: hidden; }
.tree-icon { font-size: 14px; flex-shrink: 0; width: 16px; text-align: center; display: flex; align-items: center; justify-content: center; }
.tree-icon [data-lucide] { width: 14px; height: 14px; }
.tree-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tree-count { font-size: 11px; background: var(--bg-input); color: var(--text-muted); padding: 0 6px; border-radius: var(--radius-full); flex-shrink: 0; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.5; }

.tree-delete {
  width: 20px; height: 20px;
  border-radius: var(--radius-xs);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 2px;
}
.tree-delete [data-lucide] { width: 13px; height: 13px; }
.tree-row:hover .tree-delete,
.tree-row.active .tree-delete { display: flex; }
.tree-row:hover .tree-count,
.tree-row.active .tree-count { display: none; }
.tree-delete:hover { color: var(--danger); background: var(--danger-soft); }
.tree-row.active .tree-delete { color: var(--primary); background: var(--bg-card); }
.tree-row.active .tree-delete:hover { color: var(--danger); background: var(--danger-soft); }
.tree-children { margin-left: 14px; overflow: hidden; max-height: 0; transition: max-height 0.2s ease; }
.tree-children.expanded { max-height: 99999px; }

.tree-row.dragging { opacity: 0.4; }
.tree-row.drag-over { border-top: 2px solid var(--primary); padding-top: 3px; }

.content { flex: 1; overflow-y: auto; padding: 0; position: relative; scroll-behavior: smooth; background: var(--bg); }

.welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 48px; text-align: center; }
.welcome-icon { width: 56px; height: 56px; border-radius: var(--radius-lg); background: var(--bg-card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.welcome-icon [data-lucide] { width: 26px; height: 26px; color: var(--primary); }
.welcome h2 { font-size: 22px; margin-bottom: 6px; color: var(--text); font-weight: 600; letter-spacing: -0.02em; }
.welcome > p { color: var(--text-secondary); margin-bottom: 36px; font-size: 14px; }
.welcome-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 480px; margin-bottom: 36px; }
.feature-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 12px; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); transition: all var(--transition); cursor: default; }
.feature-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.feature-card [data-lucide] { width: 20px; height: 20px; color: var(--text-secondary); }
.feature-card:hover [data-lucide] { color: var(--primary); }
.feature-card span:last-child { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; }
.recent-section { width: 100%; max-width: 480px; text-align: left; }
.recent-section h3 { font-size: 12px; margin-bottom: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.recent-list { display: flex; flex-direction: column; gap: 4px; }
.recent-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition-fast); }
.recent-item:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.recent-item [data-lucide] { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.recent-item-name { flex: 1; font-size: 13px; font-weight: 500; }
.recent-item-path { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.article-view { width: 100%; max-width: 1400px; margin: 0 auto; padding: 40px 64px 100px; }
.article-view .markdown-body { max-width: none; }
.article-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid var(--border); gap: 20px; }
.article-title-area { flex: 1; min-width: 0; }
.article-breadcrumb { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.article-breadcrumb .crumb { cursor: pointer; transition: color var(--transition-fast); font-weight: 500; }
.article-breadcrumb .crumb:hover { color: var(--text); }
.article-breadcrumb .sep { color: var(--text-faint); }
.article-breadcrumb > span:last-child { color: var(--text-secondary); }
.article-title { font-size: 28px; font-weight: 600; line-height: 1.25; color: var(--text); letter-spacing: -0.03em; }
.article-meta { display: flex; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.article-meta span { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.article-actions { display: flex; gap: 6px; flex-shrink: 0; }
.action-btn { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); display: flex; align-items: center; gap: 5px; transition: all var(--transition-fast); height: 32px; }
.action-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--bg-hover); }
.action-btn [data-lucide] { width: 13px; height: 13px; }
.action-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

.markdown-body { font-size: 15px; line-height: 1.75; color: var(--text); }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { font-weight: 600; margin-top: 1.6em; margin-bottom: 0.5em; line-height: 1.3; letter-spacing: -0.02em; }
.markdown-body h1 { font-size: 1.8em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.markdown-body h2 { font-size: 1.4em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border-light); }
.markdown-body h3 { font-size: 1.2em; }
.markdown-body h4 { font-size: 1.05em; }
.markdown-body h5 { font-size: 0.95em; }
.markdown-body h6 { font-size: 0.9em; color: var(--text-muted); }
.markdown-body p { margin: 0.85em 0; }
.markdown-body ul, .markdown-body ol { margin: 0.85em 0; padding-left: 1.6em; }
.markdown-body li { margin: 0.35em 0; }
.markdown-body code { font-family: 'JetBrains Mono','SF Mono','Fira Code','Consolas',monospace; font-size: 0.85em; background: var(--bg-subtle); padding: 0.12em 0.4em; border-radius: var(--radius-xs); color: var(--text); font-weight: 500; border: 1px solid var(--border-light); }
.markdown-body pre { background: #0d1117 !important; border-radius: var(--radius); padding: 18px; overflow-x: auto; margin: 1.1em 0; position: relative; border: 1px solid var(--border); }
.markdown-body pre code { background: none; padding: 0; font-size: 13px; color: #e6edf3; line-height: 1.6; font-weight: 400; border: none; }
.markdown-body blockquote { border-left: 3px solid var(--border-strong); padding: 4px 14px; margin: 1.1em 0; color: var(--text-secondary); }
.markdown-body blockquote p { margin: 0.3em 0; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 1.1em 0; font-size: 13.5px; display: block; overflow-x: auto; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.markdown-body th, .markdown-body td { border-bottom: 1px solid var(--border); padding: 8px 14px; text-align: left; }
.markdown-body th { background: var(--bg-subtle); font-weight: 600; color: var(--text); }
.markdown-body tr:last-child td { border-bottom: none; }
.markdown-body img { max-width: 100%; border-radius: var(--radius); margin: 1em 0; }
.markdown-body hr { border: none; height: 1px; background: var(--border); margin: 1.8em 0; }
.markdown-body a { color: var(--primary); font-weight: 500; }
.markdown-body input[type="checkbox"] { margin-right: 6px; }

.editor-view { display: flex; flex-direction: column; height: 100%; }
.editor-header { padding: 12px 48px; border-bottom: 1px solid var(--border); background: var(--bg-card); display: flex; align-items: center; gap: 12px; }
.editor-title-input { flex: 1; font-size: 17px; font-weight: 600; color: var(--text); background: transparent; padding: 6px 0; border-radius: var(--radius-sm); letter-spacing: -0.02em; }
.editor-title-input::placeholder { color: var(--text-muted); }
.editor-actions { display: flex; gap: 6px; }
.editor-btn { padding: 6px 14px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; height: 32px; display: flex; align-items: center; gap: 5px; transition: all var(--transition-fast); }
.editor-btn [data-lucide] { width: 13px; height: 13px; }
.editor-btn.primary { background: var(--primary); color: #fff; }
.editor-btn.primary:hover { background: var(--primary-dark); }
.editor-btn.secondary { background: var(--bg-hover); color: var(--text-secondary); }
.editor-btn.secondary:hover { background: var(--bg-subtle); color: var(--text); }
.editor-toolbar { padding: 6px 48px; border-bottom: 1px solid var(--border); background: var(--bg-card); display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.toolbar-btn { padding: 5px 8px; border-radius: var(--radius-xs); font-size: 13px; color: var(--text-secondary); min-width: 28px; font-weight: 500; transition: all var(--transition-fast); height: 26px; display: flex; align-items: center; justify-content: center; }
.toolbar-btn:hover { background: var(--bg-hover); color: var(--text); }
.toolbar-sep { width: 1px; height: 16px; background: var(--border); margin: 0 3px; }
.editor-body { flex: 1; display: flex; overflow: hidden; }
.editor-pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.editor-pane-label { padding: 5px 48px; font-size: 10.5px; color: var(--text-muted); background: var(--bg-subtle); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.editor-textarea { flex: 1; border: none; resize: none; padding: 24px 48px; font-family: 'JetBrains Mono','SF Mono','Fira Code','Consolas',monospace; font-size: 13.5px; line-height: 1.7; background: var(--bg-card); color: var(--text); overflow-y: auto; }
.editor-preview { flex: 1; overflow-y: auto; padding: 24px 48px; background: var(--bg); border-left: 1px solid var(--border); }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(9,9,11,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal { background: var(--bg-elevated); border-radius: var(--radius-lg); padding: 24px; min-width: 380px; max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-xl); border: 1px solid var(--border); animation: modalIn 0.2s cubic-bezier(0.16,1,0.3,1); }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 18px; color: var(--text); letter-spacing: -0.02em; }
.modal-body { margin-bottom: 20px; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.form-input, .form-select { width: 100%; padding: 9px 12px; background: var(--bg-input); color: var(--text); border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 13.5px; transition: all var(--transition); }
.form-input:focus, .form-select:focus { border-color: var(--primary); box-shadow: var(--shadow-glow); background: var(--bg-card); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; }

/* 确认弹窗 */
.confirm-dialog { text-align: center; min-width: 360px; }
.confirm-icon { width: 48px; height: 48px; border-radius: var(--radius-full); margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; background: var(--danger-soft); }
.confirm-icon.danger { background: var(--danger-soft); }
.confirm-icon [data-lucide] { width: 24px; height: 24px; }
.confirm-icon.danger [data-lucide] { color: var(--danger); }
.confirm-message { font-size: 13.5px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 24px; }
.confirm-message strong { color: var(--text); }
.danger-btn { background: var(--danger); color: #fff; padding: 6px 14px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; height: 32px; display: flex; align-items: center; gap: 5px; transition: all var(--transition-fast); }
.danger-btn:hover { background: #c93a3f; }

.upload-zone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 36px 20px; text-align: center; cursor: pointer; transition: all var(--transition); background: var(--bg-subtle); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone-icon [data-lucide] { width: 32px; height: 32px; color: var(--text-muted); margin-bottom: 8px; }
.upload-zone-text { color: var(--text-secondary); font-size: 13.5px; font-weight: 500; }
.upload-zone-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.upload-mode-bar { display: flex; gap: 8px; margin-top: 12px; justify-content: center; }
.upload-mode-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.upload-mode-btn:hover { border-color: var(--primary); color: var(--primary); }
.upload-mode-btn [data-lucide] { width: 14px; height: 14px; }

.upload-group {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.upload-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
}
.upload-group-header [data-lucide] { width: 14px; height: 14px; color: var(--primary); }
.upload-group-title { flex: 1; font-weight: 500; color: var(--text); }
.upload-group-count { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.upload-group-remove {
  width: 22px; height: 22px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
}
.upload-group-remove:hover { color: var(--danger); background: var(--danger-soft); }
.upload-group-remove [data-lucide] { width: 13px; height: 13px; }
.upload-target { padding: 9px 12px; background: var(--primary-soft); border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 12.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.upload-target [data-lucide] { width: 13px; height: 13px; color: var(--primary); }
.upload-target strong { color: var(--text); font-weight: 600; }
.upload-file-list { margin-top: 14px; max-height: 200px; overflow-y: auto; }
.upload-file-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg-subtle); margin-bottom: 4px; font-size: 12.5px; transition: background var(--transition-fast); }
.upload-file-item:hover { background: var(--bg-hover); }
.upload-file-item [data-lucide] { width: 14px; height: 14px; color: var(--text-muted); }
.upload-file-item .file-size { margin-left: auto; color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.upload-file-item .file-remove { cursor: pointer; color: var(--text-muted); padding: 2px; border-radius: var(--radius-xs); display: flex; }
.upload-file-item .file-remove:hover { color: var(--danger); background: var(--danger-soft); }
.upload-file-item .file-remove [data-lucide] { width: 13px; height: 13px; }
.upload-progress { height: 4px; background: var(--bg-input); border-radius: var(--radius-full); margin-top: 12px; overflow: hidden; }
.upload-progress-bar { height: 100%; background: var(--primary); width: 0%; transition: width 0.3s; border-radius: var(--radius-full); }

.search-results { width: 100%; max-width: 1400px; margin: 0 auto; padding: 40px 64px; }
.search-results .search-result-item { max-width: none; }
.search-results-title { font-size: 15px; margin-bottom: 20px; color: var(--text); font-weight: 600; }
.search-result-item { padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; transition: all var(--transition-fast); }
.search-result-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.search-result-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.search-result-path { font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.search-result-snippet { font-size: 12.5px; color: var(--text-secondary); background: var(--bg-subtle); padding: 6px 10px; border-radius: var(--radius-xs); line-height: 1.5; border: 1px solid var(--border-light); }
.search-result-badge { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: var(--radius-full); margin-left: 6px; background: var(--primary-soft); color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; vertical-align: middle; }
.highlight { background: rgba(250,204,21,0.3); padding: 1px 2px; border-radius: 3px; font-weight: 600; color: var(--text); }

.stats-view { width: 100%; max-width: 1400px; margin: 0 auto; padding: 40px 64px; }
.stats-view .stats-cards,
.stats-view .stats-detail { max-width: none; }
.stats-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; text-align: center; transition: all var(--transition); }
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.stat-number { font-size: 32px; font-weight: 600; color: var(--text); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.stats-detail { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.stats-detail h3 { font-size: 14px; margin-bottom: 16px; color: var(--text); font-weight: 600; }
.stats-person { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--border-light); }
.stats-person:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.stats-person-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.stats-person-name { font-weight: 600; font-size: 14px; }
.stats-person-count { font-size: 11px; color: var(--text-muted); background: var(--bg-subtle); padding: 1px 8px; border-radius: var(--radius-full); font-weight: 500; }
.stats-tech-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; font-size: 12.5px; }
.stats-tech-name { width: 110px; text-align: right; color: var(--text-secondary); font-weight: 500; }
.stats-bar-bg { flex: 1; height: 22px; background: var(--bg-subtle); border-radius: var(--radius-xs); overflow: hidden; }
.stats-bar-fill { height: 100%; background: var(--primary); border-radius: var(--radius-xs); transition: width 0.5s cubic-bezier(0.16,1,0.3,1); }
.stats-tech-count { width: 32px; font-size: 11.5px; color: var(--text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }

.context-menu { position: fixed; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xl); padding: 4px; z-index: 2000; min-width: 168px; animation: dropdownIn 0.12s ease; }
.context-menu-item { padding: 6px 8px; font-size: 13px; cursor: pointer; border-radius: var(--radius-xs); display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; transition: background var(--transition-fast); }
.context-menu-item:hover { background: var(--bg-hover); }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: var(--danger-soft); }
.context-menu-item [data-lucide] { width: 14px; height: 14px; opacity: 0.7; }
.context-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: toastIn 0.25s cubic-bezier(0.16,1,0.3,1); min-width: 200px; color: var(--text); }
.toast [data-lucide] { width: 15px; height: 15px; flex-shrink: 0; }
.toast.success [data-lucide] { color: var(--success); }
.toast.error [data-lucide] { color: var(--danger); }
.toast.warning [data-lucide] { color: var(--warning); }
.toast.info [data-lucide] { color: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.back-to-top { position: fixed; bottom: 20px; right: 72px; width: 36px; height: 36px; border-radius: var(--radius-full); background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text); display: none; align-items: center; justify-content: center; box-shadow: var(--shadow); z-index: 90; transition: all var(--transition); }
.back-to-top.visible { display: flex; animation: toastIn 0.2s ease; }
.back-to-top:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.back-to-top [data-lucide] { width: 16px; height: 16px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }
  .sidebar { position: fixed; top: var(--header-height); left: 0; bottom: 0; z-index: 99; box-shadow: var(--shadow-lg); }
  .sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-width)); }
  .article-view, .search-results, .stats-view { padding: 24px; }
  .editor-textarea, .editor-preview { padding: 16px; }
  .editor-header, .editor-toolbar { padding-left: 16px; padding-right: 16px; }
  .editor-pane-label { padding-left: 16px; padding-right: 16px; }
  .welcome-features { grid-template-columns: repeat(2, 1fr); }
  .stats-cards { grid-template-columns: 1fr; }
  .editor-preview { display: none; }
  .article-title { font-size: 22px; }
  .modal { min-width: auto; width: 90vw; padding: 20px; }
  .search-kbd { display: none; }
}
