:root {
  --red: #C1272D;
  --ink: #1c2330;
  --muted: #68707e;
  --line: #e4e7ec;
  --bg: #f5f6f8;
  --card: #ffffff;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55;
  padding-bottom: 76px;
}
header {
  position: sticky; top: 0; z-index: 20;
  background: var(--red); color: #fff;
  padding: 12px 16px;
  display: flex; align-items: baseline; gap: 10px;
}
header .ttl { font-size: 18px; font-weight: 700; }
header .sub { font-size: 12px; opacity: .85; }
main { max-width: 860px; margin: 0 auto; padding: 14px 14px 20px; }
h2 { font-size: 16px; margin: 18px 0 10px; }
h2:first-child { margin-top: 2px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 8px; text-align: center; }
.stat .num { font-size: 24px; font-weight: 700; color: var(--red); }
.stat .lbl { font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 13px; }
.bar-row .bl { width: 74px; flex: none; color: var(--muted); }
.bar-track { flex: 1; background: #eef0f3; border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; }
.bar-row .bn { width: 34px; text-align: right; flex: none; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; color: #fff; white-space: nowrap;
}
.tag.gray { background: #98a0ad; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
button {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  border-radius: 9px; padding: 7px 14px;
}
button.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
button.danger { color: #b3261e; border-color: #ecc9c7; }
button.sm { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
textarea { min-height: 74px; resize: vertical; }
label.fl { display: block; margin-bottom: 10px; }
label.fl > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 6px 0 2px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 12px; font-size: 13px; cursor: pointer; user-select: none;
}
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }
.chip.alt.on { background: #334155; border-color: #334155; }
.list-item { cursor: pointer; }
.list-item:active { background: #fafbfc; }
nav.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
nav.bottom button {
  flex: 1; border: none; border-radius: 0; background: none;
  padding: 9px 2px 7px; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
nav.bottom button .ic { font-size: 19px; line-height: 1; }
nav.bottom button.on { color: var(--red); font-weight: 700; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(16,20,28,.45); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 18px 16px 22px;
}
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 16px; } }
.modal h3 { font-size: 16px; margin-bottom: 12px; }
.auth-wrap { max-width: 400px; margin: 9vh auto 0; padding: 0 16px; }
.auth-wrap .card { padding: 22px 18px; }
.auth-wrap h1 { font-size: 21px; text-align: center; margin-bottom: 4px; }
.auth-wrap .muted { text-align: center; margin-bottom: 16px; }
.err { color: #b3261e; font-size: 13px; min-height: 18px; margin: 6px 0; }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row input { flex: 1; }
.search-row select { width: auto; flex: none; max-width: 46%; }
.fab-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.progress-note { font-size: 12px; color: var(--muted); }
a { color: var(--red); }
.hidden { display: none !important; }
.visit-line { border-top: 1px dashed var(--line); padding: 9px 0; }
.visit-line:first-of-type { border-top: none; }
