/* ===== CSS 变量系统 ===== */
:root {
  --primary: #4A90E2;
  --primary-light: #74b3f5;
  --primary-dark: #357abd;
  --bg: #e4e7ec;
  --sidebar-bg: #edf0f4;
  --list-bg: #e8ebf0;
  --editor-bg: #f0f2f5;
  --card-bg: #edf0f4;
  --card-hover: #dde1e8;
  --card-active: #d8dff0;
  --text: #2d3436;
  --text-muted: #636e72;
  --text-light: #b2bec3;
  --border: #e9ecef;
  --border-light: #f1f3f5;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --topbar-h: 56px;
  --sidebar-w: 240px;
  --list-w: 300px;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --sidebar-bg: #1a1d2e;
  --list-bg: #141726;
  --editor-bg: #1e2235;
  --card-bg: #252a3d;
  --card-hover: #2d3450;
  --card-active: #1e3a5f;
  --text: #e9ecef;
  --text-muted: #adb5bd;
  --text-light: #6c757d;
  --border: #2d4a6d;
  --border-light: #252a3d;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
  --shadow: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.6);
}

/* ===== 重置 ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'LXGW WenKai', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  transition: background 0.25s, color 0.25s;
}
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input { font-family: inherit; outline: none; border: none; }

/* ===== 布局 ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== 顶部导航栏 ===== */
#topbar {
  height: var(--topbar-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  min-width: fit-content;
  text-decoration: none;
}
.topbar-logo .emoji { font-size: 22px; }

.topbar-search {
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 8px 16px 8px 36px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.topbar-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74,144,226,0.12);
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(74,144,226,0.3);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--card-hover); color: var(--text); }
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}
.btn-icon:hover { background: var(--card-hover); color: var(--text); }

/* 调色盘弹出 */
.color-picker-popup {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: none;
}
.color-picker-popup.open { display: flex; }
.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.active { border-color: var(--text); }

/* ===== 主内容区域 ===== */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== 左侧栏 ===== */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 12px 8px;
}

.sidebar-section { margin-bottom: 4px; }
.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  padding: 8px 10px 4px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.sidebar-item:hover { background: var(--card-hover); color: var(--text); }
.sidebar-item.active { background: var(--card-active); color: var(--primary); }
.sidebar-item .item-count {
  margin-left: auto;
  font-size: 11px;
  background: var(--border);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 10px;
}

/* ===== 中间列表 ===== */
#notelist {
  width: var(--list-w);
  background: var(--list-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.notelist-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notelist-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.notelist-count {
  font-size: 12px;
  color: var(--text-light);
}

.notelist-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.notelist-items::-webkit-scrollbar { width: 4px; }
.notelist-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.note-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s;
  position: relative;
  border: 1px solid transparent;
}
.note-card:hover { background: var(--card-bg); border-color: var(--border); }
.note-card.active { background: var(--card-bg); border-color: var(--primary); box-shadow: var(--shadow-sm); }

.note-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 24px;
}
.note-card-title mark {
  background: rgba(108,92,231,0.2);
  color: var(--primary);
  border-radius: 3px;
  padding: 0 2px;
}

.note-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.note-card-meta .word-count { margin-left: auto; }

.note-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(108,92,231,0.1);
  color: var(--primary);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.note-card-star {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 14px;
  opacity: 0.4;
  transition: opacity 0.15s, transform 0.15s;
  cursor: pointer;
  z-index: 1;
}
.note-card-star:hover { opacity: 0.8; transform: scale(1.2); }
.note-card-star.starred { opacity: 1; }

.note-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.note-empty .empty-icon { font-size: 36px; display: block; margin-bottom: 12px; }

/* ===== 右侧编辑器 ===== */
#editor-panel {
  flex: 1;
  background: var(--editor-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}
.editor-empty .empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.4; }
.editor-empty h2 { font-size: 20px; margin-bottom: 8px; color: var(--text); }
.editor-empty p { font-size: 14px; }
.editor-empty .shortcut-hint {
  margin-top: 24px;
  padding: 12px 20px;
  background: var(--card-hover);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-light);
}

