:root {
  --green: #07C160;
  --green-dark: #06AD56;
  --bg: #F6F7F9;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --sub: #888888;
  --line: #EDEDED;
  --red: #E24B4A;
  --amber: #EF9F27;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -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: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; font-size: 17px; }
.me-chip {
  font-size: 12px; color: var(--sub);
  background: var(--bg); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
}

/* 主区域 */
.view { flex: 1; padding: 14px 14px 90px; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 0 6px; text-decoration: none; color: var(--sub);
  display: flex; flex-direction: column; gap: 2px; font-size: 11px;
}
.tabbar a i { font-style: normal; font-size: 20px; }
.tabbar a.active { color: var(--green); font-weight: 600; }

/* 备案号 */
.beian { text-align: center; padding: 0 0 86px; font-size: 11px; }
.beian a { color: var(--sub); text-decoration: none; }

/* 卡片与通用 */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.sec-title { font-size: 13px; color: var(--sub); margin: 4px 2px 10px; }
.sub { color: var(--sub); font-size: 12px; line-height: 1.5; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: none; border-radius: 10px; padding: 9px 14px; font-size: 14px; cursor: pointer;
  background: var(--bg); color: var(--text);
}
.btn.primary { background: var(--green); color: #fff; font-weight: 600; }
.btn.danger { background: #FCEBEB; color: var(--red); }
.btn.block { width: 100%; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 目标横滑 */
.goal-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.goal-scroll::-webkit-scrollbar { display: none; }
.goal-card {
  flex: 0 0 auto; width: 168px; min-height: 96px;
  background: linear-gradient(135deg, #EAFBF1, #FFFFFF);
  border: 1px solid #D6F2E3; border-radius: var(--radius);
  padding: 12px; cursor: pointer; position: relative;
}
.goal-card .gname { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.goal-card .cd { font-size: 12px; color: var(--sub); }
.goal-card .cd b { color: var(--green); font-size: 16px; }
.goal-card.add-card { background: #FAFAFA; border: 1px dashed #CCC; display: flex; align-items: center; justify-content: center; color: var(--sub); }
.goal-manage {
  position: absolute; right: 8px; bottom: 8px;
  font-size: 11px; color: var(--sub); background: rgba(255,255,255,.8);
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
}

/* 任务行 */
.trow { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
.ticon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex: 0 0 auto; }
.tname { font-weight: 600; font-size: 14px; }
.trow .arr { color: #CCC; font-size: 18px; }
.dot-done { color: var(--green); font-weight: 700; }
.paused-tag { font-size: 10px; background: #EEE; color: var(--sub); padding: 1px 6px; border-radius: 4px; margin-left: 6px; }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 5px 12px; border-radius: 999px; font-size: 12px;
  background: #fff; border: 1px solid var(--line); color: var(--sub); cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.chip.ended { opacity: .55; }

/* 提醒横幅 */
.banner {
  display: flex; align-items: center; gap: 8px;
  background: #FFF6E8; border: 1px solid #FAC775; color: #854F0B;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}

/* 进度条 */
.pgbar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.pgfill { height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }
.stats3 { display: flex; text-align: center; margin-top: 10px; }
.stats3 > div { flex: 1; }
.stats3 b { display: block; font-size: 17px; }
.stats3 span { font-size: 11px; color: var(--sub); }
.bigpct { font-size: 30px; font-weight: 700; color: var(--green); text-align: center; }

/* 日历 */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head b { font-size: 16px; }
.cal-head .nav { display: flex; gap: 6px; }
.cal-head .nav button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 12px; cursor: pointer; font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .wd { text-align: center; font-size: 11px; color: var(--sub); padding: 4px 0; }
.cal-cell { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; background: #fff; border: 1px solid var(--line); cursor: pointer; position: relative; }
.cal-cell .lv { position: absolute; bottom: 4px; width: 6px; height: 6px; border-radius: 50%; }
.cal-cell.g { background: #EAF3DE; border-color: #97C459; }
.cal-cell.g .lv { background: #3B6D11; }
.cal-cell.y { background: #FAEEDA; border-color: #FAC775; }
.cal-cell.y .lv { background: #854F0B; }
.cal-cell.today { border: 2px solid var(--green); font-weight: 700; }
.cal-cell.empty { background: transparent; border: none; cursor: default; }

/* 弹层 */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; animation: fade .15s; }
.sheet {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 520px; z-index: 41;
  background: #fff; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto; animation: up .2s;
}
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateX(-50%) translateY(30px); opacity: .5 } }
.sheet h3 { font-size: 16px; margin-bottom: 14px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet .actions .btn { flex: 1; }
.form-item { margin-bottom: 14px; }
.form-item label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.form-item input[type=text], .form-item input[type=number], .form-item input[type=date], .form-item input[type=time], .form-item select, .form-item textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: var(--bg);
}
.form-item textarea { resize: vertical; min-height: 60px; }
.opt-row { display: flex; gap: 8px; flex-wrap: wrap; }
.opt {
  padding: 7px 14px; border-radius: 10px; font-size: 13px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line);
}
.opt.active { background: #EAFBF1; border-color: var(--green); color: var(--green-dark); font-weight: 600; }

/* 记录行 */
.rec { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.rec:last-child { border-bottom: none; }
.rec .rdot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: 0 0 auto; }

/* toast */
#toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 99; display: none; max-width: 80vw; text-align: center;
}

/* 我的页 */
.avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--green); color: #fff; font-size: 24px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.empty { text-align: center; color: var(--sub); font-size: 13px; padding: 30px 0; }
