/* =============================================
   流水账 - 主样式文件
   * v=2026050902 修复版本号同步+对齐菜单+表情选择器
   ============================================= */

:root {
  --primary: #4f7cff;
  --primary-dark: #3a63e8;
  --primary-light: #e8eeff;
  --accent: #ff6b6b;
  --success: #52c41a;
  --warning: #faad14;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #2c3e50;
  --text-muted: #8899aa;
  --border: #e8edf5;
  --timeline-line: #d0d8f0;
  --dot: #4f7cff;
  --shadow: 0 2px 16px rgba(79,124,255,0.10);
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 禁止横向滚动 */
*, *::before, *::after {
  overflow-wrap: break-word;
  word-break: break-word;
}

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================== 下拉刷新 ===================== */
#ptr-wrapper {
  position: relative;
}

.ptr-indicator {
  position: absolute;
  top: -60px;
  left: 0;
  right: 0;
  z-index: 998;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.ptr-circle {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ptr-circle svg circle:last-child {
  transition: stroke-dashoffset 0.15s ease;
}

.ptr-label {
  white-space: nowrap;
}

/* 刷新中：旋转动画 */
.ptr-indicator.ptr-refreshing .ptr-circle svg {
  animation: ptr-spin 0.8s linear infinite;
}
.ptr-indicator.ptr-refreshing .ptr-circle svg circle:last-child {
  stroke-dashoffset: 21.99; /* 25% 留空 */
}

/* 就绪状态：高亮 */
.ptr-indicator.ptr-ready {
  color: var(--primary);
}

@keyframes ptr-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ===================== 登录页 ===================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px 40px;
  width: 380px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: slideUp 0.4s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .icon {
  font-size: 52px;
  display: block;
  margin-bottom: 8px;
}

.login-logo h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 4px;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: #fafbff;
  transition: all 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  margin-top: 8px;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79,124,255,0.35);
}

.btn-primary:active { transform: translateY(0); }

.login-error {
  background: #fff2f0;
  border: 1px solid #ffccc7;
  color: #f5222d;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.login-error.show { display: block; }

.login-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.login-footer a {
  color: var(--primary);
  font-size: 14px;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ===================== 主布局 ===================== */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: 60px;
}

.app-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
}

.header-logo span { font-size: 28px; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.user-dropdown {
  position: relative;
}

.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  border: 1px solid var(--border);
  min-width: 160px;
  overflow: hidden;
  display: none;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}

.user-menu.show { display: block; }

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text);
}

.user-menu-item:hover { background: var(--bg); }
.user-menu-item.danger { color: var(--accent); }

.user-info-bar {
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 16px 6px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.user-info-bar:hover {
  background: var(--bg);
}

.user-info-bar strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

/* ===================== 时间轴容器 ===================== */
.main-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 20px 100px;
  width: 100%;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.stat-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.stat-chip:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79,124,255,0.15);
}

.stat-chip strong { color: var(--primary); }

/* ===================== 时间轴 ===================== */
.timeline {
  position: relative;
  padding-left: 32px;
  /* 时间轴定位变量 — 圆点自动居中于竖线，只需改 --dot-size */
  --line-left: 9px;      /* 竖线 left */
  --line-w: 2px;         /* 竖线 width */
  --dot-size: 14px;      /* 圆点尺寸（含 border） */
  --pad-left: 32px;      /* padding-left，圆点 left = line中心 - pad - dot/2 */
}

.timeline::before {
  content: '';
  position: absolute;
  left: var(--line-left);
  top: 10px;
  bottom: 10px;
  width: var(--line-w);
  background: linear-gradient(to bottom, var(--primary), var(--timeline-line), transparent);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
  animation: slideIn 0.3s ease both;
  perspective: 900px;
}

.timeline-dot {
  position: absolute;
  /* 自动居中于竖线：line中心 - padding - dot半径 */
  left: calc(var(--line-left) + var(--line-w) / 2 - var(--pad-left) - var(--dot-size) / 2);
  top: 16px;
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  background: var(--dot);
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
  box-sizing: border-box;
  z-index: 2;
  transition: transform 0.2s;
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.3);
}

/* ============================================
   收起/隐藏记录 — 灰色小球（紧凑标记模式）
   
   设计理念：折叠后 item 缩为"时间轴线上的一个标记"，
   只保留一个小灰球，几乎不占额外空间。
   
   布局：
     ┌─ 26px ─────────────────┐
     │    ○  ← 灰球(top:6px)  │  margin-bottom: 8px
     └────────────────────────┘
     
   对比正常条目(~150px)，折叠后只有 26px，非常紧凑。
   多个折叠项连续时像一串珠子排在时间轴上。
   ============================================ */

