/* ========== 班委工作满意度调查 — 公共样式 ========== */
:root {
  --primary: #2563EB;
  --primary-dark: #1E40AF;
  --primary-light: #EFF6FF;
  --text: #111827;
  --text-2: #6B7280;
  --border: #E5E7EB;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --r1: #FEE2E2;
  --r2: #FEF3C7;
  --r3: #F3F4F6;
  --r4: #BFDBFE;
  --r5: #2563EB;
  --ok: #059669;
  --warn: #D97706;
  --bad: #DC2626;
  --shadow: 0 1px 3px rgba(17, 24, 39, .06), 0 1px 2px rgba(17, 24, 39, .04);
  --radius: 16px;
}

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

html { font-size: 16px; }

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

button { font-family: inherit; cursor: pointer; border: none; background: none; }
textarea { font-family: inherit; }

/* ========== 问卷页 ========== */
.page { max-width: 640px; margin: 0 auto; padding: 16px 14px 140px; }

.hero {
  background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(37, 99, 235, .22);
  margin-bottom: 16px;
}
.hero-tag {
  display: inline-block; font-size: 12px; letter-spacing: .12em;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .35);
  padding: 3px 12px; border-radius: 999px; margin-bottom: 12px;
}
.hero h1 { font-size: 24px; font-weight: 700; letter-spacing: .02em; }
.hero-sub { font-size: 13px; opacity: .85; margin-top: 6px; }

