/* ============ 班级德育分管家 样式（浅色主题） ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f3f5fb; --card: #ffffff; --line: #e9ecf5; --txt: #1c2233; --sub: #7b83a0;
  --pri: #5b6cf7; --pri2: #7a5cf0; --pri-soft: #eceefd; --pri-dark: #4654d8;
  --add: #d8483f; --add-bg: #fdeeee;      /* 加分 = 红（正向） */
  --minus: #4a55c9; --minus-bg: #eef0fc;  /* 扣分 = 蓝 */
  --gold: #f0a53a; --silver: #97a7bb; --bronze: #cf8f61;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(52, 64, 130, .08);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--txt); font-size: 15px; line-height: 1.5;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; }
.page { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }

/* ---------- 登录页 ---------- */
.auth-wrap { padding: 0 18px 40px; }
.auth-hero {
  background: linear-gradient(135deg, #5b6cf7 0%, #7a5cf0 60%, #9a5cf0 100%);
  margin: 0 -18px; padding: 44px 22px 66px; color: #fff; text-align: center;
  border-radius: 0 0 32px 32px; position: relative; overflow: hidden;
}
.auth-hero::before, .auth-hero::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.1);
}
.auth-hero::before { width: 220px; height: 220px; left: -70px; top: -80px; }
.auth-hero::after { width: 160px; height: 160px; right: -50px; bottom: -70px; }
.auth-hero h1 { font-size: 24px; margin-top: 10px; letter-spacing: 1px; position: relative; }
.auth-hero p { opacity: .85; font-size: 13px; margin-top: 4px; position: relative; }
.auth-card {
  background: var(--card); border-radius: 22px; padding: 20px;
  margin-top: -34px; position: relative; z-index: 2; box-shadow: var(--shadow);
}
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.seg-btn { flex: 1; padding: 9px 0; border-radius: 9px; color: var(--sub); font-size: 15px; font-weight: 600; }
.seg-btn.active { background: #fff; color: var(--pri-dark); box-shadow: 0 2px 8px rgba(60,72,160,.12); }
.field { display: block; margin-bottom: 13px; }
.field > span { display: block; font-size: 12px; color: var(--sub); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 11px; padding: 11px 13px;
  background: #fbfcff; outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--pri); }
.btn { border-radius: 11px; padding: 11px 18px; font-size: 15px; font-weight: 600; transition: opacity .15s, transform .05s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--pri), var(--pri2)); color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,.28); }
.btn-block { width: 100%; padding: 12px; }
.btn-ghost { background: var(--bg); color: var(--sub); }
.btn-danger { background: var(--add-bg); color: var(--add); }
.btn-mini { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.auth-hint { margin-top: 14px; font-size: 12px; color: var(--sub); text-align: center; }
.auth-hint b { color: var(--pri-dark); }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, #5b6cf7 0%, #7a5cf0 60%, #9a5cf0 100%);
  color: #fff; padding: 18px 18px 14px; position: sticky; top: 0; z-index: 20;
  border-radius: 0 0 22px 22px; box-shadow: 0 6px 18px rgba(99,102,241,.22);
}
.topbar-in { display: flex; justify-content: space-between; align-items: center; max-width: 560px; margin: 0 auto; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.role-chip {
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35);
  padding: 4px 12px; border-radius: 999px; font-size: 12px;
}
.role-chip.monitor { background: #fff; color: var(--pri-dark); border-color: #fff; font-weight: 700; }
.role-chip.teacher { background: #ffd9c2; color: #b84a1c; border-color: #ffd9c2; font-weight: 700; }

/* ---------- 主区域 ---------- */
main { padding: 14px 14px 90px; max-width: 560px; margin: 0 auto; }
.view { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title .link { font-size: 12px; color: var(--pri); font-weight: 500; }
.card-title .link svg { width: 14px; height: 14px; vertical-align: -2px; }

/* 首页得分大卡 */
.hero-card {
  background: linear-gradient(135deg, #5b6cf7, #8a5cf0 85%);
  color: #fff; border-radius: 22px; padding: 22px; box-shadow: 0 10px 26px rgba(99,102,241,.3);
  position: relative; overflow: hidden; margin-bottom: 12px;
}
.hero-card::after { content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%; background: rgba(255,255,255,.09); right: -60px; top: -70px; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; position: relative; z-index: 1; }
.hero-score-label { font-size: 13px; opacity: .9; }
.hero-score { font-size: 52px; font-weight: 800; line-height: 1.1; letter-spacing: 1px; }
.hero-sub { font-size: 12px; opacity: .85; margin-top: 4px; }
.hero-stats { display: flex; gap: 22px; margin-top: 18px; position: relative; z-index: 1; }
.hero-stats .hs { font-size: 12px; opacity: .88; }
.hero-stats .hs b { display: block; font-size: 20px; opacity: 1; }
.rank-badge {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; text-align: center;
}
.rank-badge b { font-size: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-cell { background: var(--card); border-radius: 14px; padding: 13px 15px; box-shadow: var(--shadow); }
.stat-cell .lb { font-size: 12px; color: var(--sub); }
.stat-cell .num { font-size: 24px; font-weight: 800; margin-top: 2px; }
.stat-cell .num.red { color: var(--add); }
.stat-cell .num.blue { color: var(--minus); }
.stat-cell .num.ink { color: var(--txt); }

/* 分数 chip */
.pts-chip { display: inline-block; font-weight: 800; font-size: 13px; border-radius: 8px; padding: 2px 8px; min-width: 44px; text-align: center; }
.pts-chip.add { background: var(--add-bg); color: var(--add); }
.pts-chip.minus { background: var(--minus-bg); color: var(--minus); }

/* 徽章 */
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--pri-soft); color: var(--pri-dark); margin-left: 6px; }
.badge.teacher { background: #ffe8dc; color: #b04a18; }
.badge.student { background: #eef0f6; color: var(--sub); }

/* 列表行 */
.row {
  display: flex; align-items: center; gap: 11px; padding: 11px 2px;
  border-bottom: 1px solid #f2f4fa;
}
.row:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--sub); margin-top: 1px; }
.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff;
  font-size: 16px; background: linear-gradient(135deg, #5b6cf7, #8a5cf0);
}
.avatar.o1 { background: linear-gradient(135deg, #f0a53a, #f6c968); }
.avatar.o2 { background: linear-gradient(135deg, #8fa2bb, #b9c6d8); }
.avatar.o3 { background: linear-gradient(135deg, #cf8f61, #e0b08a); }

/* 榜单 */
.medal { font-size: 13px; width: 22px; text-align: center; font-weight: 800; flex: none; }
.medal.g1 { color: var(--gold); }
.medal.g2 { color: var(--silver); }
.medal.g3 { color: var(--bronze); }
.rank-no { color: var(--sub); font-size: 13px; width: 22px; text-align: center; flex: none; }
.me-tag { background: var(--pri-soft); color: var(--pri-dark); font-size: 11px; padding: 2px 6px; border-radius: 6px; margin-left: 5px; }

/* 切换小按钮组 */
.seg-sm { display: inline-flex; background: #eef0f6; border-radius: 10px; padding: 3px; }
.seg-sm button { padding: 5px 12px; font-size: 13px; border-radius: 8px; color: var(--sub); font-weight: 600; }
.seg-sm button.active { background: #fff; color: var(--pri-dark); box-shadow: 0 1px 5px rgba(0,0,0,.08); }

/* ---------- 加减分 ---------- */
.op-mode { display: flex; gap: 10px; margin-bottom: 14px; }
.op-mode button {
  flex: 1; padding: 14px; border-radius: 16px; font-size: 17px; font-weight: 800;
  border: 2px solid transparent; transition: all .15s;
}
.op-mode button.add { background: var(--add-bg); color: var(--add); }
.op-mode button.add.on { background: var(--add); color: #fff; box-shadow: 0 6px 16px rgba(216,72,63,.3); }
.op-mode button.minus { background: var(--minus-bg); color: var(--minus); }
.op-mode button.minus.on { background: var(--minus); color: #fff; box-shadow: 0 6px 16px rgba(74,85,201,.3); }

.points-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.points-chips button {
  min-width: 56px; padding: 9px 0; border-radius: 12px; font-weight: 800; font-size: 17px;
  background: #fff; border: 2px solid var(--line); color: var(--txt);
}
.points-chips button.on { border-color: currentColor; }
.op-mode.add ~ .panel .points-chips button.on, .panel[data-mode="add"] .points-chips button.on { background: var(--add-bg); color: var(--add); }
.panel[data-mode="minus"] .points-chips button.on { background: var(--minus-bg); color: var(--minus); }

.student-pick { border: 1.5px solid var(--line); border-radius: 13px; max-height: 208px; overflow-y: auto; background: #fbfcff; }
.student-pick .sp-row { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-bottom: 1px solid #f0f2f8; cursor: pointer; }
.student-pick .sp-row:last-child { border-bottom: none; }
.student-pick .sp-row.on { background: var(--pri-soft); }
.sp-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cdd3e6; flex: none; }
.sp-row.on .sp-check { background: var(--pri); border-color: var(--pri); box-shadow: inset 0 0 0 3px #fff; }
.sp-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-score { font-size: 12px; color: var(--sub); font-weight: 700; }

.reason-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.reason-presets button {
  font-size: 13px; padding: 6px 12px; border-radius: 999px; background: #f1f3fa; color: var(--txt);
  border: 1px solid transparent;
}
.reason-presets button.on { background: #fff; border-color: var(--pri); color: var(--pri-dark); font-weight: 600; }

/* 表格 */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 380px; }
.tbl th { text-align: left; color: var(--sub); font-weight: 600; font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid #f3f5fa; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { font-weight: 800; }
.tbl .num.add { color: var(--add); }
.tbl .num.minus { color: var(--minus); }
.tbl .me td { background: #f7f8ff; }
.tbl tr.top1 td { background: #fffbf1; }

/* 记录条目 */
.rec-item { display: flex; align-items: center; gap: 10px; }
.rec-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 17px; flex: none; }
.rec-icon.add { background: var(--add-bg); color: var(--add); }
.rec-icon.minus { background: var(--minus-bg); color: var(--minus); }
.rec-del { color: #c9cedd; padding: 6px 8px; border-radius: 8px; }
.rec-del:hover { color: var(--add); background: var(--add-bg); }
.empty { text-align: center; color: var(--sub); padding: 30px 10px; font-size: 13px; }
.empty svg { width: 52px; height: 52px; opacity: .25; display: block; margin: 0 auto 10px; }

/* 周汇总头部 */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.week-nav .wn-btn { width: 34px; height: 34px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 18px; color: var(--pri-dark); font-weight: 700; }
.week-nav .wn-center { flex: 1; text-align: center; }
.week-nav .wn-title { font-weight: 700; font-size: 15px; }
.week-nav .wn-sub { font-size: 12px; color: var(--sub); }

/* 操作按钮排 */
.op-btns { display: flex; gap: 8px; }
.op-btns .btn { flex: 1; }

/* 设置列表 */
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 2px; border-bottom: 1px solid #f2f4fa; }
.set-row:last-child { border-bottom: none; }
.set-row .t { font-weight: 600; font-size: 14.5px; }
.set-row .d { font-size: 12px; color: var(--sub); margin-top: 1px; }

/* 底栏 tabbar */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-top: 1px solid #eceef6; display: flex; z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; padding: 8px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #9aa1bb; font-size: 11px; }
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.tab.active { color: var(--pri-dark); font-weight: 700; }
.tab.active svg { fill: none; }
.tab.hide { display: none; }

/* toast */
.toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 100;
  background: rgba(28,34,51,.92); color: #fff; font-size: 13.5px; padding: 9px 18px;
  border-radius: 999px; max-width: 86%; text-align: center;
  animation: popIn .2s ease;
}
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* modal */
.modal-mask { position: fixed; inset: 0; background: rgba(24,30,56,.45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn .15s; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 400px; padding: 20px; max-height: 80vh; overflow-y: auto; }
.modal h3 { font-size: 16px; margin-bottom: 12px; }
.modal-body { font-size: 14px; color: var(--txt); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.modal .field { margin-top: 10px; }
.msg-warn { background: #fff4e5; color: #a3611c; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.msg-err { background: var(--add-bg); color: var(--add); border-radius: 10px; padding: 10px 12px; font-size: 13px; }

.search {
  width: 100%; border: 1.5px solid var(--line); border-radius: 11px; padding: 9px 12px;
  background: #fbfcff; margin-bottom: 10px; outline: none;
}
.search:focus { border-color: var(--pri); }

.hr { border: none; border-top: 1px dashed var(--line); margin: 14px 0; }
.pager { display: flex; justify-content: center; padding: 6px 0 2px; }
.pager button { font-size: 13px; color: var(--pri-dark); padding: 8px 16px; }
.week-summary-hero { border-radius: 16px; padding: 13px 15px; color: #fff; margin-bottom: 10px; }
.wsh-top { font-size: 12px; opacity: .9; }
.wsh-num { font-size: 26px; font-weight: 800; margin-top: 2px; }
