:root {
  --accent: #185FA5;
  --accent-bg: #E6F1FB;
  --bg: #F6F7F9;
  --card: #FFFFFF;
  --text: #1F2329;
  --muted: #7A7E87;
  --line: #E4E6EB;
  --danger: #A32D2D;
  --danger-bg: #FCEBEB;
  --radius: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }  /* 防止组件类的 display 覆盖 hidden 属性 */
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.6;
  padding-bottom: 96px;
}
header.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 12px 14px 10px;
}
.top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.title-wrap { min-width: 0; }
h1 { font-size: 17px; font-weight: 600; margin: 0; }
h1#title { display: inline-block; cursor: pointer; }
h1#title::after { content: " ✎"; font-size: 12px; font-weight: 400; color: #A8ACB3; }
.stats { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.chips { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 13px; padding: 6px 12px; border-radius: 999px;
  cursor: pointer; user-select: none;
}
.chip:active { background: #EDEEF1; }
.chip-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-primary:active { background: #0C447C; }
.chip-danger { color: var(--danger); background: var(--danger-bg); border-color: #F0C9C9; }
.chip-danger:active { background: #F5D8D8; }
#btnNick { flex: none; margin-top: 2px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { padding: 12px 0; }
.table-wrap {
  background: var(--card); margin: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch;
}
table { border-collapse: separate; border-spacing: 0; min-width: 620px; width: 100%; }
th, td {
  font-size: 13.5px; padding: 9px 10px; text-align: center;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
th { background: #F0F2F5; font-weight: 600; position: sticky; top: 0; }
tbody tr { cursor: pointer; }
tbody tr:active { background: var(--accent-bg); }
tbody tr:last-child td { border-bottom: none; }
.c-sticky { position: sticky; left: 0; z-index: 2; min-width: 58px; width: 58px; padding-left: 10px; padding-right: 6px; text-align: center; }
thead .c-sticky { z-index: 3; background: #F0F2F5; }
tbody .c-sticky { background: var(--card); }
tbody tr:active .c-sticky { background: var(--accent-bg); }
.edit-meta {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: #F7F8FA; font-size: 12.5px; color: var(--muted); line-height: 1.7;
}
.edit-meta b { color: var(--accent); font-size: 14px; }
.mask-center { align-items: center; }
.img-box { margin-top: 10px; max-height: 55vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.img-box img { display: block; width: 100%; -webkit-touch-callout: default; user-select: auto; }
td.note-cell { white-space: normal; min-width: 140px; text-align: left; color: var(--muted); }
.num-neg { color: var(--danger); }
.num-empty { color: #C2C5CC; }
.seq { color: var(--muted); font-size: 12px; display: block; line-height: 1.2; }
.date-cell { font-weight: 500; }

.cards { padding: 0 10px; display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer;
}
.card:active { background: #FAFBFC; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-head .no { color: var(--muted); font-size: 12.5px; }
.card-head .d { font-weight: 600; font-size: 15px; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.cell { background: #F7F8FA; border-radius: 8px; padding: 6px 4px; text-align: center; }
.cell .k { font-size: 11px; color: var(--muted); }
.cell .v { font-size: 16px; font-weight: 600; }
.cell.hl .v { color: var(--accent); }
.card-note { margin-top: 8px; font-size: 13px; color: var(--muted); }
.card-meta { margin-top: 6px; font-size: 11.5px; color: #A8ACB3; }

.fab {
  position: fixed; right: 18px; bottom: 24px; z-index: 30;
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; font-size: 26px; line-height: 1;
  box-shadow: 0 4px 14px rgba(24, 95, 165, .35); cursor: pointer;
}
.fab:active { background: #0C447C; }

.mask {
  position: fixed; inset: 0; z-index: 40; background: rgba(15, 19, 26, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.dialog {
  background: var(--card); border-radius: var(--radius); margin: 16px; padding: 18px;
  width: 100%; max-width: 400px;
}
.dialog h3 { margin: 0 0 6px; font-size: 16px; }
.sheet {
  background: var(--card); width: 100%; max-width: 520px;
  border-radius: 16px 16px 0 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h3 { margin: 0; font-size: 16px; }
.icon-btn { border: none; background: none; font-size: 16px; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.form { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.form label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.form input {
  font-size: 16px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #FAFBFC; color: var(--text); width: 100%;
}
.form input:focus { outline: none; border-color: var(--accent); background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.spacer { flex: 1; }
.nick-warn {
  margin: 10px 0 2px; padding: 8px 10px; text-align: center;
  background: var(--danger-bg); border-radius: 10px;
  color: var(--danger); font-size: 14px; line-height: 1.5;
}
.nick-warn b { font-weight: 700; }

.hist-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px;
}
.hist-item .row1 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.hist-item .who { color: var(--muted); font-size: 12px; }
.hist-item .diff { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-all; }
.hist-item .act { font-weight: 600; }
.act-update { color: var(--accent); }
.act-delete { color: var(--danger); }
.act-create { color: #1D9E75; }
.act-rollback-update, .act-rollback-delete { color: #BA7517; }
.hist-item .ops { margin-top: 6px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60;
  background: rgba(31, 35, 41, .92); color: #fff; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; max-width: 86vw; text-align: center;
}

#thDate { cursor: pointer; user-select: none; }
#sortArrow { font-weight: 400; color: var(--muted); margin-left: 2px; }

/* ---------- 访问门禁 ---------- */
.gate-mask {
  z-index: 70;
  background: var(--bg);
  align-items: center;
}
.gate-mask .dialog { padding: 24px 20px; }
.gate-mask input {
  font-size: 17px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #FAFBFC; width: 100%;
}
.gate-mask input:focus { outline: none; border-color: var(--accent); background: #fff; }

/* ---------- 适老化字号（标准/大/特大） ---------- */
body.zlg { font-size: 16px; }
body.zlg th, body.zlg td { font-size: 15px; }
body.zlg h1 { font-size: 19px; }
body.zlg .stats { font-size: 13.5px; }
body.zlg .chip { font-size: 14.5px; padding: 8px 14px; }
body.zlg .fab { width: 60px; height: 60px; font-size: 30px; }
body.zlg .form input { font-size: 17px; }
body.zlg .form label { font-size: 14px; }
body.zlg .cell .v { font-size: 19px; }
body.zlg .c-sticky { min-width: 64px; }

body.zxl { font-size: 18px; }
body.zxl th, body.zxl td { font-size: 17px; padding: 11px 10px; }
body.zxl h1 { font-size: 21px; }
body.zxl .stats { font-size: 14.5px; }
body.zxl .chip { font-size: 16px; padding: 9px 16px; }
body.zxl .fab { width: 66px; height: 66px; font-size: 34px; }
body.zxl .form input { font-size: 19px; }
body.zxl .form label { font-size: 15px; }
body.zxl .cell .v { font-size: 22px; }
body.zxl .hint { font-size: 13.5px; }
body.zxl .c-sticky { min-width: 72px; }
body.zxl .edit-meta { font-size: 14px; }

