:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --primary: #2f6fed;
  --primary-d: #1f55c7;
  --text: #1f2733;
  --muted: #6b7785;
  --line: #e3e8ef;
  --warn: #e8833a;
  --ok: #1f9d55;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; padding: 0 0 72px; background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px; line-height: 1.5;
}
.app-bar {
  position: sticky; top: 0; z-index: 10; background: var(--primary); color: #fff;
  padding: 14px 16px; font-size: 19px; font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
.view { display: none; padding: 16px; max-width: 720px; margin: 0 auto; }
.view.active { display: block; }
h2 { font-size: 20px; margin: 4px 0 12px; }
h3 { font-size: 17px; margin: 20px 0 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.field { display: block; margin: 12px 0; font-size: 14px; color: var(--muted); }
.field select {
  display: block; width: 100%; margin-top: 6px; padding: 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.upload-box {
  display: flex; align-items: center; justify-content: center; min-height: 180px;
  border: 2px dashed var(--line); border-radius: 14px; background: #fff; color: var(--muted);
  font-size: 15px; text-align: center; padding: 16px; cursor: pointer; overflow: hidden;
}
.upload-box img { max-width: 100%; max-height: 320px; border-radius: 10px; }
button {
  min-height: 48px; padding: 12px 18px; font-size: 16px; border: none; border-radius: 12px;
  background: var(--primary); color: #fff; font-weight: 600; cursor: pointer; width: 100%;
}
button:disabled { opacity: .5; }
button.primary { margin-top: 14px; }
button.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); margin-top: 14px; }
button.secondary { background: #eef2fb; color: var(--primary); }
button.ok { background: var(--ok); }
button.warn { background: var(--warn); }
.card-list { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { background: #eef2fb; color: var(--primary); padding: 3px 10px; border-radius: 999px; font-size: 13px; }
.badge.weight { background: #fdeee2; color: var(--warn); }
.card img.thumb { width: 100%; max-height: 220px; object-fit: contain; border-radius: 10px; margin-top: 10px; background: #f0f2f5; }
.card .actions { display: flex; gap: 10px; margin-top: 12px; }
.card .actions button { width: auto; flex: 1; }
.q-text { white-space: pre-wrap; margin: 8px 0; }
.answer { background: #f0f7f2; border-left: 3px solid var(--ok); padding: 8px 10px; border-radius: 6px; white-space: pre-wrap; font-size: 14px; }
.stats-summary { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-pill { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; flex: 1; min-width: 90px; text-align: center; }
.stat-pill b { display: block; font-size: 22px; color: var(--primary); }
.stat-pill span { font-size: 13px; color: var(--muted); }
.kp-table table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; font-size: 14px; }
.kp-table th, .kp-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.kp-table th { background: #f0f3f8; color: var(--muted); font-weight: 600; }
.report { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; white-space: pre-wrap; font-size: 15px; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: #fff;
  border-top: 1px solid var(--line); display: flex; z-index: 20;
}
.bottom-nav button {
  flex: 1; background: none; color: var(--muted); border: none; border-radius: 0;
  font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: auto; padding: 6px;
}
.bottom-nav button.active { color: var(--primary); font-weight: 700; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; padding: 18px; width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; }
.modal h3 { margin-top: 0; }
.modal .q-text { font-weight: 600; }
.modal textarea { width: 100%; min-height: 90px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 16px; font-family: inherit; }
.modal .actions { display: flex; gap: 10px; margin-top: 12px; }
.modal .actions button { flex: 1; }

/* 登录遮罩 */
.login-mask {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: 100%; max-width: 380px; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.login-card h2 { margin-top: 0; text-align: center; }
.login-card input, .form-card input, .form-card select {
  display: block; width: 100%; margin: 10px 0; padding: 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
/* 顶部用户区 */
.app-bar .user-box { float: right; font-size: 14px; font-weight: 400; }
.logout-link { color: #fff; margin-left: 10px; text-decoration: underline; cursor: pointer; }
/* 管理表单 */
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
/* 变式卷 */
.sheet-box { margin-top: 14px; }
.sheet-head { background: #eef2fb; color: var(--primary); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 10px; }
.sheet-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.sheet-item .sheet-q { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.sheet-toggle { width: auto; min-height: 38px; padding: 8px 14px; margin-top: 8px; }
