/* ===== Treeks · Apple Style · 淡绿主题 ===== */
:root {
  /* color-scheme：让浏览器原生控件（滚动条/表单/placeholder）跟随明暗模式，
     避免系统深色模式下原生控件变黑与应用浅色主题冲突 */
  color-scheme: light;

  /* 颜色 - 淡绿主题 */
  --bg: #f4f8f4;
  --bg-gradient: radial-gradient(circle at 0% 0%, #e6f0e8 0%, #f4f8f4 40%, #fafdfa 100%);
  --bg-paper: rgba(255, 255, 255, 0.72);
  --bg-paper-solid: #ffffff;
  --bg-sidebar: rgba(244, 248, 244, 0.7);
  --bg-elevated: #ffffff;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-active: rgba(76, 153, 92, 0.1);

  --fg: #1d2a20;
  --fg-secondary: #3a4a3d;
  --fg-muted: #7a8a7c;
  --fg-tertiary: #b0bcb1;

  --accent: #4c995c;          /* 主绿色 - 柔和 */
  --accent-hover: #3e7f4c;
  --accent-pressed: #356d40;
  --accent-light: rgba(76, 153, 92, 0.12);
  --accent-soft: rgba(76, 153, 92, 0.06);
  --accent-bright: #6dbb7d;   /* 浅亮绿 */

  --success: #34c759;
  --warning: #d99a3a;
  --danger: #d9685c;
  --danger-hover: #c45a4f;

  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --border-focus: rgba(76, 153, 92, 0.4);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 12px rgba(60, 90, 70, 0.06);
  --shadow-md: 0 4px 20px rgba(60, 90, 70, 0.08);
  --shadow-lg: 0 12px 40px rgba(60, 90, 70, 0.12);
  --shadow-xl: 0 20px 60px rgba(60, 90, 70, 0.16);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 980px;

  /* 热力图绿阶 - 淡绿到深绿 */
  --heat-0: #ebf2eb;
  --heat-1: #c5dec8;
  --heat-2: #8ec496;
  --heat-3: #5da967;
  --heat-4: #3b8a48;
  --heat-empty: #eef3ee;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-serif: "New York", "Iowan Old Style", "Apple Garamond", Georgia, "Songti SC", serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Monaco, Consolas, monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg-gradient);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.01em;
}

#app { height: 100%; }
.view { height: 100%; }

/* 滚动条 - Apple 风格 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); background-clip: content-box; }

/* ===== 登录注册页 ===== */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(76, 153, 92, 0.20) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(143, 195, 145, 0.22) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(212, 222, 188, 0.15) 0%, transparent 50%),
    linear-gradient(135deg, #e9f1e8 0%, #f4f8f4 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.auth-view::before {
  content: '';
  position: absolute;
  top: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(76, 153, 92, 0.18), transparent 70%);
  filter: blur(60px);
  animation: float 18s ease-in-out infinite;
}
.auth-view::after {
  content: '';
  position: absolute;
  bottom: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(143, 195, 145, 0.22), transparent 70%);
  filter: blur(60px);
  animation: float 22s ease-in-out infinite reverse;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -40px) scale(1.1); }
}

/* 装饰叶子 - 漂浮动画 */
.deco-leaf {
  position: absolute;
  color: var(--accent);
  pointer-events: none;
  z-index: 0;
}
.deco-leaf.leaf-1 {
  width: 60px; height: 60px;
  top: 8%; left: 8%;
  animation: leafDrift1 14s ease-in-out infinite;
}
.deco-leaf.leaf-2 {
  width: 44px; height: 44px;
  top: 70%; left: 12%;
  animation: leafDrift2 18s ease-in-out infinite;
  animation-delay: -3s;
  color: #8fc391;
}
.deco-leaf.leaf-3 {
  width: 50px; height: 50px;
  top: 18%; right: 10%;
  animation: leafDrift3 16s ease-in-out infinite;
  animation-delay: -6s;
  color: #6dbb7d;
}
@keyframes leafDrift1 {
  0%, 100% { transform: translate(0, 0) rotate(-15deg); }
  50% { transform: translate(30px, 60px) rotate(20deg); }
}
@keyframes leafDrift2 {
  0%, 100% { transform: translate(0, 0) rotate(30deg); }
  50% { transform: translate(-40px, -50px) rotate(-10deg); }
}
@keyframes leafDrift3 {
  0%, 100% { transform: translate(0, 0) rotate(45deg); }
  50% { transform: translate(20px, 80px) rotate(-30deg); }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  padding: 44px 36px;
  box-shadow: var(--shadow-xl);
  z-index: 1;
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  background: linear-gradient(145deg, #ffffff 0%, #e6f0e8 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  box-shadow:
    0 10px 28px rgba(76, 153, 92, 0.22),
    0 2px 6px rgba(60, 90, 70, 0.06),
    inset 0 1px 1px rgba(255, 255, 255, 0.9);
  margin-bottom: 14px;
  animation: logoFloat 4s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}
.logo-icon::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.5) 50%, transparent 60%);
  transform: rotate(45deg);
  animation: logoShine 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes logoShine {
  0%, 60% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}
.auth-logo h1 {
  font-family: var(--font-sans);
  font-size: 30px;
  font-weight: 700;
  color: var(--fg);
  margin-top: 8px;
  letter-spacing: -0.02em;
}
.auth-subtitle {
  color: var(--fg-muted);
  font-size: 14px;
  margin-top: 6px;
  letter-spacing: 0;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  background: rgba(118, 118, 128, 0.12);
  padding: 3px;
  border-radius: var(--radius-pill);
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: all 0.25s var(--ease);
  font-family: inherit;
}
.auth-tab.active {
  background: #fff;
  color: var(--fg);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.auth-form { display: none; flex-direction: column; gap: 16px; }
.auth-form.active { display: flex; animation: fadeUp 0.4s var(--ease); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 13px;
  color: var(--fg-secondary);
  font-weight: 500;
  letter-spacing: 0;
  padding-left: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-group label::before {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
}
.form-group input,
.form-group textarea,
.form-group select {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.8);
  color: var(--fg);
  transition: all 0.25s var(--ease);
}
.form-group textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-group input::placeholder, .form-group textarea::placeholder {
  color: var(--fg-tertiary);
  transition: opacity 0.2s var(--ease);
}
.form-group input:hover, .form-group textarea:hover, .form-group select:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.95);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-light);
  transform: translateY(-1px);
}
.form-group input:focus::placeholder, .form-group textarea:focus::placeholder {
  opacity: 0.5;
}
.form-group input:disabled {
  background: rgba(118, 118, 128, 0.08);
  color: var(--fg-muted);
  cursor: not-allowed;
}

/* ===== 按钮 - Apple Style ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  font-family: inherit;
  white-space: nowrap;
  letter-spacing: -0.01em;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s var(--ease), height 0.5s var(--ease);
  pointer-events: none;
}
.btn:active::before { width: 200px; height: 200px; }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 2px rgba(76, 153, 92, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 16px rgba(76, 153, 92, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--fg-secondary);
  color: white;
}
.btn-secondary:hover { background: var(--fg); }
.btn-ghost {
  background: transparent;
  color: var(--fg-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 1px 2px rgba(255, 59, 48, 0.3);
}
.btn-danger:hover { background: var(--danger-hover); }
.btn-block { width: 100%; padding: 12px 18px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

.auth-message {
  margin-top: 14px;
  font-size: 13px;
  text-align: center;
  min-height: 18px;
  padding: 0 8px;
}
.auth-message.error { color: var(--danger); animation: shake 0.4s var(--ease); }
.auth-message.success { color: var(--success); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-3px); }
  40%, 80% { transform: translateX(3px); }
}

/* ===== 主应用布局 ===== */
.main-view {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100%;
  transition: grid-template-columns 0.32s var(--ease);
}
/* 侧栏收起状态 */
.main-view.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}
.main-view.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  pointer-events: none;
}

/* 侧边栏 - Apple Liquid Glass */
.sidebar {
  background: var(--bg-sidebar);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;   /* 防止宽度过渡时内容溢出抖动 */
  min-width: 0;         /* 允许 grid 子项收缩到 0 */
  transition: transform 0.32s var(--ease);
  position: relative;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-collapse-btn {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.25s;
}
.sidebar-collapse-btn:hover {
  background: var(--bg-hover, rgba(0,0,0,0.05));
  color: var(--fg);
}
.main-view.sidebar-collapsed .sidebar-collapse-btn {
  /* 收起后按钮旋转，提示可展开 */
  transform: rotate(180deg);
}
/* 展开按钮 - 侧栏收起后浮动显示（FAB 样式，可拖拽，与其它 FAB 统一）*/
.sidebar-expand-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #3b8a48);
  color: white;
  border: none;
  cursor: grab;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(76, 153, 92, 0.35);
  z-index: 50;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
  opacity: 0;
  transform: scale(0.5);
  user-select: none;
  touch-action: none;
}
.sidebar-expand-btn.visible {
  opacity: 1;
  transform: scale(1);
}
.sidebar-expand-btn:hover:not(.dragging) {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(76, 153, 92, 0.45);
}
.sidebar-expand-btn:active:not(.dragging) {
  transform: scale(0.96);
}
.sidebar-expand-btn.dragging {
  cursor: grabbing;
  transition: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  z-index: 100;
}
.main-view.sidebar-collapsed .sidebar-expand-btn { display: flex; }
.sidebar-header .logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(76, 153, 92, 0.18);
  animation: none;
  overflow: visible;
  margin: 0;
}
.sidebar-header .logo-icon::after { display: none; }
.brand {
  font-size: 19px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
  cursor: default;
}
.user-card:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(76, 153, 92, 0.25);
  transform: translateX(2px);
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4c995c, #8fc391);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(76, 153, 92, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  letter-spacing: -0.02em;
}
.avatar::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.user-info { min-width: 0; flex: 1; }
.user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-handle {
  font-size: 12px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-section { display: flex; flex-direction: column; gap: 4px; }
.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-tertiary);
  padding: 8px 12px 4px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  color: var(--fg-secondary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  font-family: inherit;
  transition: all 0.2s var(--ease);
  -webkit-user-select: none;
  user-select: none;
  position: relative;
}
.nav-item:hover {
  background: rgba(76, 153, 92, 0.08);
  color: var(--accent);
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(135deg, var(--accent), #3b8a48);
  color: white;
  box-shadow: 0 4px 12px rgba(76, 153, 92, 0.3);
  transform: none;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease);
}
.nav-item:hover .nav-icon { transform: scale(1.1); }
.nav-new {
  margin: 4px 0;
  background: linear-gradient(135deg, var(--accent), #3b8a48);
  color: white;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(76, 153, 92, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  animation: navNewGlow 3s ease-in-out infinite;
}
@keyframes navNewGlow {
  0%, 100% { box-shadow: 0 4px 14px rgba(76, 153, 92, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
  50% { box-shadow: 0 6px 20px rgba(76, 153, 92, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
}
.nav-new::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.7s var(--ease);
}
.nav-new:hover::before { left: 100%; }
.nav-new:hover {
  background: linear-gradient(135deg, var(--accent-hover), #356d40);
  transform: translateY(-1px);
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 主内容区 */
.content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  display: flex;
  gap: 12px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  max-width: 480px;
}
.search-icon {
  position: absolute;
  left: 14px;
  opacity: 0.45;
  pointer-events: none;
  transition: all 0.2s var(--ease);
}
#search-input {
  width: 100%;
  padding: 9px 36px 9px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  color: var(--fg);
  transition: all 0.25s var(--ease);
}
#search-input::placeholder { color: var(--fg-tertiary); }
.search-box:hover .search-icon { opacity: 0.7; }
#search-input:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--border-strong);
}
#search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-light);
}
.search-box:focus-within .search-icon { opacity: 0.9; color: var(--accent); }
.btn-clear-search {
  position: absolute;
  right: 8px;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  cursor: pointer;
  color: var(--fg-muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
  padding: 0;
}
.btn-clear-search:hover { background: rgba(0, 0, 0, 0.12); color: var(--fg); transform: rotate(90deg); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.filter-select, .filter-date {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  color: var(--fg);
  transition: all 0.2s var(--ease);
  cursor: pointer;
}
.filter-select:focus, .filter-date:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* 内容视图切换 */
.content-view { display: none; flex: 1; overflow-y: auto; padding: 28px; animation: fadeUp 0.3s var(--ease); }
.content-view.active { display: block; }
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
  flex-wrap: wrap;
}
.content-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.03em;
  position: relative;
  padding-left: 14px;
}
.content-header h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  border-radius: 2px;
}
.content-count {
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-pill);
}

/* 日记列表 */
.diary-list { display: flex; flex-direction: column; gap: 14px; }
.diary-card {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}
.diary-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--accent), #8fc391);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.diary-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right, rgba(76, 153, 92, 0.06), transparent 70%);
  border-radius: 0 var(--radius-lg) 0 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.diary-card:hover::before { opacity: 1; }
