/* css/app.css — 浅白粉主题（与小程序同色板），手机优先 */
:root {
  --bg: #FFF8FA;
  --bg2: #FDF7FA;
  --hl: #FFEDF3;
  --pink-deep: #FFDBE8;
  --pink-dot: #F6C2D4;
  --line: #F6E9EF;
  --main: #E07B9B;
  --main-text: #B8587E;
  --text: #33312E;
  --text2: #9A958C;
  --ok: #5BBE7A;
  --warn: #E8A24A;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- 顶栏 ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 248, 250, .92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 10px;
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--main); }
.topbar-date { font-size: 12px; color: var(--text2); }

/* ---- 主体 ---- */
.view { flex: 1; padding: 14px 14px 24px; }

.page-head { margin: 4px 2px 14px; }
.hello { font-size: 20px; font-weight: 700; }
.date { font-size: 12px; color: var(--text2); margin-top: 3px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.section { margin-bottom: 18px; }
.section-title { font-size: 14px; font-weight: 700; color: var(--main-text); margin: 0 2px 8px; }

/* ---- 完成度 ---- */
.progress-row { display: flex; justify-content: space-between; align-items: baseline; }
.progress-text { font-size: 14px; }
.progress-text b { color: var(--main); font-size: 18px; }
.progress-pct { font-size: 22px; font-weight: 800; color: var(--main); }
.progress-track {
  height: 10px; background: var(--hl); border-radius: 5px; margin-top: 10px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--main), var(--pink-dot));
  border-radius: 5px; transition: width .35s ease;
}