/* 收起条目：极致紧凑 — 高度刚好容纳小球 */
.timeline-item.item-collapsed {
  min-height: 14px !important;
  padding: 0 !important;
  margin-bottom: 1px !important;        /* 极小间距，多条时更紧密 */
  overflow: visible !important;
}
/* ★ 必须隐藏卡片，否则撑开 item 导致 dot 错位 */
.timeline-item.item-collapsed .timeline-card {
  display: none !important;
}

/* 收起状态：灰色圆球(内灰+外蓝环) — 紧贴时间轴线的标记点
   用 !important 确保终态始终正确（内灰#9ca3af + 外蓝环#4f7cff）
   注意：此类在变色动画完成后才添加，避免与 @keyframes 冲突 */
.timeline-dot.dot-collapsed {
  background: #9ca3af !important;
  border: 2.5px solid #ffffff !important;
  box-shadow: 0 0 0 2.5px #4f7cff !important;  /* 外圈蓝色 */
  left: calc(var(--line-left) + var(--line-w) / 2 - var(--pad-left) - var(--dot-size) / 2) !important;
  top: 0px !important;
  z-index: 5 !important;
  cursor: pointer !important;
  position: absolute !important;
  width: var(--dot-size) !important;
  height: var(--dot-size) !important;
  box-sizing: border-box !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.timeline-dot.dot-collapsed:hover {
  transform: scale(1.4) !important;
  background: #7b8290 !important;
  box-shadow: 0 0 0 2.5px #4f7cff !important;
}

/* 兼容选择器 */
.timeline-item.item-collapsed .timeline-dot.dot-collapsed {
  background: #9ca3af !important;
  box-shadow: 0 0 0 2.5px #4f7cff !important;
  left: calc(var(--line-left) + var(--line-w) / 2 - var(--pad-left) - var(--dot-size) / 2) !important;
  top: 0px !important;
  box-sizing: border-box !important;
}
.timeline-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  backface-visibility: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

/* 水平翻转动画 */
.timeline-card.flip-out {
  animation: flipOut 0.35s ease-in forwards;
}
.timeline-card.flip-in {
  animation: flipIn 0.35s ease-out forwards;
}

@keyframes flipOut {
  0%   { transform: rotateY(0deg); opacity: 1; }
  100% { transform: rotateY(90deg); opacity: 0.3; }
}
@keyframes flipIn {
  0%   { transform: rotateY(-90deg); opacity: 0.3; }
  100% { transform: rotateY(0deg); opacity: 1; }
}

.timeline-card.animating {
  transition: none !important;
}
.timeline-card.animating:hover {
  transform: none !important;
  box-shadow: var(--shadow) !important;
  border-color: var(--border) !important;
}

.timeline-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 24px rgba(79,124,255,0.14);
  transform: translateY(-1px);
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.meta-time {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-location {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-author {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.coin-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  line-height: 1.6;
  white-space: nowrap;
  letter-spacing: 0.3px;
  align-self: center;
}
.coin-badge:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.timeline-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.timeline-content .preview {
  display: block;
}

.timeline-content .full-text {
  display: none;
}

.timeline-content .full-text * { max-width: 100%; }

.timeline-content.expanded .preview { display: none; }
.timeline-content.expanded .full-text { display: block; }

.expand-btn {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
}

.expand-btn:hover { text-decoration: underline; }

/* 附件缩略图 */
.attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.attach-thumb {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s;
}

.attach-thumb:hover { transform: scale(1.05); }

.attach-file {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  max-width: 180px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.attach-file:hover { border-color: var(--primary); color: var(--primary); }

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.card-actions-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  transition: all 0.2s;
}

.action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.action-btn.share-btn:hover { border-color: var(--success); color: var(--success); background: #f6ffed; }
.action-btn.delete-btn:hover { border-color: var(--accent); color: var(--accent); background: #fff2f0; }

/* 完成状态按钮/标签 */
.complete-btn, .complete-badge {
  font-size: 15px;
  padding: 0 2px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  user-select: none;
  align-self: center;
  line-height: 1;
}
.complete-btn {
  border: none;
  background: transparent;
  color: #b0b0b0;
  font-size: 16px;
}
.complete-btn:hover {
  color: #52c41a;
}
.complete-badge {
  border: none;
  background: transparent;
  color: #52c41a;
  font-size: 16px;
}
.complete-badge:hover {
  color: #b0b0b0;
}

/* 已完成记录卡片样式 */
.timeline-card.completed {
  border-color: #b7eb8f;
  background: #fafff5;
  opacity: 0.88;
}
.timeline-card.completed .timeline-content {
  color: #888;
}

/* 置顶记录卡片样式 */
.timeline-card.pinned {
  border-color: #ffccc7;
  background: #fff2f0;
}
.timeline-card.pinned .timeline-content {
  color: #cf1322;
}

/* 置顶按钮（详情弹窗标题旁） */
.pin-btn {
  display: inline-block;
  cursor: pointer;
  font-size: 16px;
  margin-left: 6px;
  opacity: 0.35;
  transition: opacity 0.2s, transform 0.2s;
  vertical-align: middle;
}
.pin-btn:hover {
  opacity: 0.7;
  transform: scale(1.15);
}
.pin-btn.active {
  opacity: 1;
}

/* 日期分隔符 */
.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.date-divider:hover {
  /* 横线不跟随 span 的 hover */
}

.date-divider::before, .date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.date-divider span {
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.2s;
}

.date-divider span:hover {
  opacity: 0.7;
}

/* ★ 全隐藏日期组：首个收起项灰点上移至日期分隔线同高
   
   布局效果：
     │ ○ ← 灰色圆点（与横线同高）
     │ ───── 📅 2026-05-27 周三 ───
     │ ○ ← 第2条隐藏记录（紧凑排列）

   原理：date-divider 占位约 70px(28+~22+20)，
   用负margin将收起item拉至分隔线垂直居中位置。
   dot用 top:50% + translateY(-50%) 精确对齐。
*/
.all-hidden-group + .timeline-item.item-collapsed {
  margin-top: -40px !important;
  margin-bottom: 1px !important;
  padding: 0 !important;
  height: 14px !important;
  min-height: 14px !important;
}
.all-hidden-group + .timeline-item.item-collapsed .timeline-dot.dot-collapsed {
  position: absolute !important;
  left: calc(var(--line-left) + var(--line-w) / 2 - var(--pad-left) - var(--dot-size) / 2) !important;
  /* top 由 JS 动态设置为 divider 中心高度，不使用 50% */
}

/* ★ 通用：连续收起条目即时紧密排列（不依赖 all-hidden-group）
   margin-top=4px → 实际间距18px，圆点间约4px间隙，不重叠 */
.timeline-item.item-collapsed + .timeline-item.item-collapsed {
  margin-top: 4px !important;
  margin-bottom: 0px !important;
}

/* 全隐藏组内后续收起条目紧凑排列（由 JS 延迟添加 all-hidden-group 后增强） */
.all-hidden-group + .timeline-item.item-collapsed + .timeline-item.item-collapsed {
  margin-top: 4px !important;
  margin-bottom: 0px !important;
}

/* 非全隐藏日期：首个收起条目轻微上提 */
.date-divider:not(.all-hidden-group) + .timeline-item.item-collapsed {
  margin-top: -20px !important;
  margin-bottom: 1px !important;
}

/* ================================
   灰球动画：上移 / 下移 / 变色 / 缩放虚化
   终态：内里灰色(#9ca3af) + 外圈蓝色(#4f7cff)
   ================================ */

/* 收起时 — 圆球上移动画 (从原位滑向分隔线高度) — 0.6s */
@keyframes dotLiftUp {
  0%   { transform: translateY(0); filter: none; }
  20%  { filter: drop-shadow(0 4px 2px rgba(79,124,255,0.22)); }
  50%  {
    filter: drop-shadow(0 6px 3px rgba(79,124,255,0.38))
            drop-shadow(0 12px 2px rgba(79,124,255,0.16))
            drop-shadow(0 20px 1px rgba(79,124,255,0.05));
  }
  80%  { filter: drop-shadow(0 3px 2px rgba(79,124,255,0.12)); }
  100% { transform: translateY(-50%); filter: none; }
}
.dot-lifting {
  animation: dotLiftUp 0.6s cubic-bezier(0.25, 0.1, 0.25, 1) forwards !important;
}

/* 展开时 — 圆球下移动画 (从分隔线高度滑回原位) — 0.6s */
@keyframes dotDropDown {
  0%   { transform: translateY(-50%); top: 50%; filter: none; }
  20%  { filter: drop-shadow(0 -4px 2px rgba(79,124,255,0.22)); }
  50%  {
    filter: drop-shadow(0 -6px 3px rgba(79,124,255,0.38))
            drop-shadow(0 -12px 2px rgba(79,124,255,0.16))
            drop-shadow(0 -20px 1px rgba(79,124,255,0.05));
  }
  80%  { filter: drop-shadow(0 -3px 2px rgba(79,124,255,0.12)); }
  100% { transform: translateY(0); top: 0px; filter: none; }
}
.dot-dropping {
  animation: dotDropDown 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}

/* 变色动画：蓝色 → 灰色 (带扩散+缩放虚化) — 0.7s */
@keyframes dotFadeGray {
  0%   { 
    background: var(--dot, #4f7cff);
    box-shadow: 0 0 0 2px var(--primary, #4f7cff);
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  15%  {
    background: rgba(79,124,255,0.8);
    box-shadow: 0 0 0 2px var(--primary), 0 0 0 6px rgba(79,124,255,0.4);
    transform: translateY(0) scale(1.35);
    opacity: 1;
  }
  35%  {
    background: rgba(79,124,255,0.5);
    box-shadow: 0 0 0 2px var(--primary), 0 0 0 14px rgba(79,124,255,0.12);
    transform: translateY(0) scale(1.55);
    opacity: 0.85;
  }
  55%  {
    background: #b0b7c4;
    box-shadow: 0 0 0 2.5px rgba(79,124,255,0.7), 0 0 0 6px rgba(79,124,255,0.06);
    transform: translateY(0) scale(1.15);
    opacity: 1;
  }
  100% { 
    background: #9ca3af;
    box-shadow: 0 0 0 2.5px #4f7cff;
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
.dot-coloring-gray {
  animation: dotFadeGray 0.7s ease-out forwards !important;
}

/* 上移+变色组合动画（全隐藏组的收起项专用） — 0.9s */
@keyframes dotLiftAndGray {
  0%   { 
    background: var(--dot, #4f7cff);
    box-shadow: 0 0 0 2px var(--primary, #4f7cff);
    transform: translateY(0) scale(1);
    opacity: 1;
    top: 0px;
    filter: none;
  }
  12%  {
    background: rgba(79,124,255,0.75);
    box-shadow: 0 0 0 2px var(--primary), 0 0 0 7px rgba(79,124,255,0.35);
    transform: translateY(0) scale(1.4);
    opacity: 1;
    filter: drop-shadow(0 4px 2px rgba(79,124,255,0.28));
  }
  28%  {
    background: rgba(79,124,255,0.45);
    box-shadow: 0 0 0 2px var(--primary), 0 0 0 16px rgba(79,124,255,0.08);
    transform: translateY(-5%) scale(1.55);
    opacity: 0.8;
    filter: drop-shadow(0 8px 3px rgba(79,124,255,0.32))
            drop-shadow(0 16px 2px rgba(79,124,255,0.14))
            drop-shadow(0 26px 1px rgba(79,124,255,0.04));
  }
  48%  {
    background: #b0b7c4;
    box-shadow: 0 0 0 2.5px rgba(79,124,255,0.7);
    transform: translateY(-18%) scale(1.1);
    opacity: 0.95;
    filter: drop-shadow(0 5px 2px rgba(79,124,255,0.18));
  }
  72%  {
    background: #9ca3af;
    box-shadow: 0 0 0 2.5px #4f7cff;
    transform: translateY(-40%) scale(1.03);
    opacity: 1;
    filter: drop-shadow(0 3px 1px rgba(79,124,255,0.08));
  }
  100% { 
    background: #9ca3af;
    box-shadow: 0 0 0 2.5px #4f7cff;
    transform: translateY(-50%) scale(1);
    opacity: 1;
    top: 50%;
    filter: none;
  }
}
.dot-lift-and-gray {
  animation: dotLiftAndGray 0.9s cubic-bezier(0.25, 0.1, 0.25, 1) forwards !important;
}

/* 变色动画：灰色 → 蓝色 (恢复，带扩散光晕收拢) — 0.65s */
@keyframes dotFadeBlue {
  0%   { 
    background: #9ca3af;
    box-shadow: 0 0 0 2.5px #4f7cff;
    transform: scale(0.85);
    opacity: 0.6;
  }
  30%   {
    background: #a5adbb;
    box-shadow: 0 0 0 2.5px rgba(79,124,255,0.6), 0 0 0 8px rgba(79,124,255,0.2);
    transform: scale(1.2);
    opacity: 0.8;
  }
  60%   {
    background: rgba(79,124,255,0.7);
    box-shadow: 0 0 0 2px rgba(79,124,255,0.8), 0 0 0 4px rgba(79,124,255,0.3);
    transform: scale(1.06);
    opacity: 0.95;
  }
  100% { 
    background: var(--dot, #4f7cff);
    box-shadow: 0 0 0 2px var(--primary, #4f7cff);
    transform: scale(1);
    opacity: 1;
  }
}
.dot-coloring-blue {
  animation: dotFadeBlue 0.65s ease-out forwards !important;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 64px; display: block; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* 加载动画 - 双层旋转波纹 */
.loading-spinner {
  width: 56px; height: 56px;
  margin: 0 auto 20px;
  position: relative;
}
.loading-spinner::before,
.loading-spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.loading-spinner::before {
  border-top-color: var(--primary, #4f7cff);
  border-right-color: var(--primary, #4f7cff);
  animation: spinner-rotate 1.2s linear infinite;
}
.loading-spinner::after {
  border-bottom-color: var(--primary, #4f7cff);
  border-left-color: var(--primary, #4f7cff);
  animation: spinner-rotate 0.8s linear infinite reverse;
  inset: 10px;
}
@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

/* ===================== 滚动加载指示器 ===================== */
.scroll-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 28px 0;
}

.scroll-loader .loader-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.4;
  animation: loaderPulse 0.8s ease-in-out infinite;
}

.scroll-loader .loader-dot:nth-child(2) { animation-delay: 0.15s; }
.scroll-loader .loader-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes loaderPulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1.2); }
}

/* ===================== 加载更多按钮 ===================== */
.load-more-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 24px 0 8px;
  padding: 0 8px;
}

.load-more-wrap::before,
.load-more-wrap::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border));
}

.load-more-wrap::after {
  background: linear-gradient(to left, transparent, var(--border));
}

.load-more-btn {
  flex-shrink: 0;
  padding: 10px 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 1px 4px rgba(79,124,255,0.08);
  white-space: nowrap;
}

.load-more-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79,124,255,0.25);
  transform: translateY(-1px);
}

.load-more-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(79,124,255,0.12);
}

.load-more-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===================== 浮动按钮 ===================== */
.fab-container {
  position: fixed;
  right: 28px;
  bottom: 32px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.20);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  font-family: var(--font);
}

.fab-main {
  background: var(--primary);
  color: #fff;
  z-index: 2;
  line-height: 1;
}

.fab-main:hover { transform: scale(1.1) rotate(45deg); background: var(--primary-dark); }

.fab-admin {
  background: #fff;
  color: var(--text);
  width: 48px;
  height: 48px;
  font-size: 20px;
  border: 1.5px solid var(--border);
  transform: scale(0) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-container.open .fab-admin {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.fab-label {
  position: absolute;
  right: 64px;
  background: rgba(44,62,80,0.85);
  color: #fff;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.2s;
}

.fab-admin:hover .fab-label,
.fab-wrapper:hover .fab-label { opacity: 1; transform: translateX(0); }

.fab-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* ===================== 弹窗 ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.22);
  transform: translateY(30px) scale(0.97);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .modal {
  transform: translateY(0) scale(1);
}

/* 注册弹窗表单 */
#register-modal .form-group {
  margin-bottom: 14px;
}

#register-modal .form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#register-modal .form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,124,255,0.12);
}

#register-modal label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.modal-header {
  padding: 16px 44px 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  background: #fff;
  z-index: 1;
  border-radius: 20px 20px 0 0;
  flex-shrink: 0;
  position: relative;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #fff;
  border-radius: 0 0 20px 20px;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s;
  position: absolute;
  top: 10px;
  right: 10px;
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 16px 20px; }

.modal-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  background: #fff;
  border-radius: 0 0 20px 20px;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* 表单增强 */
.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 10px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: #fafbff;
  transition: all 0.2s;
  outline: none;
  height: 36px;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

/* 修复 datetime-local 在移动端的默认宽度 */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  min-width: 0;
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.rich-editor {
  width: 100%;
  min-height: 120px;
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: #fafbff;
  transition: all 0.2s;
  outline: none;
  line-height: 1.7;
  flex: 1;
  box-sizing: border-box;
  z-index: 1;
  overflow-x: auto;
  word-break: break-all;
}

/* PC端富文本编辑器 - 增加2倍 (120px + 240px = 360px) */
@media (min-width: 601px) {
  .rich-editor {
    min-height: 360px;
  }
}

.rich-editor:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* 工具栏 - 横向滚动模式 */
.editor-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--bg);
  overflow-x: auto;
  overflow-y: visible; /* 改为 visible 让下拉面板能显示 */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  position: relative; /* 支持表情面板定位 */
}

.editor-toolbar::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.editor-toolbar + .rich-editor {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* 确保工具栏按钮紧凑排列 */
.editor-toolbar .tool-btn,
.editor-toolbar .font-size-select {
  flex-shrink: 0;
}

.tool-btn {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.tool-btn:hover { background: var(--border); border-color: var(--border); }
.tool-btn.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.tool-sep {
  width: 1px;
  background: var(--border);
  margin: 0 4px;
  align-self: stretch;
  flex-shrink: 0;
}

.font-size-select {
  height: 28px;
  min-width: 48px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

/* ===================== 对齐下拉菜单 ===================== */
.align-dropdown {
  position: relative;
}

.align-btn {
  min-width: 28px;
}

.align-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 600;
  display: none;
  overflow: hidden;
  min-width: 100px;
}

.align-menu.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.align-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.align-option:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ===================== 表情选择器 ===================== */
.emoji-picker {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 9999;
  display: none;
  overflow: hidden;
}

.emoji-picker.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  background: none;
  border: none;
  padding: 0;
}

.emoji-item:hover {
  background: var(--primary-light);
  transform: scale(1.15);
}

/* ===================== Fixed定位的下拉菜单（避免层叠上下文裁剪） ===================== */
/* 对齐菜单 - fixed定位 */
.align-menu-fixed {
  position: fixed;
  z-index: 99999;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: none;
  overflow: hidden;
  min-width: 100px;
}

.align-menu-fixed.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.align-option-fixed {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.align-option-fixed:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* 表情选择器 - fixed定位 */
.emoji-picker-fixed {
  position: fixed;
  z-index: 99999;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: none;
  overflow: hidden;
}

.emoji-picker-fixed.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.emoji-grid-fixed {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-item-fixed {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  background: none;
  border: none;
  padding: 0;
}

.emoji-item-fixed:hover {
  background: var(--primary-light);
  transform: scale(1.15);
}

.emoji-item-fixed img {
  width: 22px;
  height: 22px;
  display: block;
}

/* 移动端适配 */
@media (max-width: 600px) {
  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
    max-height: 180px;
  }
  .emoji-item {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
}

/* 工具栏相对定位（支持表情面板定位） */
.editor-toolbar {
  position: relative;
}

/* 附件上传区 */
/* ===== 暂存状态图标 ===== */
.draft-status.saving {
  color: #f59e0b;
}
.draft-status.idle {
  color: var(--text-muted);
  font-size: 12px;
}
.draft-status.idle:hover {
  color: var(--primary);
}
.draft-status.saving::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid #f59e0b;
  border-top-color: transparent;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  animation: draft-spin 0.6s linear infinite;
}
@keyframes draft-spin { to { transform: rotate(360deg); } }
.draft-status.saved {
  color: #10b981;
}
.draft-status.saved:hover {
  opacity: 0.75;
}
.draft-status.error {
  color: #ef4444;
}
.draft-status.error:hover {
  opacity: 0.75;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.upload-zone .icon { font-size: 18px; display: block; margin-bottom: 2px; }
.upload-zone p { font-size: 12px; margin: 0; }
.upload-zone p + p { margin-top: 2px; font-size: 11px; opacity: 0.7; }

.upload-list {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 添加/编辑弹窗：缩小末个 form-group 到底部横线的间距 */
#add-modal .form-group:last-of-type,
#edit-modal .form-group:last-of-type {
  margin-bottom: 8px;
}

.upload-item {
  position: relative;
  display: inline-flex;
}

.upload-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.upload-item-file {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  max-width: 150px;
}

.upload-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ===================== 图片查看器 v2 ===================== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox.show {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ── 三图并排 slider ── */
.lb-slider {
  display: flex;
  width: 300vw;
  height: 100%;
  will-change: transform;
  transform: translateX(-100vw);
}
.lb-slider.animating {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.lb-slide {
  width: 100vw;
  height: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 每张图的缩放/平移容器 */
.lb-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
}

.lb-slide img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 8px;
  object-fit: contain;
  pointer-events: none;
}

.lightbox.show .lb-slide img {
  pointer-events: auto;
}


/* UI 叠加层元素 */
.lightbox-counter {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 20px;
  z-index: 10;
  transition: opacity 0.25s;
}

/* 关闭按钮 */
.lightbox-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 20px;
  border: none;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s, opacity 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-close:hover {
  background: rgba(255,255,255,0.3);
}
.lightbox-close:active {
  transform: scale(0.9);
}

/* 操作提示 */
.lightbox-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  z-index: 10;
  white-space: nowrap;
  transition: opacity 0.25s;
}

/* UI 自动隐藏 */
.lb-hidden {
  opacity: 0 !important;
  pointer-events: none;
}

/* 移动端优化 */
@media (max-width: 600px) {
  .lightbox-counter {
    top: 12px;
    right: 12px;
    font-size: 12px;
    padding: 4px 10px;
  }
  .lightbox-hint {
    bottom: 12px;
    font-size: 11px;
  }
  .lightbox-close {
    top: auto;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    font-size: 22px;
  }
  .lightbox-close:active {
    transform: translateX(-50%) scale(0.9);
  }
}

/* ===================== 后台管理 ===================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  background: linear-gradient(170deg, #2c3e50 0%, #3a5068 100%);
  padding: 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-logo {
  padding: 20px 20px 16px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-nav { padding: 12px 0; }

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.admin-nav-item:hover, .admin-nav-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.admin-nav-item.active {
  border-left: 3px solid var(--primary);
  padding-left: 17px;
}

.admin-main {
  flex: 1;
  background: var(--bg);
  overflow-y: auto;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-topbar h2 { font-size: 18px; font-weight: 700; }

.admin-content { padding: 24px 28px; }

/* 数据卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-card-icon.blue { background: var(--primary-light); }
.stat-card-icon.green { background: #f6ffed; }
.stat-card-icon.orange { background: #fff7e6; }
.stat-card-icon.red { background: #fff2f0; }

.stat-card-info h3 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-info p { font-size: 13px; color: var(--text-muted); }

/* 表格 */
.data-table-wrap {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.table-toolbar h3 { font-size: 16px; font-weight: 700; }

.btn-sm {
  padding: 7px 16px;
  font-size: 13px;
  border-radius: 6px;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover { background: var(--primary-light); }

.btn-danger {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.btn-danger:hover { background: #fff2f0; }

.btn-success {
  background: var(--success);
  color: #fff;
  border: none;
}

.btn-success:hover { background: #389e0d; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead tr { background: #fafbff; }

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbff; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-admin { background: var(--primary-light); color: var(--primary); }
.badge-user { background: #f6ffed; color: var(--success); }
.badge-active { background: #f6ffed; color: var(--success); }
.badge-inactive { background: #f5f5f5; color: #999; }

/* ===================== 搜索与统计行 ===================== */
.search-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.search-stats-row .search-bar {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.search-stats-row .stat-chip {
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.search-stats-row .stat-chip strong {
  color: var(--primary);
}

/* ===================== 搜索栏 ===================== */
.search-bar {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
}

.search-bar .search-icon { font-size: 18px; color: var(--text-muted); }

/* ===================== 分页 ===================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.page-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===================== Toast ===================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(0,0,0,0.78);
  color: #fff;
  border-radius: 20px;
  padding: 10px 24px;
  font-size: 14px;
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  max-width: 80vw;
  text-align: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.error   { background: rgba(220,38,38,0.85); }
.toast.warning { background: rgba(245,158,11,0.85); }
.toast.fade-out { opacity: 0; transform: translateY(8px); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================== 动画 ===================== */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===================== 分享色盘选择器 ===================== */
.color-picker-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.color-picker-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  position: relative;
  overflow: hidden;
  background: #ffffff !important;
}

/* 彩虹渐变调色板图标 - 覆盖在颜色上方 */
.color-picker-icon {
  position: absolute;
  inset: 4px;
  border-radius: 6px;
  background: conic-gradient(
    #ff6b6b 0deg,
    #feca57 60deg,
    #48dbfb 120deg,
    #1dd1a1 180deg,
    #5f27cd 240deg,
    #ff9ff3 300deg,
    #ff6b6b 360deg
  );
  opacity: 0.85;
  pointer-events: none;
}

/* 对角线效果 */
.color-picker-icon::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255,255,255,0.5) 45%,
    rgba(255,255,255,0.5) 55%,
    transparent 60%
  );
  transform: rotate(45deg);
}

.color-picker-btn:hover {
  transform: scale(1.08);
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(79,124,255,0.35);
}

.color-picker-btn:active {
  transform: scale(0.95);
}

/* 原生色盘输入框 - 完全覆盖按钮，透明可点击 */
.color-input-native {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  margin: 0;
  border: none;
  -webkit-appearance: none;
  appearance: none;
}

/* iOS Safari 特殊处理 */
.color-input-native::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-native::-webkit-color-swatch {
  border: none;
  border-radius: 10px;
}

/* ===================== 分享标签按钮 ===================== */
.share-tag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: all 0.2s;
  user-select: none;
  white-space: nowrap;
}

.share-tag-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* 激活状态 - 显示 */
.share-tag-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* 非激活状态 - 隐藏 */
.share-tag-btn:not(.active) {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-muted);
}

.share-tag-btn:not(.active) .tag-label {
  text-decoration: line-through;
  opacity: 0.6;
}

/* 水印输入框 */
.watermark-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  outline: none;
  transition: all 0.2s;
}

.watermark-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.watermark-clear-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.watermark-clear-btn:hover {
  background: #fff2f0;
  color: var(--accent);
}

/* ===================== 分享图片容器（支持独立滚动）===================== */
.share-img-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-height: 70vh;
  overflow-y: auto;
  border-radius: 14px;
}

.share-img-container img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

/* 自定义滚动条样式 */
.share-img-container::-webkit-scrollbar {
  width: 6px;
}

.share-img-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.share-img-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.share-img-container::-webkit-scrollbar-thumb:hover {
  background: #a1a1c1;
}

/* ===================== 响应式 ===================== */
@media (max-width: 600px) {
  .main-content { padding: 16px 12px 90px; }
  .admin-sidebar { display: none; }
  .modal {
    max-width: 100%;
    border-radius: 16px;
    max-height: 92vh;
    margin: auto;
  }
  .modal-overlay {
    padding: 12px;
    align-items: center;
  }
  /* 添加/编辑弹窗在移动端保持底部弹出（bottom-sheet），自适应视口 */
  #add-modal, #edit-modal {
    align-items: flex-end;
  }
  #add-modal .modal,
  #edit-modal .modal {
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - 24px);
    border-radius: 20px;
    transform: translateY(100%);
  }
  #add-modal.show .modal,
  #edit-modal.show .modal {
    transform: translateY(0);
  }
  .modal-header {
    padding: 14px 16px 12px;
  }
  .modal-body {
    padding: 14px 16px;
  }
  .modal-footer {
    padding: 12px 16px 14px;
  }
  .form-row {
    gap: 10px;
  }
  .form-row .form-group {
    margin-bottom: 12px;
  }
  .rich-editor { 
    width: 100%; 
    max-height: 240px;
    overflow-y: auto;
    padding: 10px 12px; 
  }
  .stats-bar { gap: 8px; }
  .app-header { padding: 0 12px; }
  .header-logo { font-size: 18px; gap: 8px; }
  .header-logo span { font-size: 24px; }
  .login-box { padding: 36px 24px 32px; }
  .login-logo h1 { font-size: 22px; letter-spacing: 2px; }
  .fab-container { right: 16px; bottom: 24px; }
  .timeline { --dot-size: 12px; }
  .timeline-item.item-collapsed { min-height: 12px !important; }
  .all-hidden-group + .timeline-item.item-collapsed { margin-top: -40px !important; height: 12px !important; min-height: 12px !important; }
  .all-hidden-group + .timeline-item.item-collapsed + .timeline-item.item-collapsed { margin-top: 3px !important; }
  .timeline-item.item-collapsed + .timeline-item.item-collapsed { margin-top: 3px !important; }
  .timeline-card { padding: 14px 16px 12px; }
  .page-title { font-size: 20px; }
  /* 移动端搜索统计行 */
  .search-stats-row {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .search-stats-row .search-bar {
    flex: 1;
    min-width: 0;
  }
  .search-stats-row .stat-chip {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 12px;
  }
  /* 强制所有元素不超过视口宽度 */
  * { max-width: 100vw; }
}

/* ===========================
   添加/编辑弹窗 — 全屏底部弹出适配
   确保头尾固定、中间内容可滚动
   =========================== */
@media (max-width: 600px) and (max-height: 750px) {
  #add-modal .modal,
  #edit-modal .modal {
    max-height: calc(100vh - env(safe-area-inset-top, 0px));
    display: flex !important;
    flex-direction: column !important;
  }

  #add-modal .modal-body,
  #edit-modal .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  #add-modal .modal-header,
  #edit-modal .modal-header {
    position: relative;
    z-index: 2;
    border-radius: 20px 20px 0 0;
    background: #fff;
  }

  #add-modal .modal-footer,
  #edit-modal .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
  }

  /* 富文本编辑器在弹窗内不要占满剩余空间，给其他表单元素留空间 */
  #add-modal .rich-editor,
  #edit-modal .rich-editor {
    min-height: 120px;
    max-height: 180px;
  }
}