.diary-card:hover::after { opacity: 1; }
.diary-card:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(76, 153, 92, 0.25);
  box-shadow: 0 8px 24px rgba(76, 153, 92, 0.12);
  transform: translateY(-2px);
}
.diary-card.pinned {
  background: linear-gradient(135deg, rgba(255, 217, 158, 0.18) 0%, rgba(255, 255, 255, 0.72) 60%);
  border-color: rgba(217, 154, 58, 0.3);
}
.diary-card.pinned::before {
  background: linear-gradient(180deg, var(--warning), #f0b860);
  opacity: 1;
}
.diary-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.diary-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  flex: 1;
  letter-spacing: -0.02em;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.diary-card-title-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.diary-card.pinned .diary-card-title::before {
  content: '📌';
  font-size: 14px;
  flex-shrink: 0;
}
.diary-card-meta {
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.diary-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: rgba(76, 153, 92, 0.06);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-secondary);
  white-space: nowrap;
}
.diary-card-meta-item.date {
  background: rgba(0, 0, 0, 0.04);
  color: var(--fg-muted);
}
.diary-card-excerpt {
  color: var(--fg-secondary);
  font-size: 14px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.diary-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.tag-chip {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-weight: 500;
  transition: all 0.18s var(--ease);
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.tag-chip::before {
  content: '#';
  opacity: 0.5;
  font-size: 10px;
}
.tag-chip:hover {
  background: var(--accent-light);
  border-color: rgba(76, 153, 92, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(76, 153, 92, 0.15);
}
.diary-card-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s var(--ease);
}
.diary-card:hover .diary-card-actions {
  opacity: 1;
  transform: translateY(0);
}
.action-btn {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  transition: all 0.15s var(--ease);
}
.action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: #fff;
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(76, 153, 92, 0.2);
}
.action-btn.danger:hover { color: var(--danger); border-color: var(--danger); box-shadow: 0 2px 6px rgba(217, 104, 92, 0.2); }

/* 日记列表入场动画 */
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.diary-card {
  animation: cardSlideIn 0.4s var(--ease) backwards;
}
.diary-card:nth-child(1) { animation-delay: 0.02s; }
.diary-card:nth-child(2) { animation-delay: 0.04s; }
.diary-card:nth-child(3) { animation-delay: 0.06s; }
.diary-card:nth-child(4) { animation-delay: 0.08s; }
.diary-card:nth-child(5) { animation-delay: 0.10s; }
.diary-card:nth-child(n+6) { animation-delay: 0.12s; }
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--fg-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.empty-state-illustration {
  width: 180px;
  height: 180px;
  margin-bottom: 24px;
  position: relative;
  animation: floatY 4s ease-in-out infinite;
}
.empty-state-illustration svg { width: 100%; height: 100%; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.empty-state h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.empty-state p {
  font-size: 14px;
  max-width: 320px;
  line-height: 1.6;
}
.empty-state .btn { margin-top: 16px; }
.empty-state .empty-decoration {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--fg-tertiary);
  font-size: 12px;
  font-style: italic;
}
.empty-state .empty-decoration::before,
.empty-state .empty-decoration::after {
  content: '';
  width: 30px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 28px;
}
.page-btn {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-secondary);
  font-family: inherit;
  transition: all 0.15s var(--ease);
}
.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: #fff;
}
.page-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(76, 153, 92, 0.3);
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== 编辑器 ===== */
#view-editor { padding: 0; display: none; flex-direction: column; }
#view-editor.active { display: flex; }
.editor-header {
  display: flex;
  gap: 14px;
  padding: 22px 28px 18px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  position: relative;
}
.editor-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 5%;
  width: 90%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
}
.editor-meta { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.editor-title-input {
  border: none;
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-sans);
  color: var(--fg);
  background: transparent;
  padding: 4px 0;
  letter-spacing: -0.03em;
  width: 100%;
  transition: color 0.2s var(--ease);
}
.editor-title-input::placeholder { color: var(--fg-tertiary); }
.editor-title-input:focus { outline: none; color: var(--accent); }
.editor-options { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  width: 150px;
  color: var(--fg);
  transition: all 0.25s var(--ease);
}
.meta-input::placeholder { color: var(--fg-tertiary); }
.meta-input:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--border-strong);
}
.meta-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-light);
  width: 170px;
}

.editor-toolbar {
  display: flex;
  gap: 6px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 5;
}
.tool-group {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.025);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.tool-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
  transition: all 0.18s var(--ease);
  position: relative;
}
.tool-btn svg { transition: transform 0.2s var(--ease-spring); }
.tool-btn:hover {
  background: rgba(76, 153, 92, 0.1);
  color: var(--accent);
}
.tool-btn:hover svg { transform: scale(1.15); }
.tool-btn:active { transform: scale(0.92); }
.tool-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 6px rgba(76, 153, 92, 0.3);
}
.tool-btn-wide {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.tool-btn.upload-btn {
  background: linear-gradient(135deg, var(--accent), #3b8a48);
  color: white;
  font-weight: 600;
  font-size: 12.5px;
  padding: 0 14px;
  box-shadow: 0 2px 6px rgba(76, 153, 92, 0.25);
}
.tool-btn.upload-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), #356d40);
  color: white;
  box-shadow: 0 4px 12px rgba(76, 153, 92, 0.35);
  transform: translateY(-1px);
}
.tool-divider {
  width: 1px;
  height: 22px;
  background: linear-gradient(180deg, transparent, var(--border), transparent);
  margin: 0 2px;
  flex-shrink: 0;
}
.tool-spacer { flex: 1; }
.tool-mode-toggle {
  display: inline-flex;
  gap: 0;
  padding: 2px;
  background: rgba(0, 0, 0, 0.025);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.mode-btn {
  width: 30px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--ease);
}
.mode-btn:hover { color: var(--accent); }
.mode-btn.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.upload-btn { cursor: pointer; }

/* ===== 预览模式全屏方案：预览模式下隐藏顶栏三栏，只保留笔刷栏 ===== */
/* 预览模式全屏：编辑器激活（active + preview-fullscreen）时用 flex 覆盖默认的 block 显示 */
#view-editor.active.preview-fullscreen {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;  /* 覆盖 .content-view 的 padding，避免占用空间 */
}
/* 预览模式全屏：隐藏 editor-header/editor-toolbar，让 editor-body 占满整个内容区 */
#view-editor.active.preview-fullscreen .editor-header-wrapper,
#view-editor.active.preview-fullscreen .editor-toolbar-wrapper {
  display: none;
}
/* editor-body 在预览模式下占满整个 content 区 */
#view-editor.active.preview-fullscreen .editor-body {
  flex: 1;
  min-height: 0;
}

/* ===== 笔刷工具栏（GoodNotes 风格浮动可拖拽）===== */
.brush-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  flex-wrap: nowrap;
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s var(--ease), opacity 0.22s var(--ease);
  overflow: visible;
}
/* 折叠淡出状态（与 display:none 配合，实现淡入淡出动画）*/
.brush-toolbar.fading-out {
  opacity: 0;
  pointer-events: none;
}
.brush-toolbar:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}
/* 浮动状态（拖拽后）—— fixed 定位贴在视口，不随页面滚动 */
.brush-toolbar.floating {
  transform: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.brush-toolbar.dragging {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  transition: none;
  cursor: grabbing;
  z-index: 100;
}
/* 折叠状态（collapsed 类仅作标记位，实际隐藏由 fading-out + display:none 完成）*/

/* 拖拽手柄 */
.brush-drag-handle {
  width: 24px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin-right: 4px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.brush-drag-handle:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--fg-secondary);
}
.brush-drag-handle:active {
  cursor: grabbing;
  background: rgba(76, 153, 92, 0.12);
  color: var(--accent);
}

/* 工具栏内容容器 */
.brush-content {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

/* 折叠按钮 */
.brush-collapse-btn {
  flex-shrink: 0;
  margin-left: 2px;
}

/* 浮动折叠按钮（FAB）—— 预览模式下笔刷栏折叠后显示（可拖拽 + 位置持久化）*/
.brush-fab {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #3b8a48);
  color: white;
  border: none;
  cursor: grab;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(76, 153, 92, 0.35);
  z-index: 50;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
  opacity: 0;
  transform: scale(0.5);
  user-select: none;
  touch-action: none;
}
.brush-fab.visible {
  opacity: 1;
  transform: scale(1);
}
.brush-fab:hover:not(.dragging) {
  transform: scale(1.08) rotate(8deg);
  box-shadow: 0 6px 20px rgba(76, 153, 92, 0.45);
}
.brush-fab:active:not(.dragging) {
  transform: scale(0.96);
}
.brush-fab.dragging {
  cursor: grabbing;
  transition: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  z-index: 100;
}
/* 移动端调整 brush-fab 位置和尺寸 */
@media (max-width: 768px) {
  .brush-fab { width: 40px; height: 40px; top: 12px; left: 12px; }
  .sidebar-expand-btn { width: 40px; height: 40px; top: 12px; left: 12px; }
}
.brush-btn {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--fg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.18s var(--ease);
  position: relative;
}
.brush-btn:hover {
  background: rgba(76, 153, 92, 0.08);
  color: var(--accent);
  border-color: var(--border);
}
.brush-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(76, 153, 92, 0.3);
}
.brush-btn.brush-save-btn {
  width: auto;
  padding: 0 12px;
  background: linear-gradient(135deg, var(--accent), #3b8a48);
  color: white;
  font-weight: 600;
  gap: 5px;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(76, 153, 92, 0.25);
}
.brush-btn.brush-save-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), #356d40);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 153, 92, 0.35);
}
.brush-divider {
  width: 1px;
  height: 22px;
  background: linear-gradient(180deg, transparent, var(--border), transparent);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ===== 色盘取色器 ===== */
.brush-color-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.brush-color-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg-paper-solid, var(--bg-paper));
}
.brush-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  display: block;
}
.brush-color-palette {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px;
  background: var(--bg-elevated, #ffffff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  width: max-content;
}
.palette-swatch {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s var(--ease);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}
.palette-swatch:hover {
  transform: scale(1.18);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.palette-custom {
  width: 24px;
  height: 24px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  transition: all 0.15s var(--ease);
  position: relative;
  overflow: hidden;
}
.palette-custom:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.palette-custom input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

/* ===== 笔刷粗细滑块 ===== */
.brush-size-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 32px;
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.brush-size-input {
  width: 70px;
  height: 4px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.brush-size-value {
  font-size: 11px;
  color: var(--fg-secondary);
  font-weight: 600;
  min-width: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ===== 标注层（SVG 覆盖在预览内容上）===== */
.preview-content-wrapper {
  position: relative;
  width: 100%;
}
.annotation-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}
.annotation-layer.active {
  pointer-events: auto;
  cursor: crosshair;
}
.annotation-layer.eraser-mode {
  cursor: not-allowed;
}
.annotation-layer path,
.annotation-layer line,
.annotation-layer polyline {
  pointer-events: stroke;
}
.annotation-layer.eraser-mode path,
.annotation-layer.eraser-mode line,
.annotation-layer.eraser-mode polyline {
  cursor: pointer;
}

/* 标注模式下的视觉提示 */
.preview-pane.annotate-active .preview-content {
  user-select: none;
}
.preview-pane.annotate-active::after {
  content: '标注模式';
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  z-index: 5;
  pointer-events: none;
  letter-spacing: 0.04em;
}

.editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}
.editor-body.mode-edit { grid-template-columns: 1fr; }
.editor-body.mode-edit .preview-pane { display: none; }
.editor-body.mode-edit .editor-pane { border-right: none; }
.editor-body.mode-preview { grid-template-columns: 1fr; }
.editor-body.mode-preview .editor-pane { display: none; }
.editor-body.mode-preview .preview-pane { border-left: none; }
.editor-pane, .preview-pane {
  overflow-y: auto;
  padding: 28px 32px;
  position: relative;
}
.editor-pane {
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.5);
}
.editor-pane::before {
  content: '编辑';
  position: sticky;
  top: -28px;
  left: 0;
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px 0;
  z-index: 1;
}
.editor-textarea {
  width: 100%;
  height: 100%;
  min-height: 400px;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.75;
  background: transparent;
  color: var(--fg);
  letter-spacing: 0;
  tab-size: 2;
}
.editor-textarea::placeholder { color: var(--fg-tertiary); }
.preview-pane { background: rgba(255, 255, 255, 0.5); }
.preview-pane::before {
  content: '预览';
  position: sticky;
  top: -28px;
  left: 0;
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px 0;
  z-index: 1;
}
.preview-content {
  font-family: var(--font-sans);
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 40px;
  background: var(--bg-elevated, #ffffff);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
  color: var(--fg);
  line-height: 1.78;
  font-size: 15px;
  letter-spacing: 0.01em;
}
/* 预览模式（单列）下加大阅读宽度 */
.editor-body.mode-preview .preview-content {
  max-width: 820px;
  padding: 48px 56px;
  font-size: 16px;
}
/* split 模式下稍微紧凑 */
.editor-body.mode-split .preview-content {
  padding: 24px 28px;
  font-size: 14.5px;
}
/* 预览内容元素间距优化 */
.preview-content > *:first-child { margin-top: 0; }
.preview-content > *:last-child { margin-bottom: 0; }
.preview-content h1,
.preview-content h2,
.preview-content h3 {
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.preview-content h1 { font-size: 1.7em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.preview-content h2 { font-size: 1.4em; padding-bottom: 0.25em; border-bottom: 1px solid var(--border); }
.preview-content h3 { font-size: 1.2em; }
.preview-content p { margin: 0.9em 0; }
.preview-content ul,
.preview-content ol { margin: 0.9em 0; padding-left: 1.6em; }
.preview-content li { margin: 0.3em 0; }
.preview-content blockquote {
  margin: 1.2em 0;
  padding: 0.6em 1em;
  border-left: 3px solid var(--accent, #3b8a48);
  background: rgba(59, 138, 72, 0.06);
  border-radius: 0 6px 6px 0;
  color: var(--fg-muted);
}
.preview-content blockquote p { margin: 0.3em 0; }
.preview-content code {
  background: var(--bg-code, rgba(175,184,193,0.2));
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: var(--font-mono);
}
.preview-content pre {
  margin: 1.2em 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.preview-content table {
  margin: 1.2em 0;
  border-collapse: collapse;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}
.preview-content img { border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.preview-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 2em 0;
}
.preview-content a {
  color: var(--accent, #3b8a48);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.preview-content a:hover { border-bottom-color: currentColor; }

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  gap: 12px;
}
.editor-status {
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  gap: 14px;
  align-items: center;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-tertiary);
  margin-right: 4px;
  vertical-align: middle;
  transition: all 0.25s var(--ease);
}
.status-dot.saved { background: var(--success); box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.18); }
.status-dot.saving { background: var(--warning); box-shadow: 0 0 0 3px rgba(217, 154, 58, 0.18); animation: pulse 1s ease-in-out infinite; }
.status-dot.draft { background: var(--fg-tertiary); }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.editor-actions { display: flex; gap: 10px; align-items: center; }
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-secondary);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s var(--ease);
  -webkit-user-select: none;
  user-select: none;
}
.checkbox:hover { background: rgba(76, 153, 92, 0.08); color: var(--accent); }
.checkbox input { cursor: pointer; accent-color: var(--accent); }

/* ===== Markdown 渲染样式 ===== */
.markdown-body {
  color: var(--fg);
  line-height: 1.75;
  font-size: 15px;
  word-wrap: break-word;
  letter-spacing: -0.005em;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  margin: 24px 0 12px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.markdown-body h1 { font-size: 1.85em; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.markdown-body h2 { font-size: 1.5em; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1.05em; }
.markdown-body p { margin: 12px 0; }
.markdown-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(76, 153, 92, 0.3);
  transition: border-color 0.15s var(--ease);
}
.markdown-body a:hover { border-bottom-color: var(--accent); }
.markdown-body strong { font-weight: 700; color: var(--fg); }
.markdown-body em { font-style: italic; }
.markdown-body del { color: var(--fg-muted); }
.markdown-body ul, .markdown-body ol { margin: 12px 0; padding-left: 24px; }
.markdown-body li { margin: 4px 0; }
.markdown-body li input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}
.markdown-body blockquote {
  margin: 14px 0;
  padding: 10px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--fg-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(76, 153, 92, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #2e6b3a;
}
.markdown-body pre {
  background: linear-gradient(135deg, #1d1d1f 0%, #2a2a2d 100%);
  color: #f5f5f7;
  padding: 18px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.65;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
}
.markdown-body pre::before {
  content: '● ● ●';
  position: absolute;
  top: 8px;
  left: 14px;
  font-size: 8px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 4px;
  font-family: var(--font-mono);
}
.markdown-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
  display: block;
  margin-top: 16px;
}

/* KaTeX 公式样式 */
.markdown-body .katex {
  font-size: 1.05em;
}
.markdown-body .katex-display {
  margin: 1.2em 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
}
.markdown-body .katex-display > .katex {
  font-size: 1.15em;
}
/* 滚动条美化 */
.markdown-body .katex-display::-webkit-scrollbar {
  height: 6px;
}
.markdown-body .katex-display::-webkit-scrollbar-thumb {
  background: var(--border, #d0d7de);
  border-radius: 3px;
}
.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 10px 0;
  box-shadow: var(--shadow-md);
}
.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
  font-size: 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}
.markdown-body th {
  background: rgba(0, 0, 0, 0.03);
  font-weight: 600;
  color: var(--fg);
}
.markdown-body tr:nth-child(even) td { background: rgba(0, 0, 0, 0.015); }
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.diary-card-excerpt code { font-size: 12px; }

/* 站点公告 */
.site-notice {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(76, 153, 92, 0.08);
  border: 1px solid rgba(76, 153, 92, 0.2);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--accent-pressed);
  line-height: 1.5;
  text-align: center;
}

/* ===== 管理员面板 ===== */
.admin-section { animation: fadeUp 0.4s var(--ease); }
.admin-section .nav-item { position: relative; }
.admin-section .nav-item::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.admin-section .nav-item.active::after { opacity: 0.5; }

.admin-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-input {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  color: var(--fg);
  transition: all 0.25s var(--ease);
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.filter-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ===== 管理概览 - 精致卡片设计 ===== */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.admin-stat {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.admin-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--stat-color, var(--accent)), transparent);
  opacity: 0.8;
}
.admin-stat::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, var(--stat-glow, rgba(76, 153, 92, 0.12)), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.admin-stat:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--stat-color, var(--accent));
}
.admin-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--stat-icon-bg, var(--accent-light));
  color: var(--stat-color, var(--accent));
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.admin-stat-body { flex: 1; min-width: 0; position: relative; z-index: 1; }
.admin-stat-label {
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.admin-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-feature-settings: "tnum";
}
.admin-stat-sub {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 6px;
  line-height: 1.5;
}
.admin-stat-sub strong { color: var(--stat-color, var(--accent)); font-weight: 600; }