/* ---- 到点横幅 ---- */
.due-banner {
  background: #FFF6E8;
  border: 1px solid #F5DFBE;
  color: #B87A1E;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ---- 列表 ---- */
.list-card { padding: 4px 14px; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row-due { background: #FFF9F0; border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.tappable { cursor: pointer; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-size: 15px; }
.name-done { color: var(--text2); text-decoration: line-through; }
.row-desc { font-size: 12px; color: var(--text2); margin-top: 3px; }
.empty { padding: 18px 0; text-align: center; color: var(--text2); font-size: 13px; }

.checkbox {
  width: 24px; height: 24px;
  border: 2px solid var(--pink-dot);
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700;
}
.checkbox.checked { background: var(--main); border-color: var(--main); }

.due-dot {
  background: var(--warn); color: #fff;
  font-size: 11px; border-radius: 8px; padding: 2px 8px; flex-shrink: 0;
}

/* ---- 喝水步进器 ---- */
.stepper { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.step-btn {
  width: 30px; height: 30px; border-radius: 10px;
  border: 1px solid var(--pink-deep);
  background: var(--hl); color: var(--main);
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.step-val { font-size: 13px; color: var(--main-text); min-width: 52px; text-align: center; }
.stepper-done .step-val { color: var(--ok); font-weight: 700; }
.stepper-done .step-btn { opacity: .45; }

/* ---- 优先级 / 删除 ---- */
.pri { font-size: 11px; border-radius: 6px; padding: 1px 6px; margin-right: 4px; }
.p-high { background: #FDEBEC; color: #D24B4B; }
.p-medium { background: #FFF3DC; color: #C08A2E; }
.p-low { background: #E8F8EE; color: #4A9D6E; }
.del-btn {
  color: #C4BFB4; font-size: 14px; padding: 6px 4px; cursor: pointer; flex-shrink: 0;
}

/* ---- 添加计划 ---- */
.add-card { display: flex; gap: 8px; align-items: center; }
.add-input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 14px; background: var(--bg2); outline: none;
}
.add-input:focus { border-color: var(--pink-dot); }
.add-select {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 4px; font-size: 13px; background: var(--bg2); color: var(--main-text); outline: none;
}
.add-btn {
  border: none; border-radius: 10px;
  background: var(--main); color: #fff;
  padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
}

/* ---- 板块宫格 ---- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.module {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 8px 12px; text-align: center; cursor: pointer;
  position: relative;
  transition: transform .12s ease;
}
.module:active { transform: scale(.96); }
.module-icon { width: 48px; height: 48px; border-radius: 12px; }
.module-name { font-size: 13px; font-weight: 600; margin-top: 6px; }
.module-desc { font-size: 10px; color: var(--text2); margin-top: 3px; }
.module-locked { opacity: .55; }
.module-tag {
  position: absolute; top: 8px; right: 8px;
  background: var(--hl); color: var(--main-text);
  font-size: 9px; border-radius: 6px; padding: 2px 5px;
}

/* ---- 备份 ---- */
.stat-card { text-align: center; padding: 18px 14px; }
.stat-line { font-size: 14px; }
.stat-line b { color: var(--main); font-size: 18px; }
.stat-sub { font-size: 12px; color: var(--text2); margin-top: 6px; }

/* ---- 底栏 ---- */
.tabbar {
  position: sticky; bottom: 0;
  display: flex;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  flex: 1; text-align: center; padding: 8px 0 6px;
  text-decoration: none; color: var(--text2);
}
.tab-icon { font-size: 20px; display: block; }
.tab-label { font-size: 11px; }
.tab.active { color: var(--main); }
.tab.active .tab-label { font-weight: 700; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 90px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(51, 49, 46, .88); color: #fff;
  padding: 10px 18px; border-radius: 10px;
  font-size: 14px; max-width: 80vw;
  opacity: 0; pointer-events: none;
  transition: all .25s ease; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 板块页 ============ */
.mod-head { display: flex; align-items: center; gap: 10px; margin: 4px 2px 14px; }
.back-link {
  color: var(--main); text-decoration: none; font-size: 14px; font-weight: 600;
  background: var(--hl); border-radius: 10px; padding: 6px 12px; flex-shrink: 0;
}
.mod-head .hello { font-size: 19px; }

.btn-row { display: flex; gap: 8px; margin-top: 8px; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-main {
  border: none; border-radius: 12px; background: var(--main); color: #fff;
  padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-ghost {
  border: 1px solid var(--pink-deep); border-radius: 12px; background: var(--hl);
  color: var(--main-text); padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-danger { border-color: #F5C6C6; background: #FDF0F0; color: #C0564E; }
.block-desc { font-size: 11px; color: var(--text2); text-align: center; margin-top: 8px; }

/* 统计格 */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat-box { background: var(--bg2); border-radius: 10px; padding: 10px 6px; text-align: center; }
.stat-box b { font-size: 17px; color: var(--main); display: block; }
.stat-box span { font-size: 11px; color: var(--text2); }

/* 迷你进度条 */
.mini-track { height: 7px; background: var(--hl); border-radius: 4px; overflow: hidden; }
.mini-fill { height: 100%; background: var(--main); border-radius: 4px; }

/* 筛选 pill */
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill {
  border: 1px solid var(--line); background: #fff; color: var(--text2);
  border-radius: 20px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.pill.active { background: var(--main); border-color: var(--main); color: #fff; font-weight: 600; }

/* 徽章 */
.badge { font-size: 10px; border-radius: 6px; padding: 1px 6px; background: var(--hl); color: var(--main-text); }
.badge.b-ok { background: #E8F8EE; color: #4A9D6E; }
.badge.b-bad { background: #FDEBEC; color: #D24B4B; }
.badge.b-warn { background: #FFF3DC; color: #C08A2E; }
.badge.b-dark { background: #F1EAF8; color: #8A5FC0; }

/* 日历 */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 15px; color: var(--main-text); }
.cal-head .btn-ghost { padding: 4px 14px; border-radius: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week { text-align: center; font-size: 11px; color: var(--text2); padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 13px; background: var(--bg2); cursor: pointer;
}
.cal-cell.on { background: var(--main); color: #fff; font-weight: 700; }
.cal-cell.today { outline: 2px solid var(--pink-dot); }
.cal-cell.future { opacity: .35; }
.cal-blank { aspect-ratio: 1; }

/* 折叠卡片 */
.collapse-card { padding: 2px 14px; }
.collapse-body { border-top: 1px dashed var(--line); }
.chev { color: var(--text2); font-size: 12px; }
.water-line { font-size: 15px; text-align: center; }
.water-line b { font-size: 24px; color: var(--main); }

/* ============ 表单弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(51, 49, 46, .4);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: #fff; width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 16px);
  max-height: 88vh; overflow-y: auto;
}
.sheet-title { font-size: 16px; font-weight: 700; color: var(--main); margin-bottom: 12px; }
.field { margin-bottom: 12px; }
.field-label { font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.field-label i { color: #D24B4B; font-style: normal; }
.field-err .f-input, .field-err .f-textarea { border-color: #D24B4B; }
.f-input, .f-select, .f-textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 15px; background: var(--bg2); outline: none;
  font-family: inherit;
}
.f-input:focus, .f-select:focus, .f-textarea:focus { border-color: var(--pink-dot); }
.f-textarea { min-height: 72px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  border-radius: 18px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--main); border-color: var(--main); color: #fff; font-weight: 600; }
.stars { display: flex; gap: 6px; }
.star { background: none; border: none; font-size: 26px; color: #E3DCD3; cursor: pointer; padding: 2px; }
.star.on { color: var(--warn); }
.tag-add { display: flex; gap: 8px; }
.tag-add .f-input { flex: 1; }
.tag-add .btn-ghost { padding: 9px 14px; border-radius: 12px; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tagchip {
  background: var(--hl); color: var(--main-text); border-radius: 8px;
  font-size: 12px; padding: 4px 8px;
}
.tagchip b { margin-left: 4px; color: var(--main); cursor: pointer; font-style: normal; }
.tag-empty { font-size: 12px; color: var(--text2); }
.sheet-btns { display: flex; gap: 10px; margin-top: 6px; }
.sheet-btns button { flex: 1; }
