/* ============ 设计变量 ============ */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-hover: #fafafa;
  --border: #e8e8e3;
  --text: #2f3437;
  --text-muted: #8a8a85;
  --primary: #2383e2;
  --primary-hover: #1a6fc2;
  --danger: #e03e3e;
  --danger-soft: #fef2f2;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15, 15, 15, 0.04), 0 1px 2px rgba(15, 15, 15, 0.04);
  --shadow-hover: 0 6px 16px rgba(15, 15, 15, 0.08), 0 2px 6px rgba(15, 15, 15, 0.06);
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 深色主题 */
[data-theme="dark"] {
  --bg: #1f2023;
  --surface: #2a2b2e;
  --surface-hover: #323336;
  --border: #3a3b3e;
  --text: #e6e6e3;
  --text-muted: #9a9a95;
  --danger-soft: #3a2424;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f2023;
    --surface: #2a2b2e;
    --surface-hover: #323336;
    --border: #3a3b3e;
    --text: #e6e6e3;
    --text-muted: #9a9a95;
    --danger-soft: #3a2424;
  }
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ============ 通用按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { filter: brightness(0.95); }
.btn-icon { padding: 6px; border-radius: var(--radius-sm); color: var(--text-muted); }
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
}
.login-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.login-card .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  transition: var(--transition);
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 8px; padding: 10px; }
.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 18px;
}

/* ============ 首页布局 ============ */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* 顶栏增强 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar h1 {
  font-size: 22px;
  font-weight: 600;
  white-space: nowrap;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-center {
  flex: 1;
  min-width: 200px;
  position: relative;
}

/* 全局搜索 */
.global-search {
  width: 100%;
  height: 40px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  transition: var(--transition);
}
.global-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.12);
}
.search-results {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  max-height: 400px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}
.search-results:not(:empty) {
  display: block;
}
.search-group {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.search-group:last-child {
  border-bottom: none;
}
.search-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.search-item {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.search-item:hover {
  background: var(--surface-hover);
}
.search-item strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}
.search-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.search-snippet {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-no-result {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* 聚合控制台 */
.dashboard {
  margin-bottom: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.overview-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}
.overview-card:hover {
  box-shadow: var(--shadow-hover);
}
.overview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.overview-icon {
  font-size: 20px;
}
.overview-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.overview-count {
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
}
.overview-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
}
.overview-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.note-tag {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #333;
}
.overview-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--primary);
  transition: var(--transition);
}
.overview-link:hover {
  opacity: 0.8;
}

