/* 家庭工作台 - 手机优先样式 */
:root {
  --primary: #2f6f4f;
  --primary-dark: #24573e;
  --primary-light: #e8f3ec;
  --accent: #e8a33d;
  --danger: #d9534f;
  --text: #2b2b2b;
  --muted: #8a8a8a;
  --bg: #f6f8f7;
  --card: #ffffff;
  --border: #e5e9e7;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
}
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html { font-size:16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height:1.5;
  padding-bottom: 72px;
}
#app { max-width: 640px; margin: 0 auto; }
.page { padding: 16px 16px 24px; animation: fade .2s ease; }
@keyframes fade { from {opacity:0; transform:translateY(6px);} to {opacity:1; transform:none;} }

/* 顶部栏 */
.topbar {
  position: sticky; top:0; z-index:20; background:var(--primary);
  color:#fff; padding:14px 16px calc(14px + env(safe-area-inset-top));
  display:flex; align-items:center; gap:10px; font-weight:600; font-size:17px;
}
.topbar .sub { font-weight:400; font-size:13px; opacity:.85; margin-left:auto; }
.topbar button { background:transparent; border:none; color:#fff; font-size:15px; padding:4px 6px; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom:0; left:0; right:0; z-index:30;
  background:#fff; border-top:1px solid var(--border);
  display:flex; padding-bottom: env(safe-area-inset-bottom);
  max-width:640px; margin:0 auto;
}
.tabbar a {
  flex:1; text-align:center; padding:9px 2px 7px; color:var(--muted);
  text-decoration:none; font-size:11px; display:flex; flex-direction:column; gap:2px;
}
.tabbar a .ic { font-size:20px; line-height:1; }
.tabbar a.active { color:var(--primary); font-weight:600; }

/* 卡片 */
.card {
  background:var(--card); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:16px; margin-bottom:14px;
}
.card h3 { font-size:15px; margin-bottom:10px; display:flex; align-items:center; gap:6px; }
.card .muted { color:var(--muted); font-size:12px; }

/* 统计 */
.stat-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:14px; }
.stat { background:var(--card); border-radius:var(--radius); box-shadow:var(--shadow); padding:12px; text-align:center; }
.stat .v { font-size:19px; font-weight:700; }
.stat .l { font-size:12px; color:var(--muted); margin-top:2px; }
.stat.income .v { color:var(--primary); }
.stat.expense .v { color:var(--danger); }