.editor-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* 编辑器头部 */
.editor-header {
  padding: 20px 28px 0;
  flex-shrink: 0;
}

.editor-title-input {
  width: 100%;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border-bottom: 2px solid transparent;
  padding: 4px 0 8px;
  transition: border-color 0.2s;
  letter-spacing: -0.01em;
}
.editor-title-input:focus { border-bottom-color: var(--primary); }
.editor-title-input::placeholder { color: var(--text-light); }

/* 标签区域 */
.editor-tags-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0;
  min-height: 38px;
  border-bottom: 1px solid var(--border-light);
}
.editor-tags-wrap .tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
}
.tag-remove {
  cursor: pointer;
  font-size: 12px;
  opacity: 0.6;
  margin-left: 2px;
}
.tag-remove:hover { opacity: 1; }
.tag-input-inline {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  min-width: 100px;
  flex: 1;
}
.tag-input-inline::placeholder { color: var(--text-light); }

/* 状态栏 */
.editor-statusbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--list-bg);
  font-size: 12px;
  color: var(--text-light);
  flex-shrink: 0;
}
.save-status { color: var(--text-muted); }
.save-status.saving { color: var(--primary); }
.save-status.saved { color: #00B894; }
.save-status.error { color: #E17055; }
.status-sep { color: var(--border); }

.statusbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.statusbar-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.statusbar-btn:hover { background: var(--card-hover); color: var(--text); }
.statusbar-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== Quill 编辑器 ===== */
.quill-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

/* 覆盖 Quill 样式 */
.ql-toolbar.ql-snow {
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 8px 28px !important;
  flex-shrink: 0;
  background: transparent;
}
.ql-container.ql-snow {
  border: none !important;
  flex: 1;
  overflow-y: auto;
  font-family: inherit !important;
  font-size: 15px !important;
  color: var(--text) !important;
}
.ql-editor {
  padding: 20px 28px 40px !important;
  line-height: 1.8 !important;
  width: 100%;
  box-sizing: border-box;
}
.ql-editor.ql-blank::before {
  color: var(--text-light) !important;
  font-style: normal !important;
  left: 0 !important;
}
.ql-snow .ql-stroke { stroke: var(--text-muted) !important; }
.ql-snow .ql-fill { fill: var(--text-muted) !important; }
.ql-snow .ql-picker { color: var(--text-muted) !important; }
.ql-snow .ql-picker-options { background: var(--card-bg) !important; border-color: var(--border) !important; }
.ql-toolbar.ql-snow .ql-formats { margin-right: 10px !important; }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke { stroke: var(--primary) !important; }
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--primary) !important; }
.ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--primary) !important; }

/* 阅读模式 */
body.reading-mode #sidebar,
body.reading-mode #notelist { display: none !important; }
body.reading-mode .ql-toolbar { display: none !important; }
body.reading-mode .topbar-actions .btn:not(.btn-reading-exit) { display: none; }

/* ===== 右键菜单 ===== */
.context-menu {
  position: fixed;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  min-width: 140px;
  padding: 4px;
  display: none;
}
.context-menu.show { display: block; }
.ctx-item {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text);
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctx-item:hover { background: var(--card-hover); }
.ctx-item.danger { color: #E17055; }
.ctx-item.danger:hover { background: rgba(225,112,85,0.1); }

/* ===== 移动端底部导航 ===== */
#mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
}
.mobile-nav-items {
  display: flex;
  justify-content: space-around;
}
.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  transition: color 0.15s;
  border-radius: var(--radius-sm);
}
.mobile-nav-item .icon { font-size: 20px; }
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-item.new-btn {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  padding: 0;
  margin-top: -16px;
  box-shadow: 0 4px 15px rgba(74,144,226,0.4);
}
.mobile-nav-item.new-btn .icon { font-size: 22px; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  #sidebar { display: none; }
  #mobile-nav { display: block; }
  #main { padding-bottom: 64px; }
  
  #notelist {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    bottom: 64px;
    width: 100%;
    z-index: 10;
    display: none;
  }
  #notelist.mobile-show { display: flex; }
  
  #editor-panel {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    bottom: 64px;
    display: none;
  }
  #editor-panel.mobile-show { display: flex; }
  
  .topbar-logo span:last-child { display: none; }
  .btn-ghost.hide-mobile { display: none; }
  .editor-header { padding: 16px 16px 0; }
  .editor-statusbar { padding: 8px 16px; }
  .ql-editor { padding: 16px 16px 40px !important; }
}

