:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --line: #e4e8e6;
  --line-2: #eef1f0;
  --text: #1c2320;
  --text-2: #5c6864;
  --text-3: #8d9793;
  --brand: #1d7a46;
  --brand-d: #165c35;
  --brand-l: #eaf5ee;
  --warn: #c2410c;
  --warn-l: #fdf1e8;
  --danger: #b91c1c;
  --danger-l: #fdecec;
  --blue: #1d4ed8;
  --blue-l: #eaeffc;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 24, .04), 0 8px 24px -12px rgba(16, 32, 24, .12);
}

* { box-sizing: border-box; }

/* hidden 属性必须真的隐藏：.tag 这类设了 display 的元素会盖掉 UA 的 [hidden] */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: .3px;
}
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, #2f9c5b 100%);
  color: #fff; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.brand small {
  font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: 2px;
}
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--text-2); font-size: 13px; }
.topbar .who b { color: var(--text); font-weight: 500; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px; }
.wrap.narrow { max-width: 760px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
}
.card-h h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-h .sub { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px 18px; }
.card-b.tight { padding: 0; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #cfd6d3; background: #fafbfa; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500;
}
.btn.primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: #f1f4f2; border-color: transparent; }
.btn.danger { color: var(--danger); border-color: #f0cccc; background: #fff; }
.btn.danger:hover { background: var(--danger-l); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text);
  background: #fff; outline: none; transition: .15s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 122, 70, .1);
}
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

