/* ===== 全局主题：柔和米白暖色 ===== */
/* 新青年体（励志语句用）—— 把字体文件放到 fonts/xinqingnian.woff2 即可生效 */
@font-face {
  font-family: "XinQingNian";
  src: url("../fonts/xinqingnian.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #faf7f2;
  --sidebar: #f4efe7;
  --line: #e6dfd3;
  --line-soft: #eee6d6;
  --card: #fbf9f4;
  --nav-active-bg: #eae3d6;
  --text: #2b2b2b;
  --text-dark: #111111;
  --muted: #8a8175;
  --faint: #b5ab9c;
  --accent: #8aa5c6;
  --accent-deep: #6b8eb8;
  --gold: #c0a368;
  --overdue: #a8807a;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

.hidden { display: none !important; }
.empty { color: var(--faint); font-size: 15px; padding: 16px 0; }

/* ===== 通用控件 ===== */
.text-input {
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
  color: var(--text);
}
.text-input:focus { border-color: var(--accent); }

.primary-btn {
  padding: 10px 18px;
  font-size: 15px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.primary-btn:hover { background: var(--accent-deep); }

.ghost-btn {
  padding: 8px 14px;
  font-size: 15px;
  color: var(--muted);
  background: var(--sidebar);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.ghost-btn:hover { color: var(--text); }

/* ===== 登录视图 ===== */
.login-view {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 320px;
  padding: 40px 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: center;
}
.login-title { font-size: 28px; font-weight: 700; }
.login-sub { color: var(--faint); font-size: 14px; margin: 8px 0 24px; }
.login-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.login-input:focus { border-color: var(--accent); }
.login-btn {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  font-size: 16px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.login-btn:hover { background: var(--accent-deep); }
.login-msg { margin-top: 14px; font-size: 14px; color: var(--overdue); min-height: 18px; }

/* ===== 应用外壳 ===== */
.app-view { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding-top: 60px;
}
.nav { flex: 1; overflow-y: auto; }
.nav a {
  display: block;
  padding: 14px 34px;
  font-family: "SimSun", "宋体", serif;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 17px;
}
.nav a.active { background: var(--nav-active-bg); font-weight: 700; }
.logout {
  margin: 16px;
  padding: 10px;
  background: none;
  border: none;
  color: #999;
  font-family: "SimSun", "宋体", serif;
  font-size: 17px;
  cursor: pointer;
  text-align: left;
}

.main { flex: 1; overflow-y: auto; padding: 24px 28px; }

.page-title {
  font-size: 40px;
  font-weight: 700;
  color: rgba(90, 80, 65, 0.45);
  letter-spacing: 1px;
  margin-bottom: 18px;
}

/* ===== 首页 ===== */
.home-date { font-size: 22px; color: var(--muted); text-align: center; margin: 8px 0 10px; }
.home-quote {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  padding: 40px 20px;
}
.quote-mark { font-size: 60px; color: #e3dbc9; line-height: 1; }
.quote-text { font-family: "XinQingNian", "STXingkai", "华文行楷", "KaiTi", serif; font-size: 40px; color: var(--text); margin: 16px 0; }
.quote-actions { margin-top: 10px; }
.home-tasks {
  max-width: 1000px;
  margin: 24px auto 0;
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
}
.task-row { margin: 10px 0; }
.task-row-label { font-size: 16px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.task-items { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.task-item { font-family: "STXingkai", "华文行楷", "KaiTi", serif; font-size: 19px; }
.task-item .task-time { color: var(--faint); font-size: 14px; font-family: inherit; }
.task-done { text-decoration: line-through; }
.task-empty { color: var(--faint); font-size: 15px; }

/* ===== 待办 ===== */
.todo-input-row { display: flex; gap: 12px; margin-bottom: 20px; }
.todo-input-row .text-input { flex: 1; }
.todo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line-soft);
}
.todo-check {
  width: 24px; height: 24px;
  border: 2px solid #d8cfbe;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: 14px; flex-shrink: 0;
}
.todo-check.checked { background: #e8e2d6; border-color: #e8e2d6; }
.todo-text { flex: 1; cursor: pointer; font-size: 17px; }
.todo-text.done { color: var(--faint); text-decoration: line-through; }
.todo-del { color: var(--faint); cursor: pointer; padding: 0 6px; }
.todo-done { margin-top: 20px; }
.done-header { color: var(--muted); font-size: 16px; cursor: pointer; margin-bottom: 8px; }

/* ===== 习惯打卡 ===== */
.habit-top { display: flex; gap: 12px; margin-bottom: 12px; }
.habit-top .text-input { flex: 1; }
.habit-week-label, .habit-row {
  display: flex;
  align-items: center;
}
.habit-week-spacer { width: 320px; flex-shrink: 0; }
.habit-day-label { width: 56px; text-align: center; color: var(--muted); font-size: 14px; }
.habit-day-label.today { color: var(--accent-deep); }
.habit-row { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.habit-info { width: 320px; flex-shrink: 0; position: relative; }
.habit-name { font-size: 17px; font-weight: 700; }
.habit-streak { font-size: 14px; margin-top: 4px; }
.habit-del { position: absolute; right: 20px; top: 0; color: var(--faint); cursor: pointer; }
.habit-cells { display: flex; }
.habit-cell {
  width: 42px; height: 42px;
  margin: 0 7px;
  border: 2px solid #e0d8c6;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}
.habit-cell.today { outline: 2px solid var(--accent-deep); outline-offset: 2px; cursor: pointer; }

/* ===== 日记 ===== */
.diary-top { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.diary-card {
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  margin-bottom: 14px;
  cursor: pointer;
}
.diary-date { font-size: 18px; font-weight: 700; display: inline-block; margin-right: 14px; }
.diary-date span { color: var(--faint); font-size: 14px; font-weight: 400; }
.diary-mood-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; }
.diary-mood-name { color: var(--muted); font-size: 14px; margin-right: 14px; }
.diary-snippet { color: var(--muted); font-size: 15px; margin-top: 8px; }
.diary-editor-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.date-input { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.diary-mood-picker { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.diary-mood-picker .label { color: var(--muted); }
.mood-option { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 16px; cursor: pointer; color: var(--muted); }
.mood-option.selected { outline: 2px solid var(--accent); }
.mood-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.diary-textarea {
  width: 100%; height: 380px;
  padding: 16px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  resize: vertical;
  outline: none;
}
.diary-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; }

/* ===== 设置 ===== */
.settings-block { margin-bottom: 24px; }
.settings-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.settings-card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 8px 20px; }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.set-label { font-size: 16px; }
.set-label.danger { color: var(--overdue); }
.set-hint { color: var(--faint); font-size: 13px; margin-top: 2px; }
.set-right { display: flex; align-items: center; gap: 12px; }
.set-code { color: var(--muted); letter-spacing: 1px; }
.set-del { color: var(--faint); cursor: pointer; padding: 0 6px; font-size: 18px; }
.set-divider { height: 1px; background: var(--line-soft); }
.mood-manage .set-row { justify-content: flex-start; gap: 12px; }
.mood-manage .set-del { margin-left: auto; }
.color-input { width: 40px; height: 36px; border: none; background: none; cursor: pointer; }

/* ===== 日历 ===== */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-month { display: flex; align-items: center; gap: 8px; }
.cal-nav { border: none; background: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 6px; }
.cal-month-label { font-size: 36px; font-weight: 700; color: rgba(90, 80, 65, .5); min-width: 110px; text-align: center; }
.cal-actions { display: flex; gap: 10px; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 72px); gap: 0 100px; justify-content: center; }
.cal-weekdays { margin-bottom: 4px; }
.cal-weekdays span { text-align: center; color: var(--muted); font-size: 15px; padding: 6px 0; }
.cal-grid { row-gap: 26px; }
.cal-cell {
  width: 72px; height: 72px;
  border-radius: 12px;
  padding: 7px;
  cursor: pointer;
  position: relative;
  transition: transform .12s ease;
  box-shadow: 0 3px 6px rgba(110, 100, 85, .18);
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
}
.cal-cell:hover { transform: scale(1.15); z-index: 2; }
.cal-cell.out { opacity: .35; }
.cal-cell.today { outline: 3px solid var(--accent-deep); outline-offset: 2px; }
.cal-daynum { width: 100%; font-weight: 700; font-size: 15px; }
.cal-star { position: absolute; top: -8px; right: -6px; color: #c0a368; font-size: 28px; }
@media (max-width: 1320px) {
  .cal-weekdays, .cal-grid { grid-template-columns: repeat(7, 1fr); gap: 8px; }
  .cal-grid { row-gap: 8px; }
  .cal-cell { width: auto; height: auto; aspect-ratio: 1 / 1; }
}
.cal-event-dot {
  width: 16px; height: 16px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px;
}
.cal-overlay {
  position: fixed; inset: 0;
  background: rgba(60, 50, 40, .3);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.cal-popup {
  width: 420px; max-width: 92vw;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(60, 50, 40, .3);
  overflow: hidden;
}
.cal-popup-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; font-size: 18px; font-weight: 700;
  border-bottom: 1px solid var(--line-soft);
}
.cal-close { border: none; background: none; font-size: 22px; color: var(--faint); cursor: pointer; }
.cal-popup-body { padding: 12px 20px; max-height: 260px; overflow-y: auto; }
.cal-popup-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.pop-check {
  width: 22px; height: 22px; border: 2px solid #d8cfbe; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: 13px; flex-shrink: 0;
}
.pop-check.checked { background: #e8e2d6; border-color: #e8e2d6; }
.pop-time { color: var(--faint); font-size: 13px; }
.pop-title { flex: 1; font-size: 15px; }
.pop-title.done { color: var(--faint); text-decoration: line-through; }
.pop-del { color: var(--faint); cursor: pointer; }
.cal-popup-add { padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid var(--line-soft); }
.cal-popup-add .text-input { flex: 1; min-width: 80px; }
.pop-major { font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }

/* ===== 笔记 ===== */
.notes-top { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.notes-top .text-input { flex: 1; min-width: 200px; }
.notes-placeholder { color: var(--muted); line-height: 1.8; padding: 20px 0; }
.notes-breadcrumb { margin-bottom: 12px; color: var(--muted); font-size: 15px; }
.crumb-root, .crumb-item { cursor: pointer; }
.crumb-item:hover { color: var(--text); }
.crumb-sep { margin: 0 6px; color: var(--faint); }
.notes-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.notes-row:hover { background: #f5f0e8; }
.file-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; flex-shrink: 0;
}
.file-icon.folder { background: #c9a882; font-size: 16px; }
.file-icon.txt { background: #8aa5c6; }
.file-icon.md { background: #a3b98a; }
.file-icon.pdf { background: #a8807a; }
.file-icon.img { background: #b0a3c4; }
.file-icon.other { background: #b5ab9c; }
.file-name { flex: 1; font-size: 16px; }
.file-kind { color: var(--faint); font-size: 13px; }
.reader-overlay { align-items: stretch; padding: 40px; }
.reader-card {
  width: 100%; max-width: 900px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(60, 50, 40, .3);
  display: flex; flex-direction: column;
  overflow: hidden;
  margin: auto;
}
.reader-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.7;
}
.reader-img { max-width: 100%; }

/* ===== 统计 ===== */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
.stat-value { font-size: 32px; font-weight: 700; color: var(--accent-deep); }
.stat-label { color: var(--muted); font-size: 15px; margin-top: 8px; }
.stat-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stat-panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.stat-panel-title { font-weight: 700; margin-bottom: 16px; }
.stat-habit-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.stat-habit-name { width: 110px; color: var(--muted); font-size: 14px; }
.stat-bar { flex: 1; height: 16px; background: #f0ece5; border-radius: 8px; overflow: hidden; }
.stat-bar-fill { height: 100%; background: var(--accent-deep); border-radius: 8px; }
.stat-habit-num { width: 50px; text-align: right; color: var(--accent-deep); font-size: 14px; }
.stat-rate-num { font-size: 40px; font-weight: 700; color: var(--accent-deep); }
.stat-progress { height: 18px; background: #f0ece5; border-radius: 9px; overflow: hidden; margin: 12px 0; }
.stat-progress-fill { height: 100%; background: var(--accent); border-radius: 9px; }
.stat-hint { color: var(--muted); font-size: 14px; }

/* ===== 移动端适配 ===== */
@media (max-width: 820px) {
  .app-view { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; padding: 0; border-right: none; border-bottom: 1px solid var(--line); }
  .nav { display: flex; flex-direction: row; overflow-x: auto; }
  .nav a { padding: 12px 14px; white-space: nowrap; }
  .logout { margin: 8px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .stat-charts { grid-template-columns: 1fr; }
  .habit-week-spacer, .habit-info { width: 150px; }
  .habit-cell { width: 34px; height: 34px; margin: 0 4px; }
}
