:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --ink: #1c2430;
  --muted: #66707d;
  --line: #dfe4ea;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --amber: #d97706;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .05);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  letter-spacing: 0;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

h1, h2, h3, p {
  margin: 0;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

svg.icon {
  flex: none;
  vertical-align: middle;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

/* ---------- 通用组件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  padding: 9px 14px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink);
  transition: background .15s, transform .1s;
  white-space: nowrap;
}

.btn:hover {
  background: #e2e7ec;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-strong);
}

.btn.danger {
  background: #fde8e8;
  color: var(--red);
}

.btn.danger:hover {
  background: #f6caca;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.sm {
  padding: 6px 10px;
  font-size: 13px;
}

.btn.block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  transition: background .15s, color .15s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn.ok {
  color: var(--green);
}

.icon-btn.ok:hover {
  background: #e7f6ec;
}

.icon-btn.bad {
  color: var(--red);
}

.icon-btn.bad:hover {
  background: #fde8e8;
}

.icon-btn.ghost {
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  transition: all .15s;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.chip .chip-balance {
  background: rgba(127, 140, 153, .14);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
}

.chip.active .chip-balance {
  background: rgba(255, 255, 255, .22);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.sm {
  width: 8px;
  height: 8px;
  margin-right: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

.badge.ok {
  background: #e7f6ec;
  color: var(--green);
}

.badge.warn {
  background: #fdf1dd;
  color: var(--amber);
}

.badge.bad {
  background: #fde8e8;
  color: var(--red);
}

.badge.info {
  background: #e5efff;
  color: var(--blue);
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
}

.t-daily {
  background: #e7f6ec;
  color: #15803d;
}

.t-weekly {
  background: #e5efff;
  color: #1d4ed8;
}

.t-once {
  background: #fdf1dd;
  color: #b45309;
}

.t-challenge {
  background: #f3e8ff;
  color: #7c3aed;
}

.t-redemption {
  background: #ffe4e6;
  color: #be123c;
}

.t-kind-achievement {
  background: #e7f6ec;
  color: #15803d;
}

.t-kind-milestone {
  background: #e5efff;
  color: #1d4ed8;
}

.t-kind-skill {
  background: #f3e8ff;
  color: #7c3aed;
}

.t-kind-note {
  background: #fdf1dd;
  color: #b45309;
}

.points {
  font-weight: 800;
  white-space: nowrap;
}

.points.plus {
  color: var(--green);
}

.points.minus {
  color: var(--red);
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.toggle {
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 22px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}

.toggle-track {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #c9d2db;
  transition: background .15s;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: left .15s;
}

.toggle.on .toggle-track {
  background: var(--green);
}

.toggle.on .toggle-track::after {
  left: 19px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

.panel h3 {
  margin-bottom: 10px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- 账号设置 ---------- */

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.account-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 7px;
  padding: 12px;
}

.account-cell b {
  font-size: 15px;
  word-break: break-all;
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.account-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.account-main b {
  font-size: 15px;
}

/* ---------- 登录页 ---------- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(14, 165, 233, .14), transparent 60%),
    radial-gradient(900px 420px at 0% 110%, rgba(15, 118, 110, .16), transparent 60%),
    #f4f6f8;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}

.login-brand h1 {
  font-size: 24px;
}

.login-sub {
  color: var(--muted);
  margin: 6px 0 20px;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 18px;
}

.seg-btn {
  padding: 9px;
  border-radius: 6px;
  font-weight: 700;
  color: var(--muted);
}

.seg-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .1);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 10px 0 4px;
}

.pin-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #c3ccd6;
  transition: all .15s;
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  width: 100%;
  margin: 0 auto;
}

.key {
  height: 54px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 20px;
  font-weight: 700;
  transition: background .12s;
}

.key:hover {
  background: #e1e6eb;
}

.key.key-ghost {
  color: var(--muted);
  font-size: 15px;
}

/* ---------- 家长端布局 ---------- */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 17px;
  color: var(--primary);
  white-space: nowrap;
}

.child-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
}

.app-nav {
  display: flex;
  gap: 4px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.nav-item.active {
  background: #e0f2f0;
  color: var(--primary);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px;
  min-width: 0;
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--muted);
}

.page-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 80px 20px;
  color: var(--muted);
}

/* ---------- 家长端模块 ---------- */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 700;
  transition: border-color .15s, box-shadow .15s;
}

.action-btn:hover {
  border-color: #b8c2cc;
  box-shadow: 0 3px 10px rgba(16, 24, 40, .06);
}

