* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: #222;
  background: #f5f6f8;
}

/* 登录/注册页 */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #4f7cff, #7b5cff);
}
.auth-box {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.auth-box h1 { text-align: center; margin: 0 0 20px; color: #4f7cff; }
.auth-box form { display: flex; flex-direction: column; gap: 12px; }
.auth-box input {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}
.auth-box button {
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: #4f7cff;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.auth-box button:hover { background: #3d68e0; }
.auth-error { color: #e5484d; font-size: 13px; text-align: center; }
.auth-switch { text-align: center; font-size: 13px; margin-top: 16px; color: #666; }
.auth-switch a { color: #4f7cff; }

/* 主布局 */
.layout {
  display: grid;
  grid-template-columns: 220px 280px 1fr;
  height: 100vh;
}
.sidebar {
  background: #fff;
  border-right: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
}
.sidebar-top { padding: 16px; border-bottom: 1px solid #eee; }
.brand { font-weight: 700; font-size: 18px; color: #4f7cff; margin-bottom: 8px; }
.user-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #666; }
.search-box { padding: 10px 14px; }
.search-box input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
}
.folder-tree { flex: 1; overflow-y: auto; padding: 4px 8px; }
.tree-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tree-item:hover { background: #f0f2f8; }
.tree-item.active { background: #e8edff; color: #4f7cff; font-weight: 600; }
.tree-sep { height: 1px; background: #eee; margin: 8px 4px; }
.folder-actions { display: none; gap: 4px; }
.tree-item:hover .folder-actions { display: flex; }
.folder-actions span { cursor: pointer; font-size: 12px; color: #999; padding: 0 3px; }
.add-folder-btn { display: block; width: 100%; text-align: left; padding: 8px 10px; font-size: 13px; color: #4f7cff; }

.note-list-pane { background: #fafbfc; border-right: 1px solid #e5e5e5; display: flex; flex-direction: column; }
.note-list-header { padding: 12px; border-bottom: 1px solid #eee; }
.primary-btn {
  width: 100%;
  padding: 9px;
  background: #4f7cff;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.primary-btn:hover { background: #3d68e0; }
.note-list { flex: 1; overflow-y: auto; }
.note-item {
  padding: 12px 14px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.note-item:hover { background: #f0f2f8; }
.note-item.active { background: #e8edff; }
.note-item .title { font-weight: 600; font-size: 14px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item .meta { font-size: 12px; color: #999; }
.note-item .snippet { font-size: 12px; color: #888; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-hint { padding: 20px; text-align: center; color: #999; font-size: 13px; }

.editor-pane { display: flex; flex-direction: column; background: #fff; }
.editor-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: #bbb; font-size: 14px; }
.editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.editor-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #eee; }
.title-input { flex: 1; font-size: 16px; font-weight: 600; border: none; outline: none; }
.editor-toolbar select { padding: 5px; border-radius: 4px; border: 1px solid #ddd; font-size: 13px; }
.upload-btn { font-size: 13px; color: #4f7cff; cursor: pointer; }
.save-status { font-size: 12px; color: #999; margin-left: auto; }
.link-btn { background: none; border: none; cursor: pointer; color: #666; font-size: 13px; }
.link-btn.danger { color: #e5484d; }
.editor-body { flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
#contentInput {
  border: none;
  outline: none;
  resize: none;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  font-family: "Cascadia Code", Consolas, monospace;
  border-right: 1px solid #eee;
}
.preview { padding: 16px; overflow-y: auto; line-height: 1.7; font-size: 14px; }
.preview img { max-width: 100%; }
.preview pre { background: #f5f5f5; padding: 10px; border-radius: 6px; overflow-x: auto; }
.preview code { background: #f5f5f5; padding: 1px 4px; border-radius: 3px; }
.preview blockquote { border-left: 3px solid #ddd; margin: 8px 0; padding-left: 12px; color: #666; }

/* 自定义确认/输入弹窗 */
.dlg-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.dlg-box {
  background: #fff; border-radius: 10px; padding: 20px; width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.dlg-msg { font-size: 14px; color: #333; margin-bottom: 14px; line-height: 1.5; }
.dlg-input {
  width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px;
  font-size: 14px; margin-bottom: 14px;
}
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dlg-actions button {
  padding: 7px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px;
}
.dlg-cancel { background: #f0f2f5; color: #333; }
.dlg-cancel:hover { background: #e5e8ed; }
.dlg-ok { background: #4f7cff; color: #fff; }
.dlg-ok:hover { background: #3d68e0; }