/* 不同统计卡片的配色 */
.admin-stat.stat-users {
  --stat-color: #4c995c;
  --stat-glow: rgba(76, 153, 92, 0.15);
  --stat-icon-bg: rgba(76, 153, 92, 0.14);
}
.admin-stat.stat-diaries {
  --stat-color: #5b8def;
  --stat-glow: rgba(91, 141, 239, 0.15);
  --stat-icon-bg: rgba(91, 141, 239, 0.14);
}
.admin-stat.stat-images {
  --stat-color: #d99a3a;
  --stat-glow: rgba(217, 154, 58, 0.15);
  --stat-icon-bg: rgba(217, 154, 58, 0.14);
}
.admin-stat.stat-storage {
  --stat-color: #a855f7;
  --stat-glow: rgba(168, 85, 247, 0.15);
  --stat-icon-bg: rgba(168, 85, 247, 0.14);
}

/* 存储进度条 */
.admin-stat-progress {
  margin-top: 10px;
  height: 5px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.admin-stat-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--stat-color, var(--accent)), var(--accent-bright, var(--accent)));
  border-radius: var(--radius-pill);
  transition: width 0.6s var(--ease);
}

/* 双列趋势图行 */
.admin-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

/* 趋势图卡片 */
.admin-chart-card {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.admin-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.admin-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-chart-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}
.admin-chart-sub strong {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.admin-chart-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding-top: 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.trend-chart::before {
  content: '';
  position: absolute;
  top: 12px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  opacity: 0.5;
}
.trend-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  border-radius: 6px 6px 2px 2px;
  min-height: 3px;
  position: relative;
  transition: all 0.25s var(--ease);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.trend-bar:hover {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent-pressed));
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(76, 153, 92, 0.25);
}
.trend-bar-tip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(29, 29, 31, 0.95);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.trend-bar-tip strong { color: var(--accent-bright); font-size: 13px; }
.trend-bar:hover .trend-bar-tip { opacity: 1; }

/* 趋势图 X 轴 */
.trend-axis {
  display: flex;
  gap: 6px;
  padding-top: 8px;
}
.trend-axis-label {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  letter-spacing: 0;
}

/* Top 用户列表 */
.top-users-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.top-user-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.2s var(--ease);
}
.top-user-item:hover {
  background: var(--bg-hover);
}
.top-user-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  background: var(--accent-light);
  color: var(--accent);
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.top-user-rank.rank-gold {
  background: linear-gradient(135deg, #ffd700, #ffa500);
  color: #5a3700;
  box-shadow: 0 2px 8px rgba(255, 165, 0, 0.3);
}
.top-user-rank.rank-silver {
  background: linear-gradient(135deg, #e8e8ed, #b0b0b8);
  color: #3a3a42;
  box-shadow: 0 2px 8px rgba(176, 176, 184, 0.3);
}
.top-user-rank.rank-bronze {
  background: linear-gradient(135deg, #d99a3a, #b06b1f);
  color: white;
  box-shadow: 0 2px 8px rgba(176, 107, 31, 0.3);
}
.top-user-avatar {
  width: 36px;
  height: 36px;
  font-size: 14px;
  flex-shrink: 0;
}
.top-user-info {
  flex: 1;
  min-width: 0;
}
.top-user-name {
  font-weight: 600;
  color: var(--fg);
  font-size: 14px;
}
.top-user-username {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 2px;
}
.top-user-stat {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-shrink: 0;
}
.top-user-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
}
.top-user-unit {
  font-size: 11px;
  color: var(--fg-muted);
}

/* 用户表格 */
.admin-table-wrap {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table thead {
  background: rgba(76, 153, 92, 0.06);
}
.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--fg-secondary);
  font-size: 12px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr {
  transition: background 0.15s var(--ease);
}
.admin-table tbody tr:hover { background: rgba(76, 153, 92, 0.04); }
.admin-table .user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-table .user-cell .avatar {
  width: 32px;
  height: 32px;
  font-size: 13px;
}
.admin-table .user-cell .avatar::after { display: none; }
.admin-table .user-cell-info { display: flex; flex-direction: column; gap: 2px; }
.admin-table .user-cell-name { font-weight: 600; color: var(--fg); }
.admin-table .user-cell-username { font-size: 11px; color: var(--fg-muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge-active { background: rgba(52, 199, 89, 0.15); color: #2a9d3a; }
.badge-active::before { background: #34c759; }
.badge-disabled { background: rgba(255, 59, 48, 0.12); color: #c8362a; }
.badge-disabled::before { background: #ff3b30; }
.badge-admin { background: rgba(76, 153, 92, 0.15); color: var(--accent); }
.badge-admin::before { background: var(--accent); }

.admin-row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.action-icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--fg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--ease);
}
.action-icon-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(76, 153, 92, 0.3);
  transform: translateY(-1px);
}
.action-icon-btn.danger:hover {
  background: rgba(255, 59, 48, 0.1);
  color: var(--danger);
  border-color: rgba(255, 59, 48, 0.3);
}
.action-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-bright), var(--accent));
  border-radius: 3px;
  transition: width 0.4s var(--ease);
  position: relative;
}
.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.progress-bar-fill.warn { background: linear-gradient(90deg, #ffb340, #ff9500); }
.progress-bar-fill.danger { background: linear-gradient(90deg, #ff6b6b, #ff3b30); }

.storage-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.storage-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.storage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-bright), var(--accent));
  border-radius: 4px;
  transition: width 0.4s var(--ease);
}
.storage-bar-text {
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  justify-content: space-between;
}

/* 设置表单 */
.admin-settings-card {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  max-width: 640px;
}
.admin-settings-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--fg);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.setting-row:last-of-type { border-bottom: none; }
.setting-row-label { flex: 1; }
.setting-row-title { font-size: 14px; font-weight: 500; color: var(--fg); margin-bottom: 3px; }
.setting-row-desc { font-size: 12px; color: var(--fg-muted); line-height: 1.5; }
.setting-row-control { flex-shrink: 0; }

/* 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(120, 120, 128, 0.32);
  border-radius: 13px;
  transition: all 0.3s var(--ease);
}
.switch-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s var(--ease-spring);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.switch input:checked + .switch-slider {
  background: var(--accent);
}
.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

/* 系统信息 */
.sys-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.sys-info-card {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}
.sys-info-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-secondary);
  margin-bottom: 14px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}
.sys-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.sys-info-row:last-child { border-bottom: none; }
.sys-info-row .label { color: var(--fg-muted); }
.sys-info-row .value { color: var(--fg); font-weight: 600; font-family: var(--font-mono); font-size: 12.5px; }