/* ===== 加载动画 ===== */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast 提示 ===== */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text);
  animation: slideIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { border-left: 3px solid #00B894; }
.toast.error { border-left: 3px solid #E17055; }
.toast.info { border-left: 3px solid var(--primary); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 修复铺满问题 ===== */
html, body {
  width: 100%;
  height: 100%;
}
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
}
#main {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: calc(100vh - var(--topbar-h));
}
#sidebar {
  height: 100%;
}
#notelist {
  height: 100%;
}
#editor-panel {
  height: 100%;
}

/* ===== 弹窗样式 ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 320px;
  box-shadow: var(--shadow-lg);
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}
.modal-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 8px;
  outline: none;
  box-sizing: border-box;
}
.modal-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.12);
}
.modal-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ===== logo 样式微调（去掉 emoji 后）===== */
.topbar-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  min-width: fit-content;
}

/* ===== 文件夹功能样式 ===== */
.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 4px;
}
.sidebar-section-header .sidebar-label {
  padding: 0;
  margin: 0;
}
.sidebar-add-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.sidebar-add-btn:hover {
  color: var(--primary);
  background: var(--card-hover);
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  position: relative;
}
.folder-item:hover { background: var(--card-hover); color: var(--text); }
.folder-item.active { background: var(--card-active); color: var(--primary); }
.folder-item .item-count {
  margin-left: auto;
  font-size: 11px;
  background: var(--border);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 10px;
}


/* 文件夹右键菜单 */
.folder-ctx-menu {
  position: fixed;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  min-width: 130px;
  padding: 4px;
  display: none;
}
.folder-ctx-menu.show { display: block; }

/* 编辑器文件夹徽标 */
.editor-folder-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 10px 3px 0;
  margin-bottom: 4px;
}
.editor-folder-badge span:last-child {
  color: var(--primary);
  font-weight: 500;
}

/* 移动笔记弹窗列表 */
.move-folder-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  max-height: 240px;
  overflow-y: auto;
}
.move-folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s;
  border: 1px solid transparent;
}
.move-folder-item:hover { background: var(--card-hover); }
.move-folder-item.current { border-color: var(--primary); color: var(--primary); background: var(--card-active); }

/* ===== 拖拽分隔线 ===== */
.resize-handle {
  width: 4px;
  background: transparent;
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
}
.resize-handle:hover,
.resize-handle.dragging {
  background: var(--primary);
}

/* ===== 导出格式选择 ===== */
.export-format-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.export-format-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.export-format-item:hover {
  background: var(--card-hover);
  border-color: var(--primary);
}
.export-icon { font-size: 24px; }
.export-fmt-name { font-size: 14px; font-weight: 600; color: var(--text); }
.export-fmt-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== 主题菜单弹出面板 ===== */
.theme-menu-popup {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: none;
  min-width: 180px;
}
.theme-menu-popup.open { display: block; }
.theme-menu-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  margin-bottom: 8px;
}
.theme-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.theme-toggle-switch {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.theme-toggle-switch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
}
.theme-toggle-switch.on {
  background: var(--primary);
}
.theme-toggle-switch.on::after {
  left: 19px;
}
.color-dots-row {
  display: flex;
  gap: 8px;
}

/* ===== 编辑器图片基础样式 ===== */
.ql-editor img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 8px 0;
  border-radius: 6px;
}

/* ===== 左侧加号下拉菜单 ===== */
.sidebar-section-header {
  position: relative;
}
.sidebar-add-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  min-width: 140px;
  padding: 4px;
  display: none;
}
.sidebar-add-menu.open { display: block; }
.sidebar-add-item {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text);
  transition: background 0.1s;
}
.sidebar-add-item:hover { background: var(--card-hover); }
