/* ============================================================
   石氏家谱 · 设计系统
   移植自原项目 tailwind-theme.css（纸张质感 + 墨色文字）
   ============================================================ */

:root {
  --background: #f7f1e8;
  --foreground: #2c1810;
  --card: #fffcf7;
  --card-foreground: #2c1810;
  --popover: #fffcf7;
  --popover-foreground: #2c1810;
  --primary: #a3261d;
  --primary-foreground: #fff8f0;
  --secondary: #f0e6d6;
  --secondary-foreground: #5c3a21;
  --muted: #efe5d4;
  --muted-foreground: #8b6b4a;
  --accent: #a3261d;
  --accent-foreground: #fff8f0;
  --accent-soft: rgba(163, 38, 29, 0.12);
  --fg-soft: rgba(44, 24, 16, 0.06);
  --info: #2563eb;
  --info-foreground: #ffffff;
  --destructive: #b91c1c;
  --destructive-foreground: #fff8f0;
  --success: #15803d;
  --success-foreground: #ffffff;
  --warning: #b45309;
  --warning-foreground: #ffffff;
  --border: #d9c9a8;
  --input: #d9c9a8;
  --ring: #a3261d;
  --chart-1: #a3261d;
  --chart-2: #c9a96e;
  --chart-3: #7a5c3e;
  --chart-4: #5c3a21;
  --chart-5: #8b6b4a;

  --font-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft Yahei',
    'Hiragino Sans GB', 'Helvetica Neue', 'Segoe UI', system-ui, Tahoma, Arial, sans-serif;
  --font-serif: 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', 'Iowan Old Style',
    Charter, Georgia, ui-serif, Cambria, 'Times New Roman', Times, serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas,
    'Liberation Mono', monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px 0 rgba(120, 80, 40, 0.06);
  --shadow: 0 2px 6px -2px rgba(120, 80, 40, 0.08), 0 1px 3px 0 rgba(120, 80, 40, 0.05);
  --shadow-md: 0 8px 20px -6px rgba(120, 80, 40, 0.12), 0 4px 8px -4px rgba(120, 80, 40, 0.08);

  --max-width: 1152px;
}

/* ---------------- Reset ---------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  letter-spacing: 0.01em;
  font-weight: 600;
  line-height: 1.3;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

/* ---------------- 工具类 ---------------- */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-display { font-family: var(--font-serif); }
.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-destructive { color: var(--destructive); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.tracking-wider { letter-spacing: 0.08em; }
.whitespace-pre-line { white-space: pre-line; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leading-relaxed { line-height: 1.7; }
.leading-tight { line-height: 1.25; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.grid { display: grid; }
.w-full { width: 100%; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.ml-auto { margin-left: auto; }
.pt-1 { padding-top: 4px; }
.pt-6 { padding-top: 24px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.pb-8 { padding-bottom: 32px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.py-16 { padding-top: 64px; padding-bottom: 64px; }
.px-5 { padding-left: 20px; padding-right: 20px; }

.bg-page-gradient {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(163, 38, 29, 0.08) 0%, transparent 55%),
    var(--background);
  /* 让渐变背景铺满 .page 的内边距：
     原实现渐变层从内容区开始，.page 顶部 32px 的 padding 落在背景层之外，
     露出纯 body 底色，在头部与内容之间形成一条偏白的色带。
     用「负外边距 + 等量内边距」把背景撑满，内容位置与整体高度都不变。 */
  margin-top: -32px;
  padding-top: 32px;
  margin-bottom: -40px;
  padding-bottom: 40px;
}
@media (max-width: 767px) {
  /* .page 在移动端的内边距是 20px / 32px，同步调整 */
  .bg-page-gradient {
    margin-top: -20px;
    padding-top: 20px;
    margin-bottom: -32px;
    padding-bottom: 32px;
  }
}

/* ---------------- 布局 ---------------- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.page { flex: 1; padding: 32px 0 40px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
/* flex/grid 子项默认 min-width:auto，内部的长文本（无空格的中文/URL）会把容器撑破。
   留言审核、操作日志这类列表页最容易踩到。 */
.stack > * { min-width: 0; max-width: 100%; }

.section-header { margin-bottom: 32px; max-width: 42rem; }
/* 后台管理页（含左侧导航）顶部标题与内容区同宽，避免只占内容区约六成宽度 */
.container:has(> .grid-sidebar) > .section-header { max-width: none; }
.section-header .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.section-header h1 { font-size: 26px; margin-top: 8px; }
.section-header .subtitle {
  font-size: 15px;
  color: var(--muted-foreground);
  margin-top: 8px;
  line-height: 1.7;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
/* 列表卡片封面（家族影像等带图栏目）：按 16:9 定比裁切，上两角与卡片圆角对齐 */
.card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--muted);
}
.card-hover { transition: box-shadow 0.2s ease, transform 0.2s ease; }
.card-hover:hover { box-shadow: var(--shadow-md); }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: #8e2019; }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { background: #e6d9c4; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--foreground); }
.btn-outline:hover { background: var(--secondary); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--secondary); }
.btn-danger { background: var(--destructive); color: var(--destructive-foreground); }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 500; color: var(--secondary-foreground); }
.field .hint { font-size: 12px; color: var(--muted-foreground); }
.field .error { font-size: 12px; color: var(--destructive); }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(163, 38, 29, 0.12);
}
.textarea { min-height: 100px; resize: vertical; }
.select { appearance: none; background-image: none; padding-right: 32px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ---------------- 徽章 / 标签 ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  font-size: 12px;
  border-radius: var(--radius-pill);
  background: var(--secondary);
  color: var(--secondary-foreground);
  white-space: nowrap;
}
.badge-primary { background: rgba(163, 38, 29, 0.1); color: var(--primary); }
.badge-success { background: rgba(21, 128, 61, 0.1); color: var(--success); }
.badge-warning { background: rgba(180, 83, 9, 0.12); color: var(--warning); }
.badge-danger { background: rgba(185, 28, 28, 0.1); color: var(--destructive); }
.badge-outline { background: transparent; border: 1px solid var(--border); color: var(--muted-foreground); }

.tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
table.data { font-size: 14px; }
table.data th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
  white-space: nowrap;
}
table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  /* 长文本（日志详情、备注等）需要正常折行；短单元格用 .cell-nowrap 保持单行，
     .cell-name 给关键列最小宽度，避免窄列把汉字压成一字一行 */
  white-space: normal;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: rgba(240, 230, 214, 0.4); }