/* 日志列表 */
.log-item {
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  transition: all 0.2s var(--ease);
}
.log-item:hover { background: rgba(255, 255, 255, 0.95); border-color: rgba(76, 153, 92, 0.2); }
.log-action-tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
  white-space: nowrap;
}
.log-action-tag.danger { background: rgba(255, 59, 48, 0.1); color: var(--danger); }
.log-action-tag.warn { background: rgba(255, 149, 0, 0.1); color: #c77a00; }
.log-time { color: var(--fg-muted); font-size: 11px; margin-left: auto; white-space: nowrap; }
.log-detail { color: var(--fg-secondary); font-family: var(--font-mono); font-size: 12px; }

/* 分页 */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 18px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--fg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  transition: all 0.18s var(--ease);
  font-family: inherit;
}
.page-btn:hover:not(:disabled) {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(76, 153, 92, 0.3);
}
.page-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== 日历视图 ===== */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  min-width: 100px;
  text-align: center;
  letter-spacing: -0.01em;
}
.calendar-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
.calendar-main {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.calendar-grid { display: flex; flex-direction: column; gap: 0; }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.cal-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  padding: 6px 0;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-day {
  min-height: 88px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-day.empty { cursor: default; }
.cal-day:not(.empty):hover {
  background: var(--accent-soft);
  border-color: rgba(76, 153, 92, 0.15);
}
.cal-day.today {
  background: var(--accent-light);
  border-color: var(--accent);
}
.cal-day.today .cal-day-num {
  color: var(--accent);
  font-weight: 700;
}
.cal-day.selected {
  background: var(--accent);
  border-color: var(--accent-pressed);
}
.cal-day.selected .cal-day-num { color: white; }
.cal-day.selected .cal-event {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}
.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  text-align: center;
  line-height: 1.3;
}
.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  position: absolute;
  top: 8px;
  right: 6px;
}
.cal-dot-diary { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.cal-day.today .cal-dot-diary { background: var(--accent-pressed); box-shadow: 0 0 0 2px rgba(255,255,255,0.5); }
.cal-day.selected .cal-dot-diary { background: white; box-shadow: none; }
.cal-event {
  font-size: 10px;
  padding: 2px 4px 2px 6px;
  background: rgba(76, 153, 92, 0.08);
  border-left: 2px solid var(--accent);
  border-radius: 3px;
  color: var(--fg-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  transition: all 0.15s var(--ease);
}
.cal-event:hover { background: rgba(76, 153, 92, 0.15); }
/* 日历中日记标题事件 */
.cal-event-diary {
  background: rgba(76, 153, 92, 0.10);
  border-left: 2px solid var(--accent);
  color: var(--fg);
  font-weight: 500;
  cursor: pointer;
}
.cal-event-diary:hover { background: rgba(76, 153, 92, 0.22); color: var(--accent-pressed); }
.cal-more {
  font-size: 10px;
  color: var(--fg-muted);
  text-align: center;
  padding: 1px 0;
  font-weight: 500;
}

/* 日历详情面板 - 日记标题列表 */
.day-diary-list { display: flex; flex-direction: column; gap: 4px; }
.day-diary-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.day-diary-item:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateX(2px);
}
.day-diary-item .pin-icon { font-size: 11px; }
.day-diary-title {
  font-size: 13px;
  color: var(--fg);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* 日历侧栏 */
.calendar-side {
  position: sticky;
  top: 16px;
}
.day-detail {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}
.day-detail-header { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.day-detail-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.day-detail-content { display: flex; flex-direction: column; gap: 14px; }
.day-detail-empty {
  color: var(--fg-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}
.day-section { display: flex; flex-direction: column; gap: 8px; }
.day-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.day-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s var(--ease);
}
.day-link:hover { opacity: 0.7; }

/* 日程项 */
.schedule-list { display: flex; flex-direction: column; gap: 6px; }
.schedule-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 10px 10px 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
  position: relative;
}
.schedule-item:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(76, 153, 92, 0.25);
  transform: translateX(2px);
}
.schedule-item.done { opacity: 0.6; }
.schedule-item.done .schedule-title { text-decoration: line-through; }
.schedule-color {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
  min-height: 32px;
}
.schedule-info { flex: 1; min-width: 0; }
.schedule-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
  word-break: break-word;
}
.schedule-time {
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}
.schedule-desc {
  font-size: 12px;
  color: var(--fg-secondary);
  margin-top: 4px;
  line-height: 1.4;
}
.schedule-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.schedule-actions .action-icon-btn {
  width: 24px;
  height: 24px;
}

/* 颜色选择器 */
.color-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.color-option {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.color-option input { position: absolute; opacity: 0; pointer-events: none; }
.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all 0.2s var(--ease);
  display: inline-block;
}
.color-option:hover .color-dot { transform: scale(1.15); }
.color-option input:checked + .color-dot {
  border-color: var(--fg);
  box-shadow: 0 0 0 2px white, 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: scale(1.1);
}

