:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e8e9ed;
  --text: #1f2024;
  --muted: #7b7d86;
  --accent: #185FA5;
  --accent-light: #e8f1fa;
  --done: #0F6E56;
  --danger: #c0392b;
  --pri-urgent-important: #e74c3c;
  --pri-important: #f5a623;
  --pri-urgent: #3498db;
  --pri-normal: #2ecc71;
  --high: #e85d5d;
  --medium: #f5a623;
  --low: #6cc070;
  --sidebar-w: 220px;
}
[data-theme="dark"] {
  --bg: #0f1115;
  --card: #1a1d23;
  --border: #2c3038;
  --text: #e8e9ed;
  --muted: #8b8f96;
  --accent: #4fa3e3;
  --accent-light: #1e2a3a;
  --done: #3ddc97;
}
[data-theme="dark"] .filter-bar input, [data-theme="dark"] .filter-bar select,
[data-theme="dark"] #recordEditModal input, [data-theme="dark"] #recordEditModal select,
[data-theme="dark"] #habitEditModal input { background: #11141a; color: var(--text); }
[data-theme="dark"] body.home-dashboard {
  background: #1A1D23;
}
[data-theme="dark"] .home-card, [data-theme="dark"] .home-write-btn {
  background: rgba(30, 34, 42, 0.82);
  border-color: rgba(60, 66, 78, 0.8);
  color: var(--text);
}
[data-theme="dark"] .home-title h1, [data-theme="dark"] .home-card-title,
[data-theme="dark"] .home-ring-text b, [data-theme="dark"] .home-today-text,
[data-theme="dark"] .home-habit-pill .name { color: var(--text); }
[data-theme="dark"] .home-meta, [data-theme="dark"] .home-sub,
[data-theme="dark"] .home-link, [data-theme="dark"] .home-empty,
[data-theme="dark"] .mood-label, [data-theme="dark"] .home-summary,
[data-theme="dark"] .home-legend-dot, [data-theme="dark"] .home-trend-legend,
[data-theme="dark"] .home-bar-label, [data-theme="dark"] .home-ring-text small,
[data-theme="dark"] .home-progress-info { color: var(--muted); }
[data-theme="dark"] .home-week-day { background: rgba(30,34,42,0.6); border-color: rgba(60,66,78,0.7); }
[data-theme="dark"] .home-progress-bar { background: #2c3038; }
[data-theme="dark"] .home-link:hover { color: var(--accent); }
[data-theme="dark"] .mood-opts button { background: rgba(40,46,56,0.6); }
[data-theme="dark"] .mood-opts button.selected { background: #2A2520; border-color: #A68B6A; }
[data-theme="dark"] .weekly-summary-card { background: rgba(40, 36, 30, 0.78); }
[data-theme="dark"] .sidebar-footer { color: var(--muted); }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
.dashboard { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
}
.brand { font-size: 18px; font-weight: 700; color: var(--accent); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.brand small { font-size: 11px; color: var(--muted); font-weight: 500; }
.nav { list-style: none; padding: 0; margin: 24px 0 0; }
.nav li { margin-bottom: 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; color: var(--muted);
  text-decoration: none; font-size: 14px; cursor: pointer;
}
.nav a:hover, .nav a.active { background: var(--accent-light); color: var(--accent); }
.nav .soon { opacity: .5; cursor: not-allowed; }

/* 主内容区 */
.main { margin-left: var(--sidebar-w); flex: 1; padding: 24px 28px; max-width: calc(100% - var(--sidebar-w)); }
header.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.greet h2 { margin: 0; font-size: 22px; }
.greet .date { color: var(--muted); font-size: 13px; margin-top: 4px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.sync { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title small { font-weight: 400; color: var(--muted); font-size: 12px; }

/* 概览网格 */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.ov-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.ov-card .num { font-size: 26px; font-weight: 700; }
.ov-card .lbl { font-size: 12px; color: var(--muted); }
.ov-card .pct { font-size: 12px; color: var(--done); font-weight: 500; }

/* 添加栏 */
.add-grid { display: grid; grid-template-columns: 2fr 150px 150px 120px 160px auto; gap: 10px; align-items: flex-end; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 14px;
}

/* 优先级自定义下拉 */
.custom-select { position: relative; }
.custom-select .sel-display {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 14px; cursor: pointer;
}
.custom-select .sel-options {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.08); z-index: 50; overflow: hidden; display: none;
}
.custom-select.open .sel-options { display: block; }
.custom-select .sel-option {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; cursor: pointer; font-size: 14px;
}
.custom-select .sel-option:hover { background: var(--accent-light); }
.pri-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pri-dot.urgent-important { background: var(--pri-urgent-important); }
.pri-dot.important { background: var(--pri-important); }
.pri-dot.urgent { background: var(--pri-urgent); }
.pri-dot.normal { background: var(--pri-normal); }
.pri-dot.sm { width: 8px; height: 8px; }
.btn {
  border: none; border-radius: 8px; padding: 9px 16px; cursor: pointer; font-size: 14px; font-weight: 500;
  background: var(--accent); color: #fff; transition: opacity .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .9; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f5f6fa; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--border); }

/* 列表 */
.day-title { font-size: 13px; color: var(--muted); margin: 16px 0 8px; font-weight: 500; }
.item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.item:first-child { border-top: none; }
.item .content { flex: 1; word-break: break-word; line-height: 1.45; }
.item.done .content { text-decoration: line-through; color: var(--muted); }
.priority {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 6px; border-radius: 6px; margin-left: 8px; font-weight: 500;
}
.priority.urgent-important { background: #fdeaea; color: var(--pri-urgent-important); }
.priority.important { background: #fff4e0; color: #b36d00; }
.priority.urgent { background: #eaf4fd; color: var(--pri-urgent); }
.priority.normal { background: #e8f9ef; color: #1e8d4a; }
.tag { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: #eef2f7; color: var(--accent); margin-left: 6px; }
.tag.work { background: #fdeaea; color: #c0392b; }
.tag.life { background: #e8f5e9; color: #27ae60; }
.tag.personal { background: #fff4e0; color: #d35400; }
.tag.other { background: #eef2f7; color: var(--accent); }
.del { border: none; background: none; color: #bbb; cursor: pointer; font-size: 13px; }
.del:hover { color: var(--danger); }
.edit { border: none; background: none; color: #bbb; cursor: pointer; font-size: 13px; margin-right: 4px; }
.edit:hover { color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* 进度条 */
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.progress { height: 8px; background: #eee; border-radius: 6px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--done); transition: width .3s; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 14px; padding: 22px; width: 360px; max-width: 92vw; }
.modal h3 { margin-top: 0; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2024; color: #fff; padding: 9px 18px; border-radius: 8px; font-size: 13px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 200;
}
.toast.show { opacity: .95; }
.hidden { display: none; }

/* 读书 */
.book-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.book-form .full { grid-column: 1 / -1; }
.book-form input, .book-form select, .book-form textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; box-sizing: border-box; }
.book-form textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.book-stars { display: inline-flex; gap: 2px; vertical-align: middle; }
.book-star { font-size: 20px; cursor: pointer; color: #d9d9d9; user-select: none; line-height: 1; }
.book-star.on { color: #f5a623; }
.book-template-btn { font-size: 12px; color: var(--accent); cursor: pointer; margin-left: 6px; }
.book-template-btn:hover { text-decoration: underline; }
.book-list { display: grid; gap: 12px; margin-top: 14px; }
.book-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.book-item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.book-title { font-weight: 600; font-size: 15px; }
.book-author { color: var(--muted); font-size: 13px; }
.book-meta { display: flex; gap: 8px; align-items: center; margin: 6px 0; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.book-status { padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.book-status.st-want { background: #eef2ff; color: #5b6bd6; }
.book-status.st-reading { background: #fff7e6; color: #b36d00; }
.book-status.st-done { background: #eafaf1; color: #1e8d4a; }
.book-note { line-height: 1.6; margin-top: 6px; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.book-actions { margin-top: 8px; display: flex; gap: 10px; }

/* 习惯 */
.habit-add { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.habit-add input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.habit-add input[type="text"] { flex: 1; }
.habit-add input[name="emoji"] { width: 50px; text-align: center; }
.color-dots { display: flex; gap: 6px; align-items: center; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-dot.selected { border-color: var(--text); }
.habit-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border);
}
.habit-row:first-child { border-top: none; }
.habit-row input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.habit-row .emoji { font-size: 18px; width: 24px; text-align: center; }
.habit-row .name { flex: 1; font-size: 14px; }
.habit-row .streak { font-size: 12px; color: var(--done); font-weight: 500; }
.habit-row .del-habit { border: none; background: none; color: #bbb; cursor: pointer; font-size: 13px; }
.habit-row .del-habit:hover { color: var(--danger); }
.link-btn { border: none; background: none; color: var(--accent); cursor: pointer; font-size: 13px; margin-right: 8px; }
.link-btn:hover { text-decoration: underline; }
.habit-row .edit-habit { border: none; background: none; color: #bbb; cursor: pointer; font-size: 13px; margin-right: 4px; }
.habit-row .edit-habit:hover { color: var(--accent); }
.habit-grid { margin-top: 14px; overflow-x: auto; }
.habit-grid table { width: 100%; border-collapse: collapse; font-size: 12px; }
.habit-grid th, .habit-grid td { text-align: center; padding: 6px 4px; border: 1px solid var(--border); }
.habit-grid th { background: #f9fafb; color: var(--muted); font-weight: 500; }
.habit-grid .check { color: var(--done); font-weight: 700; }

/* 日记 */
.diary-date { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; margin-bottom: 10px; }
.diary-text { width: 100%; min-height: 140px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; line-height: 1.6; resize: vertical; }
.diary-meta { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* 生活片段 */
.fragment-input { width: 100%; min-height: 80px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; line-height: 1.5; resize: vertical; margin-bottom: 10px; }
.fragment-date { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; margin-bottom: 10px; }
.fragment-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.fragment-preview { display: flex; gap: 8px; flex-wrap: wrap; }
.fragment-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.fragment-list { display: grid; gap: 14px; }
.fragment-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.fragment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.fragment-content { line-height: 1.5; margin-bottom: 10px; word-break: break-word; }
.fragment-gallery { display: flex; gap: 8px; flex-wrap: wrap; }
.fragment-gallery img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); }

/* 列表筛选 */
.filter-bar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; color: var(--text); }
.filter-bar input { flex: 1; min-width: 140px; }
.filter-bar select { min-width: 120px; }

/* 周报归档 */
.summary-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.summary-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.summary-title { font-weight: 600; font-size: 14px; }
.summary-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.summary-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.summary-body { margin-top: 10px; padding: 10px; background: #f9fafb; border-radius: 8px; white-space: pre-wrap; font-size: 13px; line-height: 1.6; max-height: 360px; overflow: auto; }
.btn.sm, .btn.secondary.sm { padding: 4px 10px; font-size: 12px; }

/* 设置页 */
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; }
.setting-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.stat-pill { background: #f5f6fa; border: 1px solid var(--border); border-radius: 20px; padding: 6px 12px; font-size: 13px; }
.stat-pill b { color: var(--accent); }

/* 日程月历 */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-weight: 600; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav button { padding: 4px 10px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; }
.cal-nav button:hover { background: var(--accent-light); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-weekday { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; }
.cal-cell {
  aspect-ratio: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  background: #fff; transition: background .15s;
}
.cal-cell:hover { background: #f9fafb; }
.cal-cell.today { background: var(--accent-light); border-color: var(--accent); }
.cal-cell.selected { background: #e8f1fa; border-color: var(--accent); }
.cal-cell.empty { border-color: transparent; cursor: default; background: transparent; }
.cal-day-num { font-size: 12px; color: var(--text); }
.cal-dots { display: flex; gap: 2px; margin-top: 2px; flex-wrap: wrap; justify-content: center; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-dot.urgent-important { background: var(--pri-urgent-important); }
.cal-dot.important { background: var(--pri-important); }
.cal-dot.urgent { background: var(--pri-urgent); }
.cal-dot.normal { background: var(--pri-normal); }
.cal-detail { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.cal-detail h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }

/* 统计图表 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.stat-box { background: #f9fafb; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.stat-box h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 500; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.bar-label { width: 70px; color: var(--text); }
.bar-track { flex: 1; height: 8px; background: #e8e9ed; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; }
.bar-value { width: 30px; text-align: right; color: var(--muted); }
.svg-chart { width: 100%; }

/* ===== 首页仪表盘 ===== */
body.home-dashboard {
  background: #FBF6F0 url(/home-bg.svg) no-repeat center center fixed;
  background-size: cover;
}
body.home-dashboard .dashboard { min-height: 100vh; }
body.home-dashboard .sidebar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid rgba(230, 220, 210, 0.7);
}
body.home-dashboard .main {
  background: transparent;
  padding: 22px 28px 28px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 8px 6px;
  color: #8B7D6E;
  font-size: 12px;
  line-height: 1.6;
}
.sidebar-footer p { margin: 0; }
.sidebar-plant { font-size: 28px; margin-top: 8px; opacity: 0.9; }

/* 顶部问候区 */
.home-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.home-title { flex: 1; min-width: 220px; }
.home-meta {
  display: flex; align-items: center; gap: 12px;
  color: #7D7164; font-size: 13px; margin-bottom: 6px;
}
.home-weather {
  background: rgba(255,255,255,0.55); border-radius: 999px;
  padding: 3px 10px; font-size: 12px;
  border: 1px solid rgba(230,220,210,0.8);
}
.home-title h1 {
  margin: 0; font-size: 28px; font-weight: 700; color: #4A4238;
  letter-spacing: 1px;
}
.home-top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.home-write-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #5A8F6E; border: 1px solid #D5E4D9;
  border-radius: 10px; padding: 8px 14px; font-size: 14px;
  text-decoration: none; font-weight: 500;
  box-shadow: 0 2px 6px rgba(74,66,56,0.05);
}
.home-write-btn:hover { background: #F4FAF6; }

/* 首页卡片 */
.home-grid {
  display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start;
}
.home-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(230, 220, 210, 0.8);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 4px 18px rgba(74, 66, 56, 0.05);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.home-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.home-card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: #4A4238;
}
.home-icon { font-size: 16px; }
.home-link {
  font-size: 12px; color: #8B7D6E; text-decoration: none;
  display: flex; align-items: center; gap: 2px;
}
.home-link:hover { color: var(--accent); }
.home-sub { font-size: 12px; color: #9E9286; }
.home-empty {
  color: #9E9286; font-size: 13px; text-align: center; padding: 18px 0;
}

/* 今日计划 */
.home-today-list { min-height: 80px; }
.home-today-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid rgba(230,220,210,0.6);
}
.home-today-item:last-child { border-bottom: none; }
.home-today-item.done .home-today-text { text-decoration: line-through; color: #9E9286; }
.home-today-item input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: #5A8F6E; cursor: pointer;
}
.home-today-text { flex: 1; font-size: 14px; color: #4A4238; }
.home-today-tag {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: #F3ECE4; color: #8B7D6E;
}
.home-today-tag.work { background: #FBE8E6; color: #B85C52; }
.home-today-tag.life { background: #E6F2EA; color: #4A8B5E; }
.home-progress { margin-top: 12px; }
.home-progress-info {
  display: flex; justify-content: space-between; font-size: 12px; color: #7D7164;
  margin-bottom: 6px;
}
.home-progress-info b { color: #4A4238; font-weight: 600; }
.home-progress-pct { color: #5A8F6E; font-weight: 600; }
.home-progress-bar {
  height: 8px; background: #EDE5DC; border-radius: 999px; overflow: hidden;
}
.home-progress-bar div {
  height: 100%; width: 0; background: linear-gradient(90deg, #7BA88C, #5A8F6E);
  border-radius: 999px; transition: width .35s ease;
}

/* 本周日程迷你 */
.home-week-mini { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.home-week-day {
  flex: 0 0 auto; width: 62px; text-align: center;
  background: rgba(255,255,255,0.55); border: 1px solid rgba(230,220,210,0.7);
  border-radius: 12px; padding: 10px 6px;
}
.home-week-day.active {
  background: #F3F8F4; border-color: #A8C9B3;
}
.home-week-day .dow { font-size: 11px; color: #9E9286; }
.home-week-day .date { font-size: 15px; font-weight: 700; color: #4A4238; margin: 4px 0; }
.home-week-day .dots { display: flex; justify-content: center; gap: 2px; }
.home-week-dot { width: 5px; height: 5px; border-radius: 50%; background: #D6C9BC; }
.home-week-dot.work { background: #D88C8C; }
.home-week-dot.life { background: #7FB596; }

/* 工作记录区 */
.home-work-body { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.home-ring-wrap { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.home-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.home-ring-text {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.home-ring-text b { font-size: 20px; color: #4A4238; }
.home-ring-text small { font-size: 11px; color: #9E9286; margin-top: 2px; }
.home-bar-chart { flex: 1; min-width: 180px; height: 110px; display: flex; align-items: flex-end; gap: 10px; }
.home-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.home-bar { width: 100%; background: linear-gradient(180deg, #A8C9B3, #7BA88C); border-radius: 6px 6px 0 0; min-height: 4px; transition: height .35s ease; }
.home-bar-label { font-size: 10px; color: #9E9286; }

/* 生活习惯行 */
.home-habit-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.home-habit-pill {
  flex: 0 0 auto; min-width: 120px;
  background: rgba(255,255,255,0.55); border: 1px solid rgba(230,220,210,0.7);
  border-radius: 14px; padding: 12px;
  display: flex; align-items: center; gap: 10px;
}
.home-habit-pill .emoji { font-size: 22px; }
.home-habit-pill .info { flex: 1; }
.home-habit-pill .name { font-size: 13px; color: #4A4238; font-weight: 500; }
.home-habit-pill .streak { font-size: 11px; color: #5A8F6E; }
.home-habit-pill .checks { display: flex; gap: 4px; margin-top: 6px; }
.home-habit-check { width: 14px; height: 14px; border-radius: 50%; background: #E8E0D6; }
.home-habit-check.on { background: #5A8F6E; }

/* 心情卡片 */
.mood-card { text-align: center; }
.mood-opts {
  display: flex; justify-content: center; gap: 10px; margin-bottom: 10px;
}
.mood-opts button {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid transparent;
  background: rgba(255,255,255,0.5); font-size: 22px; cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.mood-opts button:hover { transform: scale(1.1); background: #fff; }
.mood-opts button.selected { border-color: #D8B88A; background: #FFF7EF; transform: scale(1.08); }
.mood-label { font-size: 13px; color: #8B7D6E; }

/* 趋势图 */
.home-trend-chart { height: 130px; position: relative; }
.home-trend-svg { width: 100%; height: 100%; }
.home-trend-legend {
  display: flex; justify-content: center; gap: 14px; margin-top: 8px; font-size: 11px; color: #7D7164;
}
.home-legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.home-legend-dot.records { background: #A6A0D6; }
.home-legend-dot.habits { background: #6B9E7C; }

/* 生活片段网格 */
.home-fragment-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.home-fragment-thumb {
  aspect-ratio: 1; border-radius: 10px; object-fit: cover; width: 100%;
  border: 1px solid rgba(230,220,210,0.7); background: #F3ECE4;
}
.home-fragment-thumb.more {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.6); color: #8B7D6E; font-size: 12px;
}

/* 本周总结 */
.weekly-summary-card { background: rgba(255, 250, 240, 0.78); }
.home-summary { font-size: 13px; line-height: 1.7; color: #5C5349; }
.home-summary ul { margin: 0; padding-left: 18px; }
.home-summary li { margin-bottom: 5px; }

.bottom-nav { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; max-width: 100%; padding: 16px; padding-bottom: 68px; }
  .add-grid { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .book-form { grid-template-columns: 1fr; }
  .habit-add { flex-wrap: wrap; }
  .habit-add input[type="text"] { width: 100%; }
  .stats-grid { grid-template-columns: 1fr; }
  .cal-cell { aspect-ratio: auto; min-height: 48px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0;
    background: var(--card); border-top: 1px solid var(--border); z-index: 60;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .bottom-nav::-webkit-scrollbar { display: none; }
  .bottom-nav a {
    flex: 0 0 auto; min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 8px; color: var(--muted); text-decoration: none; font-size: 10px;
  }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav .ic { font-size: 18px; }

  /* 首页移动端 */
  body.home-dashboard .main { padding: 14px 14px 76px; }
  .home-top { margin-bottom: 14px; }
  .home-title h1 { font-size: 22px; }
  .home-grid { grid-template-columns: 1fr; }
  .home-card { padding: 14px; margin-bottom: 14px; border-radius: 16px; }
  .home-work-body { gap: 14px; }
  .home-ring-wrap { width: 92px; height: 92px; }
  .home-bar-chart { height: 92px; }
  .home-fragment-grid { grid-template-columns: repeat(3, 1fr); }

  /* 移动端首页顶部尽量一行显示 */
  .home-top { flex-wrap: nowrap; gap: 8px; }
  .home-title { min-width: 0; flex: 1; }
  .home-title h1 {
    font-size: 18px; letter-spacing: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .home-meta { display: none; }
  .home-top-actions { flex-wrap: nowrap; gap: 6px; flex-shrink: 0; }
  .home-top-actions .btn.secondary { padding: 7px 10px; font-size: 12px; }
  .home-write-btn { display: none; }
  .sync { font-size: 11px; }

  .sidebar-footer { display: none; }
}