/* 短内容单元格：不折行 */
table.data td.cell-nowrap { white-space: nowrap; }
/* 关键列（如姓名）：给最小宽度，防止一字一行 */
table.data td.cell-name { min-width: 96px; font-weight: 500; white-space: nowrap; }
/* 长文本列：允许折行（默认即是，显式声明以便语义清晰） */
table.data td.cell-wrap { white-space: normal; }
/* 表头与短列通用：避免角标/标签被压断 */
table.data th { white-space: nowrap; }

/* 后台列表：按 <colgroup> 固定列宽铺满容器，所有列完整可见且不产生横向滚动（2026-10-13）。
   长文本列自动省略号收束；需要折行的列加 .cell-wrap 覆盖。 */
.table-wrap.is-fixed { overflow-x: hidden; }
.table-wrap.is-fixed table.data { table-layout: fixed; }
.table-wrap.is-fixed table.data th,
.table-wrap.is-fixed table.data td {
  padding: 11px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-wrap.is-fixed table.data td.cell-wrap { white-space: normal; }

/* ---------------- 分隔线 ---------------- */
.divider { height: 1px; background: var(--border); border: none; }

/* ---------------- 空状态 ---------------- */
.empty {
  padding: 64px 20px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 14px;
}

/* ---------------- 提示条 ---------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.alert-error { background: rgba(185, 28, 28, 0.08); border-color: rgba(185, 28, 28, 0.3); color: var(--destructive); }
.alert-success { background: rgba(21, 128, 61, 0.08); border-color: rgba(21, 128, 61, 0.3); color: var(--success); }
/* 2026-10-20：.alert-info 原为蓝色系（#2563eb），与全站米棕/朱红主色不协调。
   改为暖色「宣纸 + 赭石」：底色沿用页面同一套米色，文字用深棕，
   既保留「提示」的辨识度，又融入整体纸墨气质。 */
.alert-info {
  background: rgba(196, 164, 108, 0.10);
  border-color: rgba(196, 164, 108, 0.30);
  color: #7a5c33;
}

/* ---------------- 头像 ---------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: rgba(163, 38, 29, 0.1);
  color: var(--primary);
  font-weight: 500;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; }

/* ---------------- 分页 ---------------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-family: var(--font-mono);
}
.pagination .active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.pagination .disabled { opacity: 0.45; pointer-events: none; }
.pagination .page-info {
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0 6px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--muted-foreground);
}
.pagination .page-jump { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted-foreground); }
.pagination .page-jump input {
  width: 62px;
  height: 34px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-family: var(--font-mono);
  font-size: 13px;
}
.pagination .page-ellipsis {
  min-width: 20px;
  border: none;
  background: transparent;
  padding: 0 2px;
  color: var(--muted-foreground);
  letter-spacing: 1px;
}
.pagination .page-jump .input { width: 62px; height: 34px; text-align: center; }

/* ---------------- 标签页 ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs .tab {
  padding: 9px 16px;
  font-size: 14px;
  color: var(--muted-foreground);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs .tab.active { color: var(--foreground); font-weight: 500; border-bottom-color: var(--primary); }
.tabs .tab:hover { color: var(--foreground); }

/* ---------------- 弹窗 ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 24, 16, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 17px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------- 正文排版（Markdown 渲染结果） ---------------- */
/* ==========================================================================
   文言正文统一用「郑庆科·南北词宫谱宋体」（唯一字体）
   --------------------------------------------------------------------------
   原字取自清《新定九宫大成南北词宫谱》，作者郑庆科，声明个人 / 企业免费商用。

   **为什么只留这一款**：先前是「齊伋體（明刻本）主 + 南北词宫谱补缺字」两层，
   但一个明刻、一个清刻，笔画粗细与字形肥瘦差别明显，同一段里能一眼看出换了字体。
   实测「齊伋獨有的字 0 個」——南北词宫谱完整版已覆盖全部文言用字，故单用即可。

   子集: GB2312 全集 + 本站用字 = 6,892 字 / 4.41MB（源文件 27MB / 21,501 字）
   缺 4 个符号（_ ` ~ –）交系统字体，不影响汉字。
   ========================================================================== */
@font-face {
  font-family: 'NBCGP';
  src: url('/assets/fonts/nbcgp.woff2') format('woff2');
  font-display: swap;
}

.prose .cls,
.prose .cls strong,
.prose .cls em,
.prose blockquote.cls {
  font-family: 'NBCGP', 'Songti SC', 'STSong', 'SimSun',
               'Noto Serif CJK SC', 'Source Han Serif SC', serif;
}

/*
 * 字号按「视觉字面」对齐，不能只看 font-size 数字。
 *   白话正文 15.5px × 系统宋体字面率 0.87 ≈ 13.5px 视觉高；
 *   本字体字面率 0.860，故 13.5 ÷ 0.86 ≈ 15.7 → 取 16px。
 * 行高 2.2 保持古籍疏朗感。
 */
.prose p.cls,
.prose li.cls {
  font-size: 16px;
  line-height: 2.2;
  letter-spacing: 0.02em;
}

/*
 * 标题不要合成加粗。
 * 该字体只有 Regular 一个字重，浏览器对 <h2 class="cls"> 会做 faux bold，
 * 笔画被拉粗、衬线糊掉，看着像黑体、与正文判若两体。
 * 这里锁回 400，靠字号（20px vs 16px）与留白区分层级，不靠粗细。
 */
.prose h1.cls,
.prose h2.cls,
.prose h3.cls,
.prose h4.cls {
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* 伪斜体在刻本体上很别扭，引用块按原文正体排 */
.prose blockquote.cls { font-style: normal; }

/* 白话译文维持原样，显式声明便于日后对照 */
.prose .vern { font-family: inherit; }

.prose { line-height: 1.85; color: var(--foreground); font-size: 15.5px; }
.prose > * + * { margin-top: 1em; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.6em; line-height: 1.35; }
.prose h1 { font-size: 24px; }
.prose h2 { font-size: 20px; }
.prose h3 { font-size: 17px; }
.prose p { line-height: 1.9; }
.prose a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.4em; }
.prose blockquote {
  border-left: 3px solid var(--border);
  padding-left: 16px;
  color: var(--muted-foreground);
  font-style: italic;
}
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.prose img { border-radius: var(--radius); max-width: 100%; height: auto; display: block; margin: 1.4em auto; }
.prose table { font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--muted);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------------- 骨架屏 ---------------- */
.skeleton {
  background: linear-gradient(90deg, var(--muted) 25%, var(--secondary) 37%, var(--muted) 63%);
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- 网格 ---------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
/* 注意：网格列一律写成 minmax(0, 1fr) 而非 1fr。
   裸 1fr 等价于 minmax(auto, 1fr)，轨道最小尺寸会取子项的 min-content，
   后台筛选表单（input/select）能把整列撑到 1000px+，造成移动端整页横向溢出。 */
.grid-sidebar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
/* grid item 默认 min-width:auto，图片/宽表会顶破容器 —— 移动端横向溢出的常见根因 */
.grid-sidebar > * { min-width: 0; }
@media (min-width: 768px) { .grid-sidebar { grid-template-columns: 220px minmax(0, 1fr); gap: 32px; } }
@media (min-width: 1024px) { .grid-sidebar { grid-template-columns: 250px minmax(0, 1fr); gap: 40px; } }

/* ---------------- 统计卡 ---------------- */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .stat-label { font-size: 12px; color: var(--muted-foreground); letter-spacing: 0.04em; }
.stat .stat-value { font-family: var(--font-serif); font-size: 26px; font-weight: 600; }
.stat .stat-value .unit { font-size: 14px; color: var(--muted-foreground); margin-left: 3px; font-family: var(--font-sans); }

/* ---------------- 进度条 ---------------- */
.progress { height: 8px; background: var(--muted); border-radius: var(--radius-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 20px 0 32px; }
  .section-header h1 { font-size: 22px; }
}
@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
}
@media (max-width: 479px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------- 布局收缩兜底 ----------------
   网格/弹性容器内的子项默认 min-width:auto，其自动最小尺寸取子元素 min-content，
   拿不到收缩许可就会把父容器顶破（后台分页表单是最典型的受害者）。
   显式给 min-width:0 让它们可以正常收缩；长内容由各容器自己的
   overflow-x:auto / 文本换行来处理。 */
.grid-sidebar > *,
.stack > * { min-width: 0; }
.card, .panel, .table-wrap { min-width: 0; }
.field, .field > * { min-width: 0; }
.field input, .field select, .field textarea { min-width: 0; }

/* ============================================================
   站点框架：顶部导航 / 页脚
   ============================================================ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(247, 241, 232, 0.92);
  backdrop-filter: blur(10px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }
/**
 * 2026-10-20 二次修正：真正的病根是**尺寸与容器等高**。
 * `.header-inner` 高度是 56px，而 logo 也是 56px ——
 * 边框上下正好压在 header 的两条边线上，所以无论怎么加 padding 都像"贴死"。
 * 现改为 44px，上下各留 6px 呼吸空间。
 */
.brand-logo {
  width: 44px; height: 44px; object-fit: contain; flex-shrink: 0;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--card); padding: 4px; display: block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
/* 站名一律不换行：窗口变窄时压缩的应该是菜单栏，而不是把站名挤成竖排 */
.brand-text,
.brand-text strong,
.brand-text em { white-space: nowrap; }
.brand-text strong { font-family: var(--font-serif); font-size: 17px; }
.brand-text em { font-style: normal; font-size: 11px; letter-spacing: 0.08em; color: var(--muted-foreground); text-transform: uppercase; }

.main-nav { display: flex; align-items: center; gap: 2px; flex: 1; justify-content: center; }
/* 菜单栏放不下时横向滚动，而不是撑破头部或回头挤压品牌区。
   .main-nav 的自动最小尺寸等于其内容宽度（约 734px）无法收缩，
   空间不足时原先被压缩的是 .brand —— 站名会被压成 17px 宽的竖排。
   伪元素的 auto 外边距：内容不足时居中，溢出时自动塌缩为 0，保证左端可滚动到。 */
.main-nav {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* 必须用 flex-start：若保留 justify-content:center，内容溢出时会被向左推成负偏移，
     最左侧的「首页」被裁掉且滚不回来。居中改由下面伪元素的 auto 外边距实现 ——
     有剩余空间时它们吸收全部空白实现居中，溢出时自动塌缩为 0，左端可正常滚到。 */
  justify-content: flex-start;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav::before,
.main-nav::after { content: ''; margin: auto; }
/* 左右渐隐：内容放得下时导航居中、两端是空白，遮罩不可见；
   放不下时提示"两侧还有内容可滚动"，避免最后一项像被硬生生截断。 */
.main-nav {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}

/* 中等宽度下收紧导航间距，尽量让菜单完整显示、避免出现滚动 */
@media (max-width: 1100px) {
  .nav-link { padding: 8px 7px; font-size: 13px; }
}
.nav-link { position: relative; padding: 8px 12px; font-size: 14px; color: var(--muted-foreground); white-space: nowrap; transition: color 0.15s ease; }
.nav-link:hover { color: var(--foreground); }
.nav-link.active { color: var(--foreground); font-weight: 500; }
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--primary);
}

.header-actions { display: flex; align-items: center; gap: 6px; }
.menu-toggle { font-size: 20px; padding: 4px 10px; border-radius: var(--radius-sm); }
.menu-toggle:hover { background: var(--secondary); }

/* 用户下拉 */
.user-menu { position: relative; }
.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
}
.user-trigger:hover { background: var(--secondary); }
.user-name { font-size: 13px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 60;
}
.dropdown.open { display: block; }
.dropdown-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  color: var(--foreground);
}
.dropdown-item:hover { background: var(--secondary); }
.dropdown-item.danger { color: var(--destructive); }
.dropdown-item.danger:hover { background: rgba(185, 28, 28, 0.08); }
.dropdown .divider { margin: 5px 8px; }