.progress { height: 6px; background: rgba(255, 255, 255, .25); border-radius: 999px; margin-top: 18px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: #fff; border-radius: 999px; transition: width .3s ease; }
.progress-text { font-size: 12px; opacity: .85; margin-top: 8px; text-align: right; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(229, 231, 235, .7);
}

.card h2 {
  font-size: 17px; font-weight: 700; color: var(--text);
  padding-left: 10px; border-left: 4px solid var(--primary);
  margin-bottom: 4px; line-height: 1.3;
}

.intro-card p { margin-bottom: 10px; }
.intro-card p:last-child { margin-bottom: 0; }
.intro-note {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: #1F2937;
}

.q { margin-top: 18px; }
.q-title { font-size: 15px; font-weight: 600; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.q-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; border-radius: 7px;
  background: var(--primary); color: #fff; font-size: 12.5px; font-weight: 700;
  padding: 0 5px; transform: translateY(2px);
}
.req { font-size: 11px; color: var(--bad); border: 1px solid #FECACA; background: #FEF2F2; border-radius: 6px; padding: 1px 7px; font-weight: 500; }
.opt { font-size: 11px; color: var(--text-2); border: 1px solid var(--border); background: #F9FAFB; border-radius: 6px; padding: 1px 7px; font-weight: 400; }

.hint { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.section-hint { margin: 8px 0 2px; color: var(--warn); }

/* 班级选择 */
.class-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.class-btn {
  border: 1.5px solid var(--border); background: #fff; border-radius: 12px;
  padding: 10px 0; font-size: 15px; font-weight: 600; color: var(--text);
  transition: all .15s ease;
}
.class-btn.active { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .25); }

/* 评分矩阵 */
.matrix { margin-top: 12px; }
.m-row { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.m-row:last-child { border-bottom: none; }
.m-label { font-size: 14px; color: var(--text); margin-bottom: 8px; }
.m-opts { display: flex; gap: 8px; }
.opt-btn {
  flex: 1; max-width: 64px; height: 36px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  background: #fff; transition: all .15s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.opt-btn small { font-size: 10px; font-weight: 400; margin-left: 2px; }
.opt-btn.active { color: #fff; border-color: transparent; }
.opt-btn.active[data-v="1"] { background: #EF4444; }
.opt-btn.active[data-v="2"] { background: #F59E0B; }
.opt-btn.active[data-v="3"] { background: #9CA3AF; }
.opt-btn.active[data-v="4"] { background: #3B82F6; }
.opt-btn.active[data-v="5"] { background: var(--primary); box-shadow: 0 4px 10px rgba(37, 99, 235, .3); }
.opt-btn.active-na { background: #E5E7EB; color: #4B5563; border-color: transparent; }

/* 多选 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1.5px solid var(--border); background: #fff; border-radius: 999px;
  padding: 7px 14px; font-size: 13.5px; color: var(--text);
  transition: all .15s ease; line-height: 1.35;
}
.chip.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.chip.maxed { opacity: .45; }
.chip-count { font-size: 11px; color: var(--text-2); margin-top: 8px; }

/* 开放题 */
textarea {
  width: 100%; min-height: 92px; margin-top: 10px;
  border: 1.5px solid var(--border); border-radius: 12px;
  padding: 10px 12px; font-size: 14px; color: var(--text);
  background: #fff; resize: vertical; transition: border-color .15s ease;
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

/* 提交栏 */
.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
}
.submit-inner { max-width: 640px; margin: 0 auto; }
.submit-btn {
  width: 100%; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, #2563EB, #1E40AF);
  color: #fff; font-size: 16.5px; font-weight: 700; letter-spacing: .05em;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .3);
  transition: transform .12s ease, box-shadow .12s ease;
}
.submit-btn:active { transform: scale(.98); }
.submit-btn:disabled { background: #9CA3AF; box-shadow: none; }
.submit-note { text-align: center; font-size: 11.5px; color: var(--text-2); margin-top: 7px; }

.form-error {
  display: none; margin-top: 10px; padding: 10px 12px;
  background: #FEF2F2; border: 1px solid #FECACA; border-radius: 10px;
  color: var(--bad); font-size: 13px;
}
.form-error.show { display: block; }

/* 完成页 */
.done-screen {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px;
}
.done-card {
  background: #fff; border-radius: 20px; padding: 40px 28px; text-align: center;
  box-shadow: var(--shadow); max-width: 360px; width: 100%;
}
.done-icon {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
  background: #ECFDF5; display: flex; align-items: center; justify-content: center;
}
.done-icon svg { width: 32px; height: 32px; color: var(--ok); }
.done-card h2 { font-size: 20px; margin-bottom: 10px; }
.done-card p { font-size: 14px; color: var(--text-2); }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: #111827; color: #fff; font-size: 13.5px;
  padding: 10px 18px; border-radius: 999px; z-index: 60;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.toast.show { opacity: .95; }

/* ========== 数据看板 ========== */
.admin-body { background: var(--bg); min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.topbar h1 { font-size: 17px; font-weight: 700; flex: 1; min-width: 140px; }
.topbar h1 small { font-size: 12px; color: var(--text-2); font-weight: 500; margin-left: 6px; }
.cls-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.cls-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  font-size: 12.5px; padding: 5px 12px; color: var(--text-2);
}
.cls-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.tb-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 10px;
  font-size: 12.5px; padding: 6px 12px; color: var(--text);
}
.tb-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.admin-wrap { max-width: 960px; margin: 0 auto; padding: 16px 14px 60px; }

.login-card {
  max-width: 380px; margin: 12vh auto 0; background: #fff;
  border-radius: 20px; padding: 36px 28px; box-shadow: var(--shadow); text-align: center;
}
.login-card .lock {
  width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 14px;
  background: var(--primary-light); display: flex; align-items: center; justify-content: center;
}
.login-card h2 { font-size: 19px; margin-bottom: 6px; }
.login-card p { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }
.login-card input {
  width: 100%; height: 46px; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 0 14px; font-size: 15px; margin-bottom: 12px; text-align: center; letter-spacing: .08em;
}
.login-card input:focus { outline: none; border-color: var(--primary); }
.login-card button {
  width: 100%; height: 46px; border-radius: 12px; background: var(--primary);
  color: #fff; font-size: 15.5px; font-weight: 700;
}
.login-error { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 20px; }

.panel { background: #fff; border-radius: var(--radius); padding: 20px 18px; margin-bottom: 14px; box-shadow: var(--shadow); border: 1px solid rgba(229, 231, 235, .7); }
.panel h3 { font-size: 16px; font-weight: 700; padding-left: 10px; border-left: 4px solid var(--primary); margin-bottom: 14px; }
.panel h3 small { font-size: 12px; color: var(--text-2); font-weight: 400; margin-left: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat-box { background: #F9FAFB; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat-box .k { font-size: 12px; color: var(--text-2); }
.stat-box .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-box.hl { background: var(--primary-light); border-color: #BFDBFE; }
.stat-box.hl .v { color: var(--primary-dark); }

/* 维度评分行 */
.dim-row { padding: 13px 0; border-bottom: 1px dashed var(--border); }
.dim-row:last-child { border-bottom: none; }
.dim-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dim-name { font-size: 14px; flex: 1; }
.dim-avg { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }
.dim-avg small { font-size: 11px; color: var(--text-2); font-weight: 500; }
.dist-bar { display: flex; height: 20px; border-radius: 7px; overflow: hidden; background: #F3F4F6; }
.dist-seg { height: 100%; transition: width .4s ease; min-width: 0; }
.dist-seg.s1 { background: #FCA5A5; }
.dist-seg.s2 { background: #FCD34D; }
.dist-seg.s3 { background: #D1D5DB; }
.dist-seg.s4 { background: #93C5FD; }
.dist-seg.s5 { background: var(--primary); }
.dist-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dist-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 3px; }

/* 职务卡片 */
.pos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.pos-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: #fff; }
.pos-card .pos-name { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pos-badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 10px; }
.pos-badge.good { background: #ECFDF5; color: var(--ok); }
.pos-badge.mid { background: #FFFBEB; color: var(--warn); }
.pos-badge.low { background: #FEF2F2; color: var(--bad); }
.pos-badge.na { background: #F3F4F6; color: var(--text-2); }
.pos-avg { display: flex; align-items: baseline; gap: 6px; margin: 8px 0 10px; }
.pos-avg b { font-size: 30px; font-variant-numeric: tabular-nums; line-height: 1; }
.pos-avg span { font-size: 11.5px; color: var(--text-2); }
.pos-na { font-size: 11.5px; color: var(--text-2); margin-top: 8px; }

/* 横条图 */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bar-row .bar-label { font-size: 13px; width: 42%; flex: none; }
.bar-track { flex: 1; height: 16px; background: #F3F4F6; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--primary); transition: width .4s ease; }
.bar-fill.con { background: #F59E0B; }
.bar-row .bar-num { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; width: 34px; text-align: right; flex: none; }

/* 原文 tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  font-size: 12.5px; padding: 5px 13px; color: var(--text-2);
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.tab .cnt { opacity: .75; font-size: 11px; margin-left: 2px; }
.text-list { display: flex; flex-direction: column; gap: 10px; }
.text-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: #FCFCFD; }
.text-item .meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.cls-badge { font-size: 11px; font-weight: 700; background: var(--primary-light); color: var(--primary-dark); border-radius: 6px; padding: 1px 8px; }
.text-item time { font-size: 11px; color: var(--text-2); }
.text-item .body { font-size: 14px; white-space: pre-wrap; word-break: break-word; }

.empty { text-align: center; color: var(--text-2); font-size: 13.5px; padding: 34px 0; }

.loading { text-align: center; color: var(--text-2); font-size: 13.5px; padding: 40px 0; }

@media (max-width: 480px) {
  .hero h1 { font-size: 21px; }
  .class-grid { gap: 6px; }
  .class-btn { font-size: 14px; padding: 9px 0; }
  .m-opts { gap: 6px; }
  .opt-btn { height: 34px; font-size: 13px; }
  .bar-row .bar-label { width: 38%; font-size: 12.5px; }
}