/* ===========================
   日期统计弹窗 - 日历视图
   =========================== */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 0 16px;
  user-select: none;
}
.cal-nav-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 50%;
  background: #fff;
  color: var(--primary, #4f7cff);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.cal-nav-btn:hover {
  background: var(--primary, #4f7cff);
  color: #fff;
  border-color: var(--primary, #4f7cff);
}
.cal-nav-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #333);
  min-width: 130px;
  text-align: center;
}

/* 星期表头 */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.cal-weekday {
  text-align: center;
  font-size: 12px;
  color: #999;
  padding: 6px 0;
  font-weight: 500;
}

/* 日期网格 */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text, #333);
  background: #f8f9ff;
  position: relative;
}
.cal-day-empty {
  background: transparent;
}
.cal-day-has {
  background: #eef2ff;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-day-has:hover {
  background: #dde4ff;
  transform: scale(1.05);
}
.cal-day-today {
  box-shadow: inset 0 0 0 2px var(--primary, #4f7cff);
  font-weight: 700;
}
.cal-day-num {
  font-size: 14px;
}
.cal-day-today .cal-day-num {
  color: var(--primary, #4f7cff);
}
.cal-day-count {
  font-size: 10px;
  color: #fff;
  background: var(--primary, #4f7cff);
  border-radius: 6px;
  padding: 1px 5px;
  margin-top: 2px;
  min-width: 16px;
  text-align: center;
  font-weight: 600;
}

/* 底部总计 */
.cal-total {
  text-align: center;
  padding: 16px 0 4px;
  font-size: 14px;
  color: #999;
}
.cal-total strong {
  color: var(--primary, #4f7cff);
  font-size: 18px;
  margin: 0 4px;
}

/* ===========================
   用户设置弹窗
   =========================== */
.btn-block {
  width: 100%;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border, #e0e0e0);
  border-radius: var(--radius-sm, 8px);
  font-size: 14px;
  background: #fff;
  color: var(--text, #333);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--primary, #4f7cff);
  box-shadow: 0 0 0 3px rgba(79,124,255,0.12);
}

.settings-section {
  margin-bottom: 8px;
}
.settings-section:last-child {
  margin-bottom: 0;
}
.settings-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #333);
  margin: 0 0 12px;
}
.settings-divider {
  height: 1px;
  background: var(--border, #e0e0e0);
  margin: 18px 0;
}
