:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1b1f24;
  --muted: #8b929c;
  --line: #e8ecf1;
  --read: #f2703f;
  --read-soft: #fff2ec;
  --run: #1f8fa8;
  --run-soft: #e9f6f9;
  --ok: #16a34a;
  --warn: #e0a020;
  --danger: #d94848;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 30, 45, .06);
}

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

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

.wrap { max-width: 720px; margin: 0 auto; padding: 0 14px; }

/* ---------- header ---------- */
.hero {
  background: linear-gradient(135deg, #f2703f 0%, #f5935c 55%, #1f8fa8 130%);
  color: #fff;
  padding: 22px 16px 20px;
  border-radius: 0 0 20px 20px;
}
.hero h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.hero .sub { margin-top: 6px; font-size: 13px; opacity: .92; }
.hero .meta { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .28);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
}

/* ---------- identity ---------- */
.idcard {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-top: -14px;
  position: relative;
}
.idcard .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.idcard .who { font-size: 17px; font-weight: 700; }
.idcard .who small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--read); border-color: var(--read); color: #fff; }
.btn.ghost { background: #f7f9fb; }

/* ---------- picker ---------- */
.picker { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.grp-title { font-size: 13px; color: var(--muted); margin: 10px 0 6px; font-weight: 600; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pgrid button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 4px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}
.pgrid button.on { background: var(--read-soft); border-color: var(--read); color: var(--read); font-weight: 600; }

/* ---------- checkin cards ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
@media (max-width: 380px) { .cards { grid-template-columns: 1fr; } }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  border-top: 3px solid var(--line);
}
.card.read { border-top-color: var(--read); }
.card.run { border-top-color: var(--run); }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .stat { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.big-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: var(--read);
}
.big-btn.run { background: var(--run); }
.big-btn.done { background: #eef3f0; color: var(--ok); border: 1px solid #cfe7d8; }
.big-btn:disabled { opacity: .6; }

.note-box { margin-top: 10px; }
.note-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 62px;
  background: #fbfcfd;
}
.note-box .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 6px;
  background: #fff;
  padding: 5px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 16px 0 12px;
}
.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 4px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.on { background: #1b1f24; color: #fff; font-weight: 600; }

/* ---------- panels ---------- */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.panel + .panel { margin-top: 12px; }
.panel h2 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.panel h2 .r { font-size: 12px; font-weight: 400; color: var(--muted); }

.seg { display: flex; gap: 6px; margin-bottom: 10px; }
.seg button { flex: 1; padding: 7px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 13px; cursor: pointer; }
.seg button.on { background: #1b1f24; color: #fff; border-color: #1b1f24; }

.sum { display: flex; gap: 10px; margin-bottom: 12px; }
.sum div { flex: 1; background: #f8fafc; border-radius: 10px; padding: 10px; text-align: center; }
.sum b { display: block; font-size: 20px; }
.sum span { font-size: 11px; color: var(--muted); }

.group-block { margin-bottom: 14px; }
.group-block .gt { font-size: 13px; font-weight: 700; margin-bottom: 6px; display: flex; justify-content: space-between; }
.group-block .gt em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 12px; }
.mlist { display: flex; flex-wrap: wrap; gap: 6px; }
.mlist span {
  font-size: 13px;
  padding: 5px 9px;
  border-radius: 8px;
  background: #f1f3f6;
  color: #9aa1aa;
  border: 1px solid transparent;
}
.mlist span.on { background: var(--read-soft); color: var(--read); border-color: #f8cdb9; font-weight: 600; }
.mlist span.leave { background: #fff6e5; color: var(--warn); border-color: #f3e0b5; }
.mlist span.me { outline: 2px solid #1b1f24; outline-offset: 1px; }

/* ---------- rank ---------- */
.rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: none; }
.rank-row .no { width: 26px; text-align: center; font-weight: 700; color: var(--muted); font-size: 13px; }
.rank-row .no.top { color: var(--read); }
.rank-row .nm { flex: 1; }
.rank-row .nm small { color: var(--muted); font-size: 11px; margin-left: 6px; }
.rank-row .ct { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 5px; background: #f0f2f5; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--read); border-radius: 3px; }
.bar i.run { background: var(--run); }

/* ---------- notes ---------- */
.note-item { border-left: 3px solid var(--read); padding: 6px 0 6px 10px; margin-bottom: 12px; }
.note-item p { margin: 2px 0 0; font-size: 14px; }
.note-item .by { font-size: 12px; color: var(--muted); }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  background: rgba(27, 31, 36, .93);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
  max-width: 84vw;
  text-align: center;
}
.toast.show { opacity: 1; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 20px; }
.foot a { color: var(--muted); }

/* ---------- admin ---------- */
.login { max-width: 340px; margin: 80px auto; background: #fff; padding: 22px; border-radius: var(--radius); box-shadow: var(--shadow); }
.login input { width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; margin: 10px 0; }
.login button { width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tbl-wrap { overflow-x: auto; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fld select, .fld input { border: 1px solid var(--line); border-radius: 9px; padding: 8px; font-size: 14px; background: #fff; min-width: 110px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #f1f3f6; color: #7b838d; }
.tag.leave { background: #fff6e5; color: var(--warn); }
.tag.makeup { background: #eef2ff; color: #4f5bd5; }
.tag.admin { background: #fdecec; color: var(--danger); }
.link-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 0; }

/* ---------- 登录遮罩 ---------- */
.gate { position: fixed; inset: 0; background: rgba(28,32,38,.55); display: flex; align-items: center; justify-content: center; z-index: 999; padding: 18px; }
.gate[hidden] { display: none; }
.gate-card { background: #fff; border-radius: 16px; padding: 22px 20px; width: 100%; max-width: 360px; box-shadow: 0 18px 50px rgba(0,0,0,.22); }
.gate-card h2 { margin: 0 0 6px; font-size: 19px; }
.gate-card input, .gate-card select { width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; margin: 10px 0; }
.gate-card .btn { width: 100%; }
.gate-err { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }
.gate-sub { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* ---------- 录音上传 ---------- */
.upload-box { margin: 12px 0 4px; padding: 12px; border: 1px dashed #e3c4ae; border-radius: 12px; background: #fffaf6; }
.upload-box .up-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upload-box .up-info { font-size: 12px; color: var(--muted); flex: 1; min-width: 120px; }
.upload-box .up-info.ok { color: var(--ok); }
.up-bar { height: 4px; background: #f0e3d8; border-radius: 3px; overflow: hidden; margin-top: 9px; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--read); transition: width .2s; }
.upload-box .up-hint { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.audio-cell audio { height: 30px; max-width: 190px; }

/* 未登录提示条 */
.loginbar {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: linear-gradient(180deg, #fff8f2, #fffdfb);
  border: 1px solid #f7d9c6; border-radius: 12px;
  padding: 10px 12px; margin-top: 12px;
}
.loginbar[hidden] { display: none; }
.loginbar .lb-txt { font-size: 13.5px; color: #8a5a3c; line-height: 1.5; }
.loginbar .btn { flex: 0 0 auto; padding: 8px 14px; font-size: 13.5px; }
