/* 家谱公众号 H5 · 全局样式（零框架，移动端优先） */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a9099;
  --line: #e8eaed;
  --primary: #2f6b4f;
  --primary-weak: #e8f2ec;
  --danger: #c0392b;
  --radius: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}
.app { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: 72px; }
.page { padding: 16px; }
.page-bottom { padding-bottom: 24px; }
.nav-title { font-size: 20px; font-weight: 600; padding: 18px 16px 8px; }
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; border: 1px solid var(--line);
}
.title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.subtitle { font-size: 14px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.warn { font-size: 13px; color: var(--danger); margin-top: 8px; line-height: 1.6; }
.form-item { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; height: 44px; padding: 0 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
  outline: none;
}
.input:focus { border-color: var(--primary); }
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 16px; border-radius: 8px; font-size: 15px;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary[disabled] { opacity: .55; }
.btn-ghost { background: #fff; color: var(--primary); border-color: var(--line); }
.btn-ghost[disabled] { color: var(--muted); }
.btn-row { display: flex; gap: 10px; align-items: center; }
.btn-row .btn-primary { flex: 1; width: auto; }
.btn-row .btn-ghost { flex: 0 0 auto; }
.grow { flex: 1; }
.row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; flex: 1; }
.row-title { font-size: 15px; font-weight: 500; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tag {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 20px;
  background: var(--primary-weak); color: var(--primary); margin-left: 6px;
}
.tag.gray { background: #f0f1f3; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; font-size: 14px; }
.code-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px; letter-spacing: 2px; text-align: center;
  background: var(--primary-weak); color: var(--primary);
  padding: 14px; border-radius: 8px; margin: 12px 0;
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  max-width: 640px; margin: 0 auto; display: flex;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 10px 0 8px; color: var(--muted);
  text-decoration: none; font-size: 12px;
}
.tabbar a.active { color: var(--primary); font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(31,35,41,.9); color: #fff; padding: 10px 16px;
  border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .2s; z-index: 50; max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; }
.overlay { position: fixed; inset: 0; z-index: 40; display: none; }
.overlay.show { display: block; background: rgba(0,0,0,.45); }
.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(86vw, 420px); background: #fff; border-radius: 14px; padding: 20px; z-index: 41;
}
.modal h3 { margin: 0 0 10px; font-size: 17px; }
.modal p { font-size: 14px; color: #4a5058; line-height: 1.7; margin: 0 0 16px; }
.loading { text-align: center; color: var(--muted); padding: 48px 0; font-size: 14px; }

/* 世系树：递归嵌套，左侧竖线 + 连接横 */
.tree-root, .tree-children { list-style: none; margin: 0; padding: 0; }
.tree-children { margin-left: 14px; padding-left: 16px; border-left: 1px solid var(--line); }
.tree-row { display: flex; align-items: center; min-height: 34px; position: relative; }
.tree-row::before {
  content: ''; position: absolute; left: -16px; top: 17px;
  width: 16px; height: 1px; background: var(--line);
}
.tree-root > .tree-node > .tree-row::before { display: none; }
.tree-toggle {
  flex: 0 0 22px; height: 22px; line-height: 20px; text-align: center;
  border: 1px solid var(--line); border-radius: 6px; color: var(--primary);
  background: #fff; font-size: 14px; cursor: pointer; margin-right: 8px;
}
.tree-toggle.blank { border-color: transparent; background: transparent; cursor: default; }
.tree-person { flex: 1; min-width: 0; cursor: pointer; padding: 4px 0; }
.tree-name { font-size: 15px; font-weight: 500; color: var(--text); }
.tree-meta { font-size: 12px; color: var(--muted); margin-left: 8px; }
.gen-label { font-size: 13px; color: var(--muted); padding: 10px 0 6px; border-bottom: 1px solid var(--line); }
.gen-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; }
.gen-person { font-size: 14px; color: var(--text); background: var(--primary-weak); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.gen-person .tag { margin-left: 4px; }

/* 表单多选配偶 */
.check-group { max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 5px 0; }
.check-row input { width: 18px; height: 18px; }
.btn-ghost.danger { color: var(--danger); }