/* 移动端导航 */
.mobile-nav { display: none; border-top: 1px solid var(--border); background: var(--background); }
.mobile-nav.open { display: block; }
.mobile-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 20px;
  font-size: 15px;
  border-bottom: 1px solid rgba(217, 201, 168, 0.6);
  color: var(--muted-foreground);
}
.mobile-link:hover { background: rgba(240, 230, 214, 0.5); }
.mobile-link.active { color: var(--foreground); font-weight: 500; background: rgba(240, 230, 214, 0.4); }
.mobile-link.danger { color: var(--destructive); }

/* 页脚 */
.site-footer { border-top: 1px solid var(--border); background: var(--background); margin-top: 48px; }
.site-footer .container { padding-top: 36px; padding-bottom: 32px; }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.footer-brand strong { font-family: var(--font-serif); font-size: 17px; display: block; }
.footer-brand em { font-style: normal; font-size: 11px; letter-spacing: 0.08em; color: var(--muted-foreground); text-transform: uppercase; }
.footer-desc { font-size: 13px; color: var(--muted-foreground); line-height: 1.7; max-width: 40rem; }

.footer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
.footer-title { font-size: 13px; font-weight: 500; margin-bottom: 12px; color: var(--muted-foreground); letter-spacing: 0.06em; }
.footer-list { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted-foreground); }
.footer-list a:hover { color: var(--foreground); }

