/* 青岛市学生常见病身体指标录入系统 —— 共用样式（手机优先，现场大字大按钮） */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #dde3ec;
  --text: #1c2430;
  --muted: #6b7787;
  --brand: #1a5fb4;
  --brand-d: #123f7a;
  --ok: #1a7f37;
  --warn: #b45309;
  --err: #c0281c;
  --err-bg: #fdecea;
  --warn-bg: #fff7e6;
  --ok-bg: #eaf6ec;
  --radius: 12px;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.55;
}

a { color: var(--brand); }

.wrap { max-width: 760px; margin: 0 auto; padding: 12px 12px 96px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--brand); color: #fff;
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; flex: 1; }
.topbar .link { color: #dbe8ff; font-size: 14px; text-decoration: none; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin: 12px 0;
  box-shadow: 0 1px 3px rgba(16,32,64,.04);
}
.card h2 { font-size: 15px; margin: 0 0 10px; color: var(--brand-d); }
.card h2 .tag { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }

/* 学生核名卡（现场防串码，必须醒目） */
.who { background: #fffdf3; border: 2px solid #e9c46a; }
.who .n { font-size: 26px; font-weight: 700; letter-spacing: 2px; }
.who .meta { font-size: 14px; color: #6a5a20; margin-top: 4px; }
.who .mask { font-size: 13px; color: var(--muted); margin-top: 4px; }
.who .warnline { margin-top: 8px; background: var(--warn-bg); color: var(--warn);
  border: 1px solid #f0d59a; border-radius: 8px; padding: 8px 10px; font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .grid { grid-template-columns: 1fr; } }

.fld { display: flex; flex-direction: column; gap: 4px; }
.fld > label { font-size: 15px; font-weight: 500; }
.fld .req { color: var(--err); margin-left: 2px; }
.fld .hint { font-size: 12px; color: var(--muted); }
.fld input, .fld select {
  height: 46px; padding: 0 10px; font-size: 17px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
  width: 100%; min-width: 0;
}
.fld input:focus, .fld select:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.fld.bad input, .fld.bad select { border-color: var(--err); background: var(--err-bg); }
.fld.bad .hint { color: var(--err); }

/* ---------------- 现场版块（默认折叠，各自提交；老八 2026-09-30） ---------------- */
section.sec {
  border: 1px solid var(--line); border-radius: 10px; margin: 10px 0;
  background: #fff; overflow: hidden;
}
section.sec > .sechead {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 14px; cursor: pointer; user-select: none;
}
section.sec .stitle { flex: 1; font-size: 16px; font-weight: 600; color: var(--brand-d); }
section.sec .stitle .tag { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
section.sec .badge {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: #eef3fb; color: var(--brand); white-space: nowrap;
}
section.sec .badge.ok { background: var(--ok-bg); color: var(--ok); }
section.sec .chev { color: var(--muted); font-size: 13px; }
section.sec.open > .sechead { border-bottom: 1px solid var(--line); }
section.sec .secbody { padding: 12px 12px 14px; }
section.sec .secbody > .grid { margin-bottom: 4px; }
.subsec { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.subsec:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.subsec > h4 { font-size: 14px; margin: 0 0 8px; color: var(--brand-d); }
.secfoot { display: flex; gap: 8px; margin-top: 14px; }
.secfoot .btn { flex: 1; }

/* 选项按钮（1/2/3 旁标注含义） */
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts .opt {
  min-height: 44px; padding: 0 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #f7f9fc; color: var(--text);
}
.opts .opt.on { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.fld.bad .opt { border-color: var(--err); background: var(--err-bg); }
.fld.bad > label { color: var(--err); }

/* 数值：值按钮 + 数字盘 */
.valbtn {
  width: 100%; min-height: 46px; padding: 0 12px; text-align: left;
  font-size: 18px; font-weight: 600; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.valbtn.empty { color: var(--muted); font-weight: 400; }
.fld.bad .valbtn { border-color: var(--err); background: var(--err-bg); }
.pad { margin-top: 8px; padding: 8px; border: 1px solid var(--line);
  border-radius: 10px; background: #fbfcfe; }
.pad .padlabel { font-size: 12px; color: var(--muted); margin: 6px 2px 4px; }
.padgrid {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px;
  max-height: 208px; overflow-y: auto; padding-right: 2px;
}
.padgrid.dec { grid-template-columns: repeat(10, minmax(0, 1fr)); max-height: none; }
.padgrid button {
  min-height: 38px; padding: 0; font-size: 15px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text);
}
.padgrid button.on { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.padfoot { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.padfoot .preview { font-size: 13px; color: var(--muted); }
/* 数字盘上标出「正常/常用」值（血压 110/70） */
.padgrid button.mark { border-color: #2e7d32; background: #eef8ef; font-weight: 700; }
.padgrid button.mark.on { background: var(--brand); border-color: var(--brand); }
.padgrid button.mark .mk { display: block; font-size: 10px; line-height: 10px; font-weight: 400; color: #2e7d32; }
.padgrid button.mark.on .mk { color: #fff; }
.padgrid button.num { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* 关联规则：自动填好的值（只读） */
.autoval {
  min-height: 46px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; font-size: 17px; font-weight: 600;
  border: 1px solid #cfe3d2; border-radius: 10px; background: #f4faf5; color: #1f5c2a;
}
.autoval .tag {
  font-size: 11px; font-weight: 400; padding: 1px 7px; border-radius: 999px;
  background: #dcefdf; color: #1f5c2a;
}
.autoval.skip { color: var(--muted); font-weight: 400; border-style: dashed;
  border-color: var(--line); background: #f8f9fb; }
.fld.auto > label { color: #1f5c2a; }
.fld.skip > label { color: var(--muted); }
.padfoot .miss {
  font-size: 13px; padding: 6px 10px; border-radius: 999px;
  border: 1px dashed #c9a227; background: #fffdf3; color: #8a6d1a;
}

/* 底部进度条 */
.bar .prog { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.bar .row { display: flex; gap: 10px; width: 100%; }

button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px; font-size: 17px; font-weight: 600;
  border: none; border-radius: 10px; background: var(--brand); color: #fff;
}
button.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
button.btn.grey { background: #e8edf5; color: #33415c; }
button.btn:disabled { opacity: .55; }
button.btn.wide { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; max-width: 760px; margin: 0 auto;
}
.bar .btn { flex: 1; }

.alert { border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 15px; }
.alert.err { background: var(--err-bg); color: var(--err); border: 1px solid #f2b8b2; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #b7dfc0; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d59a; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; }
th { background: #f7f9fc; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tblwrap { overflow-x: auto; }

.muted { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; background: #eef3fb; color: var(--brand); }
.pill.g { background: var(--ok-bg); color: var(--ok); }
.pill.r { background: var(--err-bg); color: var(--err); }

/* 扫码页 */
#reader { width: 100%; max-width: 460px; margin: 0 auto; border-radius: 12px; overflow: hidden;
  background: #000; position: relative; }
#reader video { width: 100%; display: block; }
.scanbox { position: relative; }
.scanbox .frame {
  position: absolute; inset: 18% 12%; border: 3px solid #3ddc84; border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.28); pointer-events: none;
}
.big-title { text-align: center; font-size: 20px; font-weight: 700; margin: 10px 0; }

.kv { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
.kv b { font-weight: 600; }

.field-tbl td input { width: 100%; }
details.block { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; background: #fff; }
details.block > summary {
  padding: 12px 14px; font-size: 16px; font-weight: 600; color: var(--brand-d);
  cursor: pointer; list-style: none;
}
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary:after { content: "▾"; float: right; color: var(--muted); }
details.block[open] > summary:after { content: "▴"; }
details.block .body { padding: 0 14px 14px; }

.done { text-align: center; padding: 24px 12px; }
.done .big { font-size: 56px; line-height: 1; }