/* 迷你待办列表（首页卡片内） */
.todo-mini-list {
  margin: 8px 0 4px;
  max-height: 200px;
  overflow-y: auto;
}
.todo-mini-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 10px 0;
}
.todo-mini-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  cursor: default;
}
.todo-mini-item:hover {
  background: var(--surface-hover);
}
.todo-mini-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
  color: transparent;
  cursor: pointer;
  transition: var(--transition);
}
.todo-mini-check:hover {
  border-color: #51cf66;
}
.todo-mini-check.done {
  background: #51cf66;
  border-color: #51cf66;
  color: #fff;
}
.todo-mini-title {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.todo-mini-prio {
  font-size: 11px;
  flex-shrink: 0;
}
.todo-mini-more {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0 2px;
  cursor: pointer;
}
.todo-mini-more:hover {
  color: var(--primary);
}

/* 快速添加待办（首页卡片内） */
.todo-quick-add {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.todo-quick-add input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.todo-quick-add input:focus {
  border-color: var(--primary);
}
.todo-quick-add input::placeholder {
  color: var(--text-muted);
}

/* 颜色变体 */
.pending-card { border-left: 3px solid #51cf66; }
.expense-card { border-left: 3px solid #ff6b6b; }
.diary-card { border-left: 3px solid #ffd43b; }
.note-card { border-left: 3px solid #74c0fc; }

/* 快捷入口 */
.quick-access {
  margin-bottom: 32px;
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}
.quick-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.quick-icon {
  font-size: 28px;
}
.quick-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

/* 生活中心 */
.life-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.life-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}
.life-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.life-icon {
  font-size: 32px;
}
.life-label {
  font-size: 13px;
  color: var(--text);
}
.diary-item:hover { border-color: #ffd43b; }
.expense-item:hover { border-color: #ff6b6b; }
.todo-item:hover { border-color: #51cf66; }
.note-item:hover { border-color: #74c0fc; }
.media-item:hover { border-color: #be4bdb; }
.health-item:hover { border-color: #20c997; }

/* 工具合集 */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}
.tool-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.tool-icon {
  font-size: 26px;
}
.tool-label {
  font-size: 13px;
  color: var(--text);
}

/* 数据备份 */
.backup-actions {
  display: flex;
  gap: 12px;
}
.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}
.topbar h1 {
  font-size: 20px;
  font-weight: 600;
}
.topbar .actions { display: flex; align-items: center; gap: 8px; }
.user-badge {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 4px;
}

/* 搜索框 */
.search-wrap {
  position: relative;
  margin-bottom: 40px;
  display: flex;
  gap: 8px;
}
.search-engines {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  overflow-x: auto;
}
.search-engines button {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  transition: var(--transition);
  white-space: nowrap;
}
.search-engines button.active {
  background: var(--primary);
  color: #fff;
}
.search-input-wrap {
  flex: 1;
  position: relative;
}
.search-input-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  transition: var(--transition);
}
.search-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.12);
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* 区域标题 */
.section { margin-bottom: 40px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-head h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-head h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

/* ============ 链接分组 & 卡片 ============ */
.link-group { margin-bottom: 24px; }
.link-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative;
}
.link-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: transparent;
}
.link-card .favicon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}
.link-card .favicon img { width: 100%; height: 100%; object-fit: contain; }
.link-card .meta { min-width: 0; flex: 1; }
.link-card .title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-card .desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-card .del {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
  transition: var(--transition);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.link-card:hover .del { opacity: 1; }
.link-card .del:hover { background: var(--danger-soft); color: var(--danger); }

/* 卡片操作按钮 */
.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  gap: 4px;
}
.link-card:hover .card-actions {
  display: flex;
}
.btn-icon.small {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* ============ 文件管理 ============ */
.file-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}
.file-tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
}
.file-tab.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.file-tab-add {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.file-tab-add:hover { border-color: var(--primary); color: var(--primary); }

/* 拖拽上传区 */
.dropzone {
	  position: relative;
	  border: 2px dashed var(--border);
	  border-radius: var(--radius);
	  padding: 40px 24px;
	  text-align: center;
	  color: var(--text-muted);
	  background: var(--surface);
	  margin-top: 16px;
	  margin-bottom: 16px;
	  cursor: pointer;
	}
.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(35, 131, 226, 0.04);
  color: var(--primary);
}
.dropzone .dz-title { 
  font-size: 14px; 
  font-weight: 500; 
  color: var(--text); 
  margin-bottom: 8px;
  line-height: 1.4;
}
.dropzone .dz-hint { 
  font-size: 12px;
  color: var(--text-muted);
}
.dropzone input[type=file] { 
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* 文件列表 */
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.file-item:hover { background: var(--surface-hover); }
.file-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.file-meta { flex: 1; min-width: 0; }
.file-name {
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-sub { font-size: 12px; color: var(--text-muted); }
.file-actions { display: flex; gap: 4px; }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
  font-size: 13px;
}

/* ============ 模态框 ============ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-hover);
}
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal .field { margin-bottom: 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--surface);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-hover);
  z-index: 200;
  transition: transform 0.3s, opacity 0.3s;
  opacity: 0;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: var(--danger); color: #fff; }

/* ============ 工具合集页面通用 ============ */
.countdown-page,
.bookmark-page,
.markdown-page,
.time-page {
  max-width: 900px;
}

.countdown-toolbar,
.bookmark-toolbar,
.markdown-toolbar,
.time-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.countdown-toolbar h2,
.bookmark-toolbar h2,
.markdown-toolbar h2,
.time-toolbar h2 {
  font-size: 16px;
  font-weight: 600;
}

/* ===== 倒计时卡片 ===== */
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.countdown-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--cd-color, #2383e2);
  transition: var(--transition);
}
.countdown-card:hover {
  box-shadow: var(--shadow-hover);
}
.cd-icon {
  font-size: 32px;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--cd-color, #2383e2) 15%, transparent);
  border-radius: 12px;
}
.cd-body {
  flex: 1;
  min-width: 0;
}
.cd-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.cd-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.cd-days {
  font-size: 13px;
  font-weight: 500;
  color: var(--cd-color, #2383e2);
}
.cd-days.past {
  color: var(--text-muted);
}
.cd-days.today {
  color: #e03e3e;
  font-weight: 700;
}
.cd-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
}
.countdown-card:hover .cd-actions {
  opacity: 1;
}
.cd-actions button {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  transition: var(--transition);
}
.cd-actions button:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.cd-actions .del-btn:hover {
  background: rgba(224, 62, 62, 0.1);
  color: #e03e3e;
}

/* ===== 收藏库 ===== */
.collection-group {
  margin-bottom: 24px;
}
.collection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.collection-header:hover {
  box-shadow: var(--shadow-hover);
}
.collection-name {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.collection-name .count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}
.collection-actions {
  display: flex;
  gap: 4px;
}
.collection-actions button {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  transition: var(--transition);
}
.collection-actions button:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.collection-actions .del-collection:hover {
  background: rgba(224, 62, 62, 0.1);
  color: #e03e3e;
}
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-left: 12px;
}
.bookmark-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.bookmark-item:hover {
  background: var(--surface-hover);
}
.bm-favicon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.bm-info {
  flex: 1;
  min-width: 0;
}
.bm-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bm-url {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bm-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: var(--transition);
}
.bookmark-item:hover .bm-actions {
  opacity: 1;
}
.bm-actions button {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  transition: var(--transition);
}
.bm-actions button:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.bm-actions .del-bm:hover {
  background: rgba(224, 62, 62, 0.1);
  color: #e03e3e;
}

/* ===== Markdown 笔记 ===== */
.markdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.md-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
}
.md-card:hover {
  box-shadow: var(--shadow-hover);
}
.md-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.md-card-preview {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}
.md-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}
.md-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
}
.md-card:hover .md-card-actions {
  opacity: 1;
}
.md-card-actions button {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  transition: var(--transition);
}
.md-card-actions button:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.md-card-actions .del-md:hover {
  background: rgba(224, 62, 62, 0.1);
  color: #e03e3e;
}
.md-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.md-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(35, 131, 226, 0.1);
  color: var(--primary);
}