/* 后台侧栏分组标题 */
.admin-nav-group {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
  padding: 5px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  background: var(--secondary);
  text-transform: uppercase;
}

/* 后台侧栏 · 移动端折叠
   侧栏在移动端排在最前，14 项竖排约 1100px，正文被挤到首屏之外（内容起点 ~1150px）。
   移动端改为「管理菜单」折叠面板，默认收起，正文直接进入首屏。
   开关复用 app.js 的 [data-toggle]/[data-dropdown]（面板带 .dropdown 类，
   故桌面端由下方规则强制 display:block，保持原样展开）。 */
.admin-nav-toggle {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--foreground);
  background: var(--secondary);
  border-radius: var(--radius-sm);
}
.admin-nav-caret { font-size: 12px; color: var(--muted-foreground); }

/* 折叠面板本体：抵消 .dropdown 的绝对定位/浮层样式，让它回到正常文档流 */
.admin-nav-body {
  position: static !important;
  min-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

@media (min-width: 768px) {
  .admin-nav-body { display: block !important; }
  .admin-nav-toggle, .admin-nav > .divider.hide-desktop { display: none !important; }
}

@media (max-width: 767px) {
  /* 展开后每组链接排两列，进一步压缩高度；分组顺序与菜单项均不改变。
     注意：admin-nav.php 中链接带 inline style，需 !important 才盖得住。 */
  .admin-nav nav.stack > .stack {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4px !important;
  }
  .admin-nav .admin-nav-group { grid-column: 1 / -1; }
  .admin-nav .mobile-link { padding: 10px 12px !important; min-height: 44px; }
  /* 英文标签是中文名的装饰性重复，窄屏隐藏以换取密度 */
  .admin-nav .mobile-link .tag { display: none !important; }
}

/* 后台数据表辅助 */
.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(163, 38, 29, 0.08);
  color: var(--primary);
  margin: 0 4px 4px 0;
}
.chip-muted { background: rgba(120, 113, 108, 0.1); color: var(--muted-foreground); }