.action-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.child-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.child-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  border-top: 4px solid var(--accent, var(--primary));
}

.child-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex: none;
}

.child-title {
  flex: 1;
  min-width: 0;
}

.child-title h3 {
  font-size: 17px;
}

.balance-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.balance-line b {
  font-size: 26px;
  color: var(--ink);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-stats div {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.mini-stats b {
  font-size: 17px;
}

.mini-stats span {
  font-size: 12px;
  color: var(--muted);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-list.wide {
  gap: 10px;
}

.review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
}

.review-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.review-main b {
  font-size: 14px;
}

.note {
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 0;
  word-break: break-all;
}

.review-side {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.chips-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
}

.task-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.task-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-title-line b {
  font-size: 15px;
}

.desc {
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.task-side {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.balance-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent, var(--primary));
  border-radius: var(--radius);
  padding: 20px;
  flex-wrap: wrap;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-number {
  font-size: 38px;
  line-height: 1.1;
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ledger {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.ledger th, .ledger td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}

.ledger th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.ledger tr:last-child td {
  border-bottom: 0;
}

.ledger .reason {
  max-width: 260px;
  word-break: break-all;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.item-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.item-card.off {
  opacity: .62;
}

.item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.sub-title {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.stat-card b {
  font-size: 22px;
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 10px 6px;
  overflow-x: auto;
}

.trend-col {
  flex: 1;
  min-width: 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.trend-bar {
  width: 100%;
  max-width: 22px;
  border-radius: 4px 4px 0 0;
  background: var(--green);
  min-height: 4px;
}

.trend-col.neg .trend-bar {
  background: var(--red);
}

.trend-label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.archive-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.archive-date {
  color: var(--muted);
  font-size: 12px;
  min-width: 58px;
  padding-top: 2px;
}

.archive-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.archive-main b {
  font-size: 15px;
}

.week-label {
  color: var(--muted);
  font-size: 13px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(158px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.day-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 150px;
  display: flex;
  flex-direction: column;
}

.day-col.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}

.day-head b {
  font-size: 13px;
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  flex: 1;
}

.event-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.event-time {
  color: var(--muted);
  font-size: 12px;
  min-width: 58px;
}

.event-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.event-body b {
  font-size: 13px;
  word-break: break-all;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.src-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
}

.src-parent {
  background: #e5efff;
  color: #1d4ed8;
}

.src-child {
  background: #fdf1dd;
  color: #b45309;
}

/* ---------- 表单 / 弹窗 ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
}

.weekday-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.day-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  font-weight: 700;
  color: var(--muted);
  transition: all .12s;
}

.day-btn.on {
  background: var(--primary);
  color: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal-box {
  width: min(440px, 100%);
  max-height: min(86vh, 720px);
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-box.wide {
  width: min(560px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

.modal-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.confirm-text {
  color: var(--muted);
  line-height: 1.6;
}

.request-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 7px;
  padding: 12px;
}

.request-summary b {
  font-size: 16px;
}

.warn-text {
  color: var(--amber);
  font-size: 12px;
  margin-top: 4px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  background: #1c2430;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  transition: all .25s;
  max-width: min(88vw, 420px);
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-success {
  background: var(--green);
}

.toast-error {
  background: var(--red);
}

/* ---------- 大宝端 ---------- */

.child-theme {
  --primary: #f97316;
  --primary-strong: #ea580c;
  --bg: #fff7f2;
}

.child-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #f1e3d9;
  position: sticky;
  top: 0;
  z-index: 20;
}

.child-greet {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.child-greet > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.child-greet b {
  font-size: 16px;
}

.mini-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  flex: none;
}

.child-balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff0e3;
  color: #c2410c;
  font-weight: 800;
  white-space: nowrap;
}

.child-balance-pill span {
  font-size: 12px;
  font-weight: 600;
}

.child-nav {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #f1e3d9;
  border-bottom: 0;
  justify-content: space-around;
  padding: 6px 8px;
  z-index: 20;
}

.child-nav .nav-item {
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  padding: 7px 12px;
}

.child-nav .nav-item.active {
  background: #fff0e3;
  color: #ea580c;
}

.child-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff));
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
}

.child-hero .muted {
  color: rgba(255, 255, 255, .82);
}

.child-hero-number {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 4px;
}

.child-hero-number b {
  font-size: 46px;
  line-height: 1;
}

.child-hero-number span {
  font-size: 16px;
  font-weight: 700;
}

.child-hero .badge.warn {
  background: rgba(255, 255, 255, .9);
  color: #b45309;
}

.child-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.child-section-title h2 {
  font-size: 18px;
}

.child-section-title a {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.child-group-title {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.child-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.child-task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid #f1e3d9;
  border-radius: var(--radius);
  padding: 13px 14px;
}

.child-task-card.st-approved {
  border-left: 4px solid var(--green);
}

.child-task-card.st-submitted {
  border-left: 4px solid var(--amber);
}

.child-task-card.st-rejected {
  border-left: 4px solid var(--red);
}

.child-task-card .task-main {
  flex: 1;
}

.child-schedule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #f1e3d9;
  border-radius: var(--radius);
  padding: 12px 14px;
}

.schedule-item > div:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.child-tx-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #f1e3d9;
  border-radius: var(--radius);
  padding: 12px 14px;
}

.tx-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--accent, #f97316);
  flex: none;
}

