:root {
  --blue: #185FA5;
  --blue-600: #185FA5;
  --blue-700: #134C85;
  --blue-50: #E6F1FB;
  --green-600: #3B6D11;
  --green-50: #EAF3DE;
  --red-600: #A32D2D;
  --red-50: #FCEBEB;
  --amber-600: #854F0B;
  --amber-50: #FAEEDA;
  --purple-600: #534AB7;
  --purple-50: #EEEDFE;
  --teal-600: #0F6E56;
  --teal-50: #E1F5EE;
  --coral-600: #993C1D;
  --coral-50: #FAECE7;
  --pink-600: #993556;
  --pink-50: #FBEAF0;
  --gray: #5F5E5A;
  --gray-200: #E5E7EB;
  --gray-100: #F0F1F3;
  --bg: #F2F4F7;
  --card: #FFFFFF;
  --text: #1F2937;
  --text-muted: #6B7280;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --drawer-bg: #FFFFFF;
  --drawer-text: #1F2937;
  --drawer-text-muted: #6B7280;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* Header */
#app-header {
  background: linear-gradient(135deg, #185FA5 0%, #2076C2 100%);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 14px;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 30;
}
.header-top {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.hamburger {
  border: none; background: rgba(255,255,255,0.12);
  color: #fff; width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex: 0 0 36px; padding: 0;
  transition: background .15s;
}
.hamburger:hover { background: rgba(255,255,255,0.22); }
#header-title {
  font-weight: 600; font-size: 16px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.2px;
}
.sync-badge { font-size: 12px; opacity: 0.9; flex: 0 0 auto; padding: 4px 10px; background: rgba(255,255,255,0.14); border-radius: 999px; }
.sync-badge.cloud { background: rgba(46, 213, 137, 0.18); color: #B9F6CA; }

.class-switch {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -4px;
}
.class-switch::-webkit-scrollbar { display: none; }
.class-pill {
  flex: 0 0 auto;
  padding: 8px 16px; border-radius: 18px; border: none;
  background: rgba(255,255,255,0.18); color: #fff;
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.class-pill.active { background: #fff; color: var(--blue-600); box-shadow: 0 2px 6px rgba(0,0,0,0.1); }

/* Main */
#page { flex: 1; padding: 18px 16px 96px; overflow-y: auto; }

.section-title {
  font-size: 13px; color: var(--text-muted);
  margin: 22px 0 12px; font-weight: 600;
  letter-spacing: 0.3px; text-transform: uppercase;
}
.section-title:first-child { margin-top: 0; }

/* Cards */
.card {
  background: var(--card); border-radius: 14px; padding: 16px;
  box-shadow: var(--shadow-sm); margin-bottom: 12px; border: 1px solid #EEF1F5;
}

/* Stat grid —— 卡片布局关键修复 */
.stat-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.stat-card { background: #f6f8fb; border: 1px solid #e6ebf2; border-radius: 10px; padding: 10px 8px; text-align: center; }
.stat-card .v { font-size: 20px; font-weight: 700; color: #185FA5; line-height: 1.2; }
.stat-card .k { font-size: 12px; color: #888; margin-top: 3px; }
.chart-wrap { background: #fff; border: 1px solid #e6ebf2; border-radius: 12px; padding: 12px; margin: 10px 0; }
.chart-title { font-size: 14px; font-weight: 600; color: #333; margin-bottom: 8px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #555; }
.legend .lg i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.stat {
  background: var(--card);
  border-radius: 16px;
  padding: 18px 16px 16px;
  position: relative;
  box-shadow: var(--shadow-sm);
  border: 1px solid #EEF1F5;
  overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.stat .label {
  font-size: 12px; font-weight: 500; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.stat .label .dot {
  width: 6px; height: 6px; border-radius: 50%; display: inline-block;
}
.stat .num { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat .sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.stat.blue::before    { background: var(--blue); }    .stat.blue .label    { color: var(--blue); }    .stat.blue .num    { color: #0C447C; }    .stat.blue .dot    { background: var(--blue); }
.stat.green::before   { background: var(--green-600); }.stat.green .label   { color: var(--green-600); }.stat.green .num   { color: #27500A; }    .stat.green .dot   { background: var(--green-600); }
.stat.red::before     { background: var(--red-600); }  .stat.red .label     { color: var(--red-600); }  .stat.red .num     { color: #791F1F; }    .stat.red .dot     { background: var(--red-600); }
.stat.amber::before   { background: var(--amber-600); }.stat.amber .label   { color: var(--amber-600); }.stat.amber .num   { color: #633806; }    .stat.amber .dot   { background: var(--amber-600); }

@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* Function grid */
.fn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.fn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid #EEF1F5;
  border-radius: 14px; cursor: pointer; padding: 14px 4px 10px;
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s;
}
.fn:active { transform: scale(0.97); box-shadow: var(--shadow-sm); }
.fn .icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.fn .name { font-size: 12px; color: var(--text); font-weight: 500; }

/* Alert */
.alert {
  background: linear-gradient(135deg, #FCEBEB 0%, #FCE0E0 100%);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 14px;
  border-left: 4px solid var(--red-600);
}
.alert .t { font-size: 14px; font-weight: 600; color: var(--red-600); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.alert .d { font-size: 13px; color: #791F1F; line-height: 1.5; }

/* Tab bar */
#tabbar {
  display: flex; background: #fff; border-top: 1px solid var(--gray-200);
  padding-bottom: env(safe-area-inset-bottom); position: sticky; bottom: 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04); z-index: 20;
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  padding: 9px 0 7px; font-size: 11px; color: var(--gray);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: color .15s;
}
.tab.active { color: var(--blue); font-weight: 600; }
.tab.active::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--blue); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--blue); color: #fff; border: none; border-radius: 12px;
  padding: 12px 18px; font-size: 15px; font-weight: 500; cursor: pointer; width: 100%;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn.ghost { background: var(--blue-50); color: var(--blue); border: 1px solid #D6E6F6; }
.btn.ghost:hover { background: #D6E6F6; }
.btn.sm { padding: 8px 14px; font-size: 13px; width: auto; }
.btn.danger { background: var(--red-600); }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
input, select, textarea {
  width: 100%; border: 1px solid var(--gray-200); border-radius: 10px;
  padding: 11px 14px; font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24,95,165,0.1); }
textarea { resize: vertical; min-height: 88px; }

/* List */
.list { background: var(--card); border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden; border: 1px solid #EEF1F5; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100); cursor: pointer;
  transition: background .12s;
}
.list-row:hover { background: #FAFBFC; }
.list-row:last-child { border-bottom: none; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.list-row .meta { flex: 1; min-width: 0; }
.list-row .meta .n { font-size: 15px; font-weight: 500; }
.list-row .meta .s { font-size: 12px; color: var(--text-muted); }
.no-badge {
  display: inline-block;
  padding: 1px 8px;
  margin-left: 6px;
  background: var(--blue-50, #E8F0FC);
  color: var(--blue, #185FA5);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.tag {
  font-size: 11px; padding: 3px 9px; border-radius: 8px;
  background: var(--blue-50); color: var(--blue); font-weight: 500;
}

/* Schedule table */
.sch-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.sch-table th, .sch-table td {
  border: 1px solid var(--gray-200); padding: 10px 6px; text-align: center; background: #fff;
}
.sch-table th { background: var(--blue-50); color: var(--blue); font-weight: 600; }
.sch-table td input { border: none; padding: 4px; text-align: center; font-size: 13px; background: transparent; width: 100%; }
.sch-table td.has {
  background: linear-gradient(135deg, var(--blue-50) 0%, #D6E6F6 100%);
  color: var(--blue); font-weight: 600;
}
.sch-table td.next {
  outline: 3px solid var(--amber-600); outline-offset: -3px;
  background: linear-gradient(135deg, #FFF7E6 0%, #FFE9C7 100%);
  color: var(--amber-600); font-weight: 700;
}
.next-class {
  background: linear-gradient(135deg, var(--blue) 0%, #2076C2 100%);
  color: #fff; font-weight: 600; font-size: 15px;
  padding: 14px 18px; border-radius: 14px;
  margin-bottom: 14px; box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
}
.next-class .nc-icon { font-size: 22px; }
.next-class .nc-body { flex: 1; }
.next-class .nc-body .nc-l { font-size: 11px; opacity: 0.85; font-weight: 400; margin-bottom: 2px; letter-spacing: 0.5px; }
.next-class .nc-body .nc-t { font-size: 15px; }
.next-class .nc-body .nc-t b { font-size: 17px; }

/* 课程表：可点击格子 */
.sch-table td.cell { cursor: pointer; -webkit-user-select: none; user-select: none; }
.sch-table td.cell:active { transform: scale(0.96); }
.sch-jump {
  display: inline-block; padding: 3px 10px; margin: 2px; border-radius: 999px;
  background: #fff; color: var(--blue); border: 1px solid #B9D4EE;
  cursor: pointer; font-weight: 600; font-size: 12px;
}
.sch-jump:active { background: var(--blue); color: #fff; }
.sch-hint { color: #C3C7CC; font-size: 14px; }
/* 课表：午托 / 晚托 行（绿色区分） */
.sch-table tr.care-row th { background: #E6F7F1; color: #0F6E56; }
.sch-table tr.care-row td { background: #F4FBF9; }
.sch-table td.care.has { background: linear-gradient(135deg, #E6F7F1 0%, #C9EEDD 100%); color: #0F6E56; font-weight: 600; }
/* 课程色格（按课程颜色铺底，白字） */
.sch-table td.course-cell { color: #fff; font-weight: 700; }
.sch-table td.course-cell span { color: #fff; }
/* 课表控制条：视图切换 + 单双周 */
.sch-ctrl { padding: 12px 14px; }
.sch-ctrl .seg { display: flex; gap: 6px; margin-bottom: 10px; }
.seg-btn { flex: 1; padding: 8px 0; border-radius: 10px; border: 1px solid var(--gray-200); background: #fff; color: var(--gray-600); font-size: 13px; cursor: pointer; font-weight: 500; }
.seg-btn.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.wk-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wk-badge { font-size: 13px; color: var(--gray-700); }
.wk-badge b { color: var(--blue); }
.btn.xs { padding: 5px 12px; font-size: 12px; }
/* 课表：表头真实日期 + 日期导航 + 选中日高亮 */
.sch-table th .sch-date { display: block; font-size: 11px; font-weight: 400; color: var(--gray-400); margin-top: 2px; line-height: 1.1; }
.sch-table th.focus-col { background: var(--blue); color: #fff; }
.sch-table th.focus-col .sch-date { color: rgba(255, 255, 255, 0.85); }
.sch-table td.focus { box-shadow: inset 0 0 0 2px var(--blue); background: var(--blue-50); }
.wk-nav { display: inline-flex; gap: 6px; }
.date-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.date-row label { font-size: 13px; color: var(--gray-600); flex: 0 0 auto; }
.date-row input[type=date] { flex: 1; min-width: 150px; padding: 7px 10px; border: 1px solid var(--gray-200); border-radius: 10px; font-size: 13px; background: #fff; color: var(--gray-800); }
.focus-day { border-left: 4px solid var(--blue); }
.focus-day .flist { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.focus-day .flist li { margin: 3px 0; }
/* 班级教学进度管理 */
.pg-wrap { display: flex; gap: 14px; align-items: flex-start; }
.pg-side { width: 200px; flex: 0 0 200px; background: var(--card); border-radius: 12px; padding: 12px 0 4px; box-shadow: var(--shadow-sm); }
.pg-side-h { font-size: 13px; font-weight: 600; padding: 0 12px 8px; color: var(--blue); }
.pg-units { max-height: 60vh; overflow-y: auto; }
.pg-unit { padding: 8px 12px; cursor: pointer; border-left: 3px solid transparent; }
.pg-unit:hover { background: var(--gray-100); }
.pg-unit.on { background: var(--blue-50); border-left-color: var(--blue); }
.pg-unit-n { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.pg-bar { height: 5px; background: var(--gray-200); border-radius: 3px; margin: 6px 0 4px; overflow: hidden; }
.pg-bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.pg-unit-s { font-size: 11px; color: var(--text-muted); }
.pg-main { flex: 1; min-width: 0; }
.pg-top { padding: 12px 14px; }
.pg-cls { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.pg-usel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pg-usel label { font-size: 13px; color: var(--text-muted); }
.pg-usel select { padding: 6px 10px; border: 1px solid var(--gray-200); border-radius: 10px; font-size: 13px; background: #fff; }
.pg-dl { font-size: 12px; padding: 3px 9px; border-radius: 8px; background: var(--gray-100); color: var(--text-muted); }
.pg-dl.soon { background: var(--amber-50); color: var(--amber-600); }
.pg-dl.overdue { background: var(--red-50); color: var(--red-600); }
.pg-flag { font-size: 11px; padding: 1px 6px; border-radius: 6px; font-weight: 400; }
.pg-flag.red { background: var(--red-50); color: var(--red-600); }
.pg-flag.amber { background: var(--amber-50); color: var(--amber-600); }
.pg-flag.green { background: var(--green-50); color: var(--green-600); }
.pg-tabs { display: flex; gap: 6px; margin: 12px 0; }
.pg-tabs .seg-btn { max-width: 180px; }
.pg-alert { padding: 10px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 12px; }
.pg-alert.red { background: var(--red-50); color: var(--red-600); }
.pg-alert.amber { background: var(--amber-50); color: var(--amber-600); }
.pg-lesson { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); }
.pg-lesson-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pg-idx { font-size: 13px; font-weight: 600; }
.pg-date { font-size: 12px; color: var(--text-muted); flex: 1; }
.pg-block { margin-bottom: 8px; }
.pg-lb { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.pg-lt { font-size: 14px; white-space: pre-wrap; }
.pg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-chip { font-size: 12px; padding: 2px 9px; border-radius: 8px; background: var(--green-50); color: var(--green-600); }
.pg-matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.pg-matrix th, .pg-matrix td { border-bottom: 1px solid var(--gray-100); padding: 9px 10px; text-align: left; }
.pg-matrix th.pg-th { text-align: center; min-width: 96px; }
.pg-matrix th.pg-th.cur { background: var(--blue-50); }
.pg-th-s { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-top: 2px; }
.pg-cell { text-align: center; font-weight: 600; }
.pg-cell.done { color: var(--green-600); background: var(--green-50); }
.pg-cell.todo { color: var(--gray-200); }
.pg-checks { display: flex; flex-direction: column; gap: 6px; }
.pg-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
@media (max-width: 767px) {
  .pg-wrap { flex-direction: column; }
  .pg-side { width: 100%; flex: none; }
  .pg-units { max-height: none; }
}
/* 课程管理 */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.dot.lg { width: 18px; height: 18px; border-radius: 6px; }
.tag.sm { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--blue-50); color: var(--blue); margin-left: 4px; }
.tag.act { cursor: pointer; }
.tag.act.del { color: #c0392b; }
.course-pick { display: flex; flex-direction: column; gap: 8px; }
.cp-item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--gray-200); background: #fff; cursor: pointer; text-align: left; width: 100%; }
.cp-item:active { transform: scale(0.98); }
.cp-item .cp-name { font-weight: 600; flex: 1; }
.cp-item .cp-meta { font-size: 12px; color: var(--gray-500); }
.cp-item.cp-clear { color: #c0392b; justify-content: center; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.palette .sw { width: 26px; height: 26px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.palette .sw.on { border-color: var(--gray-700); }
.class-edit-row { display: flex; gap: 8px; margin-bottom: 10px; overflow-x: auto; }
.ce-pill {
  flex: 0 0 auto; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--gray-200);
  background: #fff; color: var(--gray); font-size: 13px; font-weight: 500; cursor: pointer;
}
.ce-pill.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* 成绩录入：模式切换 + 逐个录入大卡 */
.seg-row { display: flex; gap: 6px; margin: 4px 0 12px; }
.seg {
  flex: 1; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--gray-200);
  background: #fff; color: var(--gray); font-size: 13px; font-weight: 500; cursor: pointer;
}
.seg.active { background: var(--blue-50); border-color: var(--blue); color: var(--blue); }
.one-card {
  background: linear-gradient(135deg, #F4F9FF 0%, #E9F2FB 100%);
  border: 1px solid #CDE0F2; border-radius: 16px; padding: 18px 16px; text-align: center;
}
.one-card .one-progress { font-size: 12px; color: var(--gray); margin-bottom: 8px; }
.one-card .one-name { font-size: 34px; font-weight: 600; color: var(--blue); margin-bottom: 12px; }
.one-card input {
  font-size: 24px; text-align: center; font-weight: 600; padding: 12px;
  border: 2px solid var(--blue); border-radius: 12px; margin-bottom: 12px;
}
#paste-area { min-height: 120px; font-size: 14px; }

/* 语音录入 */
.voice-btn { width: 100%; padding: 15px; font-size: 16px; border-radius: 14px; }
.voice-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.voice-btn.listening {
  background: var(--red-600);
  animation: voicePulse 1.2s infinite;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(163, 45, 45, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(163, 45, 45, 0); }
}
#voice-area { min-height: 90px; font-size: 14px; margin-top: 4px; }

/* 班委与小组 */
.role-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.role-row:last-child { border-bottom: none; }
.role-row .rname { flex: 0 0 92px; font-size: 14px; font-weight: 500; }
.role-row select { flex: 1; padding: 9px; border: 1px solid var(--gray-200); border-radius: 10px; font-size: 14px; background: #fff; }
.group-card { background: var(--card); border: 1px solid var(--gray-200); border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.group-card .gh { font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--gray-200); font-size: 12px; background: #fff;
  cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--blue); }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.member-pick { margin-top: 10px; }
.member-pick .chip { cursor: pointer; }

/* 班级事务 */
.task-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
}
.task-row .tinfo { flex: 1; }
.task-row .tinfo .tt { font-size: 15px; font-weight: 500; }
.task-row .tinfo .td { font-size: 12px; color: var(--text-muted); }
.task-row.done .tt { text-decoration: line-through; color: var(--text-muted); }
.countdown { color: var(--red-600); font-weight: 600; font-size: 12px; }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0;
  padding: 22px 18px calc(env(safe-area-inset-bottom) + 22px);
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet h3 { margin: 0 0 16px; font-size: 17px; font-weight: 600; }
.sheet .close { float: right; background: none; border: none; font-size: 22px; color: var(--text-muted); cursor: pointer; line-height: 1; padding: 0; }

/* Pick big name */
.pick-stage {
  background: linear-gradient(135deg, var(--blue-50) 0%, #D6E6F6 100%);
  border-radius: 16px; padding: 48px 18px; text-align: center; margin-bottom: 16px;
  min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.pick-name { font-size: 48px; font-weight: 700; color: var(--blue); min-height: 60px; letter-spacing: 2px; }
.pick-sub { font-size: 13px; color: var(--text-muted); margin-top: 10px; }

/* misc */
.muted { color: var(--text-muted); font-size: 12px; }
.empty { text-align: center; color: var(--text-muted); padding: 36px 0; font-size: 14px; }

/* 不安全连接提醒（仅在非安全上下文时显示） */
.secure-warn {
  background: linear-gradient(135deg, #FFF7E6 0%, #FFE9C2 100%);
  border-bottom: 1px solid #F2C97A;
  color: #6B3A00;
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.secure-warn .sw-icon { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.secure-warn b { color: #8C3A00; }
.secure-warn a { color: var(--blue); text-decoration: none; font-weight: 500; }
.secure-warn a:hover { text-decoration: underline; }
.secure-warn .sw-close { background: none; border: none; color: #8C3A00; font-size: 18px; line-height: 1; padding: 0 0 0 4px; cursor: pointer; flex-shrink: 0; }
.divider { height: 1px; background: var(--gray-200); margin: 16px 0; }
.pick-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 2px; background: var(--gray-200); }
.pick-dot.used { background: var(--blue); }
.center { text-align: center; }

/* 导出到腾讯文档 / 提示 toast */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: #1F2937; color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; max-width: 90%; width: max-content;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 999; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ====================== 侧边栏 Drawer ====================== */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 268px;
  background: var(--drawer-bg);
  color: var(--drawer-text);
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 60; display: flex; flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,0.12);
}
.drawer.open { transform: translateX(0); }

.drawer .brand {
  padding: calc(env(safe-area-inset-top) + 22px) 20px 18px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 12px;
}
.drawer .logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--blue) 0%, #2076C2 100%);
  color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(24,95,165,0.3);
}
.drawer .brand-t .b1 { font-weight: 700; font-size: 16px; color: var(--text); }
.drawer .brand-t .b2 { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.drawer .menu {
  flex: 1; overflow-y: auto; padding: 8px 0 16px;
  -webkit-overflow-scrolling: touch;
}
.drawer .menu-section {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  padding: 14px 22px 8px;
  text-transform: uppercase; letter-spacing: 1px;
}
.drawer .menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 22px;
  font-size: 14px; color: var(--drawer-text);
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.drawer .menu-item:hover {
  background: #F4F8FC; color: var(--blue);
}
.drawer .menu-item.active {
  background: linear-gradient(90deg, var(--blue-50) 0%, transparent 100%);
  color: var(--blue); font-weight: 600;
  border-left-color: var(--blue);
}
.drawer .menu-item .ic {
  width: 22px; font-size: 16px; text-align: center; flex: 0 0 22px;
}
.drawer .menu-item span:not(.ic) { flex: 1; }

.drawer-footer {
  padding: 14px 22px calc(env(safe-area-inset-bottom) + 14px);
  border-top: 1px solid var(--gray-100);
  font-size: 11px; color: var(--text-muted);
}
.drawer-footer .df-line { margin-bottom: 3px; }
.drawer-footer .df-ver { opacity: 0.7; }

/* Scrim 遮罩 */
.scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity .25s; z-index: 55;
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* ====================== 桌面端 ≥768px ====================== */
@media (min-width: 768px) {
  body { background: #ECEFF3; }
  #app {
    max-width: none; margin: 0;
    padding-left: 268px;
  }
  .drawer {
    transform: translateX(0);
    box-shadow: 1px 0 0 rgba(0,0,0,0.06);
    border-right: 1px solid var(--gray-200);
  }
  .scrim { display: none; }
  .hamburger { display: none; }
  #app-header { border-radius: 0; }
  #page { padding: 28px 32px 100px; max-width: 1200px; margin: 0 auto; width: 100%; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .fn-grid { grid-template-columns: repeat(6, 1fr); }
  .card { padding: 18px 20px; }
  /* 桌面端把 tabbar 隐藏：侧栏已覆盖 */
  #tabbar { display: none; }
  #page { padding-bottom: 40px; }
}
@media (min-width: 1200px) {
  #page { padding: 32px 40px; }
}

/* ====================== 积分奖励系统 ====================== */
.center-pill {
  background: linear-gradient(135deg, var(--amber-50) 0%, #FCEFD6 100%);
  border: 1px solid #F0D9A8; border-radius: 14px;
  padding: 16px; text-align: center; font-size: 17px; font-weight: 700; color: var(--amber-600);
  margin-bottom: 8px;
}
.btn-col { display: flex; flex-direction: column; gap: 12px; }
.btn.big-act {
  font-size: 19px; font-weight: 600; padding: 18px; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn.big-act span {
  font-size: 15px; font-weight: 700; background: rgba(255,255,255,0.22);
  padding: 2px 12px; border-radius: 999px;
}
.btn.big-act:active { transform: scale(0.98); }

/* 学号宫格 */
.no-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.no-cell {
  background: #fff; border: 1px solid #EEF1F5; border-radius: 12px;
  padding: 10px 2px 8px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: var(--shadow-sm); transition: transform .12s, background .15s, border-color .15s;
  -webkit-user-select: none; user-select: none;
}
.no-cell:active { transform: scale(0.96); }
.no-cell .nc-no { font-size: 16px; font-weight: 700; color: var(--text); }
.no-cell .nc-name { font-size: 11px; color: var(--text-muted); line-height: 1.2; min-height: 14px; }
.no-cell .nc-pts { font-size: 11px; color: var(--amber-600); font-weight: 600; }
.no-cell.empty { background: #FAFBFC; cursor: not-allowed; opacity: 0.6; }
.no-cell.empty .nc-no { color: #C3C7CC; }
.no-cell.on { background: var(--blue); border-color: var(--blue); }
.no-cell.on .nc-no, .no-cell.on .nc-name, .no-cell.on .nc-pts { color: #fff; }
.no-cell.sel { background: var(--amber-600); border-color: var(--amber-600); }
.no-cell.sel .nc-no, .no-cell.sel .nc-name { color: #fff; }

.qp { font-size: 13px; line-height: 1.5; }
.act-head { display: flex; gap: 12px; align-items: center; background: linear-gradient(135deg, var(--blue-50) 0%, #D6E6F6 100%); border-color: #CDE0F2; }
.act-head .ah-ic { font-size: 30px; flex: 0 0 auto; }
.act-head .ah-t { font-size: 17px; font-weight: 700; color: var(--blue); }
.act-head .ah-sub { font-size: 13px; color: var(--text-muted); }
.act-head .ah-sub b { color: var(--blue); }
.act-ok { background: linear-gradient(135deg, #E1F5EE 0%, #C9EFE0 100%); border-color: #A9DFC9; }
.act-ok .ok-t { font-size: 16px; font-weight: 700; color: var(--teal-600); }
.act-ok .ok-d { font-size: 14px; color: #1F5C49; margin-top: 4px; }
.ss-t { font-size: 14px; margin-bottom: 8px; }
.pd-head { display: flex; gap: 12px; align-items: center; }

/* 流水批次 */
.ledger-batch { padding: 14px 16px; }
.lb-head { display: flex; justify-content: space-between; align-items: center; }
.lb-reason { font-size: 15px; font-weight: 600; color: var(--blue); }
.lb-date { font-size: 12px; color: var(--text-muted); }
.lb-sub { font-size: 13px; color: var(--text); margin-top: 4px; }
.lb-names { font-size: 12px; margin-top: 4px; word-break: break-all; }

/* 兑换 / 奖励券 */
.ex-status .ex-s-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.ex-status .ex-s-row b { font-size: 15px; color: var(--gray); }
.ex-status .ex-s-row b.on { color: var(--teal-600); }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 14px; }
.switch-row input { width: 20px; height: 20px; }
.cp-block { margin: 4px 0 2px; font-size: 13px; }
.cp-block .cp-h { color: var(--text-muted); margin-bottom: 4px; }
.cp-used-chip { text-decoration: line-through; opacity: .65; }
.reward-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px; background: var(--purple-50); color: var(--purple-600); border: 1px solid #D9D4F2;
}
.reward-btn .rb-cost { font-weight: 700; }
.reward-btn.disabled { opacity: 0.45; cursor: not-allowed; }
.reward-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
.reward-row:last-of-type { border-bottom: none; }
.reward-row b { color: var(--purple-600); }