/* ===== 时间统计 ===== */
.time-entry {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: var(--transition);
}
.time-entry:hover {
  box-shadow: var(--shadow-hover);
}
.time-icon {
  font-size: 10px;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
}
.time-body {
  flex: 1;
  min-width: 0;
}
.time-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.time-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.time-duration {
  font-weight: 600;
  color: var(--text);
}
.time-tag {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(35, 131, 226, 0.1);
  color: var(--primary);
}
.time-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
}
.time-entry:hover .time-actions {
  opacity: 1;
}
.time-actions button {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  transition: var(--transition);
}
.time-actions button:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.time-actions .del-time:hover {
  background: rgba(224, 62, 62, 0.1);
  color: #e03e3e;
}

/* ===== 健康打卡 ===== */
.health-page {
  max-width: 720px;
}

.health-today {
  margin-bottom: 32px;
}
.health-today-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.health-today-header h2 {
  font-size: 16px;
  font-weight: 600;
}
.health-date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.health-date-label {
  font-size: 14px;
  font-weight: 500;
  min-width: 120px;
  text-align: center;
}

.health-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.health-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.health-field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}
.health-field input,
.health-field textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.2s;
}
.health-field input:focus,
.health-field textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.health-field textarea {
  resize: vertical;
}
.health-form-row {
  margin-bottom: 12px;
}

/* 心情选择器 */
.mood-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mood-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  min-width: 60px;
}
.mood-option:hover {
  border-color: var(--primary);
  background: rgba(35, 131, 226, 0.04);
}
.mood-option.selected {
  border-color: var(--primary);
  background: rgba(35, 131, 226, 0.08);
}
.mood-emoji {
  font-size: 24px;
}
.mood-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* 运动选择器 */
.exercise-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ex-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  min-width: 54px;
}
.ex-option:hover {
  border-color: #51cf66;
  background: rgba(81, 207, 102, 0.04);
}
.ex-option.selected {
  border-color: #51cf66;
  background: rgba(81, 207, 102, 0.1);
}
.ex-emoji {
  font-size: 20px;
}
.ex-label {
  font-size: 11px;
  color: var(--text-muted);
}

.health-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* 历史记录 */
.health-history {
  margin-top: 8px;
}
.health-history-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.health-month-label {
  font-size: 14px;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

.health-history-item {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.health-history-item:hover {
  box-shadow: var(--shadow-hover);
}
.hhi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.hhi-date {
  font-size: 13px;
  font-weight: 500;
}
.hhi-mood {
  font-size: 20px;
}
.hhi-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hhi-stat {
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 999px;
}
.hhi-exercise {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.hhi-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* 响应式 */
@media (max-width: 640px) {
  .app { padding: 20px 16px 60px; }
  .link-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .search-wrap { flex-direction: column; }
  .countdown-grid,
  .markdown-grid {
    grid-template-columns: 1fr;
  }
  .bookmark-grid {
    margin-left: 0;
  }
}
