* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --primary: #ff8a3d;
  --primary-dark: #f2701a;
  --ink: #2b2d42;
  --muted: #8a8fa3;
  --line: #eceef3;
  --green: #38b000;
  --red: #e63946;
  --blue: #3a86ff;
  --shadow: 0 4px 16px rgba(43,45,66,.06);
}
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
}
.hidden { display: none !important; }
button, input, select, textarea { font-family: inherit; font-size: 15px; color: var(--ink); }

/* ---------- 通用控件 ---------- */
.btn { border: none; border-radius: 10px; padding: 11px 18px; cursor: pointer; font-weight: 600; transition: .15s; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; display: block; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }

.card { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.page-head h2 { font-size: 19px; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, #fff4ea 0%, #f5f6fa 55%); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; padding: 30px 24px; box-shadow: var(--shadow); }
.auth-logo { font-size: 46px; text-align: center; }
.auth-card h1 { text-align: center; font-size: 24px; margin: 6px 0 2px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.tabs-line { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 2px solid var(--line); }
.tab-line { flex: 1; background: none; border: none; padding: 10px; font-size: 15px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-line.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.auth-tip { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }

/* ---------- 主框架 ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 74px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px; background: #fff; position: sticky; top: 0; z-index: 10; box-shadow: var(--shadow); }
.app-title { font-size: 19px; font-weight: 700; }
.app-sub { font-size: 12px; color: var(--muted); }
.content { padding: 14px; }

/* ---------- 首页：主汇总卡 ---------- */
.hero-card {
  background: linear-gradient(135deg, #ff9a5a, #ff7a3d);
  color: #fff; border-radius: 16px; padding: 18px 18px 16px; margin-bottom: 18px;
  box-shadow: 0 6px 20px rgba(255,122,61,.28);
}
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.hero-emoji { font-size: 34px; line-height: 1; flex: 0 0 auto; }
.hero-title { font-size: 17px; font-weight: 700; }
.hero-sub { font-size: 12px; opacity: .88; margin-top: 3px; }
.hero-body {
  display: flex; align-items: stretch; gap: 16px;
  background: rgba(255,255,255,.16); border-radius: 12px; padding: 12px 16px;
}
.hero-total { flex: 1.2; min-width: 0; }
.hero-total .hs-label { font-size: 12px; opacity: .85; }
.hero-total .hs-num { margin-top: 2px; font-weight: 700; line-height: 1.2; }
.hero-total .hs-num span { font-size: 30px; }
.hero-total .hs-num i { font-style: normal; font-size: 14px; margin-left: 4px; opacity: .9; }
.hero-side {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding-left: 16px; border-left: 1px solid rgba(255,255,255,.35);
}
.hero-mini { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hero-mini span { font-size: 12px; opacity: .85; }
.hero-mini b { font-size: 16px; font-weight: 700; }
.hero-mini b.up::before { content: "+"; font-size: 12px; }
.hero-mini b.down::before { content: "-"; font-size: 12px; }

/* ---------- 首页：节标题 ---------- */
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.sub-title {
  font-size: 15px; color: var(--ink); position: relative; padding-left: 10px;
}
.sub-title::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 14px; border-radius: 2px; background: var(--primary);
}
.link-btn {
  border: none; background: none; color: var(--primary); font-size: 13px;
  cursor: pointer; padding: 4px 2px; font-weight: 500;
}

/* ---------- 首页：孩子积分卡 ---------- */
.kid-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.kid-grid .empty { grid-column: 1 / -1; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 28px 20px; }
.kid-card:only-child { grid-column: 1 / -1; }
.kid-card {
  background: #fff; border-radius: 14px; padding: 12px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.kid-card .avatar { font-size: 28px; flex: 0 0 auto; }
.kid-card .kinfo { flex: 1; min-width: 0; }
.kid-card .kname { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid-card .kdesc { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid-card .kpoints { flex: 0 0 auto; color: var(--primary); font-weight: 700; font-size: 18px; }
.kid-card .kpoints small { font-size: 11px; margin-left: 1px; font-weight: 400; color: var(--muted); }

/* ---------- 列表项 ---------- */
.item { background: #fff; border-radius: 12px; padding: 13px 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; }
.item-ico { font-size: 28px; flex: 0 0 auto; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; font-size: 15px; }
.item-desc { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-val { font-weight: 700; color: var(--primary); white-space: nowrap; }
.item-val.green { color: var(--green); }
.item-val.red { color: var(--red); }
.item-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.icon-btn { border: none; background: #f5f6fa; color: var(--ink); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 14px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #f0f2f7; color: var(--muted); margin-left: 6px; }
.badge.pending { background: #fff3e6; color: var(--primary-dark); }
.badge.approved { background: #e8f5e9; color: var(--green); }
.badge.rejected { background: #fdecea; color: var(--red); }
.badge.fulfilled { background: #e8f0fe; color: var(--blue); }

/* ---------- 分段控件 ---------- */
.seg { display: flex; background: #eceef3; border-radius: 10px; padding: 3px; margin-bottom: 14px; gap: 3px; overflow-x: auto; }
.seg-btn { flex: 1; border: none; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13px; white-space: nowrap; }
.seg-btn.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.balance-line { background: #fff7ef; color: var(--primary-dark); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.task-hint { font-size: 12px; color: var(--muted); margin: -6px 0 14px; }

/* ---------- 底部导航 ---------- */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; max-width: 560px; margin: 0 auto; display: flex; background: #fff; box-shadow: 0 -2px 16px rgba(43,45,66,.08); z-index: 10; }
.nav-item { flex: 1; border: none; background: none; padding: 9px 0 11px; cursor: pointer; color: var(--muted); font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.nav-item span { font-size: 20px; }
.nav-item.active { color: var(--primary); font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(43,45,66,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-box { background: #fff; border-radius: 16px; width: 100%; max-width: 420px; max-height: 85vh; overflow-y: auto; padding: 20px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; }
.modal-close { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal-foot { display: flex; gap: 10px; margin-top: 8px; }
.modal-foot .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 10px; z-index: 200; box-shadow: var(--shadow); font-size: 14px; max-width: 90vw; text-align: center; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }

/* ---------- 顶部操作区 ---------- */
.top-actions { display: flex; gap: 8px; }

/* ---------- 首页：任务完成进度 ---------- */
.progress-card { padding: 16px; margin-bottom: 14px; }
.progress-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.progress-head span:last-child { color: var(--primary); }
.progress-track { height: 10px; background: #eceef3; border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #ffb067, var(--primary)); border-radius: 10px; transition: width .3s; }
.progress-detail { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.progress-detail .chip {
  display: inline-block; font-size: 12px; color: var(--primary-dark);
  background: #fff4ea; border-radius: 999px; padding: 3px 10px;
}
.progress-detail .chip.done { background: #e8f5e9; color: var(--green); }

/* ---------- 今日任务项 ---------- */
.task-item { flex-wrap: wrap; }
.task-item .item-actions { margin-left: auto; }
.tool-row { display: flex; gap: 10px; margin-top: 14px; }
.tool-row .btn { flex: 1; }
