:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e8eaee;
  --primary: #2563eb;
  --primary-soft: #eef3ff;
  --run: #f59e0b;
  --run-soft: #fff6e6;
  --ok: #10b981;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 24px rgba(17, 24, 39, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  padding: 16px 14px 40px;
}

.wrap { max-width: 720px; margin: 0 auto; }
.hide { display: none !important; }
.muted { color: var(--muted); font-size: 13px; margin-left: 8px; }
.err { color: #fecaca; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- 顶部 ---------- */
.hero {
  background: linear-gradient(135deg, #1f2937, #111827);
  color: #fff;
  border-radius: 20px;
  padding: 18px 18px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero.compact { padding: 14px 18px; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero-title h1 { font-size: 19px; margin: 0 0 4px; font-weight: 650; letter-spacing: .2px; }
.hero-title p { margin: 0; font-size: 13px; color: #cbd5e1; }
.ghost-btn {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.ghost-btn:active { background: rgba(255, 255, 255, .22); }
.who { margin-top: 12px; display: flex; align-items: baseline; gap: 6px; }
.who b { font-size: 16px; }
.who .muted { color: #94a3b8; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  background: rgba(255, 255, 255, .1);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: #e2e8f0;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
  margin-bottom: 10px;
}
.stat { font-size: 12px; font-weight: 500; color: var(--muted); }

/* ---------- 表单 ---------- */
textarea, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  outline: none;
}
textarea:focus, input:focus, select:focus { border-color: var(--primary); background: #fff; }
textarea { resize: vertical; margin-bottom: 10px; }
.form { display: grid; gap: 10px; }
.form.grid2 { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form.inline { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
label input, label select { margin-top: 1px; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 11px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary.run { background: var(--run); border-color: var(--run); }
.btn.done { background: var(--primary-soft); border-color: #dbe4ff; color: var(--primary); }
.btn.ghost { background: #f9fafb; color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.empty { color: var(--muted); font-size: 13px; padding: 14px 0; text-align: center; }
.stat-line { font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.sub-title { font-weight: 600; font-size: 13px; margin: 16px 0 8px; color: #374151; }

/* ---------- 选择身份 ---------- */
.picker .card-head { margin-bottom: 6px; }
.picker-body { max-height: 46vh; overflow: auto; }
.grp { font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.pgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.pbtn {
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}
.pbtn.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 选项卡 ---------- */
.tabs, .nav {
  display: flex;
  gap: 4px;
  background: #eceef2;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow-x: auto;
}
.tabs button, .nav button {
  flex: 1 0 auto;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  border-radius: 9px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tabs button.on, .nav button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(17, 24, 39, .08); }

.seg { display: inline-flex; background: #f1f3f6; border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg button {
  border: 0; background: transparent; padding: 6px 16px; border-radius: 8px;
  font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
}
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(17, 24, 39, .08); }

/* ---------- 看板 ---------- */
.board-date { font-size: 12px; color: var(--muted); }
.board-sum { display: flex; gap: 10px; margin: 10px 0 16px; }
.board-sum > div {
  flex: 1; background: #f8fafc; border-radius: 12px; padding: 10px 12px; text-align: center;
}
.board-sum b { display: block; font-size: 18px; }
.board-sum span { font-size: 12px; color: var(--muted); }

.gblock { margin-bottom: 14px; }
.gt { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.gt em { font-style: normal; color: var(--muted); font-weight: 500; margin-left: 8px; font-size: 12px; }
.mlist { display: flex; flex-wrap: wrap; gap: 8px; }
.mlist span {
  border: 1px solid var(--line);
  color: #9ca3af;
  border-radius: 9px;
  padding: 5px 11px;
  font-size: 13px;
  background: #fbfcfd;
}
.mlist .on { background: #ecfdf5; border-color: #bbf7d0; color: #047857; font-weight: 550; }
.mlist .leave { background: #fff7ed; border-color: #fed7aa; color: #b45309; }
.mlist .me { box-shadow: 0 0 0 2px rgba(37, 99, 235, .18); }

/* ---------- 榜单 ---------- */
.rank-range { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f4f5f7; }
.rank-row:last-child { border-bottom: 0; }
.no { width: 22px; text-align: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.no.top { color: var(--primary); font-weight: 700; }
.nm { flex: 1; min-width: 0; font-size: 14px; }
.nm small { display: block; color: var(--muted); font-size: 12px; }
.bar { height: 5px; background: #f1f3f6; border-radius: 999px; margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar i.run { background: var(--run); }
.ct { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; }
.crown { font-size: 11px; background: #fef3c7; color: #92400e; border-radius: 6px; padding: 1px 6px; font-weight: 600; vertical-align: 1px; }

/* ---------- 精句墙 ---------- */
.note-item { padding: 12px 0; border-bottom: 1px solid #f4f5f7; }
.note-item:last-child { border-bottom: 0; }
.note-item .by { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.note-item p { margin: 0; font-size: 14px; line-height: 1.65; }

/* ---------- 我的记录 ---------- */
.rec-row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f4f5f7; align-items: flex-start; }
.rec-row:last-child { border-bottom: 0; }
.rec-row .ico {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 8px; background: #f1f3f6;
  display: grid; place-items: center; font-size: 12px; color: var(--muted);
}
.rec-row .body { font-size: 14px; }
.rec-row .body small { display: block; color: var(--muted); font-size: 12px; }

.tag { font-size: 11px; background: #f1f3f6; color: #4b5563; border-radius: 6px; padding: 1px 6px; margin-left: 4px; }
.tag.leave { background: #fff7ed; color: #b45309; }
.tag.admin { background: #eef3ff; color: #1d4ed8; }
.tag.off { background: #f3f4f6; color: #9ca3af; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid #f4f5f7; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
td.note { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
tr.dim { opacity: .45; }
.warn { color: var(--danger); }
.link {
  border: 0; background: none; color: var(--primary); font: inherit; font-size: 12px;
  cursor: pointer; padding: 2px 4px;
}
.link.danger { color: var(--danger); }
.ops { display: flex; gap: 2px; }

/* ---------- 其他 ---------- */
.foot { text-align: center; margin-top: 18px; font-size: 12px; }
.foot a { color: var(--muted); text-decoration: none; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: rgba(17, 24, 39, .94); color: #fff; padding: 10px 18px; border-radius: 12px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .22s ease; max-width: 82vw;
  text-align: center; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

details.makeup summary { cursor: pointer; font-weight: 600; list-style: none; }
details.makeup summary::-webkit-details-marker { display: none; }
details.makeup summary::after { content: "＋"; float: right; color: var(--muted); font-weight: 400; }
details.makeup[open] summary::after { content: "－"; }
details.makeup[open] summary { margin-bottom: 12px; }

.no-running .col-run { display: none !important; }
.no-groups .col-group { display: none !important; }
.book-pick { margin-bottom: 8px; }
.book { font-size: 11px; background: #eef2ff; color: #4338ca; border-radius: 6px; padding: 1px 6px; white-space: nowrap; }

.code {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0 0 12px;
}

@media (max-width: 480px) {
  .form.grid2 { grid-template-columns: 1fr; }
  body { padding: 12px 10px 32px; }
}
