:root {
  --brand: #2F4A36;
  --brand-2: #3F6349;
  --brand-soft: #E8EEE6;
  --gold: #C0983C;
  --bg: #F4F6F3;
  --card: #FFFFFF;
  --text: #1F2A24;
  --text-2: #5C6B61;
  --text-3: #93A096;
  --line: #E6EAE4;
  --red: #C0503F;
  --amber: #C08A2E;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 42, 36, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: #E9EDE7;
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: 76px;
  position: relative;
  overflow-x: hidden;
}

/* ---------- 顶部 ---------- */
.topbar {
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 14px 18px 20px;
  border-radius: 0 0 22px 22px;
}
.topbar .row1 { display: flex; align-items: center; justify-content: space-between; }
.topbar .store { font-size: 17px; font-weight: 600; letter-spacing: .3px; }
.topbar .sub { font-size: 12px; opacity: .78; margin-top: 3px; }
.badge-lv {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
}
.topbar .date { font-size: 12px; opacity: .72; margin-top: 12px; }

.search {
  margin-top: 14px; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px; padding: 9px 12px; font-size: 13px; color: rgba(255,255,255,.85);
}

/* ---------- 通用 ---------- */
.section { padding: 16px 16px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.section-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.section-head a { font-size: 12px; color: var(--text-3); text-decoration: none; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px;
}
.muted { color: var(--text-2); font-size: 13px; }
.tiny { color: var(--text-3); font-size: 12px; }

/* ---------- 待办 ---------- */
.todo {
  display: flex; gap: 12px; padding: 13px 14px; align-items: flex-start;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 10px; cursor: pointer; transition: transform .12s;
}
.todo:active { transform: scale(.99); }
.todo .dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 8px;
  background: var(--text-3);
}
.todo.urgent .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(192,80,63,.12); }
.todo .body { flex: 1; min-width: 0; }
.todo .t { font-size: 14px; font-weight: 600; line-height: 1.4; }
.todo .d { font-size: 12.5px; color: var(--text-2); margin-top: 4px; line-height: 1.45; }
.todo .meta { font-size: 11.5px; color: var(--text-3); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.todo .done {
  font-size: 11px; color: var(--brand); border: 1px solid var(--brand-soft);
  background: var(--brand-soft); padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.chip {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: #F0F2EF; color: var(--text-2);
}
.chip.red { background: #FBEDEB; color: var(--red); }
.chip.amber { background: #FBF3E4; color: var(--amber); }
.chip.green { background: var(--brand-soft); color: var(--brand); }

/* ---------- 快捷入口 ---------- */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.entry {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 6px 12px; text-align: center; cursor: pointer;
}
.entry .ico { font-size: 20px; line-height: 1; }
.entry .lb { font-size: 12px; color: var(--text-2); margin-top: 8px; }
.entry:active { transform: scale(.97); }

/* ---------- 学习 ---------- */
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 0; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; font-size: 13px; padding: 7px 14px; border-radius: 999px;
  background: #fff; color: var(--text-2); border: 1px solid var(--line); cursor: pointer;
}
.cat.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.lesson {
  display: flex; gap: 12px; padding: 13px; background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; cursor: pointer;
}
.lesson .thumb {
  width: 56px; height: 56px; flex: 0 0 56px; border-radius: 10px;
  background: linear-gradient(145deg, #EDF1EA, #DDE5D9);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--brand);
}
.lesson .t { font-size: 14px; font-weight: 600; line-height: 1.4; }
.lesson .d { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.lesson .m { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.tag-new {
  font-size: 10px; font-weight: 700; color: #fff; background: var(--red);
  border-radius: 4px; padding: 1px 5px; margin-right: 5px; vertical-align: 1px;
}

/* ---------- 我的 ---------- */
.profile { display: flex; gap: 14px; align-items: center; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: 0 0 52px;
  background: var(--brand); color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 20px; font-weight: 600;
}
.kv { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--text-3); }
.kv .v { color: var(--text); text-align: right; max-width: 60%; }

/* ---------- 底部 tab ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 0 8px; z-index: 30;
}
.tabbar div {
  text-align: center; font-size: 11px; color: var(--text-3); padding: 4px 0; cursor: pointer;
}
.tabbar div .i { font-size: 19px; display: block; line-height: 1.2; }
.tabbar div.on { color: var(--brand); font-weight: 600; }

/* ---------- 下单弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(20,28,23,.42); z-index: 40;
  display: none; align-items: flex-end; justify-content: center;
}
.mask.on { display: flex; }
.sheet {
  width: 100%; max-width: 480px; background: #fff; border-radius: 20px 20px 0 0;
  padding: 20px 20px 26px;
}
.sheet h3 { margin: 0 0 4px; font-size: 17px; }
.sheet .steps { margin: 14px 0 16px; padding: 0; list-style: none; }
.sheet .steps li { font-size: 13px; color: var(--text-2); padding-left: 22px; position: relative; margin-bottom: 9px; }
.sheet .steps li b {
  position: absolute; left: 0; top: 1px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.qrbox {
  border: 1px dashed #CBD5C8; border-radius: 12px; padding: 18px;
  text-align: center; background: #FAFBF9;
}
.qrbox .ph {
  width: 132px; height: 132px; margin: 0 auto 10px; border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, #2F4A36 0 6px, transparent 6px 12px),
    repeating-linear-gradient(90deg, #2F4A36 0 6px, transparent 6px 12px);
  opacity: .16;
}
.btn {
  display: block; width: 100%; text-align: center; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 600;
  padding: 13px; border-radius: 12px; margin-top: 14px; font-family: inherit;
}
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn:active { opacity: .9; }

/* ---------- 详情页 ---------- */
.detail-head { padding: 16px 18px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.detail-body { padding: 16px 18px; }
.detail-body h4 { font-size: 14px; margin: 18px 0 8px; }
.detail-body p, .detail-body li { font-size: 13.5px; color: var(--text-2); line-height: 1.75; }
.back {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px;
  color: var(--text-2); cursor: pointer; margin-bottom: 10px;
}
.empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 40px 0; }

/* ---------- 登录 ---------- */
.login { padding: 56px 26px 0; }
.login .logo-img { display: block; width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 18px; box-shadow: 0 2px 10px rgba(47,74,54,.14); }
.login .logo { font-size: 26px; font-weight: 700; color: var(--brand); letter-spacing: 3px; text-align: center; }
.login .login-sub { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 6px; letter-spacing: 1px; }
.login-card { margin-top: 30px; background: #fff; border-radius: 16px; padding: 20px 18px 22px; box-shadow: var(--shadow); }
.login-card label { display: block; font-size: 12.5px; color: var(--text-3); margin: 12px 0 6px; }
.login-card input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font-size: 15px; font-family: inherit; outline: none; background: #FAFBF9;
}
.login-card input:focus { border-color: var(--brand); background: #fff; }
.login-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin-top: 8px; }

/* ---------- 顶部变体 ---------- */
.topbar.sub-top { padding-bottom: 16px; }

/* ---------- 成本卡 ---------- */
.cost-sum { display: flex; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 8px; }
.cost-sum > div { flex: 1; text-align: center; }
.cost-sum .n { font-size: 17px; font-weight: 700; }
.cost-sum .l { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
