/* ===== 布局 ===== */
.notes-app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  gap: 20px;
  min-height: 620px;
  height: calc(100vh - 200px);
}

/* ===== 侧边栏 ===== */
.notes-sidebar {
  width: 280px;
  min-width: 260px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 14px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.sidebar-search {
  margin-bottom: 10px;
  position: relative;
}

.sidebar-search::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  opacity: 0.5;
  pointer-events: none;
  z-index: 1;
}

.sidebar-search input {
  width: 100%;
  padding: 9px 12px 9px 33px;
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  background: #f7f9fc;
  transition: all 0.2s;
  font-family: inherit;
  color: #4a5568;
}

.sidebar-search input::placeholder { color: #a0aec0; }
.sidebar-search input:focus {
  border-color: var(--color-purple, rgb(179, 71, 241));
  background: #fff;
  box-shadow: 0 0 0 3px rgba(179, 71, 241, 0.08);
}

/* 分类筛选 */
.sidebar-category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.cat-filter-item {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f3f6fa;
  color: #718096;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.cat-filter-item:hover {
  background: rgba(179, 71, 241, 0.08);
  color: var(--color-purple, rgb(179, 71, 241));
  border-color: rgba(179, 71, 241, 0.15);
}

.cat-filter-item.active {
  background: var(--color-purple, rgb(179, 71, 241));
  color: white;
  border-color: var(--color-purple, rgb(179, 71, 241));
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(179, 71, 241, 0.25);
}

/* 排序 */
.sidebar-sort {
  margin-bottom: 10px;
}

.sidebar-sort select {
  width: 100%;
  padding: 8px 30px 8px 12px;
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  font-size: 12px;
  color: #4a5568;
  background: #f7f9fc;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.sidebar-sort select:hover {
  border-color: #cbd5e0;
  background-color: #f0f3f7;
}

.sidebar-sort select:focus {
  border-color: var(--color-purple, rgb(179, 71, 241));
  background: #fff;
  box-shadow: 0 0 0 3px rgba(179, 71, 241, 0.08);
}

/* 新建按钮行 */
.sidebar-actions {
  display: flex;
  gap: 6px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--color-purple, rgb(179, 71, 241));
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:hover { background: #9f45d6; }
.btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(179, 71, 241, 0.3); }

.btn-new { flex: 1; padding: 9px; font-size: 14px; }

.btn-batch {
  padding: 0 12px;
  font-size: 12px;
  background: #fff;
  color: #718096;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-batch:hover { background: #f7fafc; color: #4a5568; border-color: #cbd5e0; }
.btn-batch.active { background: var(--color-purple, rgb(179, 71, 241)); color: white; border-color: var(--color-purple); }

.btn-small { padding: 5px 12px; font-size: 12px; }

.btn-pin {
  background: transparent;
  color: #718096;
  border: 1px solid #e2e8f0;
}
.btn-pin:hover { background: #f7fafc; }
.btn-pin.pinned { background: rgba(179, 71, 241, 0.1); color: var(--color-purple, rgb(179, 71, 241)); border-color: var(--color-purple, rgb(179, 71, 241)); }

.btn-danger {
  background: transparent;
  color: #e53e3e;
  border: 1px solid #e53e3e;
}
.btn-danger:hover { background: rgba(229, 62, 62, 0.08); }

.btn-cancel {
  background: transparent;
  color: #718096;
  border: 1px solid #e2e8f0;
}
.btn-cancel:hover { background: #f7fafc; }
.btn-danger {
  background: #e53e3e;
  color: #fff;
  border-color: #e53e3e;
}
.btn-danger:hover { background: #c53030; }

/* 批量操作栏 */
.batch-bar {
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,0.05);
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.batchbar-spacer { flex: 1; }

/* ===== 便签列表 ===== */
.note-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.note-item {
  padding: 11px 14px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 3px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-item:hover { background: rgba(179, 71, 241, 0.05); }
.note-item.active {
  background: rgba(179, 71, 241, 0.08);
  border-left-color: var(--color-purple, rgb(179, 71, 241));
  box-shadow: 0 1px 4px rgba(179, 71, 241, 0.08);
}

.note-item.selected { background: rgba(229, 62, 62, 0.06); }

.note-checkbox {
  display: none;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-purple, rgb(179, 71, 241));
}

.note-item.batch-mode .note-checkbox { display: block; }

.note-item-content { flex: 1; min-width: 0; }

.note-item.pinned .note-item-title::before {
  content: '[置顶] ';
  font-size: 10px;
  color: var(--color-purple, rgb(179, 71, 241));
}

.note-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.note-item-preview {
  font-size: 11px;
  color: #a0aec0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-cat {
  font-size: 10px;
  color: var(--color-purple, rgb(179, 71, 241));
  background: rgba(179, 71, 241, 0.1);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid rgba(0,0,0,0.05);
  font-size: 12px;
  color: #a0aec0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.btn-export {
  background: transparent;
  color: var(--color-purple, rgb(179, 71, 241));
  border: 1px solid var(--color-purple, rgb(179, 71, 241));
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  transition: all 0.15s;
}
.btn-export:hover { background: rgba(179, 71, 241, 0.08); }

/* ===== 编辑区 ===== */
.notes-editor {
  flex: 1;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #a0aec0;
  font-size: 15px;
  gap: 16px;
  user-select: none;
}

.editor-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
  padding-bottom: 0;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.note-title {
  width: 100%;
  border: none;
  font-size: 24px;
  font-weight: 700;
  color: #2d3748;
  padding: 0 0 12px 0;
  outline: none;
  border-bottom: 2px solid rgba(0,0,0,0.05);
  background: transparent;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.note-title:focus { border-bottom-color: var(--color-purple, rgb(179, 71, 241)); }
.note-title::placeholder { color: #cbd5e0; font-weight: 400; }

/* 分类行 */
.note-category-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.cat-label {
  font-size: 12px;
  font-weight: 600;
  color: #a0aec0;
  flex-shrink: 0;
}

.note-category {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 13px;
  color: #718096;
  outline: none;
  background: #f7fafc;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.note-category:focus { border-color: var(--color-purple, rgb(179, 71, 241)); background: #fff; }
.note-category::placeholder { color: #cbd5e0; }

/* ===== 工具栏 ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  flex-wrap: wrap;
}

.toolbar-group { display: flex; gap: 2px; }

.toolbar-sep { color: #e2e8f0; font-size: 14px; margin: 0 2px; }

.toolbar-spacer { flex: 1; }

.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #718096;
  font-family: inherit;
  transition: all 0.15s;
}
.tb-btn:hover { background: #f7fafc; color: #4a5568; }
.tb-btn:focus { outline: none; }

.tb-btn-toggle {
  width: auto;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
}
.tb-btn-toggle.active {
  background: var(--color-purple, rgb(179, 71, 241));
  color: white;
  border-color: var(--color-purple, rgb(179, 71, 241));
}

/* 标题下拉菜单 */
.toolbar-group { position: relative; }

.tb-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 100;
  min-width: 130px;
  overflow: hidden;
}

.tb-dropdown-item {
  display: block;
  width: 100%;
  padding: 7px 14px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #4a5568;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.1s;
}

.tb-dropdown-item:hover {
  background: rgba(179, 71, 241, 0.08);
  color: var(--color-purple, rgb(179, 71, 241));
}

[data-theme="dark"] .tb-dropdown { background: #2d2d2d; border-color: #444; }
[data-theme="dark"] .tb-dropdown-item { color: #cbd5e0; }
[data-theme="dark"] .tb-dropdown-item:hover { background: rgba(179, 71, 241, 0.15); }

/* ===== 编辑器区域 ===== */
.editor-area {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.note-body {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  line-height: 1.8;
  color: #4a5568;
  background: transparent;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  padding: 14px 0;
  box-sizing: border-box;
  overflow-y: auto;
}
.note-body::placeholder { color: #cbd5e0; }

/* 分屏模式 */
.editor-area.split .note-body {
  flex: 1;
  border-right: 1px solid #f0f0f0;
  padding-right: 14px;
  width: 50%;
}
.editor-area.split .note-preview {
  flex: 1;
  padding-left: 14px;
  display: block !important;
}

/* 预览模式 */
.editor-area.preview .note-body { display: none; }
.editor-area.preview .note-preview { display: block !important; }

.note-preview {
  flex: 1;
  overflow-y: auto;
  padding: 14px 0;
  font-size: 15px;
  line-height: 1.8;
  color: #4a5568;
}

/* Markdown 预览样式 */
.note-preview h1,.note-preview h2,.note-preview h3,.note-preview h4 { color: #2d3748; margin: 18px 0 10px; }
.note-preview h1 { font-size: 1.5em; border-bottom: 2px solid #f0f0f0; padding-bottom: 8px; }
.note-preview h2 { font-size: 1.3em; border-bottom: 1px solid #f0f0f0; padding-bottom: 6px; }
.note-preview h3 { font-size: 1.15em; }
.note-preview p { margin: 0 0 12px; }
.note-preview ul,.note-preview ol { padding-left: 24px; margin: 0 0 12px; }
.note-preview li { margin-bottom: 4px; }
.note-preview code {
  background: #f7fafc;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  color: #e53e3e;
}
.note-preview pre {
  background: #2d3748;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
}
.note-preview pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; }
.note-preview blockquote {
  border-left: 3px solid var(--color-purple, rgb(179, 71, 241));
  margin: 0 0 12px;
  padding: 6px 14px;
  color: #718096;
  background: rgba(179, 71, 241, 0.04);
}
.note-preview table { border-collapse: collapse; width: 100%; margin: 0 0 12px; }
.note-preview th,.note-preview td { border: 1px solid #e2e8f0; padding: 8px 12px; text-align: left; }
.note-preview th { background: #f7fafc; font-weight: 600; }
.note-preview img { max-width: 100%; border-radius: 4px; }
.note-preview a { color: var(--color-purple, rgb(179, 71, 241)); }
.note-preview hr { border: none; border-top: 1px solid #e2e8f0; margin: 18px 0; }

/* ===== 底部状态栏 ===== */
.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(0,0,0,0.05);
  font-size: 12px;
  color: #a0aec0;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer-right { display: flex; gap: 6px; }

.footer-stat { padding-left: 14px; border-left: 1px solid #e2e8f0; }
.footer-stat b { color: #4a5568; }

/* ===== 暗色主题 ===== */
[data-theme="dark"] .notes-sidebar,
[data-theme="dark"] .notes-editor {
  background: #1e1e1e;
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
[data-theme="dark"] .sidebar-header,
[data-theme="dark"] .sidebar-footer,
[data-theme="dark"] .toolbar,
[data-theme="dark"] .editor-footer,
[data-theme="dark"] .note-title,
[data-theme="dark"] .note-category-row,
[data-theme="dark"] .batch-bar { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sidebar-search input { background: #2d2d2d; border-color: #444; color: #e2e8f0; }
[data-theme="dark"] .sidebar-search input::placeholder { color: #666; }
[data-theme="dark"] .sidebar-search::before { opacity: 0.3; }
[data-theme="dark"] .note-title { color: #e2e8f0; }
[data-theme="dark"] .note-category { background: #2d2d2d; color: #cbd5e0; }
[data-theme="dark"] .note-category:focus { background: #333; }
[data-theme="dark"] .footer-stat { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .note-preview hr { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .note-preview h1,
[data-theme="dark"] .note-preview h2,
[data-theme="dark"] .note-preview h3,
[data-theme="dark"] .note-preview h4 { color: #e2e8f0; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .note-preview code { background: #333; color: #fc8181; }
[data-theme="dark"] .note-preview pre { background: #111; }
[data-theme="dark"] .note-preview blockquote { background: rgba(179, 71, 241, 0.08); }
[data-theme="dark"] .note-preview th { background: #333; }
[data-theme="dark"] .note-preview th,
[data-theme="dark"] .note-preview td { border-color: #444; }
[data-theme="dark"] .note-item-title { color: #cbd5e0; }
[data-theme="dark"] .note-item:hover { background: rgba(179, 71, 241, 0.08); }
[data-theme="dark"] .note-item.active { background: rgba(179, 71, 241, 0.15); }
[data-theme="dark"] .note-item.selected { background: rgba(229, 62, 62, 0.1); }
[data-theme="dark"] .tb-btn { color: #a0aec0; }
[data-theme="dark"] .tb-btn:hover { background: #333; color: #e2e8f0; }
[data-theme="dark"] .toolbar-sep { color: #444; }
[data-theme="dark"] .editor-empty { color: #555; }
[data-theme="dark"] .editor-area.split .note-body { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .footer-stat { border-color: #444; }
[data-theme="dark"] .note-preview hr { border-color: #333; }
[data-theme="dark"] .cat-filter-item { background: #2d2d2d; color: #a0aec0; }
[data-theme="dark"] .cat-filter-item:hover { background: rgba(179, 71, 241, 0.15); }
[data-theme="dark"] .btn-batch { background: #2d2d2d; border-color: #444; color: #a0aec0; }
[data-theme="dark"] .btn-batch:hover { background: #333; }
[data-theme="dark"] .btn-export { background: transparent; }
[data-theme="dark"] .btn-export:hover { background: rgba(179, 71, 241, 0.12); }
[data-theme="dark"] .btn-cancel { background: transparent; color: #a0aec0; border-color: #444; }
[data-theme="dark"] .sidebar-sort select { background: #2d2d2d; border-color: #444; color: #cbd5e0; }
[data-theme="dark"] .sidebar-sort select:hover { background: #333; border-color: #555; }
[data-theme="dark"] .sidebar-sort select:focus { background: #333; }
[data-theme="dark"] .btn-pin { color: #a0aec0; border-color: #444; }
[data-theme="dark"] .btn-pin:hover { background: #333; }
[data-theme="dark"] .btn-pin.pinned { background: rgba(179, 71, 241, 0.15); color: #b794f4; border-color: #7c3aed; }

/* ===== 模态弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  width: 420px;
  max-width: 92vw;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.modal-header h3 { margin: 0; font-size: 16px; color: #2d3748; }

.modal-close {
  font-size: 22px;
  color: #a0aec0;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}

.modal-close:hover { color: #e53e3e; }

.modal-body { padding: 20px; }

.modal-count {
  font-size: 13px;
  color: #718096;
  margin: 0 0 18px;
  padding: 8px 12px;
  background: #f7fafc;
  border-radius: 6px;
}

.modal-section {
  margin-bottom: 16px;
}

.modal-section:last-child { margin-bottom: 0; }

.modal-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
}

.modal-radio-group { display: flex; flex-direction: column; gap: 6px; }

.modal-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #4a5568;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  transition: border-color 0.15s, background 0.15s;
}

.modal-radio:hover { border-color: var(--color-purple, rgb(179, 71, 241)); background: rgba(179, 71, 241, 0.04); }

.modal-radio input[type="radio"] { accent-color: var(--color-purple, rgb(179, 71, 241)); }

.modal-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #4a5568;
  cursor: pointer;
}

.modal-checkbox input[type="checkbox"] { accent-color: var(--color-purple, rgb(179, 71, 241)); }

.modal-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  color: #4a5568;
  background: #f7f9fc;
  transition: all 0.2s;
}
.modal-input:focus {
  border-color: var(--color-purple, rgb(179, 71, 241));
  background: #fff;
  box-shadow: 0 0 0 3px rgba(179, 71, 241, 0.08);
}

.modal-hint {
  display: block;
  font-size: 12px;
  color: #a0aec0;
  margin-top: 6px;
  padding-left: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

/* 暗色主题 */
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.6); }
[data-theme="dark"] .modal-box { background: #1e1e1e; }
[data-theme="dark"] .modal-header { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .modal-header h3 { color: #e2e8f0; }
[data-theme="dark"] .modal-count { background: #2d2d2d; color: #a0aec0; }
[data-theme="dark"] .modal-label { color: #cbd5e0; }
[data-theme="dark"] .modal-radio { color: #cbd5e0; border-color: #444; }
[data-theme="dark"] .modal-radio:hover { background: rgba(179, 71, 241, 0.08); }
[data-theme="dark"] .modal-close { color: #718096; }
[data-theme="dark"] .modal-footer { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .modal-input { background: #2d2d2d; color: #cbd5e0; border-color: #444; }
[data-theme="dark"] .modal-input:focus { background: #333; }
[data-theme="dark"] #confirmModalMsg,
[data-theme="dark"] #alertModalMsg { color: #cbd5e0 !important; }

@media (max-width: 480px) {
  .modal-box { width: 96vw; }
  .modal-body { padding: 16px; }
  .modal-header { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }
}

/* ===== 响应式 - 移动端 ===== */
@media (max-width: 900px) {
  .notes-app {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
    height: 100dvh;
    min-height: 0;
  }

  /* 侧边栏 - 紧凑顶部，最多占 35% 视口 */
  .notes-sidebar {
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
    max-height: 35vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .sidebar-header {
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex-shrink: 0;
  }

  .sidebar-search { width: 100%; margin-bottom: 0; }
  .sidebar-category-filter { width: 100%; margin-bottom: 0; }
  .sidebar-sort { flex: 1; min-width: 100px; margin-bottom: 0; }
  .sidebar-actions { flex: 1; min-width: 160px; }

  /* 便签列表 - 横向滚动 */
  .note-list {
    flex: 1;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 6px;
    padding: 6px 8px;
    -webkit-overflow-scrolling: touch;
  }

  .note-item {
    flex-shrink: 0;
    width: 140px;
    min-width: 120px;
    border-left: none;
    border-bottom: 3px solid transparent;
    margin-bottom: 0;
    padding: 8px 10px;
  }
  .note-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--color-purple, rgb(179, 71, 241));
  }
  .note-item-cat { display: none; }

  .sidebar-footer {
    flex-shrink: 0;
    padding: 6px 8px;
  }

  /* 编辑器 - flex 链式约束实现内部滚动 */
  .notes-editor {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px;
    padding-bottom: 0;
    position: relative;
    min-height: 0;
  }

  .note-title { font-size: 18px; }

  /* 工具栏 - 横向滚动 */
  .toolbar {
    gap: 2px;
    flex-wrap: nowrap;
    padding: 8px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent 100%);
  }
  .toolbar::-webkit-scrollbar { display: none; }
  .tb-btn { width: 26px; height: 26px; font-size: 11px; flex-shrink: 0; }
  .tb-btn-toggle { width: auto; padding: 0 6px; font-size: 10px; flex-shrink: 0; }
  .toolbar-sep { display: inline; flex-shrink: 0; }
  .toolbar-spacer { display: none; }

  /* 编辑器区域 - 这是真正滚动的容器 */
  .editor-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .note-body {
    font-size: 14px;
    padding: 10px 0;
  }

  .note-preview { font-size: 14px; }

  /* 分屏模式 - 上下各占 50% */
  .editor-area.split {
    flex-direction: column;
    overflow-y: hidden;
  }
  .editor-area.split .note-body {
    flex: none;
    width: 100%;
    height: 50%;
    border-right: none;
    border-bottom: 1px solid #f0f0f0;
    padding-right: 0;
    padding-bottom: 6px;
    overflow-y: auto;
  }
  .editor-area.split .note-preview {
    flex: 1;
    padding-left: 0;
    padding-top: 6px;
    overflow-y: auto;
    display: block !important;
  }

  /* 预览模式 */
  .editor-area.preview .note-preview {
    overflow-y: auto;
    display: block !important;
  }

  /* 底部状态栏 */
  .editor-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 0;
    flex-shrink: 0;
  }
  .footer-left { gap: 6px; font-size: 11px; }
  .footer-right { justify-content: flex-end; }
  .footer-stat { padding-left: 8px; }

  [data-theme="dark"] .editor-area.split .note-body { border-bottom-color: rgba(255,255,255,0.08); }
}

@media (max-width: 480px) {
  .notes-app { padding: 4px; gap: 4px; }

  .sidebar-header { padding: 6px; gap: 4px; }

  .sidebar-sort { min-width: 90px; }
  .sidebar-sort select { font-size: 11px; padding: 6px 24px 6px 8px; }

  .sidebar-actions { min-width: 140px; gap: 4px; }
  .btn-new { font-size: 12px; padding: 6px; }
  .btn-batch { font-size: 10px; padding: 0 6px; }

  .note-list { gap: 4px; padding: 4px 6px; }
  .note-item { width: 120px; min-width: 110px; padding: 6px 8px; }
  .note-item-title { font-size: 12px; }

  .sidebar-footer { padding: 4px 6px; font-size: 11px; }

  .editor-content { padding: 8px 10px; padding-bottom: 0; }
  .note-title { font-size: 16px; padding-bottom: 6px; }

  .toolbar { padding: 6px 0; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%); }
  .toolbar::-webkit-scrollbar { display: none; }
  .tb-btn { width: 24px; height: 24px; font-size: 10px; flex-shrink: 0; }
  .tb-btn-toggle { width: auto; padding: 0 5px; font-size: 10px; flex-shrink: 0; }

  .note-body { font-size: 13px; }
  .note-preview { font-size: 13px; }

  .sidebar-category-filter { gap: 3px; }
  .cat-filter-item { font-size: 10px; padding: 3px 6px; }

  .note-category-row { gap: 4px; padding: 4px 0; }
  .note-category { font-size: 12px; }

  .editor-footer { gap: 4px; }
  .footer-left { font-size: 10px; gap: 4px; }
  .footer-right { gap: 4px; }
  .btn-small { padding: 4px 8px; font-size: 11px; }
}