/* ============================================================
   教育管理平台 · 家庭手账风格
   暖奶油底 + 柔和圆角 + 家常配色，拒绝企业后台的冷淡感
   ============================================================ */

:root {
  /* 主色：暖橙（家长端） */
  --bg: #fff7ee;
  --card: #ffffff;
  --ink: #4b382a;
  --sub: #a3907f;
  --primary: #ff8a4c;
  --primary-2: #ffb067;
  --primary-soft: #fff1e3;

  /* 辅助色：孩子档案用的柔和糖果色 */
  --mint: #3ec08d;
  --mint-soft: #e6f8f0;
  --sky: #5ab4ef;
  --sky-soft: #e7f3fd;
  --lilac: #b79bf0;
  --lilac-soft: #f2ecfe;
  --rose: #ff7f96;
  --rose-soft: #ffecef;

  --warn: #ffa726;
  --warn-soft: #fff4e0;
  --danger: #f4776b;
  --danger-soft: #ffedeb;

  --border: #f5e6d7;
  --radius: 18px;
  --shadow: 0 4px 16px rgba(196, 133, 79, 0.09);
}

/* 孩子端换一套更活泼的薄荷绿 */
body.kid {
  --primary: #45c3a0;
  --primary-2: #7fd8bd;
  --primary-soft: #e8f8f3;
  --bg: #f3fbf8;
  --border: #dff2ec;
  --ink: #2f4f45;
  --sub: #8aa79e;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

/* 背景光斑：像家里暖暖的灯光 */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
body::before {
  top: -90px; right: -70px;
  width: 230px; height: 230px;
  background: radial-gradient(circle, rgba(255, 190, 130, 0.32), transparent 70%);
}
body::after {
  bottom: -80px; left: -70px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255, 175, 175, 0.22), transparent 70%);
}
body.kid::before { background: radial-gradient(circle, rgba(126, 220, 195, 0.34), transparent 70%); }
body.kid::after  { background: radial-gradient(circle, rgba(150, 205, 255, 0.24), transparent 70%); }

#app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 80px;
  position: relative;
  z-index: 1;
}

/* ---------------- 顶部：家的门牌 ---------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(120deg, #ffc48a 0%, #ff9d5c 55%, #ff8fa0 100%);
  color: #fff;
  padding: 16px 18px 14px;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 6px 18px rgba(255, 150, 100, 0.22);
}
body.kid .app-header {
  background: linear-gradient(120deg, #7fd8bd 0%, #45c3a0 55%, #59b8e8 100%);
  box-shadow: 0 6px 18px rgba(80, 200, 175, 0.24);
}
.app-header .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.app-header h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: 0.5px; }
.app-header .sub { font-size: 12px; opacity: 0.92; margin-top: 3px; }
.app-header .who {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.26);
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------------- 宝贝切换 ---------------- */
.child-switch {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 16px 6px;
  scrollbar-width: none;
}
.child-switch::-webkit-scrollbar { display: none; }
.child-chip {
  flex: 0 0 auto;
  padding: 9px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--ink);
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(196, 133, 79, 0.07);
  transition: all 0.18s;
}
.child-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(255, 138, 76, 0.3);
}
.child-chip .dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
}