.tx-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tx-main b {
  font-size: 14px;
  word-break: break-all;
}

.tx-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: none;
}

.child-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.child-item-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border: 1px solid #f1e3d9;
  border-radius: var(--radius);
  padding: 14px;
}

.child-item-card .item-top {
  color: var(--primary);
}

.child-item-card .item-foot {
  margin-top: auto;
}

/* ---------- 二宝端 ---------- */

.toddler-stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  position: relative;
  background:
    radial-gradient(900px 420px at 10% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
    radial-gradient(800px 400px at 90% 100%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    #fffaf5;
}

.toddler-top {
  position: absolute;
  top: 14px;
  right: 14px;
}

.mascot {
  position: relative;
  width: 190px;
  height: 190px;
}

.mascot-face {
  position: absolute;
  inset: 0;
  border-radius: 46% 54% 52% 48% / 58% 56% 44% 42%;
  background: var(--accent);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--accent) 35%, transparent);
}

.mascot-face::before,
.mascot-face::after {
  content: "";
  position: absolute;
  top: 46%;
  width: 18px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
}

.mascot-face::before {
  left: 25%;
}

.mascot-face::after {
  right: 25%;
}

.eye {
  position: absolute;
  top: 55%;
  width: 9px;
  height: 12px;
  border-radius: 50%;
  background: #1c2430;
}

.eye.left {
  left: 29%;
}

.eye.right {
  right: 29%;
}

.mouth {
  position: absolute;
  left: 50%;
  top: 64%;
  transform: translateX(-50%);
  width: 46px;
  height: 24px;
  border-bottom: 6px solid #1c2430;
  border-radius: 0 0 60px 60px;
}

.spark {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fbbf24;
  clip-path: polygon(50% 0, 61% 35%, 100% 50%, 61% 65%, 50% 100%, 39% 65%, 0 50%, 39% 35%);
  animation: float 2.6s ease-in-out infinite;
}

.s1 { top: -14px; left: 8%; animation-delay: .2s; }
.s2 { top: 28px; right: -16px; animation-delay: .7s; }
.s3 { bottom: 8px; left: -12px; animation-delay: 1.2s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.12); }
}

.toddler-balance {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
}

.toddler-number {
  font-size: 92px;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
}

.checkin-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 18px 34px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .12s, box-shadow .12s;
}

.checkin-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px color-mix(in srgb, var(--accent) 45%, transparent);
}

.checkin-btn:disabled {
  background: #a8b3bf;
  box-shadow: none;
}

.checkin-btn.done {
  background: var(--green);
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 300;
}

.confetti {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: fall 1.6s ease-in forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: .4;
  }
}

/* ---------- 响应式 ---------- */

@media (max-width: 860px) {
  .main {
    padding: 14px 12px 90px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .app-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
  }

  .child-nav {
    position: sticky;
  }

  .topbar {
    gap: 10px;
  }

  .brand span {
    display: none;
  }

  .user-chip {
    display: none;
  }

  .child-chips {
    order: 3;
    width: 100%;
  }
}

@media (min-width: 861px) {
  .app {
    display: grid;
    grid-template-columns: 190px 1fr;
    grid-template-rows: auto 1fr;
  }

  .topbar {
    grid-column: 1 / -1;
  }

  .app-nav {
    grid-column: 1;
    grid-row: 2;
    flex-direction: column;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding: 12px 10px;
    gap: 6px;
  }

  .main {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    padding: 24px;
  }

  .child-nav .nav-item {
    flex-direction: row;
    font-size: 14px;
    padding: 11px 14px;
  }
}
