/* 生活控制台 · 暗夜智感 2.0 */
:root {
  --bg: #0B0F1A;
  --bg-2: #101626;
  --glass: rgba(24, 32, 52, .66);
  --glass-soft: rgba(24, 32, 52, .38);
  --glass-border: rgba(140, 160, 210, .14);
  --text: #E9EEF9;
  --text-soft: #8C97B2;
  --teal: #4FC3A1;
  --blue: #5B8DEF;
  --violet: #8B7BF7;
  --amber: #F0B45C;
  --coral: #F07A6A;
  --grad: linear-gradient(135deg, #4FC3A1, #5B8DEF);
  --grad-v: linear-gradient(135deg, #8B7BF7, #5B8DEF);
  --r-lg: 20px;
  --r-md: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; color: var(--text); }
.num { font-variant-numeric: tabular-nums; }
.accent {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- 背景光斑 ---------- */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.orb-1 { width: 420px; height: 420px; left: -120px; top: -100px; background: #1d5f50; animation: drift 26s ease-in-out infinite alternate; }
.orb-2 { width: 380px; height: 380px; right: -140px; top: 30%; background: #2b3f78; animation: drift 32s ease-in-out infinite alternate-reverse; }
.orb-3 { width: 300px; height: 300px; left: 30%; bottom: -140px; background: #3a2f6e; opacity: .25; animation: drift 38s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(60px, 40px) scale(1.12); }
}

/* ---------- 玻璃卡片 ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.glass-soft {
  background: var(--glass-soft);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.glass-strong {
  background: rgba(16, 22, 38, .82);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 350px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 44px 32px 26px;
  text-align: center;
  animation: rise .6s cubic-bezier(.2,.9,.3,1.2) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(28px) scale(.97); } to { opacity: 1; transform: none; } }
.login-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.login-card h1 {
  font-size: 24px; letter-spacing: .1em; font-weight: 700;
  background: linear-gradient(135deg, #E9EEF9, #9FB4E8);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-sub { color: var(--text-soft); font-size: 13px; margin: 6px 0 28px; letter-spacing: .06em; }
.login-card input {
  width: 100%; padding: 13px 16px; font-size: 15px;
  border: 1px solid var(--glass-border);
  background: rgba(11, 15, 26, .5);
  border-radius: 14px; margin-bottom: 14px; outline: none;
  transition: border .2s, box-shadow .2s;
}
.login-card input:focus { border-color: rgba(79,195,161,.6); box-shadow: 0 0 0 3px rgba(79,195,161,.12); }
.login-card button {
  width: 100%; padding: 13px; font-size: 15px; font-weight: 600; letter-spacing: .2em; text-indent: .2em;
  background: var(--grad); color: #0B0F1A;
  border-radius: 14px; transition: transform .15s, box-shadow .2s;
}
.login-card button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(79,195,161,.25); }
.login-card button:active { transform: scale(.98); }
.login-err { color: var(--coral); font-size: 13px; min-height: 20px; margin-top: 12px; }
.login-hint { color: var(--text-soft); font-size: 12px; }

/* ---------- 布局 ---------- */
.app { max-width: 760px; margin: 0 auto; padding: 0 16px calc(110px + env(safe-area-inset-bottom)); }
.view { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.section-title {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 4px 12px;
}
.section-title h2 { font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.pill {
  font-size: 12px; color: var(--text-soft);
  background: var(--glass-soft);
  border: 1px solid var(--glass-border);
  padding: 2px 12px; border-radius: 999px;
}

/* ---------- 英雄区 ---------- */
.hero {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 22px; margin-top: 22px;
}
.hero-date { color: var(--text-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.hero-greeting {
  font-size: 26px; font-weight: 700; margin: 2px 0 4px;
  background: linear-gradient(120deg, #FFFFFF 20%, #A9C3FF 80%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub { color: var(--text-soft); font-size: 13px; }
.hero-sub strong { color: var(--teal); font-weight: 600; }
.hero-ring { flex-shrink: 0; }

/* ---------- 习惯 ---------- */
.habit-grid { display: flex; flex-direction: column; gap: 10px; }
.habit-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 14px 16px;
  transition: transform .15s, border-color .2s;
}
.habit-item:hover { transform: translateY(-1px); border-color: rgba(79,195,161,.35); }
.habit-item.done { border-color: rgba(79,195,161,.5); }
.habit-ring { flex-shrink: 0; position: relative; width: 44px; height: 44px; }
.habit-ring svg { transform: rotate(-90deg); }
.habit-ring .ring-track { stroke: rgba(140,160,210,.15); }
.habit-ring .ring-fill { stroke: url(#gradStroke); transition: stroke-dashoffset .6s cubic-bezier(.3,.8,.3,1); }
.habit-ring .ring-check {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-soft); font-weight: 600;
}
.habit-item.done .ring-check { color: var(--teal); animation: pop .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.habit-info { flex: 1; min-width: 0; }
.habit-name { font-size: 15px; font-weight: 600; }
.habit-note { font-size: 12px; color: var(--text-soft); margin-left: 8px; }
.habit-streak {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; color: var(--amber); margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.habit-del { font-size: 12px; color: var(--text-soft); opacity: .55; padding: 6px; }
.habit-del:hover { opacity: 1; color: var(--coral); }

/* ---------- 任务 ---------- */
.task-timeline { padding: 6px 18px; }
.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(140,160,210,.08);
  position: relative;
}
.task-row:last-child { border-bottom: none; }
.task-check {
  width: 22px; height: 22px; flex-shrink: 0;
  border: 2px solid rgba(140,160,210,.4);
  border-radius: 7px; position: relative;
  transition: all .2s;
}
.task-check:hover { border-color: var(--teal); }
.task-row.done .task-check {
  background: var(--grad); border-color: transparent;
  animation: pop .35s cubic-bezier(.2,1.6,.4,1);
}
.task-row.done .task-check::after {
  content: ""; position: absolute; left: 5px; top: 1px;
  width: 6px; height: 11px;
  border: solid #0B0F1A; border-width: 0 2.5px 2.5px 0;
  transform: rotate(42deg);
}
.task-title { flex: 1; font-size: 15px; min-width: 0; }
.task-row.done .task-title { color: var(--text-soft); text-decoration: line-through; }
.task-goal { font-size: 12px; color: var(--violet); margin-left: 6px; }
.task-min {
  font-size: 12px; color: var(--text-soft);
  background: rgba(140,160,210,.1);
  padding: 2px 10px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.task-min.hot { color: #0B0F1A; background: var(--teal); font-weight: 600; }
.task-del { font-size: 12px; color: var(--text-soft); opacity: .5; padding: 6px; }
.task-del:hover { opacity: 1; color: var(--coral); }

/* ---------- 快记 ---------- */
.quick-card { padding: 6px 20px; }
.quick-block { padding: 16px 0; border-bottom: 1px solid rgba(140,160,210,.08); }
.quick-block-last { border-bottom: none; }
.quick-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 10px; }
.quick-head .accent { font-size: 16px; font-weight: 700; }
.meter {
  height: 10px; background: rgba(140,160,210,.12);
  border-radius: 999px; overflow: hidden; margin-bottom: 12px;
  max-width: 420px;
}
.meter-fill { height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.3,.8,.3,1); }
.water-fill { background: var(--grad); box-shadow: 0 0 12px rgba(91,141,239,.4); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  color: var(--text);
  background: rgba(140,160,210,.1);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  transition: all .15s;
}
.chip:hover { background: rgba(79,195,161,.16); border-color: rgba(79,195,161,.4); color: var(--teal); }
.chip:active { transform: scale(.94); }
.quick-note-card { padding: 14px 16px 10px; }

/* ---------- 输入 ---------- */
.inline-input {
  flex: 1; min-width: 0; padding: 10px 14px; font-size: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(11, 15, 26, .45);
  border-radius: 12px; outline: none;
  transition: border .2s;
}
.inline-input:focus { border-color: rgba(79,195,161,.6); }
.inline-input::placeholder { color: var(--text-soft); }
.inline-num { flex: 0 0 90px; }
.inline-num.wide { flex: 1; max-width: 200px; }
.inline-date { flex: 0 0 150px; color-scheme: dark; }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row-col { flex-direction: column; }
.add-row-col .add-row { margin-top: 8px; }
.btn-mini {
  flex-shrink: 0; padding: 10px 18px; font-size: 14px; font-weight: 600;
  background: var(--grad); color: #0B0F1A;
  border-radius: 12px;
  transition: transform .15s, box-shadow .2s;
}
.btn-mini:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79,195,161,.3); }
.btn-mini:active { transform: scale(.97); }
.note-input {
  width: 100%; padding: 12px; font-size: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(11, 15, 26, .45);
  border-radius: 14px;
  resize: vertical; outline: none;
}
.note-input:focus { border-color: rgba(79,195,161,.6); }
.note-send { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ---------- 数据 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.stat-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 18px 14px 14px;
  text-align: center;
}
.stat-card .stat-num {
  font-size: 30px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card.hot .stat-num { background: linear-gradient(135deg, #F0B45C, #F07A6A); -webkit-background-clip: text; background-clip: text; }
.stat-card .stat-label { font-size: 12px; color: var(--text-soft); margin-top: 4px; }

.heat-card { padding: 20px; }
.heatmap {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px;
  max-width: 460px;
}
.heatmap i { display: block; aspect-ratio: 1; border-radius: 4px; background: rgba(140,160,210,.1); transition: transform .1s; }
.heatmap i:hover { transform: scale(1.2); }
.heatmap i.h0 { background: rgba(140,160,210,.1); }
.heatmap i.h1 { background: rgba(79,195,161,.3); }
.heatmap i.h2 { background: rgba(79,195,161,.6); }
.heatmap i.h3 { background: var(--teal); box-shadow: 0 0 6px rgba(79,195,161,.5); }
.heat-legend { font-size: 11px; color: var(--text-soft); margin-top: 12px; }
.heat-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 2px; }
.heat-legend i.h0 { background: rgba(140,160,210,.1); }
.heat-legend i.h1 { background: rgba(79,195,161,.3); }
.heat-legend i.h2 { background: rgba(79,195,161,.6); }
.heat-legend i.h3 { background: var(--teal); }

.metric-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.metric-tab {
  font-size: 12px; padding: 4px 12px;
  color: var(--text-soft);
  background: var(--glass-soft);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  transition: all .15s;
}
.metric-tab.active {
  color: #0B0F1A; background: var(--grad); border-color: transparent; font-weight: 600;
}
.chart-card { padding: 18px 18px 12px; }
.metric-empty { color: var(--text-soft); font-size: 13px; padding: 24px 0; text-align: center; }
.week-card { padding: 6px 20px; }
.stat-list { list-style: none; }
.stat-list li {
  display: flex; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid rgba(140,160,210,.08);
  font-size: 14px;
}
.stat-list li:last-child { border-bottom: none; }
.stat-list .num { color: var(--teal); font-weight: 600; }

/* ---------- 目标 ---------- */
.hint-banner {
  font-size: 13px; color: var(--text-soft);
  padding: 13px 16px; margin-top: 22px;
  border-left: 3px solid var(--teal);
}
.goal-list { display: flex; flex-direction: column; gap: 14px; }
.goal-item {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 18px 18px 12px;
}
.goal-head { display: flex; align-items: center; gap: 14px; }
.goal-ring { flex-shrink: 0; position: relative; width: 58px; height: 58px; }
.goal-ring svg { transform: rotate(-90deg); }
.goal-ring .ring-track { stroke: rgba(140,160,210,.15); }
.goal-ring .ring-fill { stroke: url(#gradStroke); transition: stroke-dashoffset .8s cubic-bezier(.3,.8,.3,1); }
.goal-ring .goal-pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.goal-main { flex: 1; min-width: 0; }
.goal-title { font-size: 16px; font-weight: 700; }
.goal-deadline { font-size: 12px; color: var(--amber); margin-left: 8px; white-space: nowrap; }
.goal-note { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.goal-count-text { font-size: 12px; color: var(--text-soft); margin-top: 2px; font-variant-numeric: tabular-nums; }
.goal-done-btn { font-size: 12px; color: var(--text-soft); padding: 6px; white-space: nowrap; }
.goal-done-btn:hover { color: var(--teal); }
.goal-tasks { margin-top: 12px; border-top: 1px solid rgba(140,160,210,.08); padding-top: 4px; }
.goal-task-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; padding: 8px 0;
}
.goal-task-row .dot-mini { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); flex-shrink: 0; }
.goal-task-row.done .dot-mini { background: var(--text-soft); }
.task-title-sm { flex: 1; min-width: 0; }
.goal-task-row.done .task-title-sm { color: var(--text-soft); text-decoration: line-through; }
.gt-date { color: var(--text-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.goal-add-task { display: flex; gap: 8px; padding: 8px 0 6px; border-top: 1px solid rgba(140,160,210,.08); margin-top: 4px; }
.goals-empty { text-align: center; color: var(--text-soft); padding: 30px 0; font-size: 13px; }

/* ---------- 手记 ---------- */
.search-input {
  width: 100%; padding: 12px 16px; font-size: 14px;
  color: var(--text);
  margin: 0 0 14px; outline: none;
}
.search-input::placeholder { color: var(--text-soft); }
.search-input:focus { border-color: rgba(79,195,161,.6); }
.notes-card { padding: 4px 20px; max-height: 64vh; overflow-y: auto; }
.notes-list { list-style: none; }
.note-date {
  font-size: 13px; font-weight: 600; color: var(--teal);
  padding: 14px 0 4px; letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
}
.note-item { padding: 8px 0; border-bottom: 1px solid rgba(140,160,210,.08); }
.note-item:last-child { border-bottom: none; }
.note-content { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.note-content .tag { color: var(--blue); margin-right: 6px; }
.note-meta { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.note-del { color: var(--text-soft); opacity: .5; }
.note-del:hover { opacity: 1; color: var(--coral); }
.notes-empty { text-align: center; color: var(--text-soft); padding: 30px 0; font-size: 13px; }

/* ---------- 悬浮导航 ---------- */
.tabbar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 2px;
  border-radius: 999px;
  padding: 6px;
  z-index: 10;
  box-shadow: 0 10px 34px rgba(0,0,0,.45);
  width: min(92vw, 420px);
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 0 7px;
  color: var(--text-soft);
  border-radius: 999px;
  font-size: 11px;
  transition: all .2s;
}
.tab svg { opacity: .8; }
.tab.active {
  color: #0B0F1A;
  background: var(--grad);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(79,195,161,.35);
}
.tab.active svg { opacity: 1; }
.tab:active { transform: scale(.95); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%) translateY(8px);
  color: var(--text);
  font-size: 13px; padding: 10px 20px;
  border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: all .25s cubic-bezier(.3,.8,.3,1);
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .hero { padding: 20px 18px; }
  .hero-greeting { font-size: 22px; }
  .stat-row { gap: 8px; }
  .stat-card .stat-num { font-size: 24px; }
  .inline-date { flex: 1; }
}
@media (min-width: 720px) {
  .app { padding-bottom: 60px; }
  .habit-grid { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
