* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

/* ========== 顶部搜索栏 ========== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  max-width: 948px;
  margin: 0 auto;
}

.search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

.search-input:focus { border-color: #e74c3c; }

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}

.btn-search {
  background: #e74c3c;
  color: #fff;
}

.btn-search:hover { background: #c0392b; }
.btn-search:disabled { background: #ccc; cursor: default; }

/* ========== 主内容区 ========== */
.main {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}

.empty-tip {
  text-align: center;
  color: #999;
  padding: 60px 0;
  font-size: 14px;
  line-height: 1.8;
}

/* ========== 列表 ========== */
.list-item {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
  position: relative;
  overflow: hidden;
}

.list-item:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  transform: translateY(-1px);
}

.item-title {
  font-size: 15px;
  font-weight: 600;
  color: #222;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-content {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}

.item-thumb {
  max-width: 120px;
  max-height: 80px;
  border-radius: 4px;
  display: block;
  margin-top: 6px;
  cursor: zoom-in;
  object-fit: cover;
}

.item-file {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  color: #666;
}

.item-file .fname {
  color: #444;
  word-break: break-all;
}

.item-meta {
  font-size: 11px;
  color: #bbb;
  margin-top: 6px;
}

/* 高亮：深红色加粗 */
mark.hl {
  color: #c0392b;
  font-weight: 700;
  background: none;
}

/* ========== 加载更多 ========== */
.load-more {
  text-align: center;
  padding: 16px;
  color: #999;
  font-size: 13px;
  display: none;
}

.load-more.show { display: block; }

.default-tip {
  text-align: center;
  padding: 16px;
  color: #bbb;
  font-size: 13px;
  display: none;
}

.default-tip.show { display: block; }

/* ========== 右下角添加按钮 ========== */
.add-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #e74c3c;
  color: #fff;
  font-size: 28px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(231,76,60,.4);
  transition: transform .2s, box-shadow .2s;
  z-index: 200;
  line-height: 52px;
  text-align: center;
}

.add-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(231,76,60,.5);
}

/* ========== 添加菜单弹出层 ========== */
.add-menu {
  position: fixed;
  bottom: 90px;
  right: 28px;
  width: 180px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  z-index: 250;
  padding: 14px;
  display: none;
}

.add-menu.show { display: block; }

/* 三角形尖尖 */
.add-menu::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 18px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.05));
}

.add-menu-greeting {
  font-size: 13px;
  color: #555;
  margin-bottom: 10px;
  line-height: 1.6;
}

#menuLogout {
  display: block;
  font-size: 12px;
  color: #999;
  text-decoration: none;
  margin-top: 4px;
}

#menuLogout:hover { color: #e74c3c; }

.menu-divider {
  height: 1px;
  background: #eee;
  margin-bottom: 10px;
}

.add-menu-types {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.add-type-btn {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #eee;
  border-radius: 7px;
  background: #fafafa;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: #555;
  transition: border-color .2s, background .2s;
}

.add-type-btn:hover {
  border-color: #e74c3c;
  background: #fff0f0;
  color: #c0392b;
}

/* ========== 遮罩层 ========== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.overlay.show {
  opacity: 1;
  pointer-events: all;
}

/* ========== 对话框 ========== */
.dialog {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  transform: translateY(20px);
  transition: transform .2s;
}

.overlay.show .dialog {
  transform: translateY(0);
}

.form-greeting {
  font-size: 14px;
  color: #888;
  margin-bottom: 10px;
  font-weight: 600;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 10px;
}

.diag-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #222;
}

.diag-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.diag-close:hover { color: #333; }

/* ========== 类型选择（旧兼容） ========== */
.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 4px;
}

.type-btn {
  padding: 20px 8px;
  border: 2px solid #eee;
  border-radius: 10px;
  background: #fafafa;
  cursor: pointer;
  text-align: center;
  transition: border-color .2s, background .2s;
  font-size: 13px;
  color: #555;
}

.type-btn:hover {
  border-color: #e74c3c;
  background: #fff0f0;
}

.type-btn .icon { font-size: 28px; display: block; margin-bottom: 6px; }

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
  font-family: inherit;
}

.form-input:focus { border-color: #e74c3c; }

textarea.form-input {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.file-upload-box {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}

.file-upload-box:hover {
  border-color: #e74c3c;
  background: #fff8f7;
}

.file-upload-box input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-hint { color: #999; font-size: 13px; }
.upload-preview { max-width: 200px; max-height: 150px; border-radius: 6px; margin-top: 8px; display: none; object-fit: contain; }
.upload-file-info { margin-top: 8px; font-size: 13px; color: #555; }

/* ========== 弹窗按钮组 ========== */
.diag-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.diag-actions .btn { flex: 1; padding: 10px; font-size: 14px; }

.btn-cancel {
  background: #f0f0f0;
  color: #555;
}
.btn-cancel:hover { background: #e0e0e0; }

.btn-danger {
  background: #e74c3c;
  color: #fff;
}
.btn-danger:hover { background: #c0392b; }

.btn-primary {
  background: #e74c3c;
  color: #fff;
}
.btn-primary:hover { background: #c0392b; }
.btn-primary:disabled { background: #ccc; cursor: default; }

/* ========== 详情弹窗 ========== */
.view-title-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  margin-bottom: 14px;
  outline: none;
  transition: border-color .2s;
}

.view-title-input:focus { border-color: #e74c3c; }

.view-content-text {
  width: 100%;
  min-height: 120px;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.7;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .2s;
}

.view-content-text:focus { border-color: #e74c3c; }

.view-img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
  display: block;
  cursor: zoom-in;
  object-fit: contain;
}

.view-file-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 6px;
  font-size: 13px;
}

.view-file-box .fname { word-break: break-all; color: #444; }

/* ========== 图片灯箱 ========== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.lightbox.show {
  opacity: 1;
  pointer-events: all;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
}

/* ========== Loading ========== */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 确认删除框 ========== */
.confirm-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.confirm-box p {
  font-size: 15px;
  color: #333;
  margin-bottom: 20px;
}

.confirm-box .diag-actions { margin-top: 0; }