/* 按钮 */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  background:var(--primary); color:#fff; border:none; border-radius:10px;
  padding:12px 18px; font-size:15px; font-weight:600; cursor:pointer; width:100%;
}
.btn:active { transform:scale(.98); }
.btn.secondary { background:var(--primary-light); color:var(--primary-dark); }
.btn.danger { background:#fdecec; color:var(--danger); }
.btn.small { padding:7px 12px; font-size:13px; width:auto; }
.btn-row { display:flex; gap:10px; }
.btn-row .btn { flex:1; }

/* 表单 */
.field { margin-bottom:12px; }
.field label { display:block; font-size:13px; color:var(--muted); margin-bottom:5px; }
.field input, .field select, .field textarea {
  width:100%; padding:11px 12px; border:1px solid var(--border); border-radius:10px;
  font-size:15px; background:#fff; outline:none; font-family:inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color:var(--primary); }
.field textarea { min-height:70px; resize:vertical; }
.row2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

/* 列表 */
.list { list-style:none; }
.list li {
  display:flex; align-items:center; gap:10px; padding:12px 0;
  border-bottom:1px solid var(--border); font-size:14px;
}
.list li:last-child { border-bottom:none; }
.list .amount { margin-left:auto; font-weight:700; }
.list .amount.exp { color:var(--danger); }
.list .amount.inc { color:var(--primary); }
.list .tag { font-size:11px; background:var(--primary-light); color:var(--primary-dark); padding:2px 8px; border-radius:20px; white-space:nowrap; }

/* 分段选择 */
.seg { display:flex; background:#eef1f0; border-radius:10px; padding:3px; margin-bottom:14px; }
.seg button {
  flex:1; border:none; background:transparent; padding:8px; border-radius:8px;
  font-size:14px; color:var(--muted); cursor:pointer;
}
.seg button.active { background:#fff; color:var(--text); font-weight:600; box-shadow:0 1px 4px rgba(0,0,0,.08); }

/* 成员头像 */
.avatar {
  width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-size:16px; font-weight:700; color:#fff; flex-shrink:0;
}
.avatar.dad { background:#5b8dd9; } .avatar.mom { background:#e07a9c; }
.avatar.child1 { background:#7ac26c; } .avatar.child2 { background:#e8a33d; }
.avatar.member { background:#9aa7b5; }

/* 成员选择 */
.member-tabs { display:flex; gap:8px; overflow-x:auto; padding-bottom:8px; margin-bottom:14px; }
.member-tabs .mt {
  padding:8px 14px; border-radius:20px; background:#eef1f0; font-size:14px;
  white-space:nowrap; cursor:pointer; border:none; color:var(--text);
}
.member-tabs .mt.active { background:var(--primary); color:#fff; font-weight:600; }

/* 气泡文字（AI结果） */
.ai-box {
  background:var(--primary-light); border-radius:12px; padding:14px; font-size:14px;
  white-space:pre-wrap; margin-top:10px; line-height:1.7;
}
.ai-box .t { font-weight:700; color:var(--primary-dark); margin-bottom:6px; }

/* Toast */
#toast {
  position:fixed; top:60px; left:50%; transform:translateX(-50%); z-index:99;
  background:rgba(0,0,0,.82); color:#fff; padding:10px 18px; border-radius:20px;
  font-size:14px; max-width:86%; text-align:center; display:none;
}
#toast.show { display:block; animation:fade .2s; }

/* 登录页 */
.login-wrap { min-height:100vh; display:flex; flex-direction:column; justify-content:center; padding:24px; background:linear-gradient(160deg,#2f6f4f,#3d8a63); }
.login-wrap .logo { color:#fff; text-align:center; margin-bottom:30px; }
.login-wrap .logo h1 { font-size:26px; margin-bottom:6px; }
.login-wrap .logo p { opacity:.85; font-size:13px; }
.login-card { background:#fff; border-radius:18px; padding:22px; box-shadow:0 8px 30px rgba(0,0,0,.18); }
.login-card .tabs { display:flex; margin-bottom:18px; }
.login-card .tabs button { flex:1; background:none; border:none; padding:10px; font-size:15px; color:var(--muted); border-bottom:2px solid var(--border); cursor:pointer; }
.login-card .tabs button.active { color:var(--primary); border-color:var(--primary); font-weight:700; }

/* 空状态 */
.empty { text-align:center; color:var(--muted); padding:36px 0; font-size:14px; }

/* 预警条 */
.warn-bar { background:#fff6e8; border:1px solid #f3d9a4; color:#8a6420; border-radius:10px; padding:10px 12px; font-size:13px; margin-bottom:12px; }

/* 进度 */
.bar { height:8px; background:#eef1f0; border-radius:5px; overflow:hidden; margin-top:6px; }
.bar i { display:block; height:100%; background:var(--primary); }
.bar i.over { background:var(--danger); }

/* 月份选择 */
.month-nav { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.month-nav button { background:#eef1f0; border:none; border-radius:8px; padding:6px 12px; font-size:14px; cursor:pointer; }
.month-nav .cur { font-weight:700; font-size:15px; }

/* 复习/提醒条目 */
.due-item { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); font-size:14px; }
.due-item .rd { width:34px; height:34px; border-radius:8px; background:var(--primary-light); color:var(--primary-dark); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; flex-shrink:0; }
.due-item .done-btn { margin-left:auto; }

/* 图片 */
.img-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.img-grid img { width:100%; aspect-ratio:1; object-fit:cover; border-radius:10px; }