/* ===== 主题设置 ===== */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.theme-card {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s var(--ease);
  cursor: default;
}
.theme-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(76, 153, 92, 0.15);
}
.theme-preview {
  height: 120px;
  position: relative;
  overflow: hidden;
}
.theme-preview-bar {
  height: 24px;
  width: 100%;
}
.theme-preview-body {
  height: calc(100% - 24px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-preview-bg {
  position: absolute;
  inset: 0;
  opacity: 0.5;
}
.theme-preview-card {
  position: relative;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid;
  border-radius: 8px;
  padding: 10px 14px;
  width: 70%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.theme-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.theme-preview-line {
  height: 4px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  width: 100%;
}
.theme-preview-line.short { width: 60%; }
.theme-info {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.theme-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.theme-desc {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.4;
  margin-bottom: 4px;
}

/* ===== 主题设置 V2 ===== */
.theme-settings-v2 {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.theme-section { display: flex; flex-direction: column; gap: 10px; }
.theme-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.theme-auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--fg-muted);
  cursor: pointer;
  user-select: none;
}
.theme-auto-toggle input { margin: 0; accent-color: var(--accent); }
.theme-auto-label { color: var(--fg-muted); }

/* 明暗模式选择 */
.theme-mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.theme-mode-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-paper);
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s var(--ease);
}
.theme-mode-card:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}
.theme-mode-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* 调色板选择 */
.theme-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.theme-palette-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-paper);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s var(--ease);
}
.theme-palette-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.theme-palette-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.palette-preview {
  height: 80px;
  position: relative;
  overflow: hidden;
  padding: 8px;
}
.palette-accent-bar {
  height: 6px;
  width: 100%;
  border-radius: 3px;
  margin-bottom: 8px;
}
.palette-mini-card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
[data-mode="dark"] .palette-mini-card { background: rgba(40, 40, 42, 0.9); }
.palette-mini-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.palette-mini-line {
  height: 3px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  width: 100%;
}
[data-mode="dark"] .palette-mini-line { background: rgba(255, 255, 255, 0.2); }
.palette-mini-line.short { width: 60%; }
.palette-info {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.palette-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}
.palette-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* 实时预览 */
.theme-live-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow);
}
.tlp-topbar {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
}
.tlp-logo {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--accent);
}
.tlp-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}
.tlp-actions { margin-left: auto; display: flex; gap: 6px; }
.tlp-btn {
  width: 32px;
  height: 14px;
  border-radius: 4px;
  background: var(--bg-hover);
}
.tlp-btn.primary { background: var(--accent); width: 40px; }
.tlp-body { display: flex; height: 120px; }
.tlp-sidebar {
  width: 56px;
  padding: 8px 6px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tlp-nav-item {
  height: 8px;
  border-radius: 3px;
  background: var(--bg-hover);
}
.tlp-nav-item.active { background: var(--accent); }
.tlp-content {
  flex: 1;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg);
}
.tlp-card {
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tlp-card-header {
  height: 6px;
  width: 60%;
  background: var(--fg-secondary);
  border-radius: 2px;
  opacity: 0.7;
}
.tlp-card-line {
  height: 3px;
  background: var(--fg-muted);
  opacity: 0.4;
  border-radius: 2px;
}
.tlp-card-line.short { width: 50%; }
.tlp-card-tag {
  width: 28px;
  height: 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  margin-top: 2px;
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  align-self: flex-start;
}

/* ===== 多主题支持（双属性方案：data-palette + data-mode）=====
   data-palette: green/blue/purple/orange/pink/rose/teal/indigo（控制强调色）
   data-mode: light/dark（控制明暗模式）
   旧 data-theme="green/blue/.../dark" 仍兼容（applyTheme 内部会同步双属性）
*/

/* --- 调色板（accent 色板，明暗共用基础色相）--- */
/* 浅色模式：每个色板定义独立的背景渐变与色相氛围，换色 = 换整套视觉氛围 */
:root,
[data-palette="green"] {
  --accent: #4c995c;
  --accent-hover: #3e7f4c;
  --accent-pressed: #356d40;
  --accent-light: rgba(76, 153, 92, 0.12);
  --accent-soft: rgba(76, 153, 92, 0.06);
  --accent-bright: #6dbb7d;
  --bg: #f4f8f4;
  --bg-gradient: radial-gradient(circle at 0% 0%, #e6f0e8 0%, #f4f8f4 40%, #fafdfa 100%);
  --bg-sidebar: rgba(244, 248, 244, 0.7);
  --bg-paper: rgba(255, 255, 255, 0.72);
  --bg-elevated: #ffffff;
  --bg-active: rgba(76, 153, 92, 0.1);
  --heat-0: #ebf2eb;
  --heat-1: #c5dec8;
  --heat-2: #8ec496;
  --heat-3: #5da967;
  --heat-4: #3b8a48;
}

[data-palette="blue"] {
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-pressed: #1d4ed8;
  --accent-light: rgba(59, 130, 246, 0.12);
  --accent-soft: rgba(59, 130, 246, 0.06);
  --accent-bright: #60a5fa;
  --bg: #f0f5fb;
  --bg-gradient: radial-gradient(circle at 0% 0%, #dbeafe 0%, #f0f5fb 40%, #f8fbfe 100%);
  --bg-sidebar: rgba(240, 245, 251, 0.7);
  --bg-paper: rgba(255, 255, 255, 0.72);
  --bg-elevated: #ffffff;
  --bg-active: rgba(59, 130, 246, 0.1);
  --heat-0: #e0e7ff;
  --heat-1: #c7d2fe;
  --heat-2: #93c5fd;
  --heat-3: #60a5fa;
  --heat-4: #2563eb;
}

[data-palette="purple"] {
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-pressed: #6d28d9;
  --accent-light: rgba(139, 92, 246, 0.12);
  --accent-soft: rgba(139, 92, 246, 0.06);
  --accent-bright: #a78bfa;
  --bg: #f6f3fc;
  --bg-gradient: radial-gradient(circle at 0% 0%, #ede9fe 0%, #f6f3fc 40%, #fcfaff 100%);
  --bg-sidebar: rgba(246, 243, 252, 0.7);
  --bg-paper: rgba(255, 255, 255, 0.72);
  --bg-elevated: #ffffff;
  --bg-active: rgba(139, 92, 246, 0.1);
  --heat-0: #ede9fe;
  --heat-1: #ddd6fe;
  --heat-2: #c4b5fd;
  --heat-3: #a78bfa;
  --heat-4: #7c3aed;
}

[data-palette="orange"] {
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-pressed: #b45309;
  --accent-light: rgba(245, 158, 11, 0.12);
  --accent-soft: rgba(245, 158, 11, 0.06);
  --accent-bright: #fbbf24;
  --bg: #fdf8f0;
  --bg-gradient: radial-gradient(circle at 0% 0%, #fef3c7 0%, #fdf8f0 40%, #fffdf8 100%);
  --bg-sidebar: rgba(253, 248, 240, 0.7);
  --bg-paper: rgba(255, 255, 255, 0.72);
  --bg-elevated: #ffffff;
  --bg-active: rgba(245, 158, 11, 0.1);
  --heat-0: #fef3c7;
  --heat-1: #fde68a;
  --heat-2: #fcd34d;
  --heat-3: #fbbf24;
  --heat-4: #d97706;
}

[data-palette="pink"] {
  --accent: #ec4899;
  --accent-hover: #db2777;
  --accent-pressed: #be185d;
  --accent-light: rgba(236, 72, 153, 0.12);
  --accent-soft: rgba(236, 72, 153, 0.06);
  --accent-bright: #f472b6;
  --bg: #fcf4f8;
  --bg-gradient: radial-gradient(circle at 0% 0%, #fce7f3 0%, #fcf4f8 40%, #fefafc 100%);
  --bg-sidebar: rgba(252, 244, 248, 0.7);
  --bg-paper: rgba(255, 255, 255, 0.72);
  --bg-elevated: #ffffff;
  --bg-active: rgba(236, 72, 153, 0.1);
  --heat-0: #fce7f3;
  --heat-1: #fbcfe8;
  --heat-2: #f9a8d4;
  --heat-3: #f472b6;
  --heat-4: #db2777;
}

[data-palette="rose"] {
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --accent-pressed: #be123c;
  --accent-light: rgba(244, 63, 94, 0.12);
  --accent-soft: rgba(244, 63, 94, 0.06);
  --accent-bright: #fb7185;
  --bg: #fcf3f4;
  --bg-gradient: radial-gradient(circle at 0% 0%, #ffe4e6 0%, #fcf3f4 40%, #fef9fa 100%);
  --bg-sidebar: rgba(252, 243, 244, 0.7);
  --bg-paper: rgba(255, 255, 255, 0.72);
  --bg-elevated: #ffffff;
  --bg-active: rgba(244, 63, 94, 0.1);
  --heat-0: #ffe4e6;
  --heat-1: #fecdd3;
  --heat-2: #fda4af;
  --heat-3: #fb7185;
  --heat-4: #e11d48;
}

[data-palette="teal"] {
  --accent: #14b8a6;
  --accent-hover: #0d9488;
  --accent-pressed: #0f766e;
  --accent-light: rgba(20, 184, 166, 0.12);
  --accent-soft: rgba(20, 184, 166, 0.06);
  --accent-bright: #2dd4bf;
  --bg: #f0faf8;
  --bg-gradient: radial-gradient(circle at 0% 0%, #ccfbf1 0%, #f0faf8 40%, #f8fdfc 100%);
  --bg-sidebar: rgba(240, 250, 248, 0.7);
  --bg-paper: rgba(255, 255, 255, 0.72);
  --bg-elevated: #ffffff;
  --bg-active: rgba(20, 184, 166, 0.1);
  --heat-0: #ccfbf1;
  --heat-1: #99f6e4;
  --heat-2: #5eead4;
  --heat-3: #2dd4bf;
  --heat-4: #0d9488;
}

[data-palette="indigo"] {
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-pressed: #4338ca;
  --accent-light: rgba(99, 102, 241, 0.12);
  --accent-soft: rgba(99, 102, 241, 0.06);
  --accent-bright: #818cf8;
  --bg: #f3f4fc;
  --bg-gradient: radial-gradient(circle at 0% 0%, #e0e7ff 0%, #f3f4fc 40%, #fafbff 100%);
  --bg-sidebar: rgba(243, 244, 252, 0.7);
  --bg-paper: rgba(255, 255, 255, 0.72);
  --bg-elevated: #ffffff;
  --bg-active: rgba(99, 102, 241, 0.1);
  --heat-0: #e0e7ff;
  --heat-1: #c7d2fe;
  --heat-2: #a5b4fc;
  --heat-3: #818cf8;
  --heat-4: #4f46e5;
}

/* --- 明暗模式：light 默认（:root 已定义），dark 覆盖 --- */
[data-mode="dark"] {
  color-scheme: dark;
  --bg: #0f0f11;
  --bg-gradient: radial-gradient(circle at 0% 0%, #1a1f1c 0%, #0f0f11 40%, #0a0a0c 100%);
  --bg-sidebar: rgba(18, 18, 20, 0.85);
  --bg-paper: rgba(28, 28, 30, 0.72);
  --bg-paper-solid: #1c1c1e;
  --bg-elevated: #2c2c2e;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.08);
  --fg: #f5f5f7;
  --fg-secondary: #d1d1d6;
  --fg-tertiary: #aeaeb2;
  --fg-muted: #86868b;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-focus: rgba(255, 255, 255, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* 暗色模式下各调色板的微调（提高对比度 + 带色相的背景渐变）*/
[data-mode="dark"][data-palette="green"] {
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-pressed: #059669;
  --accent-light: rgba(16, 185, 129, 0.18);
  --accent-soft: rgba(16, 185, 129, 0.08);
  --accent-bright: #6ee7b7;
  --bg: #0d1410;
  --bg-gradient: radial-gradient(circle at 0% 0%, #163a26 0%, #0d1410 40%, #080b09 100%);
  --bg-sidebar: rgba(15, 22, 18, 0.85);
}
[data-mode="dark"][data-palette="blue"] {
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-pressed: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.2);
  --accent-soft: rgba(59, 130, 246, 0.1);
  --accent-bright: #93c5fd;
  --bg: #0c1018;
  --bg-gradient: radial-gradient(circle at 0% 0%, #1a2848 0%, #0c1018 40%, #080a10 100%);
  --bg-sidebar: rgba(13, 17, 26, 0.85);
}
[data-mode="dark"][data-palette="purple"] {
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-pressed: #8b5cf6;
  --accent-light: rgba(167, 139, 250, 0.2);
  --accent-soft: rgba(167, 139, 250, 0.1);
  --accent-bright: #ddd6fe;
  --bg: #110d19;
  --bg-gradient: radial-gradient(circle at 0% 0%, #2a1a4a 0%, #110d19 40%, #0a080f 100%);
  --bg-sidebar: rgba(18, 14, 26, 0.85);
}
[data-mode="dark"][data-palette="orange"] {
  --accent: #fbbf24;
  --accent-hover: #fcd34d;
  --accent-pressed: #f59e0b;
  --accent-light: rgba(251, 191, 36, 0.2);
  --accent-soft: rgba(251, 191, 36, 0.1);
  --accent-bright: #fde68a;
  --bg: #15110a;
  --bg-gradient: radial-gradient(circle at 0% 0%, #3a2a10 0%, #15110a 40%, #0b0906 100%);
  --bg-sidebar: rgba(22, 18, 11, 0.85);
}
[data-mode="dark"][data-palette="pink"] {
  --accent: #f472b6;
  --accent-hover: #f9a8d4;
  --accent-pressed: #ec4899;
  --accent-light: rgba(244, 114, 182, 0.2);
  --accent-soft: rgba(244, 114, 182, 0.1);
  --accent-bright: #fbcfe8;
  --bg: #170f12;
  --bg-gradient: radial-gradient(circle at 0% 0%, #3d1a2a 0%, #170f12 40%, #0c0809 100%);
  --bg-sidebar: rgba(24, 16, 19, 0.85);
}
[data-mode="dark"][data-palette="rose"] {
  --accent: #fb7185;
  --accent-hover: #fda4af;
  --accent-pressed: #f43f5e;
  --accent-light: rgba(251, 113, 133, 0.2);
  --accent-soft: rgba(251, 113, 133, 0.1);
  --accent-bright: #fecdd3;
  --bg: #170e10;
  --bg-gradient: radial-gradient(circle at 0% 0%, #3d161c 0%, #170e10 40%, #0c0708 100%);
  --bg-sidebar: rgba(24, 15, 17, 0.85);
}
[data-mode="dark"][data-palette="teal"] {
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-pressed: #14b8a6;
  --accent-light: rgba(45, 212, 191, 0.2);
  --accent-soft: rgba(45, 212, 191, 0.1);
  --accent-bright: #99f6e4;
  --bg: #0a1413;
  --bg-gradient: radial-gradient(circle at 0% 0%, #103a36 0%, #0a1413 40%, #060a09 100%);
  --bg-sidebar: rgba(11, 20, 19, 0.85);
}
[data-mode="dark"][data-palette="indigo"] {
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-pressed: #6366f1;
  --accent-light: rgba(129, 140, 248, 0.2);
  --accent-soft: rgba(129, 140, 248, 0.1);
  --accent-bright: #c7d2fe;
  --bg: #0d0e1a;
  --bg-gradient: radial-gradient(circle at 0% 0%, #1f2148 0%, #0d0e1a 40%, #08080f 100%);
  --bg-sidebar: rgba(14, 15, 27, 0.85);
}

/* --- 兼容旧 data-theme 属性（applyTheme 会同时设置 data-palette + data-mode）--- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f11;
  --bg-gradient: radial-gradient(circle at 0% 0%, #1a1f1c 0%, #0f0f11 40%, #0a0a0c 100%);
  --bg-sidebar: rgba(18, 18, 20, 0.85);
  --bg-paper: rgba(28, 28, 30, 0.72);
  --bg-paper-solid: #1c1c1e;
  --bg-elevated: #2c2c2e;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(16, 185, 129, 0.14);
  --fg: #f5f5f7;
  --fg-secondary: #d1d1d6;
  --fg-tertiary: #aeaeb2;
  --fg-muted: #86868b;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-focus: rgba(16, 185, 129, 0.5);
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-pressed: #059669;
  --accent-light: rgba(16, 185, 129, 0.18);
  --accent-soft: rgba(16, 185, 129, 0.1);
  --accent-bright: #34d399;
  --heat-0: #1c1c1e;
  --heat-1: #0a3d2c;
  --heat-2: #0f5d42;
  --heat-3: #15805c;
  --heat-4: #1aa371;
  --heat-empty: #161618;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.7);
}

/* 卡片类容器：使用更不透明的深色背景 */
[data-theme="dark"] .diary-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .admin-stat,
[data-theme="dark"] .admin-table-wrap,
[data-theme="dark"] .calendar-main,
[data-theme="dark"] .day-detail,
[data-theme="dark"] .theme-card,
[data-theme="dark"] .sys-info-card,
[data-theme="dark"] .admin-chart-card,
[data-theme="dark"] .admin-settings-card,
[data-theme="dark"] .image-card,
[data-theme="dark"] .schedule-item,
[data-theme="dark"] .export-format-card,
[data-theme="dark"] .export-template-card {
  background: rgba(28, 28, 30, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .diary-card:hover,
[data-theme="dark"] .stat-card:hover,
[data-theme="dark"] .admin-stat:hover,
[data-theme="dark"] .theme-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(32, 32, 36, 0.95);
}
[data-theme="dark"] .preview-content {
  background: #1c1c1e;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
}
[data-theme="dark"] .preview-content blockquote {
  background: rgba(59, 138, 72, 0.12);
  border-left-color: var(--accent, #4ade80);
}

/* 编辑器相关 */
[data-theme="dark"] .editor-toolbar,
[data-theme="dark"] .editor-header,
[data-theme="dark"] .editor-footer,
[data-theme="dark"] .brush-toolbar,
[data-theme="dark"] .topbar-expand-btn {
  background: rgba(22, 22, 24, 0.85);
}
[data-theme="dark"] .editor-body { background: var(--bg); }
[data-theme="dark"] .editor-pane,
[data-theme="dark"] .preview-pane {
  background: rgba(20, 20, 22, 0.6);
}
[data-theme="dark"] .editor-pane::before,
[data-theme="dark"] .preview-pane::before {
  background: rgba(22, 22, 24, 0.85);
}
[data-theme="dark"] .editor-textarea { color: var(--fg); }
[data-theme="dark"] .tool-group,
[data-theme="dark"] .tool-mode-toggle {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .brush-btn,
[data-theme="dark"] .brush-size-wrap,
[data-theme="dark"] .brush-color-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .brush-color-btn { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .brush-color-palette {
  background: var(--bg-elevated, #1f1f23);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .tool-btn {
  color: var(--fg-secondary);
}
[data-theme="dark"] .tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-bright);
}
[data-theme="dark"] .mode-btn.active {
  background: var(--accent);
  color: white;
}

/* 输入元素 */
[data-theme="dark"] #search-input,
[data-theme="dark"] .filter-input,
[data-theme="dark"] .meta-input,
[data-theme="dark"] .filter-select,
[data-theme="dark"] .filter-date,
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .editor-title-input {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] #search-input::placeholder,
[data-theme="dark"] .filter-input::placeholder,
[data-theme="dark"] .meta-input::placeholder,
[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
  color: var(--fg-muted);
}
[data-theme="dark"] #search-input:focus,
[data-theme="dark"] .filter-input:focus,
[data-theme="dark"] .meta-input:focus,
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .editor-title-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

/* 按钮 */
[data-theme="dark"] .btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg-secondary);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.2);
}

/* 表格 */
[data-theme="dark"] .admin-table thead { background: rgba(16, 185, 129, 0.1); }
[data-theme="dark"] .admin-table th { color: var(--fg-secondary); border-color: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .admin-table td { border-color: rgba(255, 255, 255, 0.06); color: var(--fg); }
[data-theme="dark"] .admin-table tbody tr:hover { background: rgba(16, 185, 129, 0.06); }

/* 徽章 */
[data-theme="dark"] .badge-active { background: rgba(52, 199, 89, 0.2); color: #34c759; }
[data-theme="dark"] .badge-disabled { background: rgba(255, 99, 71, 0.18); color: #ff8a80; }
[data-theme="dark"] .badge-admin { background: rgba(16, 185, 129, 0.2); color: var(--accent-bright); }

/* 头像 */
[data-theme="dark"] .avatar {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: #0f0f11;
}

/* 浮起元素：模态框、Toast、下拉 */
[data-theme="dark"] .toast { background: rgba(28, 28, 30, 0.95); color: var(--fg); border: 1px solid rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .modal-content { background: rgba(28, 28, 30, 0.98); border: 1px solid rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .logo-icon { box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3); }

/* 侧边栏与导航 */
[data-theme="dark"] .sidebar { background: var(--bg-sidebar); border-right-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .user-card { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .nav-item { color: var(--fg-secondary); }
[data-theme="dark"] .nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--fg); }
[data-theme="dark"] .nav-item.active { background: var(--bg-active); color: var(--accent-bright); }

/* 内容区域 */
[data-theme="dark"] .content-header h2 { color: var(--fg); }
[data-theme="dark"] .topbar { background: rgba(22, 22, 24, 0.6); border-bottom-color: rgba(255, 255, 255, 0.06); }

/* 日历 */
[data-theme="dark"] .cal-day { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .cal-day.empty { background: transparent; }
[data-theme="dark"] .cal-day:not(.empty):hover { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .cal-day.today { background: rgba(16, 185, 129, 0.15); }
[data-theme="dark"] .cal-day.selected { background: var(--accent); }
[data-theme="dark"] .cal-day-num { color: var(--fg); }
[data-theme="dark"] .cal-event { background: rgba(16, 185, 129, 0.2); color: var(--accent-bright); }

/* 热力图 */
[data-theme="dark"] .heat-cell { background: var(--heat-empty); border-color: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .heat-cell.level-1 { background: var(--heat-1); }
[data-theme="dark"] .heat-cell.level-2 { background: var(--heat-2); }
[data-theme="dark"] .heat-cell.level-3 { background: var(--heat-3); }
[data-theme="dark"] .heat-cell.level-4 { background: var(--heat-4); }

/* 空状态与上传 */
[data-theme="dark"] .empty-state h3 { color: var(--fg); }
[data-theme="dark"] .empty-state p { color: var(--fg-muted); }
[data-theme="dark"] .upload-area {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .upload-area:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--accent);
}

/* 进度条 */
[data-theme="dark"] .progress-bar { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .admin-stat-progress { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .trend-chart { border-bottom-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .trend-chart::before { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent); }
[data-theme="dark"] .admin-chart-badge { background: rgba(16, 185, 129, 0.18); color: var(--accent-bright); }
[data-theme="dark"] .top-user-item:hover { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .trend-bar-tip { background: rgba(245, 245, 247, 0.95); color: #1c1c1e; }
[data-theme="dark"] .trend-bar-tip strong { color: var(--accent); }

/* 数据管理卡片 */
[data-theme="dark"] .data-mgmt-card { background: rgba(28, 28, 30, 0.85); }
[data-theme="dark"] .data-stat-pill,
[data-theme="dark"] .result-stat {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .data-import-result.loading { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .result-errors pre { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .data-spinner { border-color: rgba(255, 255, 255, 0.2); border-top-color: var(--accent); }

/* Markdown 预览 - 暗色友好的代码块 */
[data-theme="dark"] .preview-pane pre,
[data-theme="dark"] .markdown-body pre {
  background: #1a1a1c !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .preview-pane code,
[data-theme="dark"] .markdown-body code {
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .preview-pane pre code,
[data-theme="dark"] .markdown-body pre code {
  background: transparent;
}
[data-theme="dark"] .preview-pane blockquote,
[data-theme="dark"] .markdown-body blockquote {
  background: rgba(255, 255, 255, 0.04);
  border-left-color: var(--accent);
  color: var(--fg-secondary);
}
[data-theme="dark"] .preview-pane table th,
[data-theme="dark"] .markdown-body table th {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .preview-pane table td,
[data-theme="dark"] .markdown-body table td {
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .preview-pane a,
[data-theme="dark"] .markdown-body a {
  color: var(--accent-bright);
}

/* 主题设置卡片预览 */
[data-theme="dark"] .theme-card .theme-preview {
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* 趋势图工具提示 */
[data-theme="dark"] .trend-bar-tip {
  background: rgba(255, 255, 255, 0.95);
  color: #1c1c1e;
}

/* 导出模态框 */
[data-theme="dark"] .export-format-card,
[data-theme="dark"] .export-template-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .export-format-option input:checked + .export-format-card,
[data-theme="dark"] .export-template-option input:checked + .export-template-card {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* 批量选择栏 */
[data-theme="dark"] .batch-select-bar {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
}

/* 滚动条 */
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

/* 选中文本 */
[data-theme="dark"] ::selection { background: rgba(16, 185, 129, 0.35); color: white; }

/* 装饰叶子在暗色下更亮 */
[data-theme="dark"] .deco-leaf { opacity: 0.5; }

/* 登录卡片 */
[data-theme="dark"] .auth-card {
  background: rgba(28, 28, 30, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .auth-view {
  background:
    radial-gradient(circle at 15% 20%, rgba(16, 185, 129, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(52, 211, 153, 0.15) 0%, transparent 45%),
    linear-gradient(135deg, #0a0a0c 0%, #16161a 100%);
}
[data-theme="dark"] .auth-tabs { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .auth-tab.active { background: rgba(28, 28, 30, 0.95); color: var(--fg); }

/* 日历响应式 */
@media (max-width: 900px) {
  .calendar-layout { grid-template-columns: 1fr; }
  .calendar-side { position: static; }
  .day-detail { max-height: none; }
}
@media (max-width: 600px) {
  .cal-day { min-height: 60px; }
  .cal-event { display: none; }
  .cal-day-num { font-size: 11px; }
}

/* ===== 统计视图 ===== */
.stats-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right, rgba(76, 153, 92, 0.06), transparent 70%);
  border-radius: 0 var(--radius-lg) 0 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.stat-card:hover::after { opacity: 1; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card h3 {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 10px;
  font-weight: 500;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s var(--ease);
}
.stat-row:hover { background: rgba(76, 153, 92, 0.05); }
.stat-row > span:first-child { color: var(--fg-secondary); font-weight: 500; }
.stat-row > span:last-child { color: var(--fg); font-weight: 600; display: inline-flex; align-items: center; }
.stat-bar {
  display: inline-block;
  height: 6px;
  background: linear-gradient(90deg, #8fc391, #4c995c);
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 8px;
  box-shadow: 0 0 0 1px rgba(76, 153, 92, 0.15);
}

/* ===== 图片视图 ===== */
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.image-item:hover {
  box-shadow: var(--shadow-md);
  transform: scale(1.02);
}
.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease);
}
.image-item:hover img { transform: scale(1.08); }
.image-item-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.image-item:hover .image-item-actions { opacity: 1; }
.image-action {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  color: var(--fg);
  transition: all 0.15s var(--ease);
}
.image-action:hover { background: #fff; transform: scale(1.05); }
.image-action.danger { color: var(--danger); }

/* ===== 个人设置 ===== */
.profile-card {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 720px;
}
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}
.profile-section { margin-top: 4px; }
.profile-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
.profile-card form { display: flex; flex-direction: column; gap: 14px; }

/* ===== Toast - Apple Style ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(29, 29, 31, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: white;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0;
  transition: all 0.3s var(--ease-spring);
  pointer-events: none;
  z-index: 1000;
  max-width: 80%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.toast::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error { background: rgba(217, 104, 92, 0.95); }
.toast.error::before { background: rgba(255, 255, 255, 0.8); }
.toast.success { background: rgba(76, 153, 92, 0.95); }
.toast.success::before { background: rgba(255, 255, 255, 0.8); }

/* ===== 模态框 - Apple Style ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-content {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 420px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  animation: scaleIn 0.3s var(--ease-spring);
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 12px;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.modal-close {
  background: rgba(0, 0, 0, 0.06);
  border: none;
  font-size: 13px;
  cursor: pointer;
  color: var(--fg-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
}
.modal-close:hover { background: rgba(0, 0, 0, 0.12); color: var(--fg); }
.modal-body {
  padding: 4px 24px 20px;
  font-size: 14px;
  color: var(--fg-secondary);
  line-height: 1.5;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--border);
}

/* 宽模态 - 用于导出对话框 */
.modal-content-wide {
  max-width: 640px;
}

/* ===== 导出对话框样式 ===== */
.export-section {
  margin-bottom: 20px;
}
.export-section:last-child { margin-bottom: 0; }
.export-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.export-section-title::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
}
.export-format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.export-format-option {
  cursor: pointer;
  position: relative;
}
.export-format-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.export-format-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  transition: all 0.2s var(--ease);
  background: rgba(255, 255, 255, 0.6);
}
.export-format-option:hover .export-format-card {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}
.export-format-option input:checked + .export-format-card {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.export-format-icon {
  color: var(--accent);
  margin-bottom: 6px;
  display: flex;
  justify-content: center;
}
.export-format-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}
.export-format-desc {
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.4;
}
.export-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.export-template-option {
  cursor: pointer;
  position: relative;
}
.export-template-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.export-template-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: all 0.2s var(--ease);
  background: rgba(255, 255, 255, 0.6);
}
.export-template-option:hover .export-template-card {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.95);
}
.export-template-option input:checked + .export-template-card {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.export-template-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}
.export-template-desc {
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.4;
}
.export-summary {
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--fg-secondary);
  font-weight: 500;
}
.export-progress {
  margin-top: 14px;
}
.export-progress-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 6px;
}
.export-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: var(--radius-pill);
  transition: width 0.3s var(--ease);
  width: 0%;
}
.export-progress-text {
  font-size: 12px;
  color: var(--fg-muted);
  text-align: center;
}

/* ===== 列表头部操作按钮 ===== */
.content-header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ===== 批量选择栏 ===== */
.batch-select-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius);
  margin-bottom: 12px;
  animation: slideDown 0.25s var(--ease);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.select-all-label {
  font-size: 13px;
  color: var(--fg-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.batch-count {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}
.batch-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ===== 日记卡片选择模式 ===== */
.diary-card-select {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}
.diary-card-select input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}
.diary-card {
  position: relative;
}
.diary-card.selectable {
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.diary-card.selectable:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(76, 153, 92, 0.12);
}
.diary-card.selectable .diary-card-actions {
  opacity: 0.3;
  pointer-events: none;
}

/* ===== 数据管理（导出/导入） ===== */
.data-mgmt-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.data-mgmt-card {
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease);
}
.data-mgmt-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--card-color, var(--accent)), transparent);
}
.data-mgmt-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.data-export-card { --card-color: #4c995c; }
.data-import-card { --card-color: #5b8def; }
.data-note-card { --card-color: #d99a3a; }

.data-mgmt-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-light);
  color: var(--card-color, var(--accent));
}
.data-export-card .data-mgmt-icon {
  background: rgba(76, 153, 92, 0.14);
  color: #4c995c;
}
.data-import-card .data-mgmt-icon {
  background: rgba(91, 141, 239, 0.14);
  color: #5b8def;
}
.data-note-card .data-mgmt-icon {
  background: rgba(217, 154, 58, 0.14);
  color: #d99a3a;
}
.data-mgmt-body { flex: 1; min-width: 0; }
.data-mgmt-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.data-mgmt-desc {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}
.data-mgmt-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.data-stat-pill {
  font-size: 12px;
  color: var(--fg-secondary);
  background: var(--bg-hover);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  border: 1px solid var(--border);
}
.data-mgmt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.data-mgmt-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.data-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-secondary);
  cursor: pointer;
}
.data-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.data-note-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: var(--fg-secondary);
  line-height: 1.7;
}
.data-note-list li {
  padding-left: 16px;
  position: relative;
}
.data-note-list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--card-color, var(--accent));
  opacity: 0.6;
}

/* 导入结果 */
.data-import-result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
  animation: fadeUp 0.3s var(--ease);
}
.data-import-result.loading {
  background: var(--bg-hover);
  color: var(--fg-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.data-import-result.success {
  background: rgba(52, 199, 89, 0.08);
  border-color: rgba(52, 199, 89, 0.3);
}
.data-import-result.error {
  background: rgba(217, 104, 92, 0.08);
  border-color: rgba(217, 104, 92, 0.3);
}
.result-title {
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
  font-size: 14px;
}
.data-import-result.success .result-title { color: var(--success); }
.data-import-result.error .result-title { color: var(--danger); }
.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.result-stat {
  font-size: 12px;
  color: var(--fg-secondary);
  background: var(--bg-paper-solid);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}
.result-msg {
  color: var(--danger);
  font-size: 13px;
}
.result-errors {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-muted);
}
.result-errors summary {
  cursor: pointer;
  color: var(--warning);
  padding: 4px 0;
}
.result-errors pre {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--bg-hover);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 160px;
  overflow-y: auto;
}

/* 加载旋转动画 */
.data-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 存储位置管理 ===== */
.data-storage-card { --card-color: #9b6dd7; }
.data-storage-card .data-mgmt-icon {
  background: rgba(155, 109, 215, 0.14);
  color: #9b6dd7;
}
.data-mgmt-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.data-mgmt-title-row .data-mgmt-title { margin-bottom: 0; }
.storage-mode-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.storage-mode-badge.default {
  background: rgba(91, 141, 239, 0.12);
  color: #5b8def;
  border-color: rgba(91, 141, 239, 0.25);
}
.storage-mode-badge.custom {
  background: rgba(155, 109, 215, 0.14);
  color: #9b6dd7;
  border-color: rgba(155, 109, 215, 0.3);
}
.storage-restart-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 10px 14px;
  background: rgba(217, 154, 58, 0.1);
  border: 1px solid rgba(217, 154, 58, 0.3);
  border-radius: var(--radius-sm);
  color: var(--warning);
  font-size: 13px;
  font-weight: 500;
}
.storage-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.storage-info-item {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.storage-info-item.storage-info-total {
  background: rgba(155, 109, 215, 0.08);
  border-color: rgba(155, 109, 215, 0.25);
}
.storage-info-label {
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.storage-info-value {
  font-size: 13px;
  color: var(--fg);
  font-weight: 500;
  word-break: break-all;
  font-family: var(--font-mono, 'SF Mono', Consolas, monospace);
}
.storage-info-sub {
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 400;
}
.storage-default-hint {
  font-size: 11px;
  color: var(--fg-muted);
  margin: 6px 0 12px;
  word-break: break-all;
  line-height: 1.5;
}
.storage-drives-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 14px;
  flex-wrap: wrap;
}
.storage-drives-label {
  font-size: 12px;
  color: var(--fg-muted);
  padding-top: 6px;
  flex-shrink: 0;
}
.storage-drives-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.storage-drive-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-paper-solid, var(--bg-paper));
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-family: inherit;
}
.storage-drive-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.storage-drive-sys {
  font-size: 10px;
  padding: 1px 5px;
  background: rgba(217, 104, 92, 0.15);
  color: var(--danger);
  border-radius: var(--radius-xs);
  font-weight: 600;
}
.storage-switch-form {
  margin-top: 8px;
}
.storage-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.storage-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--bg-paper-solid, var(--bg-paper));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--fg);
  font-family: var(--font-mono, 'SF Mono', Consolas, monospace);
  transition: border-color 0.2s var(--ease);
}
.storage-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.storage-input::placeholder {
  color: var(--fg-muted);
  font-family: var(--font-body, inherit);
}
.storage-validate-result {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  word-break: break-all;
}
.storage-validate-result.loading {
  background: var(--bg-hover);
  color: var(--fg-secondary);
}
.storage-validate-result.success {
  background: rgba(52, 199, 89, 0.08);
  border-color: rgba(52, 199, 89, 0.3);
  color: var(--success);
}
.storage-validate-result.error {
  background: rgba(217, 104, 92, 0.08);
  border-color: rgba(217, 104, 92, 0.3);
  color: var(--danger);
}

/* ===== 系统清理 ===== */
.sys-cleanup-section {
  margin-top: 20px;
  background: var(--bg-paper);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}
.sys-cleanup-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, #d9685c, #d99a3a, transparent);
}
.sys-cleanup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.sys-cleanup-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--danger);
}
.sys-cleanup-title svg { flex-shrink: 0; }
.cleanup-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.cleanup-subtitle {
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-top: 2px;
}
.sys-cleanup-summary {
  display: flex;
  gap: 14px;
}
.cleanup-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 6px 14px;
  background: var(--bg-hover);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.cleanup-stat.highlight {
  background: rgba(217, 104, 92, 0.08);
  border-color: rgba(217, 104, 92, 0.2);
}
.cleanup-stat .stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}
.cleanup-stat.highlight .stat-num { color: var(--danger); }
.cleanup-stat .stat-label {
  font-size: 10.5px;
  color: var(--fg-muted);
  margin-top: 1px;
}

.cleanup-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cleanup-group-card {
  background: var(--bg-paper-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: all 0.2s var(--ease);
}
.cleanup-group-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.cleanup-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cleanup-checkbox-wrap {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
}
.cleanup-checkbox-wrap input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.cleanup-checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-paper-solid);
  transition: all 0.2s var(--ease);
  position: relative;
}
.cleanup-checkbox-wrap input:checked ~ .cleanup-checkbox-custom {
  background: var(--danger);
  border-color: var(--danger);
}
.cleanup-checkbox-wrap input:checked ~ .cleanup-checkbox-custom::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.cleanup-checkbox-wrap input:disabled ~ .cleanup-checkbox-custom {
  opacity: 0.3;
  cursor: not-allowed;
}
.cleanup-group-info {
  flex: 1;
  min-width: 0;
}
.cleanup-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.cleanup-group-desc {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.cleanup-group-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.cleanup-count {
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.cleanup-size {
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  font-family: var(--font-mono);
}
.cleanup-items-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.cleanup-items-details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  padding: 4px 0;
  user-select: none;
}
.cleanup-items-details summary:hover { color: var(--accent-hover); }
.cleanup-items-list {
  list-style: none;
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}
.cleanup-items-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  font-size: 11.5px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.cleanup-items-list li:last-child { border-bottom: none; }
.cleanup-items-list .item-path {
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  word-break: break-all;
  flex: 1;
}
.cleanup-items-list .item-size {
  color: var(--fg-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.cleanup-items-list .more-items {
  color: var(--fg-muted);
  font-style: italic;
  justify-content: center;
}
.cleanup-empty {
  font-size: 12px;
  color: var(--fg-tertiary);
  padding: 8px 0 0;
  font-style: italic;
}

.cleanup-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.cleanup-result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
  animation: fadeUp 0.3s var(--ease);
}
.cleanup-result.loading {
  background: var(--bg-hover);
  color: var(--fg-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cleanup-result.success {
  background: rgba(52, 199, 89, 0.08);
  border-color: rgba(52, 199, 89, 0.3);
}
.cleanup-result.error {
  background: rgba(217, 104, 92, 0.08);
  border-color: rgba(217, 104, 92, 0.3);
}
.cleanup-result.success .result-title { color: var(--success); }
.cleanup-result.error .result-title { color: var(--danger); }

.cleanup-safety-note {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(76, 153, 92, 0.06);
  border: 1px solid rgba(76, 153, 92, 0.15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-secondary);
  line-height: 1.5;
}
.cleanup-safety-note svg {
  color: var(--accent);
  flex-shrink: 0;
}

/* 暗色主题适配 */
[data-theme="dark"] .sys-cleanup-section { background: rgba(28, 28, 30, 0.85); }
[data-theme="dark"] .cleanup-group-card { background: rgba(44, 44, 46, 0.65); }
[data-theme="dark"] .cleanup-checkbox-custom { background: rgba(44, 44, 46, 0.8); }
[data-theme="dark"] .cleanup-stat { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .cleanup-count { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .cleanup-safety-note {
  background: rgba(76, 153, 92, 0.1);
  border-color: rgba(76, 153, 92, 0.2);
}

/* ===== 移动端顶部栏（默认隐藏，<768px 显示） ===== */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}
.mobile-brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), #3b8a48);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mobile-menu-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--fg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.mobile-menu-btn:hover, .mobile-menu-btn:active {
  background: var(--bg-hover);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 60;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* ===== 响应式 ===== */
/* 平板：<= 900px - 侧边栏收窄为图标 */
@media (max-width: 900px) {
  .main-view { grid-template-columns: 64px 1fr; }
  .sidebar { padding: 12px 8px; }
  .sidebar-header .brand, .user-info, .nav-item span:not(.nav-icon), .nav-new span:not(:first-child) { display: none; }
  .nav-item { justify-content: center; padding: 12px 8px; }
  .nav-new { padding: 12px; }
  .user-card { justify-content: center; padding: 8px; }
  /* 小屏幕下分屏模式退化为编辑模式 */
  .editor-body.mode-split, .editor-body:not(.mode-edit):not(.mode-preview) { grid-template-columns: 1fr; }
  .editor-body.mode-split .preview-pane, .editor-body:not(.mode-edit):not(.mode-preview) .preview-pane { display: none; }
  .editor-body.mode-split .editor-pane, .editor-body:not(.mode-edit):not(.mode-preview) .editor-pane { border-right: none; }
  .content-header h2 { font-size: 24px; }
}

/* 手机：<= 768px - 侧边栏改为抽屉式 */
@media (max-width: 768px) {
  .main-view {
    grid-template-columns: 1fr;
    padding-top: 52px;
  }
  /* 移动端不使用桌面收起逻辑 */
  .main-view.sidebar-collapsed { grid-template-columns: 1fr; }
  .main-view.sidebar-collapsed .sidebar { transform: none; pointer-events: auto; }
  .sidebar-collapse-btn,
  .sidebar-expand-btn { display: none !important; }
  .mobile-topbar { display: flex; }

  /* 侧边栏抽屉 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    z-index: 70;
    padding: 18px 14px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  /* 抽屉模式下恢复完整显示 */
  .sidebar-header .brand,
  .user-info,
  .nav-item span:not(.nav-icon),
  .nav-new span:not(:first-child) {
    display: block;
  }
  .nav-item {
    justify-content: flex-start;
    padding: 10px 12px;
  }
  .nav-new { padding: 12px 14px; }
  .user-card { justify-content: flex-start; padding: 10px; }

  /* topbar */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    gap: 10px;
    position: sticky;
    top: 52px;
  }
  .search-box { max-width: none; }
  .topbar-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
  .topbar-actions .filter-select,
  .topbar-actions .filter-date {
    flex: 1;
    min-width: 120px;
  }

  /* 内容视图 */
  .content-view { padding: 16px 14px; }
  .content-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .content-header h2 { font-size: 22px; }
  .content-header-actions { width: 100%; }

  /* 编辑器头部 */
  .editor-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 14px;
  }
  .editor-meta { width: 100%; }
  .editor-title-input {
    font-size: 20px !important;
    width: 100%;
  }
  .editor-options {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }
  .meta-input { width: 100%; }

  /* 编辑器工具栏：横向滚动 */
  .editor-toolbar {
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .editor-toolbar::-webkit-scrollbar { display: none; }
  .tool-group { flex-shrink: 0; }
  .tool-divider { flex-shrink: 0; }
  .tool-spacer { display: none; }
  .tool-mode-toggle { flex-shrink: 0; }
  .tool-btn { min-width: 36px; height: 36px; }

  /* 编辑器底部 */
  .editor-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 14px;
  }
  .editor-status {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
  }
  .editor-actions {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }
  .editor-actions .filter-select {
    flex: 1;
    min-width: 120px;
  }

  /* 日记卡片 */
  .diary-card { padding: 14px; }
  .diary-card-title { font-size: 15px; }
  .diary-card-meta { flex-wrap: wrap; gap: 6px; font-size: 11px; }
  .diary-card-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* 模态弹窗 */
  .modal { align-items: flex-end; }
  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: slideUp 0.3s var(--ease);
  }
  .modal-content-wide { max-width: 100%; }
  @keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .modal-header { padding: 16px 18px 10px; }
  .modal-header h3 { font-size: 16px; }
  .modal-body { padding: 4px 18px 16px; font-size: 13px; }
  .modal-footer {
    padding: 10px 18px 16px;
    flex-direction: column-reverse;
    gap: 6px;
  }
  .modal-footer .btn { width: 100%; }

  /* 统计卡片 */
  .stats-content {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .stat-card { padding: 16px; }
  .admin-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .admin-stat { padding: 14px; }

  /* 日历 */
  .cal-day { min-height: 48px; padding: 2px; }
  .cal-event { display: none; }
  .cal-day-num { font-size: 11px; }

  /* 主题网格 */
  .theme-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* 图片网格 */
  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }

  /* 朋友/信件网格已通过 600px 媒体查询处理 */
  /* 但确保 768px 下也合理 */
  .friends-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* 协作者管理弹窗：横向布局优化 */
  .collab-add-section {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .collab-add-section .filter-select { width: 100%; }

  /* 信件详情 */
  .letter-detail-content { padding: 10px; font-size: 13px; }

  /* 编辑器正文 */
  .editor-textarea {
    font-size: 15px;
    line-height: 1.7;
    padding: 14px;
  }
  .preview-content {
    font-size: 15px;
    padding: 14px;
  }

  /* 登录注册页 */
  .auth-card {
    padding: 22px 18px;
    margin: 16px;
    max-width: 100%;
  }
  .auth-view { padding: 60px 12px 20px; }
  .auth-logo h1 { font-size: 26px; }
  .auth-subtitle { font-size: 13px; }

  /* 热力图 - 横向滚动 */
  .heatmap-scroll { padding-bottom: 8px; }

  /* 模式切换按钮组在小屏更紧凑 */
  .tool-mode-toggle .mode-btn {
    min-width: 36px;
    height: 32px;
  }

  /* 协同在线显示 */
  .collab-presence {
    margin-left: auto;
    margin-right: 0;
  }

  /* 用户卡片 */
  .user-card { padding: 8px; }
  .user-name { font-size: 14px; }
  .user-handle { font-size: 11px; }
}

/* 超小屏幕：<= 414px - 进一步紧凑 */
@media (max-width: 414px) {
  .content-view { padding: 12px 10px; }
  .topbar { padding: 10px; }
  .editor-header, .editor-toolbar, .editor-footer { padding-left: 10px; padding-right: 10px; }
  .diary-card { padding: 12px; }
  .diary-card-title { font-size: 14px; }
  .friend-card { padding: 12px; gap: 10px; }
  .friend-actions .btn-sm { padding: 4px 10px; font-size: 12px; }
  .letter-card { padding: 12px; }
  .modal-body { padding: 4px 14px 14px; }
  .modal-header { padding: 14px 14px 8px; }
  .modal-footer { padding: 8px 14px 12px; }
  .auth-card { padding: 18px 14px; margin: 8px; }
  .auth-logo h1 { font-size: 22px; }
  .theme-grid { grid-template-columns: 1fr; }
  .image-grid { grid-template-columns: 1fr 1fr; }
  .editor-textarea { font-size: 14px; padding: 12px; }
  .nav-badge { min-width: 16px; height: 16px; font-size: 10px; }
  .content-header h2 { font-size: 20px; }
}

/* 移动端触摸优化 */
@media (hover: none) and (pointer: coarse) {
  /* 触摸设备禁用 hover 效果（避免粘性 hover） */
  .diary-card:hover,
  .friend-card:hover,
  .letter-card:hover,
  .shared-diary-card:hover,
  .stat-card:hover {
    transform: none;
    box-shadow: var(--shadow);
  }
  .btn:hover { transform: none; }
  .tool-btn:hover { background: transparent; color: var(--fg-secondary); }
  .tool-btn:active { background: var(--accent-soft); color: var(--accent); }

  /* 增大触摸目标 */
  .nav-item { min-height: 44px; }
  .btn-sm { min-height: 32px; }
  .tool-btn { min-width: 36px; height: 36px; }
  .modal-close { width: 32px; height: 32px; }
  .mobile-menu-btn { width: 42px; height: 42px; }

  /* 触摸点击反馈 */
  .diary-card:active,
  .friend-card:active,
  .letter-card:active {
    transform: scale(0.98);
    transition: transform 0.1s;
  }
}

/* 横屏模式优化 */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .mobile-topbar { height: 44px; }
  .main-view { padding-top: 44px; }
  .topbar { top: 44px; padding: 8px 12px; }
  .topbar { flex-direction: row; flex-wrap: wrap; }
  .content-view { padding: 12px; }
  .modal { align-items: center; }
  .modal-content {
    max-height: 95vh;
    border-radius: var(--radius-lg);
    animation: scaleIn 0.3s var(--ease-spring);
  }
}

/* 暗色主题：移动端顶栏适配 */
[data-theme="dark"] .mobile-topbar {
  background: rgba(28, 28, 30, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .mobile-menu-btn { color: var(--fg); }
[data-theme="dark"] .mobile-menu-btn:hover,
[data-theme="dark"] .mobile-menu-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

/* 选中文本颜色 */
::selection {
  background: rgba(76, 153, 92, 0.22);
  color: var(--fg);
}

/* ===== 统计卡片细节 ===== */
.stat-suffix {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-left: 4px;
}
.stat-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}
.stat-empty {
  color: var(--fg-muted);
  font-size: 13px;
  padding: 8px 0;
}

/* ===== GitHub 风格热力图 ===== */
.heatmap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.heatmap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.heatmap-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin: 0;
}
.heatmap-summary {
  font-size: 14px;
  color: var(--fg-muted);
}
.heatmap-summary strong { color: var(--accent); font-weight: 600; }

.heatmap-scroll {
  overflow-x: auto;
  padding: 8px 0 4px;
  margin: 0 -4px;
}
.heatmap-grid {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px;
  min-width: 100%;
}
.heatmap-months {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 28px;
}
.heatmap-corner { height: 0; }
.heatmap-month-labels {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  gap: 3px;
  font-size: 11px;
  color: var(--fg-muted);
  position: relative;
  height: 16px;
}
.heatmap-month-label {
  text-align: left;
  white-space: nowrap;
  grid-column: span 1;
}

.heatmap-body {
  display: flex;
  gap: 6px;
}
.heatmap-weekdays {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  gap: 3px;
  font-size: 11px;
  color: var(--fg-muted);
  width: 22px;
  flex-shrink: 0;
}
.heatmap-weekdays span {
  height: 14px;
  line-height: 14px;
  text-align: right;
  padding-right: 2px;
}
.heatmap-weeks {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  gap: 3px;
}
.heatmap-week {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  gap: 3px;
}
.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--heat-0);
  transition: all 0.15s var(--ease);
  cursor: default;
}
.heatmap-cell.out-year {
  background: transparent;
  pointer-events: none;
}
.heatmap-cell:not(.out-year) {
  cursor: pointer;
}
.heatmap-cell:not(.out-year):hover {
  transform: scale(1.4);
  box-shadow: 0 2px 6px rgba(60, 90, 70, 0.25);
  z-index: 1;
  position: relative;
}
.heatmap-cell.level-0 { background: var(--heat-0); }
.heatmap-cell.level-1 { background: var(--heat-1); }
.heatmap-cell.level-2 { background: var(--heat-2); }
.heatmap-cell.level-3 { background: var(--heat-3); }
.heatmap-cell.level-4 { background: var(--heat-4); box-shadow: 0 0 0 1px rgba(76, 153, 92, 0.3); }

.heatmap-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  font-size: 12px;
  color: var(--fg-muted);
  flex-wrap: wrap;
  gap: 8px;
}
.heatmap-link {
  color: var(--fg-muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--fg-tertiary);
  transition: color 0.15s var(--ease);
}
.heatmap-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
}
.heatmap-legend .heatmap-cell {
  width: 12px;
  height: 12px;
  cursor: default;
}
.heatmap-legend .heatmap-cell:hover { transform: none; box-shadow: none; }
.heatmap-legend span { font-size: 11px; padding: 0 2px; }

.heatmap-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(29, 42, 32, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  white-space: nowrap;
}
.heatmap-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== 好友 / 信件 / 共享 / 协同 新增样式 ===== */

/* 侧边栏徽标（好友请求 / 未读信件） */
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(217, 104, 92, 0.4);
  animation: badgePop 0.3s var(--ease-spring);
}
@keyframes badgePop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== 好友页面 ===== */
.friends-section { margin-bottom: 28px; }
.friends-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-secondary);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.friends-section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}
.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.friend-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-paper);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
  position: relative;
  overflow: hidden;
}
.friend-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}
.friend-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.friend-card:hover::before { opacity: 1; }
.friend-request-card {
  background: linear-gradient(135deg, rgba(76, 153, 92, 0.08), var(--bg-paper));
  border-color: var(--border-focus);
}
.friend-info { flex: 1; min-width: 0; }
.friend-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend-handle {
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.friend-bio, .friend-msg {
  font-size: 13px;
  color: var(--fg-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend-msg { font-style: italic; color: var(--accent); }
.friend-status {
  font-size: 12px;
  color: var(--warning);
  display: flex;
  align-items: center;
  gap: 4px;
}
.friend-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 1.4s ease-in-out infinite;
}
.friend-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* 添加好友弹窗 - 搜索 */
.friend-search-box { margin-bottom: 14px; }
.friend-search-results {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.search-hint {
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
  padding: 24px 8px;
}
.search-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
  border: 1px solid var(--border);
  transition: all 0.15s var(--ease);
}
.search-user-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.search-user-info { flex: 1; min-width: 0; }
.search-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.search-user-handle {
  font-size: 12px;
  color: var(--fg-muted);
}
.badge-friend {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(52, 199, 89, 0.15);
  color: #2a9d3a;
  font-weight: 500;
}
.badge-pending {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(217, 154, 58, 0.15);
  color: #b97a26;
  font-weight: 500;
}

/* ===== 信件页面 ===== */
.letters-tabs, .shared-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
  width: fit-content;
}
.letter-tab {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.letter-tab:hover { color: var(--fg); background: var(--bg-hover); }
.letter-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(76, 153, 92, 0.3);
}
.letters-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.letter-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--bg-paper);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
}
.letter-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}
.letter-unread {
  background: linear-gradient(135deg, rgba(76, 153, 92, 0.06), var(--bg-paper));
  border-color: var(--border-focus);
}
.letter-unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.letter-body { flex: 1; min-width: 0; }
.letter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}
.letter-from {
  font-size: 13px;
  color: var(--fg-secondary);
}
.letter-from strong { color: var(--fg); font-weight: 600; }
.letter-date {
  font-size: 12px;
  color: var(--fg-muted);
  flex-shrink: 0;
}
.letter-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 153, 92, 0.18);
  animation: pulse 1.6s ease-in-out infinite;
}
.letter-preview {
  font-size: 13px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.letter-attached {
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--accent-soft);
  border-radius: var(--radius-xs);
  width: fit-content;
}

/* 信件详情弹窗 */
.letter-detail { padding: 4px 0; }
.letter-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.letter-detail-from {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}
.letter-detail-date {
  font-size: 12px;
  color: var(--fg-muted);
}
.letter-detail-subject {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.letter-detail-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg-secondary);
  padding: 14px;
  background: var(--bg-paper);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  white-space: pre-wrap;
}
.letter-detail-diary {
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-paper));
  border: 1px solid var(--border-focus);
  border-radius: var(--radius);
}
.attached-diary-label {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 600;
}
.letter-detail-diary h4 {
  font-size: 15px;
  color: var(--fg);
  margin-bottom: 8px;
}