/* ---------------- 卡片：像手账上的便签 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #fff;
  box-shadow: var(--shadow);
  padding: 15px 16px;
  margin: 10px 12px;
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ink);
}
.card-title .more { font-size: 12px; color: var(--sub); font-weight: 400; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
}
.grid .n { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1.3; }
.grid .l { font-size: 12px; color: var(--sub); }
.grid .n.green { color: var(--mint); }
.grid .n.orange { color: var(--warn); }
.grid .n.red { color: var(--danger); }
.grid .n.sky { color: var(--sky); }
.grid .n.rose { color: var(--rose); }
.grid .n.lilac { color: var(--lilac); }

/* ---------------- 列表 ---------------- */
.list { display: flex; flex-direction: column; gap: 9px; }
.item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fffdfb;
  transition: all 0.15s;
}
.item.done { opacity: 0.62; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-size: 14px; font-weight: 600; word-break: break-all; }
.item .meta { font-size: 12px; color: var(--sub); margin-top: 3px; }
.item .ops { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  margin-right: 4px;
  white-space: nowrap;
}
.tag.blue   { background: var(--sky-soft);   color: #3a90c8; }
.tag.sky    { background: var(--sky-soft);   color: #3a90c8; }
.tag.green  { background: var(--mint-soft);  color: #2b9b71; }
.tag.mint   { background: var(--mint-soft);  color: #2b9b71; }
.tag.orange { background: var(--warn-soft);  color: #d98614; }
.tag.red    { background: var(--danger-soft);color: #e05a4e; }
.tag.lilac  { background: var(--lilac-soft); color: #8b6ad4; }
.tag.rose   { background: var(--rose-soft);  color: #e05a76; }
.tag.gray   { background: #f6f1ea;           color: var(--sub); }

/* ---------------- 按钮：圆滚滚 ---------------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(255, 138, 76, 0.22);
}
body.kid .btn { box-shadow: 0 2px 8px rgba(69, 195, 160, 0.24); }
.btn:active { transform: scale(0.96); }
.btn.ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); box-shadow: none; }
.btn.gray  { background: #f6f1ea; color: var(--sub); box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 12px; font-size: 12px; }
.btn.block { display: block; width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; }
.btn:disabled { opacity: 0.5; }

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

/* ---------------- 子 Tab ---------------- */
.subtabs {
  display: flex;
  gap: 7px;
  padding: 8px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
  flex: 0 0 auto;
  padding: 7px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--border);
  font-size: 13px;
  color: var(--sub);
  box-shadow: 0 2px 6px rgba(196, 133, 79, 0.05);
}
.subtab.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
}

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  background: #fffcfa;
  border-top: 1px solid var(--border);
  max-width: 720px;
  margin: 0 auto;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 16px rgba(196, 133, 79, 0.07);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tab {
  flex: 1;
  text-align: center;
  padding: 8px 0 7px;
  font-size: 11px;
  color: var(--sub);
  background: none;
  border: none;
  cursor: pointer;
}
.tabbar .tab.active { color: var(--primary); font-weight: 700; }
.tabbar .tab .ico { display: block; font-size: 21px; line-height: 24px; }

/* ---------------- 其他 ---------------- */
.empty {
  text-align: center;
  color: var(--sub);
  font-size: 13px;
  padding: 24px 12px;
}
.empty .big { font-size: 32px; display: block; margin-bottom: 8px; }

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  color: #fff;
  font-size: 27px;
  line-height: 48px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(255, 138, 76, 0.38);
  border: none;
  z-index: 25;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(75, 56, 42, 0.4);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: #fffdfb;
  width: 100%;
  max-width: 720px;
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
  max-height: 86vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 14px; font-size: 17px; }

.toast {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: rgba(75, 56, 42, 0.9);
  color: #fff;
  padding: 11px 20px;
  border-radius: 14px;
  font-size: 14px;
  z-index: 60;
  max-width: 80%;
  text-align: center;
}

.week-wrap { display: flex; gap: 7px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.week-wrap::-webkit-scrollbar { display: none; }
.day-col {
  flex: 0 0 46%;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 9px;
  min-height: 88px;
  background: #fffdfb;
}
.day-col.today { border-color: var(--primary); background: var(--primary-soft); }
.day-col .dhead { font-size: 12px; color: var(--sub); margin-bottom: 7px; font-weight: 600; }
.course {
  font-size: 12px;
  padding: 5px 7px;
  border-radius: 9px;
  background: #fff6ee;
  color: var(--ink);
  margin-bottom: 5px;
  border-left: 4px solid var(--primary);
  word-break: break-all;
}

.points-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.points-row:last-child { border-bottom: none; }
.points-row .amt { font-weight: 800; }
.points-row .amt.plus { color: var(--mint); }
.points-row .amt.minus { color: var(--danger); }

.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 6px 0; }
.kv .k { color: var(--sub); flex-shrink: 0; }

.loading, .forbidden { text-align: center; padding: 60px 22px; color: var(--sub); }
.forbidden .big { font-size: 46px; display: block; margin-bottom: 12px; }

/* 一句家常话 */
.warm-note {
  font-size: 12.5px;
  color: var(--sub);
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 9px 12px;
  margin-top: 10px;
  line-height: 1.7;
}
