:root { --bg: #fff6ec; --text: #3d3a50; --muted: #9a93b8; --card: #fff; --line: rgba(0,0,0,.06); }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #fff6ec, #f0f4ff); background-attachment: fixed;
  color: var(--text); max-width: 480px; margin: 0 auto; min-height: 100vh;
  padding-bottom: 76px;
}
body.dark { --bg: #1b1926; --text: #e6e2f0; --muted: #9a93b8; background: linear-gradient(180deg,#1b1926,#14121d); background-attachment: fixed; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; background: transparent; }
.topbar h1 { font-size: 19px; font-weight: 800; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); font-size: 16px; cursor: pointer; }
body.dark .icon-btn { background: #2a2636; }
#app { padding: 0 12px 20px; }
.placeholder { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto; display: flex; justify-content: space-around; background: #fff; border-radius: 18px 18px 0 0; padding: 9px 4px calc(9px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 14px rgba(0,0,0,.07); font-size: 12px; }
body.dark .tabbar { background: #211e2e; }
.tab { border: 0; background: none; color: var(--muted); font-size: 12px; padding: 4px 12px; border-radius: 12px; cursor: pointer; }
.tab.active { color: #6ea8ff; font-weight: 700; background: #eaf2ff; }
body.dark .tab.active { color: #9cc4ff; background: #2d3a55; }

.card { border-radius: 18px; padding: 14px; margin-bottom: 12px; }
.card .ct { font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.card.pink  { background: linear-gradient(135deg,#ffe4ec,#ffd6e3); } .card.pink  .ct { color: #d06a86; }
.card.blue  { background: linear-gradient(135deg,#e0edff,#d3e6ff); } .card.blue  .ct { color: #4a7bd6; }
.card.yellow{ background: linear-gradient(135deg,#fff3d6,#ffe9b8); } .card.yellow.ct { color: #c08a2d; }
.card.yellow .ct { color: #c08a2d; }
.card.green { background: linear-gradient(135deg,#e2f7e8,#d0f2dc); } .card.green .ct { color: #3d9a5c; }
.card.purple{ background: linear-gradient(135deg,#ece4ff,#e0d6ff); } .card.purple .ct { color: #7c6bd6; }
.card.orange{ background: linear-gradient(135deg,#ffe9d6,#ffddc2); } .card.orange .ct { color: #d97a2d; }
.card.mint  { background: linear-gradient(135deg,#dcf6ee,#c8efe2); } .card.mint  .ct { color: #2d9a77; }
.card.white { background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.05); }
body.dark .card.white { background: #2a2636; box-shadow: none; }

.mood-row { display: flex; justify-content: space-between; font-size: 22px; padding: 2px 4px; }
.mood-row span { opacity: .4; transition: .15s; cursor: pointer; }
.mood-row span.on { opacity: 1; transform: scale(1.35); }

.ring { width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ring-inner { width: 44px; height: 44px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: inherit; }
body.dark .ring-inner { background: #2a2636; }
.row { font-size: 13px; line-height: 1.9; }
.row.task-row { display: flex; align-items: center; gap: 6px; }
.row.task-row .task-title { flex: 1; min-width: 0; }
.row.task-row .st { margin-left: 0; }
.mut { color: var(--muted); }

.st { display: inline-block; border-radius: 8px; padding: 1px 7px; font-size: 11px; color: #fff; margin-left: 4px; }
.st-fr { background: #ff9f5a; } .st-bl { background: #5b8def; } .st-wk { background: #63d8a8; }
.pr { font-weight: 800; margin-right: 4px; }
.pr-1 { color: #ff7a70; } .pr-2 { color: #ff9f5a; } .pr-3 { color: #5b8def; } .pr-n { color: #c9c2d8; }

.task { background: #fff; border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
body.dark .task { background: #2a2636; box-shadow: none; }
.task.done { opacity: .6; }
.task-overdue { border: 1.5px solid #ffb3a6; }
.checkbox { width: 20px; height: 20px; border: 2px solid #6ea8ff; border-radius: 6px; flex-shrink: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; }
.checkbox.checked { background: #6ea8ff; }

.chips { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.chip { background: #fff; color: #6b6480; border-radius: 14px; padding: 5px 13px; font-size: 12px; white-space: nowrap; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
body.dark .chip { background: #2a2636; }
.chip.act { background: #6ea8ff; color: #fff; }

.group-label { font-size: 11px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.addbar { display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px dashed #e0d8d0; border-radius: 14px; padding: 12px; color: var(--muted); font-size: 13px; cursor: pointer; }
body.dark .addbar { background: #2a2636; border-color: #4a4358; }

.btn { border: 0; border-radius: 14px; padding: 10px; text-align: center; font-size: 13px; color: #fff; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,.12); }
.btn-blue { background: #6ea8ff; } .btn-org { background: #ffb86c; } .btn-grn { background: #63d8a8; }
.btn-row { display: flex; gap: 8px; margin-bottom: 12px; } .btn-row .btn { flex: 1; }

.habit-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.habit-row:last-child { border-bottom: 0; }
.habit-row > .habit-name { flex: 1; min-width: 0; }
.streak { color: #f5823b; font-weight: 700; width: 42px; text-align: center; flex-shrink: 0; margin: 0 4px; }
.check-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #63d8a8; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; background: transparent; flex-shrink: 0; }
.check-dot.checked { background: #63d8a8; }
.mini-btn { border: 0; background: #63d8a8; color: #fff; border-radius: 10px; padding: 3px 10px; font-size: 12px; cursor: pointer; flex-shrink: 0; }

.heat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.heat-cell { border-radius: 3px; height: 15px; background: #e8e4ef; }
body.dark .heat-cell { background: #3a3546; }
.heat-1 { background: #d3efd9; } .heat-2 { background: #a8e0b4; } .heat-3 { background: #4cb968; }

.progress { height: 9px; background: #fff; border-radius: 5px; overflow: hidden; margin: 7px 0 3px; }
body.dark .progress { background: #3a3546; }
.progress > div { height: 100%; background: #2d9a77; border-radius: 5px; }

.stat-row { display: flex; text-align: center; }
.stat-row > div { flex: 1; }
.stat-row b { font-size: 16px; display: block; }

.timer-display { font-size: 38px; font-weight: 800; text-align: center; color: #6a58c7; }
.timer-sub { font-size: 12px; color: #8d7fd0; text-align: center; margin: 4px 0 12px; }
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 46px; }
.bar-chart > div { flex: 1; background: #efeff4; border-radius: 3px; }
body.dark .bar-chart > div { background: #3a3546; }
.bar-chart > div.has { background: #5b8def; }
.bar-labels { display: flex; gap: 4px; margin-top: 4px; font-size: 10px; color: var(--muted); text-align: center; }
.bar-labels > span { flex: 1; }

.subject-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.swatch.sel { border-color: #6a58c7; box-shadow: 0 0 0 2px rgba(106,88,199,.4); }
.session-time { font-size: 24px; font-weight: 800; color: #6a58c7; line-height: 1.2; }

.review-item { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
body.dark .review-item { background: #2a2636; }
.review-mark { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; }
.mark-ok { background: #e2f7e8; } .mark-ing { background: #ffe9d6; } .mark-none { background: #ffe4ec; }
.warn-box { border: 1px solid #ffc9a6; border-radius: 14px; padding: 10px 12px; font-size: 12px; color: #a35b1e; display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }

form { display: flex; flex-direction: column; gap: 10px; }
label.f { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
input, select, textarea {
  border: 1px solid #e4deee; border-radius: 10px; padding: 9px 10px; font-size: 14px;
  background: #fff; color: var(--text); font-family: inherit; width: 100%;
}
body.dark input, body.dark select, body.dark textarea { background: #2a2636; border-color: #4a4358; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-width: 480px; background: #fff; border-radius: 20px 20px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 82vh; overflow-y: auto; }
body.dark .modal { background: #211e2e; }
.modal h3 { font-size: 15px; margin-bottom: 12px; }
.modal .btn { margin-top: 6px; }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: rgba(61,58,80,.92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13px; z-index: 60; opacity: 0; pointer-events: none; transition: .2s; }
#toast.show { opacity: 1; }

.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 13px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.badge-warn { background: #ffe9d6; color: #a35b1e; border-radius: 10px; padding: 3px 10px; font-size: 12px; }
.onboard { position: fixed; inset: 0; background: rgba(20,18,29,.82); color: #fff; z-index: 70; display: flex; align-items: center; justify-content: center; }
.onboard-card { background: #fff; color: var(--text); border-radius: 20px; padding: 24px 20px; width: 300px; text-align: center; }
.onboard-card h3 { margin-bottom: 10px; }
.onboard-card p { font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.7; }
.onboard-card .btn { width: 100%; }
.dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: #d9d2e6; }
.dots span.on { background: #6ea8ff; }

/* ===== 日历页 ===== */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.nav-btn { width: 30px; height: 30px; border: 0; border-radius: 50%; background: #f2ecff; color: #6a58c7; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
body.dark .nav-btn { background: #2d2a3d; color: #a78bfa; }
.cal-title { font-size: 16px; font-weight: 800; letter-spacing: .5px; min-width: 92px; text-align: center; }
.cal-today-btn { border: 0; background: #6ea8ff; color: #fff; border-radius: 12px; padding: 5px 12px; font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 6px rgba(110,168,255,.4); }
body.dark .cal-today-btn { background: #4a7bd6; }
.cal-card { background: #fff; border-radius: 18px; padding: 14px 12px; box-shadow: 0 3px 10px rgba(0,0,0,.05); }
body.dark .cal-card { background: #2a2636; box-shadow: none; }
.week-row { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.week-row .wkend { color: #f0a1a1; }
body.dark .week-row .wkend { color: #d98a8a; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell { aspect-ratio: 1/1; border-radius: 12px; background: #faf8fb; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; cursor: pointer; position: relative; transition: transform .12s, box-shadow .12s; }
body.dark .cal-cell { background: #332e42; }
.cal-cell:active { transform: scale(.96); }
.cal-cell .num { font-size: 13px; font-weight: 700; color: #6b6480; line-height: 1.3; width: 100%; text-align: center; }
body.dark .cal-cell .num { color: #c9c2d8; }
/* 每日完成率圆环（与今日页完成率同一口径） */
:root { --ring-track: #e6e1ec; }
body.dark { --ring-track: #4a4358; }
.cal-ring { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cal-ring-inner { width: 20px; height: 20px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; color: #6a58c7; }
body.dark .cal-ring-inner { background: #2a2636; }
.cal-cell .due { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: #ff7a70; box-shadow: 0 0 0 2px rgba(255,122,112,.25); }
/* 今天：蓝紫渐变高亮块 */
.cal-cell.today { background: linear-gradient(135deg, #7c6bd6, #6a58c7); box-shadow: 0 4px 12px rgba(106,88,199,.45); }
.cal-cell.today .num { color: #fff; font-size: 15px; }
.cal-cell.today .cal-ring-inner { background: #fff; }
/* 未来格：置灰不可看详情（无完成率圆环，只显示数字 + 截止标记） */
.cal-cell.future { opacity: .4; background: #f6f4f8; cursor: default; }
body.dark .cal-cell.future { background: #242030; }
.cal-cell.future .num { color: #b7b0c4; }
/* 非本月补格：完全空白占位（保网格对齐，不显示任何内容，避免上月/次月日期干扰当月边界） */
.cal-cell.other { background: transparent; box-shadow: none; }
.cal-hint { margin-top: 12px; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.7; }