/* 写信表单 */
.compose-form { display: flex; flex-direction: column; gap: 14px; }
.compose-textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-paper);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: all 0.2s var(--ease);
}
.compose-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--bg-elevated);
}
.compose-attached-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent);
}

/* ===== 共享日记页面 ===== */
.shared-diary-card {
  padding: 16px;
  background: var(--bg-paper);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  overflow: hidden;
}
.shared-diary-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-soft), transparent 50%);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}
.shared-diary-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.shared-diary-card:hover::before { opacity: 1; }
.shared-diary-card .diary-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.diary-author {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-secondary);
}
.diary-date {
  font-size: 12px;
  color: var(--fg-muted);
  margin-left: auto;
}
.diary-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.diary-preview {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.diary-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.diary-tags .tag {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-weight: 500;
}
.vis-badge, .role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.vis-public { background: rgba(52, 199, 89, 0.15); color: #2a9d3a; }
.vis-friends { background: rgba(59, 125, 216, 0.15); color: #2c6cb8; }
.vis-specific { background: rgba(217, 154, 58, 0.15); color: #b97a26; }
.role-badge.role-editor { background: rgba(76, 153, 92, 0.15); color: var(--accent); }
.role-badge.role-viewer { background: rgba(120, 120, 120, 0.15); color: var(--fg-muted); }

/* ===== 协同编辑：在线协作者显示 ===== */
.collab-presence {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 4px;
  background: var(--accent-soft);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-pill);
  margin-right: 4px;
}
.collab-presence::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34c759;
  margin-left: 4px;
  box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.25);
  animation: pulse 1.6s ease-in-out infinite;
}
.collab-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-elevated);
  margin-left: -6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.collab-avatar:first-of-type { margin-left: 0; }