.diff-row { display: grid; grid-template-columns: 120px 1fr 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.diff-row:last-child { border-bottom: none; }
.diff-field { color: var(--muted-foreground); }
.diff-old { color: var(--destructive); text-decoration: line-through; word-break: break-all; }
.diff-new { color: var(--success); word-break: break-all; }

.log-detail { font-size: 12.5px; color: var(--muted-foreground); line-height: 1.7; word-break: break-all; }

.danger-zone { border: 1px solid rgba(185, 28, 28, 0.35); border-radius: var(--radius); padding: 18px 20px; background: rgba(185, 28, 28, 0.04); }

@media (max-width: 640px) {
  .diff-row { grid-template-columns: 1fr; gap: 2px; }
}
.footer-qr-row { display: flex; gap: 14px; }
.footer-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.footer-qr-box {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  overflow: hidden;
}
.footer-qr-box img { width: 100%; height: 100%; object-fit: cover; }
.footer-qr-box.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  font-size: 11px;
  color: var(--muted-foreground);
  text-align: center;
  padding: 4px;
  line-height: 1.3;
}

.footer-legal {
  border-top: 1px solid var(--border);
  margin-top: 28px;
  padding-top: 22px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.footer-legal a:hover { color: var(--foreground); }
.footer-legal .sep { margin: 0 8px; color: rgba(217, 201, 168, 0.9); }

/**
 * 备案信息（2026-10-28）
 *
 * ICP 与公安备案各带一枚图标，且**都能点**：
 * 公安部要求「网站底部放置备案图标并链接到备案系统」，只写文字是不合规的。
 * `.footer-legal` 是 column 的 flex，这里自己再排一行（居中 + 可换行），
 * 窄屏两个备案号会折成两行，不会把文字挤出容器。
 */
.footer-beian {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 14px;
}
.footer-beian .beian-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  text-decoration: none;
}
.footer-beian .beian-item:hover { color: var(--foreground); }
.footer-beian .beian-ico {
  display: block;
  flex: 0 0 auto;
  /* 官方图标是 256×256 透明位图（按 96px 落地，照顾高 DPI）：
     正方形，只锁高度即可等比缩放。**不要加圆角** —— 警徽本身有轮廓，加圆角会啃边。
     18px 而不是 16px：完整警徽的麦穗、五星在这个尺寸下才不糊。 */
  height: 18px;
  width: auto;
}

@media (max-width: 767px) {
  .footer-beian {
    gap: 4px 10px;
  }
  .footer-beian .beian-ico {
    height: 16px;
    width: auto;
  }
}

@media (max-width: 767px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------------- 提示条（toast） ---------------- */
.toast-host {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  background: var(--foreground);
  color: var(--background);
  box-shadow: var(--shadow-md);
  animation: toast-in 0.25s ease;
  max-width: 90vw;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--destructive); color: #fff; }
.toast-out { opacity: 0; transition: opacity 0.3s ease; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- 页头搜索 ---------------- */
.header-search { position: relative; }
.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--muted-foreground);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.header-icon-btn:hover { color: var(--primary); border-color: rgba(163, 38, 29, 0.4); background: var(--secondary); }
.search-dropdown { min-width: 320px; padding: 12px; }
.search-dropdown-form { display: flex; gap: 8px; }
.search-dropdown-form .input { flex: 1; height: 38px; }
.search-dropdown-hint {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px;
  color: var(--muted-foreground);
  line-height: 1.7;
}
@media (max-width: 767px) {
  .search-dropdown { min-width: 260px; right: -8px; }
}

/* ---------------- 分享二维码 ---------------- */
.share-card { text-align: center; }
.share-qr-frame {
  width: 168px;
  height: 168px;
  margin: 22px auto 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-qr-frame canvas { display: block; }
.share-qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.share-link-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.share-link-row .input { flex: 1; font-size: 12.5px; height: 36px; }
.share-empty { font-size: 12.5px; color: var(--muted-foreground); padding: 30px 8px; }
.footer-share-btn {
  font-size: 12.5px;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer-share-btn:hover { opacity: 0.8; }

/* ---------------- 我的家世 ---------------- */
.lineage-gen + .lineage-gen { margin-top: 16px; }
.lineage-gen-title {
  font-size: 12px;
  color: var(--muted-foreground);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.lineage-row { display: flex; flex-wrap: wrap; gap: 10px; }
.lineage-node {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lineage-node:hover { border-color: rgba(163, 38, 29, 0.35); box-shadow: var(--shadow-sm); }
.lineage-node.is-self { border-color: var(--primary); background: rgba(163, 38, 29, 0.06); }
.lineage-node .avatar { width: 28px; height: 28px; font-size: 13px; }

/* ---------------- 隐私开关 ---------------- */
.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}
.switch-row + .switch-row { border-top: 1px dashed var(--border); }
.switch-row .switch-text { min-width: 0; }
.switch-row .switch-text strong { font-size: 14px; font-weight: 600; display: block; }
.switch-row .switch-text span { font-size: 12.5px; color: var(--muted-foreground); line-height: 1.75; display: block; margin-top: 3px; }
.switch {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--muted);
  border: 1px solid var(--border);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}
.switch.on { background: var(--primary); border-color: var(--primary); }
.switch.on::after { transform: translateX(20px); }
.switch:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------- 成员史料附件 / 多版本备注 ---------------- */
.attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.attach-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--card);
  display: flex;
  flex-direction: column;
}
.attach-thumb {
  aspect-ratio: 4 / 3;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: 30px;
  color: var(--primary);
  opacity: 0.9;
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-body { padding: 11px 13px; min-width: 0; }
.attach-title { font-size: 13.5px; font-weight: 600; word-break: break-word; }
.attach-meta { font-size: 11.5px; color: var(--muted-foreground); margin-top: 4px; line-height: 1.7; }
.attach-actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.version-card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted-foreground);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--card);
}
.version-card + .version-card { margin-top: 12px; }
.version-card.v-mainstream { border-left-color: var(--success); }
.version-card.v-doubtful { border-left-color: var(--warning, #b45309); }
.version-card.v-disputed { border-left-color: var(--destructive); }
.version-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.version-content { font-size: 13.5px; line-height: 1.9; margin-top: 8px; color: var(--foreground); }
.version-source { font-size: 12px; color: var(--muted-foreground); margin-top: 8px; line-height: 1.7; }

.attach-thumb { position: relative; }
.attach-type {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  font-size: 11px; letter-spacing: 0.04em; padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(44, 24, 16, 0.62); color: #fff8f0;
}
.attach-note { font-size: 12px; color: var(--muted-foreground); margin-top: 4px; line-height: 1.6; }

.version-badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: var(--radius-pill); font-size: 11.5px; letter-spacing: 0.04em;
  border: 1px solid var(--border); color: var(--muted-foreground); background: var(--secondary);
}
.version-badge.is-mainstream { border-color: rgba(21, 128, 61, 0.35); color: var(--success); background: rgba(21, 128, 61, 0.08); }
.version-badge.is-doubtful { border-color: rgba(180, 83, 9, 0.35); color: var(--warning); background: rgba(180, 83, 9, 0.08); }
.version-badge.is-disputed { border-color: rgba(185, 28, 28, 0.35); color: var(--destructive); background: rgba(185, 28, 28, 0.08); }
.version-title { font-size: 13.5px; font-weight: 500; }
.version-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted-foreground); margin-top: 8px;
}

