/* 杭祺新目标 · 全站样式（家长端 + 孩子端，同一套响应式） */

:root {
  --brand: #2f6fd0;
  --brand-dark: #1f4f9c;
  --brand-soft: #eaf1fd;
  --plus: #d33c3c;
  --minus: #2f9e6a;
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e3e8f0;
  --text: #1f2430;
  --text-2: #6b7488;
  --text-3: #9aa3b5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(24, 39, 75, .05), 0 4px 14px rgba(24, 39, 75, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------------------------------------------------------- 布局 */
.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 18px 16px 60px; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 14px;
}
.logo { font-size: 16px; font-weight: 600; letter-spacing: .5px; }
.logo span { color: var(--brand); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); }

.tabs { display: flex; gap: 4px; overflow-x: auto; background: var(--card); border-bottom: 1px solid var(--line); }
.tabs-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; }
.tab {
  padding: 11px 14px; font-size: 14px; color: var(--text-2);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
  background: none; border-top: 0; border-left: 0; border-right: 0;
}
.tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ---------------------------------------------------------- 卡片 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; }
.card-head .spacer { margin-left: auto; }
.muted { color: var(--text-2); font-size: 13px; }
.tiny { color: var(--text-3); font-size: 12px; }

.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.metric .k { font-size: 13px; color: var(--text-2); }
.metric .v { font-size: 26px; font-weight: 600; margin-top: 2px; letter-spacing: -.5px; }
.metric .v.plus { color: var(--plus); }
.metric .v.minus { color: var(--minus); }

/* ---------------------------------------------------------- 表单 / 按钮 */
input, select, textarea, button { font-family: inherit; font-size: 14px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label.field { display: block; margin-bottom: 10px; }
label.field > .lb { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.danger { color: #b3362f; }
.btn.danger:hover { border-color: #b3362f; color: #b3362f; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------- 列表 */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .main { min-width: 0; flex: 1; }
.row .t { font-size: 14px; }
.row .s { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.row .right { margin-left: auto; text-align: right; white-space: nowrap; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; background: var(--brand-soft); color: var(--brand);
}
.pill.warn { background: #fdf1e3; color: #a8661a; }
.pill.ok { background: #e8f6ef; color: #1f7a52; }
.pill.gray { background: #eef0f4; color: var(--text-2); }
.pill.no { background: #fbeceb; color: #b3362f; }

.score { font-weight: 600; font-variant-numeric: tabular-nums; }
.score.plus { color: var(--plus); }
.score.minus { color: var(--minus); }

.empty { text-align: center; color: var(--text-3); padding: 26px 0; font-size: 13px; }

/* ---------------------------------------------------------- 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--text-2); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- 弹层 */
.mask {
  position: fixed; inset: 0; background: rgba(20, 26, 38, .45);
  display: none; align-items: center; justify-content: center; padding: 16px; z-index: 60;
}
.mask.on { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto; padding: 20px;
}
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---------------------------------------------------------- 提示 */
#toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%) translateY(20px);
  background: #1f2430; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .22s; z-index: 90; max-width: 90vw;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #b3362f; }

/* ---------------------------------------------------------- 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 26px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card .brand { text-align: center; margin-bottom: 20px; }
.login-card .brand .n { font-size: 21px; font-weight: 600; letter-spacing: 1px; }
.login-card .brand .n em { font-style: normal; color: var(--brand); }
.login-card .brand .d { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.seg { display: flex; background: #eef1f6; border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.seg button {
  flex: 1; padding: 8px; border: 0; background: transparent; border-radius: 8px;
  cursor: pointer; color: var(--text-2); font-size: 14px;
}
.seg button.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------------------------------------------------------- 孩子端主题 */
body.kid { background: #fff8ef; }
body.kid .topbar { background: #fff; }
body.kid .logo span { color: #ef8123; }
body.kid .card { border-radius: 16px; border-color: #f3e3cf; }
body.kid .btn.primary { background: #ef8123; border-color: #ef8123; }
body.kid .btn.primary:hover { background: #d96f16; }
body.kid .tab.on { color: #ef8123; border-bottom-color: #ef8123; }
body.kid .pill { background: #fdf0e2; color: #b5620f; }

.big-balance {
  text-align: center; padding: 22px 12px;
  background: linear-gradient(180deg, #fff3e2, #fffaf4);
  border: 1px solid #f6e3c8; border-radius: 18px;
}
.big-balance .n { font-size: 46px; font-weight: 700; color: #ef8123; line-height: 1.1; letter-spacing: -1px; }
.big-balance .u { font-size: 14px; color: #a8703a; margin-top: 2px; }

.task {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: #fff; border: 1px solid #f3e3cf; border-radius: 14px; margin-bottom: 10px;
}
.task .ico { font-size: 22px; width: 30px; text-align: center; flex: none; }
.task .body { flex: 1; min-width: 0; }
.task .name { font-size: 15px; font-weight: 500; }
.task .meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.task .pt { font-weight: 600; font-size: 15px; white-space: nowrap; }
.task.done { opacity: .55; }

.wish {
  border: 1px solid #f3e3cf; border-radius: 14px; padding: 14px; background: #fff;
  display: flex; flex-direction: column; gap: 8px;
}
.wish .name { font-weight: 500; }
.wish .cost { color: #ef8123; font-weight: 600; }

/* ---------------------------------------------------------- 条形图 */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.bars .b i { display: block; width: 100%; max-width: 26px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .b i.neg { background: var(--minus); }
.bars .b em { font-style: normal; font-size: 11px; color: var(--text-3); }

@media (max-width: 640px) {
  .wrap, .wrap-narrow { padding: 12px 12px 60px; }
  .metric .v { font-size: 22px; }
  .big-balance .n { font-size: 38px; }
}