.collab-more {
  background: var(--fg-tertiary);
  font-size: 10px;
  width: 22px;
}

/* ===== 协作者管理弹窗 ===== */
.collab-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  max-height: 320px;
  overflow-y: auto;
}
.collab-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.15s var(--ease);
}
.collab-item:hover { background: var(--bg-hover); }
.collab-info { flex: 1; min-width: 0; }
.collab-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.collab-role {
  font-size: 12px;
  color: var(--fg-muted);
}
.collab-add-section {
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.collab-add-section h4 {
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-secondary);
  margin-bottom: 4px;
}
.collab-add-section .filter-select { flex: 1; min-width: 140px; }

/* ===== 选择用户弹窗（指定可见） ===== */
.pick-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}
.pick-user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  font-size: 14px;
  color: var(--fg);
}
.pick-user-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.pick-user-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.pick-user-item span small {
  color: var(--fg-muted);
  font-size: 12px;
}

/* ===== 指定可见用户徽标 ===== */
.visible-to-badge {
  margin-top: 8px;
  width: 100%;
}
.visible-to-users {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-hover, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border);
  border-radius: 8px;
}
.visible-to-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 4px;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.visible-to-name {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.visible-to-more {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  color: var(--fg-muted);
}
.visible-to-edit {
  margin-left: auto;
  border: none;
  background: var(--accent, #3b8a48);
  color: #fff;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: filter 0.15s;
}
.visible-to-edit:hover { filter: brightness(1.08); }
[data-theme="dark"] .visible-to-chip,
[data-theme="dark"] .visible-to-more {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

/* 头像圆形 / 图片 - 通用 */
.avatar-circle, .avatar-img {
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===== 暗色主题覆盖 ===== */
[data-theme="dark"] .friend-card,
[data-theme="dark"] .letter-card,
[data-theme="dark"] .shared-diary-card,
[data-theme="dark"] .search-user-card,
[data-theme="dark"] .collab-item,
[data-theme="dark"] .pick-user-item,
[data-theme="dark"] .letter-detail-content {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .friend-card:hover,
[data-theme="dark"] .letter-card:hover,
[data-theme="dark"] .shared-diary-card:hover {
  border-color: rgba(76, 153, 92, 0.4);
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .friend-request-card,
[data-theme="dark"] .letter-unread {
  background: linear-gradient(135deg, rgba(76, 153, 92, 0.12), rgba(255, 255, 255, 0.04));
}
[data-theme="dark"] .letters-tabs,
[data-theme="dark"] .shared-tabs {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .letter-tab.active {
  background: var(--accent);
  color: #fff;
}
[data-theme="dark"] .collab-presence {
  background: rgba(76, 153, 92, 0.15);
  border-color: rgba(76, 153, 92, 0.3);
}
[data-theme="dark"] .collab-avatar {
  border-color: var(--bg);
}
[data-theme="dark"] .compose-textarea,
[data-theme="dark"] .compose-attached-info,
[data-theme="dark"] .letter-detail-diary {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--fg);
}
[data-theme="dark"] .compose-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 153, 92, 0.2);
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .friend-name,
[data-theme="dark"] .letter-from strong,
[data-theme="dark"] .diary-author,
[data-theme="dark"] .diary-title,
[data-theme="dark"] .collab-name,
[data-theme="dark"] .search-user-name,
[data-theme="dark"] .letter-detail-subject,
[data-theme="dark"] .letter-detail-from {
  color: var(--fg);
}
[data-theme="dark"] .friend-handle,
[data-theme="dark"] .friend-bio,
[data-theme="dark"] .letter-date,
[data-theme="dark"] .letter-preview,
[data-theme="dark"] .diary-preview,
[data-theme="dark"] .diary-date,
[data-theme="dark"] .collab-role,
[data-theme="dark"] .search-user-handle {
  color: var(--fg-muted);
}

/* 响应式：小屏幕下好友/信件卡片单列 */
@media (max-width: 600px) {
  .friends-grid { grid-template-columns: 1fr; }
  .friend-card, .letter-card { flex-wrap: wrap; }
  .friend-actions { width: 100%; justify-content: flex-end; }
  .letters-tabs, .shared-tabs { width: 100%; }
  .letter-tab { flex: 1; }
  .collab-add-section .filter-select { width: 100%; }
}