/* ---------------- 电子功德证书 ---------------- */
.cert-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px 24px;
  background: linear-gradient(180deg, rgba(163, 38, 29, 0.03), rgba(163, 38, 29, 0));
  text-align: center;
}
.cert-title { font-family: var(--font-serif); font-size: 22px; letter-spacing: 0.28em; color: var(--primary); }
.cert-body { font-size: 13.5px; line-height: 2.1; margin-top: 16px; color: var(--foreground); }
.cert-amount { font-size: 26px; color: var(--primary); font-weight: 600; }
.cert-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  margin-top: 18px;
  border: 2px solid rgba(163, 38, 29, 0.45);
  border-radius: 50%;
  color: var(--primary);
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.1em;
  transform: rotate(-8deg);
}

/* ---------------- 打印 ---------------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card, .panel { box-shadow: none; border-color: #ccc; }
  .site-header, .site-footer { display: none; }
}

/* ---------------- 头部触控目标 · 移动端放大到 44px ----------------
   iOS/Android 推荐的最小可点尺寸为 44×44。只撑开可点区域，
   不放大图标与 Logo 图形本身；桌面端完全不受影响。
   必须放在文件末尾：.header-icon-btn 等基础样式定义在文件中部，
   同权重规则后出现者生效，放在前面会被覆盖。 */
