:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #d1fae5;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #1f2937;
  --text-sub: #6b7280;
  --danger: #ef4444;
  --border: #e5e7eb;
  --radius: 16px;
  --shadow: 0 4px 16px rgba(17, 24, 39, 0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 40px; }
button { font-family: inherit; cursor: pointer; border: none; }
input, textarea, select { font-family: inherit; font-size: 15px; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #34d399 0%, #10b981 45%, #0ea5e9 130%);
}
.login-hero { text-align: center; color: #fff; margin-bottom: 32px; }
.login-hero .logo { font-size: 56px; }
.login-hero h1 { font-size: 26px; margin-top: 8px; letter-spacing: 1px; }
.login-hero p { opacity: 0.9; margin-top: 6px; font-size: 14px; }
.login-card {
  background: var(--card); border-radius: 20px; padding: 28px 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 12px; outline: none; transition: border-color 0.2s; background: #fafafa;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); background: #fff; }
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1; letter-spacing: 4px; font-weight: 700; text-align: center; }
.captcha-img {
  width: 112px; height: 46px; border-radius: 12px; border: 1.5px solid var(--border);
  flex-shrink: 0; background: #eef2f7; cursor: pointer; display: block;
}
.btn {
  display: block; width: 100%; padding: 13px; border-radius: 12px;
  font-size: 16px; font-weight: 600; color: #fff;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: transform 0.1s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; }
.btn-outline {
  background: #fff; color: var(--primary-dark);
  border: 1.5px solid var(--primary); font-weight: 600;
}
.btn-danger { background: linear-gradient(90deg, #f87171, var(--danger)); }
.btn-ghost { background: #f3f4f6; color: var(--text); }
.btn-sm { width: auto; padding: 7px 14px; font-size: 13px; border-radius: 10px; display: inline-block; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #fff; padding: 18px 20px 56px; border-radius: 0 0 28px 28px;
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; }
.topbar .hello { font-size: 19px; font-weight: 700; }
.topbar .sub { font-size: 13px; opacity: 0.9; margin-top: 3px; }
.topbar .actions { display: flex; gap: 8px; }
.chip {
  background: rgba(255, 255, 255, 0.22); color: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 12.5px; backdrop-filter: blur(4px);
}

/* ---------- 内容 ---------- */
.content { padding: 0 16px; margin-top: -38px; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }

/* 今日签到卡 */
.today-card { text-align: center; padding: 22px 18px; }
.today-date { color: var(--text-sub); font-size: 13.5px; margin-bottom: 12px; }
.big-btn {
  width: 150px; height: 150px; border-radius: 50%;
  background: linear-gradient(145deg, #34d399, #059669);
  color: #fff; font-size: 19px; font-weight: 700; line-height: 1.5;
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.4);
  transition: transform 0.12s;
  margin: 6px auto 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.big-btn .icon { font-size: 34px; }
.big-btn:active { transform: scale(0.95); }
.big-btn.done {
  background: linear-gradient(145deg, #a7f3d0, #6ee7b7);
  color: #065f46; box-shadow: none; cursor: default;
}
.today-tip { color: var(--text-sub); font-size: 13px; }

/* 统计 */
.stats-row { display: flex; gap: 12px; }
.stat {
  flex: 1; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; text-align: center; cursor: pointer;
  transition: transform 0.12s;
}
.stat:active { transform: scale(0.97); }
.stat .num { font-size: 28px; font-weight: 800; color: var(--primary-dark); }
.stat .lbl { font-size: 12.5px; color: var(--text-sub); margin-top: 2px; }

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head .month { font-weight: 700; font-size: 15px; }
.cal-nav { background: #f3f4f6; border-radius: 10px; width: 32px; height: 32px; font-size: 16px; color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week { text-align: center; font-size: 12px; color: var(--text-sub); padding: 6px 0; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 13.5px; cursor: pointer; position: relative;
  border: none; background: transparent; color: var(--text);
}
.cal-day.empty { cursor: default; }
.cal-day.checked { background: var(--primary); color: #fff; font-weight: 700; }
.cal-day.today { outline: 2px solid var(--primary); outline-offset: -2px; font-weight: 700; }
.cal-day.selected:not(.checked) { background: var(--primary-light); }
.cal-day:active:not(.empty) { opacity: 0.75; }
.day-detail { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 12px; font-size: 14px; }
.legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--text-sub); align-items: center; }
.dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; margin-right: 4px; vertical-align: -2px; }

/* ---------- 列表 ---------- */
.rec-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 4px; border-bottom: 1px solid #f1f3f5;
}
.rec-item:last-child { border-bottom: none; }
.rec-main { display: flex; align-items: center; gap: 12px; }
.rec-badge {
  width: 42px; height: 42px; border-radius: 12px; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.rec-date { font-weight: 700; font-size: 14.5px; }
.rec-sub { font-size: 12.5px; color: var(--text-sub); margin-top: 2px; }
.rec-ops { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; background: #f3f4f6;
  font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.icon-btn.del { background: #fee2e2; }
.empty-tip { text-align: center; color: var(--text-sub); padding: 28px 0; font-size: 14px; }

/* 孩子卡片（管理员） */
.child-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px; border-bottom: 1px solid #f1f3f5;
}
.child-item:last-child { border-bottom: none; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; font-size: 20px;
  background: linear-gradient(145deg, #fbbf24, #f59e0b); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  animation: fadein 0.15s;
}
.modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 400px;
  padding: 22px 20px; animation: pop 0.18s;
  max-height: 86vh; overflow-y: auto;
}
.modal h3 { font-size: 17px; margin-bottom: 16px; }
.modal-btns { display: flex; gap: 10px; margin-top: 18px; }
.modal-btns .btn { flex: 1; }
.pwd-hint { font-size: 12px; color: var(--text-sub); margin-top: -8px; margin-bottom: 14px; line-height: 1.6; }
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  z-index: 200; pointer-events: none;
}
.toast-msg {
  background: rgba(17, 24, 39, 0.88); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 14px; margin-top: 8px;
  animation: fadein 0.2s; white-space: nowrap; max-width: 88vw;
  overflow: hidden; text-overflow: ellipsis;
}

/* 返回条 */
.back-row { display: flex; align-items: center; gap: 8px; padding: 14px 16px 0; }
.back-btn { background: #fff; border-radius: 10px; padding: 7px 13px; font-size: 14px; box-shadow: var(--shadow); }
.page-title { font-size: 17px; font-weight: 700; }