/* ---------- 指标 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: #fbfcfb; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 12px 14px;
}
.stat .k { font-size: 12.5px; color: var(--text-3); }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -.3px; margin-top: 2px; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.stat.ok .v { color: var(--brand); }
.stat.no .v { color: var(--warn); }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  background: #f7f9f8;
  text-align: left; font-weight: 500; color: var(--text-2);
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.grid td {
  padding: 8px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
table.grid tbody tr:hover { background: #fafcfb; }
table.grid th.num { text-align: right; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid .muted { color: var(--text-3); }

/* ---------- 徽标 ---------- */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; line-height: 18px; border: 1px solid transparent;
  white-space: nowrap;
}
.tag.gray { background: #f2f4f3; color: var(--text-2); }
.tag.green { background: var(--brand-l); color: var(--brand-d); }
.tag.blue { background: var(--blue-l); color: var(--blue); }
.tag.amber { background: var(--warn-l); color: var(--warn); }
.tag.red { background: var(--danger-l); color: var(--danger); }

/* ---------- 二维码 ---------- */
.qr-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px;
}
.qr-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  text-align: center; background: #fff;
}
.qr-card .cls { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.qr-card .meta { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.qr-card svg, .qr-card img { width: 132px; height: 132px; display: block; margin: 0 auto; }
.qr-card .url {
  font-size: 10.5px; color: var(--text-3); margin-top: 7px;
  word-break: break-all; line-height: 1.35;
}

/* ---------- 空态 ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 13.5px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%) translateY(-10px);
  background: #1f2a25; color: #fff; padding: 9px 18px; border-radius: 999px;
  font-size: 13.5px; opacity: 0; transition: .22s; pointer-events: none; z-index: 999;
  max-width: 80vw; text-align: center;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(160deg, #eef4f1 0%, #f4f6f5 46%, #f7f4ee 100%);
}
.login-box {
  width: 100%; max-width: 368px; background: #fff; border-radius: 16px;
  border: 1px solid var(--line); box-shadow: 0 12px 40px -18px rgba(20, 50, 34, .28);
  padding: 30px 28px 26px;
}
.login-box .logo { text-align: center; margin-bottom: 22px; }
.login-box .logo .mark {
  width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 10px;
  background: linear-gradient(135deg, var(--brand) 0%, #2f9c5b 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600; letter-spacing: .5px;
}
.login-box h1 { font-size: 17px; margin: 0 0 3px; font-weight: 600; }
.login-box .sub { font-size: 12.5px; color: var(--text-3); }
.login-box .btn { height: 38px; margin-top: 6px; }

/* ---------- 手机端 ---------- */
.m-body { background: #f4f6f5; padding-bottom: 84px; }
.m-hero {
  background: #fff; border-bottom: 1px solid var(--line); padding: 16px 16px 14px;
  position: sticky; top: 0; z-index: 10;
}
.m-hero .cls { font-size: 17px; font-weight: 600; }
.m-hero .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.m-hero .bar {
  height: 5px; background: #eef1f0; border-radius: 999px; margin-top: 10px; overflow: hidden;
}
.m-hero .bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s; }

.m-list { padding: 10px 12px 0; }
.m-item {
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 13px; margin-bottom: 7px; display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.m-item:active { background: #f7faf8; }
.m-item .idx { color: var(--text-3); font-size: 12px; width: 22px; font-variant-numeric: tabular-nums; }
.m-item .nm { font-size: 15px; font-weight: 500; }
.m-item .info { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.m-item .right { margin-left: auto; text-align: right; }
.m-item .val { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.m-item.done { border-color: #cfe6d9; background: #fbfdfb; }

.m-sheet-mask {
  position: fixed; inset: 0; background: rgba(20, 30, 25, .38); z-index: 100;
  display: none; align-items: flex-end;
}
.m-sheet-mask.on { display: flex; }
.m-sheet {
  width: 100%; background: #fff; border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.m-sheet h3 { margin: 0 0 2px; font-size: 17px; }
.m-sheet .sub { color: var(--text-3); font-size: 12.5px; margin-bottom: 16px; }
.m-sheet input { height: 46px; font-size: 17px; text-align: center; }
.m-sheet .unit { position: relative; }
.m-sheet .unit span {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  font-size: 12.5px; color: var(--text-3); pointer-events: none;
}
.m-actions { display: flex; gap: 10px; }
.m-actions .btn { flex: 1; height: 46px; font-size: 15px; border-radius: 10px; }

@media (max-width: 720px) {
  .wrap { padding: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row { flex-direction: column; gap: 0; }
  .topbar { padding: 0 12px; height: 52px; }
  .brand small { display: none; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: none; margin: 0; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .qr-card { break-inside: avoid; page-break-inside: avoid; }
}

/* ================= 体测录入（手机端） ================= */
.m-hero-top { display: flex; align-items: center; gap: 10px; }
.m-back {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  font-size: 22px; line-height: 1; padding: 0 0 4px; cursor: pointer;
}
.m-back:active { background: #f2f5f3; }
.m-mini {
  height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  font-size: 13px; font-family: inherit; cursor: pointer;
}
.m-hint-row {
  padding: 12px 16px 4px; font-size: 13px; color: var(--text-3);
}

/* 选班级前先选年级 */
.m-grade-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 2px;
}
.m-grade-row select {
  width: auto; max-width: 62%; height: 40px; padding: 0 32px 0 13px;
  font-size: 16px; font-weight: 500; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23808a86' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 12px;
  appearance: none; -webkit-appearance: none; outline: none;
}
.m-grade-row select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 122, 70, .1);
}
.m-grade-meta { font-size: 12.5px; color: var(--text-3); }

.m-focus {
  margin: 14px 12px 0; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 20px 18px 18px; box-shadow: var(--shadow);
}
.m-focus.done { border-color: #cfe6d9; }
.f-idx { font-size: 12.5px; color: var(--text-3); }
.f-name {
  font-size: 26px; font-weight: 600; letter-spacing: .5px; margin-top: 4px;
  display: flex; align-items: center; gap: 9px;
}
.f-sex {
  font-size: 12px; font-weight: 400; color: var(--text-2); background: #f2f4f3;
  border-radius: 999px; padding: 2px 9px; letter-spacing: 0;
}
.f-sno { font-size: 12px; color: var(--text-3); margin-top: 3px; }

.f-fields { display: flex; gap: 12px; margin-top: 20px; }
.f-field { flex: 1; min-width: 0; }
.f-field > label { display: block; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.f-input { position: relative; }
.f-input input {
  width: 100%; height: 52px; border: 1px solid var(--line); border-radius: 11px;
  font-size: 22px; font-weight: 500; text-align: center; font-family: inherit;
  color: var(--text); background: #fbfcfb; outline: none; transition: .15s;
  -moz-appearance: textfield;
}
.f-input input::-webkit-outer-spin-button,
.f-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.f-input input:focus {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(29, 122, 70, .1);
}
.f-input span {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--text-3); pointer-events: none;
}
.f-bmi { margin-top: 14px; font-size: 13px; color: var(--text-2); min-height: 20px; }
.f-bmi.warn { color: var(--warn); }
.m-tip {
  margin: 12px 20px 0; font-size: 12px; color: var(--text-3); line-height: 1.7; text-align: center;
}

.m-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.m-btn-prev { width: 104px; flex: 0 0 104px; height: 48px; font-size: 15px; border-radius: 11px; }
.m-btn-next { flex: 1; height: 48px; font-size: 16px; font-weight: 500; border-radius: 11px; }

.m-modal-mask {
  position: fixed; inset: 0; background: rgba(18, 28, 22, .42); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.m-modal-mask.on { display: flex; }
.m-modal {
  width: 100%; max-width: 340px; background: #fff; border-radius: 16px;
  padding: 22px 20px 16px; animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.94); opacity: .5; } to { transform: none; opacity: 1; } }
.m-modal-title { font-size: 16.5px; font-weight: 600; margin-bottom: 10px; }
.m-modal-body { font-size: 13.5px; line-height: 1.75; color: var(--text-2); }
.m-modal-body p { margin: 0 0 8px; }
.m-modal-body b { color: var(--text); }
.m-modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.m-modal-actions .btn { flex: 1; height: 44px; font-size: 14.5px; border-radius: 10px; }

@media (max-width: 360px) {
  .f-name { font-size: 23px; }
  .f-input input { font-size: 20px; height: 48px; }
  .m-btn-prev { width: 92px; flex: 0 0 92px; }
}

/* 表格内进度条 */
.pbar { height: 8px; background: #e4e9e6; border-radius: 999px; overflow: hidden; min-width: 90px; }
.pbar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s; }

/* 桌面弹窗里的表单：恢复正常尺寸与左对齐（手机录入弹层仍用大号居中） */
.m-sheet.form input[type=text],
.m-sheet.form input[type=password],
.m-sheet.form input[type=number],
.m-sheet.form select {
  height: 36px; font-size: 14px; text-align: left; padding: 0 11px; border-radius: 8px;
}
.m-sheet.form input[type=file] { height: auto; text-align: left; }
.m-sheet.form .field > label { font-size: 13px; color: var(--text-2); }

/* ================= 测试信息表 ================= */
.ti-tip {
  background: #f7faf8; border: 1px solid #d9e9df; border-radius: 10px;
  padding: 10px 14px; font-size: 13px; color: var(--text-2);
  margin-bottom: 14px; line-height: 1.75;
}
.ti-tip b { color: var(--text); font-weight: 500; }
.ti-bulk {
  background: #fbfcfb; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 14px 16px 12px;
}
.ti-bulk-title { font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.ti-bulk .field { margin-bottom: 10px; }
.ti-table { font-size: 13px; }
.ti-table th, .ti-table td { padding: 5px 8px; }
.ti-table .ti-in {
  width: 100%; height: 30px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; font-size: 13px; font-family: inherit; color: var(--text);
  padding: 0 7px; outline: none; transition: .12s;
}
.ti-table .ti-in:hover { border-color: var(--line); background: #fff; }
.ti-table .ti-in:focus {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(29, 122, 70, .08);
}
.ti-table .ti-in.ti-dirty { border-color: #eed6ae; background: #fffdf7; }
.ti-table select.ti-in { appearance: none; cursor: pointer; }
.ti-table input[type=date].ti-in { min-width: 132px; }

/* 班级 / 项目选择 chips */
.scope-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 9px; }
.scope-row > label {
  flex: 0 0 40px; font-size: 13px; color: var(--text-2); padding-top: 5px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.chip {
  height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 12.5px; color: var(--text-2); font-family: inherit;
  cursor: pointer; transition: .12s; white-space: nowrap;
}
.chip:hover { border-color: #cfd6d3; background: #fafbfa; }
.chip.on { background: var(--brand-l); border-color: #9ed3b3; color: var(--brand-d); font-weight: 500; }

.ti-jobs-head { font-size: 13px; color: var(--text-2); margin: 16px 0 8px; }
.ti-jobs-head .hint { margin-left: 6px; }
.job-item {
  display: flex; align-items: center; gap: 12px;
  background: #fbfcfb; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px;
}
.job-main { flex: 1; min-width: 0; font-size: 13px; }
.job-main b { font-weight: 500; color: var(--text); }
.job-scope { display: block; font-size: 12px; color: var(--text-3); margin-top: 3px; }