@media screen and (max-width: 767px) {
  .brand { min-height: 44px; }
  .header-icon-btn { width: 44px; height: 44px; }
  .menu-toggle {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  .user-trigger { min-height: 44px; }

  /* 正文内按钮、分页与页脚链接：撑到可稳定点中的高度 */
  .btn { min-height: 40px; }
  .pagination a, .pagination span { height: 40px; min-width: 40px; }
  .footer-list a { display: inline-block; padding: 5px 0; }
}
/* ============================================================
 * 全族分布图（同城寻亲页顶部总览区）
 * ============================================================ */
.dist-map { margin-bottom: 24px; }
.dist-map__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.dist-map__title { font-size: 15px; font-weight: 500; margin: 0; }
.dist-map__desc { font-size: 13px; color: var(--muted-foreground); margin: 4px 0 0; }
.dist-map__stats { display: flex; gap: 10px; }
.dist-map__stat {
  background: var(--secondary); border-radius: 8px;
  padding: 8px 12px; min-width: 76px;
}
.dist-map__stat span { display: block; font-size: 12px; color: var(--muted-foreground); text-align: center; }
.dist-map__stat b { display: block; font-size: 20px; font-weight: 500; margin-top: 2px; text-align: center; }
/* 地图容器必须是固定高度，否则腾讯 GL JS 不会渲染。
   高度调大：地图越"高"，能容纳的经纬跨度越大，视野级别才能收得更紧（更聚焦）。 */
/**
 * 腾讯地图自带控件（2026-10-23）：
 * 右上角那组「指南针 + 缩放按钮」盖在地图主体上，手机屏小的时候尤其挡视线，
 * 实际几乎用不上（缩放直接用双指 / 鼠标滚轮）。全端隐藏，只保留左下比例尺。
 *
 * 类名来自 SDK 自身（`.tmap-zoom-control` / `.compass-circle`），
 * 没有官方开关可用，只能用 CSS 隐藏；加 !important 防止 SDK 后续操作把 display 改回去。
 */
.dist-map__canvas .tmap-zoom-control,
.dist-map__canvas .compass-circle,
.dist-map__canvas .compass-circle-background,
.dist-map__canvas .compass-img,
.dist-map__canvas [class^="compass"],
.dist-map__canvas .rotate-circle {
  display: none !important;
}

.dist-map__canvas {
  width: 100%; height: 440px;
  border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--border);
  /**
   * 2026-10-20：建立**层叠上下文**，把腾讯地图自带控件「关」在容器里。
   *
   * 问题现象：滚动页面时，地图的缩放按钮（+/-）、比例尺、腾讯 logo
   * 会浮在顶部导航栏之上，遮住「同城寻亲」「搜索」「admin」等内容。
   *
   * 原因：腾讯 GL 的控件是 `position:absolute; z-index:1000`。
   * 容器虽然有 `position:relative`，但 `z-index` 是 `auto` ——
   * **auto 不建立层叠上下文**，子元素的 z-index 直接参与根层叠上下文，
   * 于是 1000 > 导航栏的 50，控件就压到了导航栏上面。
   *
   * 加 `z-index: 0`（或 isolation:isolate）后，容器成为独立层叠上下文，
   * 控件再高的 z-index 也只在容器内部比较，翻不出去。
   */
  position: relative;
  z-index: 0;
  isolation: isolate;
}
/**
 * 压淡底图（2026-10-20 用户要求：只要地市边界，路网等干扰信息不要显示）
 *
 * 腾讯地图 GL 的 `features` 只能关掉 POI / 标注 / 3D 建筑 / 路况箭头，
 * **主要道路属于 base 层内部，无法单独关闭**。
 * 这里对**底图那块 canvas** 降饱和度，路网会淡到几乎看不见，
 * 而自己画的祖籍地红点与迁徙弧线在**另一块 canvas 层**，不受影响。
 *
 * 若需彻底自定义（例如只留行政区划色块），应到腾讯位置服务控制台
 * 创建「个性化地图」样式，再在 Map 构造函数里传 styleId —— 那是最干净的方案。
 */
/**
 * 压淡底图路网（2026-10-20 用户要求：高速路网太抢眼，只要地市边界）
 *
 * 前提：腾讯 GL 把底图与 marker/polyline **画在同一块 WebGL canvas** 里，
 * 所以任何滤镜都会同时作用于标记，只能在「路网够淡」和「红点够醒目」之间取平衡。
 *
 * 实测三组（同一屏对比截图）：
 *   saturate(.18)                 → 路网几乎全消，红点被压成灰褐 ❌
 *   grayscale(.85)+brightness(1.1)→ 路网淡了，但整图偏冷灰，与站点米色不搭 ❌
 *   saturate(.35)+opacity(.72)    → 米色底调保留、路网只剩浅灰细线、
 *                                   省界/市界清晰、祖籍地红点仍是深红 ✅
 *
 * 注：`features` 已剔除 point/label/building3d/arrow，但**主要道路属于 base 层内部**，
 * 无法通过 features 关闭，只能靠这里压淡。
 * 若日后要做「彻底只留行政区划」，可改用腾讯控制台的个性化地图样式（styleId），
 * 届时删掉这段 filter 即可。
 */
/**
 * 底图弱化（2026-10-20 最终方案）
 *
 * 前面试过两轮都把标记带灰了：
 *   · `saturate(0.35)` → 红点/弧线全被抽成灰褐
 *   · `saturate(0.75) opacity(0.55)` → 仍偏灰
 *
 * 根因：底图与 marker/polyline 在**同一块 WebGL canvas**，
 * 任何滤镜都同时作用于两者；DOMOverlay 方案实测不可用（详见 JS 注释）。
 *
 * 折中：**只降不透明度、不动饱和度**。
 * 颜色 100% 保留，只是整体变淡 —— 路网弱化，红点仍是正红、弧线仍是橙。
 */
.dist-map__canvas > canvas:first-child {
  opacity: 0.62;
}

/**
 * 祖籍地「石老塆」标记（DOMOverlay，2026-10-20）
 *
 * 它是 DOM 节点、位于地图 canvas 之上，**不受上面那段 filter 影响**，
 * 所以能做真正的鲜朱红 + 白描边 + 呼吸光晕，稳稳压在最上层。
 */
.dist-map-origin {
  position: relative;
  width: 30px; height: 30px;
  pointer-events: none;
}
.dist-map-origin__halo {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: rgba(211, 36, 26, 0.20);
  animation: distOriginPulse 2.6s ease-out infinite;
}
.dist-map-origin__dot {
  position: absolute; left: 50%; top: 50%;
  width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: #d3241a;
  box-shadow: 0 0 0 2.5px #fffdf9, 0 2px 7px rgba(160, 30, 20, 0.45);
}
@keyframes distOriginPulse {
  0%   { transform: scale(0.55); opacity: 0.85; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dist-map-origin__halo { animation: none; opacity: 0.35; }
}
.dist-map__note { font-size: 12px; color: var(--muted-foreground); margin: 10px 0 0; }

/**
 * 2026-10-23：隐藏腾讯地图自带的「指南针」与「缩放」控件
 *
 * 用户反馈：右上角这两个悬浮控件遮挡视线，实际几乎用不上
 * （缩放用鼠标滚轮 / 双指捏合即可，PC 与手机同样处理）。
 *
 * 类名是实测枚举出来的（SDK 渲染出的真实 DOM）：
 *   · 指南针  .compass-circle / .compass-circle-background / .compass-img
 *   · 缩放    .tmap-zoom-control（含 .tmap-zoom-in / .tmap-zoom-out 两个按钮）
 * 比例尺 `.tmap-scale-control` 保留 —— 它显示「图上一段=多少公里」，有用且不挡视线。
 *
 * 为什么用 CSS 而不用构造参数：该 SDK 的 controlOptions 只接受 `{position}`，
 * 传 false 会被静默忽略（已在 distribution-map.js 里试过），只能从样式层隐藏。
 */
.dist-map__canvas .compass-circle,
.dist-map__canvas .compass-circle-background,
.dist-map__canvas .compass-img,
.dist-map__canvas .tmap-zoom-control {
  display: none !important;
}

@media (max-width: 767px) {
  /* 移动端地图压矮，把首屏留给下方列表 */
  .dist-map__canvas { height: 300px; }
  .dist-map__stats { width: 100%; }
  .dist-map__stat { flex: 1; min-width: 0; padding: 8px 10px; }
  .dist-map__stat b { font-size: 18px; }
}

/* ---------- 世代时间轴 ---------- */
.dist-map__time {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px;
}
.dist-map__chip {
  flex-shrink: 0; font-size: 12px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted-foreground);
  cursor: pointer; white-space: nowrap;
}
.dist-map__chip.is-on {
  background: var(--primary); border-color: var(--primary); color: var(--primary-foreground);
}
.dist-map__time input[type="range"] { flex: 1; min-width: 90px; }
.dist-map__genlabel {
  flex-shrink: 0; font-size: 12px; color: var(--foreground);
  min-width: 4.5em; text-align: right;
}
.dist-map.is-notime .dist-map__time { display: none; }

@media (max-width: 767px) {
  .dist-map__time { flex-wrap: wrap; gap: 8px; }
  .dist-map__time input[type="range"] { order: 3; flex-basis: 100%; min-width: 0; }
  .dist-map__genlabel { min-width: 0; text-align: left; }
}

/* ---------- 详情页「标签　值」信息行 ----------
   原本只写在 member-detail.php 的页面内 <style> 里。配偶详情页
   （spouse-detail.php）输出同样的 class 却没有对应样式，
   标签与值就连排成「姓名名氏」「房别元配」这种一坨文字。
   跨页面复用的结构样式必须放全局。 */
.detail-row {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(217, 201, 168, 0.75);
  font-size: 14px;
  align-items: baseline;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  flex: 0 0 84px;
  color: var(--muted-foreground);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}
.detail-value { flex: 1; min-width: 0; word-break: break-word; line-height: 1.7; }

@media (max-width: 767px) {
  .detail-row { flex-direction: column; gap: 2px; }
  .detail-label { flex: none; }
}

/* 窄屏隐藏次要列：后台侧栏占掉 ~350px，表格可用宽度有限。
   手机号 / 绑定成员在窄屏先让位，保证「用户名 + 操作」始终可见。 */
@media (max-width: 1560px) {
  .hide-narrow { display: none !important; }
}

/* ---------- 后台用户列表的「更多」菜单 ----------
   操作列原本有 4 个按钮（约 280px），是整张表最宽的一列；
   表格被撑到 1120px 后必然横向滚动，滚动过去左侧「用户名 / 角色」
   就被裁掉，视觉上像是列错位。压缩成「编辑 + 更多」后表格能自适应容器。 */
.us-more { position: relative; display: inline-block; }
.us-more > summary { cursor: pointer; user-select: none; }
.us-more > summary::-webkit-details-marker { display: none; }
.us-more__pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  min-width: 132px; padding: 4px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
}
.us-more__pop button {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; font: inherit; font-size: 13px;
  color: var(--foreground); cursor: pointer; white-space: nowrap;
}
.us-more__pop button:hover { background: var(--secondary); }

/* ---------- 后台用户表格紧凑化（2026-10-22） ----------
   这张表 9 列：用户名 / 角色 / 绑定成员 / 微信 / 核验等级 / 手机号 / 状态 / 最近登录 / 操作
   在 1366 屏幕上必然横向滚动，用户要求不要滚动条 ——
   于是压缩每列的内边距与字号，而不是隐藏信息。
   */
.us-table th,
.us-table td {
  padding: 10px 9px;
  font-size: 12.5px;
}
.us-table th { font-size: 12px; letter-spacing: .02em; }
/* 徽章与标签在窄格子里也收一点，省出横向空间 */
.us-table .badge { padding: 2px 7px; font-size: 11.5px; }
.us-table .tag { padding: 1px 6px; font-size: 11.5px; }
.us-ops {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.us-ops__wx {
  font-size: 12.5px;
  color: #8a7f72;
  margin-right: 4px;
}
.us-ops .btn-sm { padding: 3px 9px; font-size: 12px; }

/* ---------- 后台用户表格紧凑化（2026-10-22） ----------

/* ---------- 编辑弹窗里的「账号操作」区（2026-10-22） ---------- */
.us-ops {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.us-ops__wx {
  font-size: 12.5px;
  color: #8a7f72;
  margin-right: 4px;
}
.us-ops .btn-sm { padding: 3px 9px; font-size: 12px; }
