
/* ============================================================
   晚晴计划 v2 前端 —— 小程序风格 · 适老化 · 五模块
   数据唯一源：后端 API（localStorage 仅存登录 token）
   适老化：字号≥20px / 按钮高≥48px / 点击区≥44px / 对比度≥4.5:1
   ============================================================ */
:root {
  /* 对比度已按 WCAG 2.1 AA 校核（正文 ≥4.5:1，见 test/a11y.test.js 自动校验）
     --accent 由 #c96a22 调整为 #a8531a：白字按钮对比度 3.76:1 → 5.37:1 */
  --primary: #1a3a5c; --accent: #a8531a; --green: #177a40;
  --bg: #f5f0e8; --card: #fff; --text: #2b2b2b; --sub: #57534e;
  --danger: #b03a2e; --line: #cfc7b8; --line-strong: #8f8677; --tab: #5f5a51;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 20px; line-height: 1.6; color: var(--text); background: var(--bg); }
.app { max-width: 480px; height: 100%; margin: 0 auto; position: relative; overflow: hidden; background: var(--bg); box-shadow: 0 0 24px rgba(0,0,0,.12); }
.view { position: absolute; inset: 0; display: none; flex-direction: column; }
.view.active { display: flex; animation: fadeIn .3s ease; }
/* 后台没有 .home-main：直接由视图区滚动，避免固定高度外壳裁掉长列表。 */
body[data-page="admin"] #view-admin {
  display: block; min-height: 0; overflow-y: auto;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================
   后台：对话安全与隐私保护——树状节点展示
   结构：根节点 → 四条分支（输入侧 / 输出侧 / 审计计数 / 传输侧）
   动画：分支按顺序"逐点长出"，节点里的数字从 0 数到真实值
   ============================================================ */
.sec-tree { margin-top: 12px; }
.sec-root {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 700;
}
.sec-root::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%;
  background: #7ee2a8; box-shadow: 0 0 0 4px rgba(126,226,168,.25);
}
.sec-branch {
  position: relative; margin-left: 18px; padding-left: 22px;
  border-left: 2px solid var(--line);
}
.sec-branch:last-child { border-left-color: transparent; }
.sec-cap {
  position: relative; margin: 10px 0 4px; padding: 8px 12px;
  border-radius: 10px; background: #fbfaf6; border: 1px solid var(--line);
  font-size: 15px; font-weight: 700; color: var(--primary);
  opacity: 0; transform: translateX(-6px);
  transition: opacity .3s ease, transform .3s ease;
}
.sec-cap::before {
  content: ''; position: absolute; left: -28px; top: 50%;
  width: 20px; height: 2px; background: var(--line); transform: translateY(-50%);
}
.sec-cap.on { opacity: 1; transform: none; }
.sec-leaf {
  position: relative; display: flex; align-items: baseline; gap: 10px;
  margin: 6px 0 6px 14px; padding: 6px 10px; border-radius: 8px;
  background: #fff; border: 1px dashed var(--line);
  font-size: 15px; opacity: 0; transform: translateY(4px);
  transition: opacity .3s ease, transform .3s ease;
}
.sec-leaf::before {
  content: ''; position: absolute; left: -14px; top: 50%;
  width: 14px; height: 2px; background: var(--line); transform: translateY(-50%);
}
.sec-leaf.on { opacity: 1; transform: none; }
.sec-leaf .k { color: var(--sub); flex: 1; min-width: 0; }
.sec-leaf .v {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--green);
  font-size: 17px; white-space: nowrap;
}
.sec-leaf .v.hit { color: var(--danger); }
.sec-leaf .unit { color: var(--sub); font-size: 13px; white-space: nowrap; }
.sec-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px; margin-top: 14px;
}
.sec-stat {
  padding: 10px 12px; border-radius: 10px; background: #fbfaf6;
  border: 1px solid var(--line);
}
.sec-stat .n { font-size: 22px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.sec-stat .l { font-size: 13px; color: var(--sub); }
.sec-notes { margin-top: 12px; font-size: 13px; color: var(--sub); line-height: 1.7; }
.sec-notes li { margin-left: 18px; }
.sec-pill {
  display: inline-block; padding: 1px 8px; margin-right: 6px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.sec-pill.ok { background: #e6f1ea; color: var(--green); }
.sec-pill.limit { background: #f8ece1; color: var(--accent); }
/* 注意：本段不新增任何宽度断点媒体块 —— 版面测试按"第一个同级媒体块"取样式，
   在此插入会让原有断点断言读到错误的块。列数由 auto-fit 自适应。 */
body.std .sec-leaf, body.std .sec-cap { font-size: 13px; }
body.std .sec-leaf .v { font-size: 15px; }
body.std .sec-stat .n { font-size: 19px; }
body.font-lg .sec-leaf, body.font-lg .sec-cap { font-size: 18px; }
body.font-lg .sec-leaf .v { font-size: 20px; }
body.font-lg .sec-stat .n { font-size: 26px; }
@media (prefers-reduced-motion: reduce) {
  .sec-cap, .sec-leaf { opacity: 1; transform: none; transition: none; }
}
.card { background: var(--card); border-radius: 16px; padding: 20px; margin: 12px 16px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
/* 首页规划进度条：手机 12px，电脑/投屏逐级加粗加长（电脑上通栏显示，见 1000px 断点） */
.progress-head { display: flex; justify-content: space-between; align-items: center; }
#progressBar { height: 12px; border-radius: 6px; background: #e9e4da; margin-top: 10px; overflow: hidden; }
#progressFill { height: 100%; width: 0%; background: var(--green); border-radius: 6px; transition: width .4s; }
.btn { display: block; width: 100%; min-height: 52px; border: none; border-radius: 12px; font-size: 21px; font-weight: 600; color: #fff; background: var(--primary); cursor: pointer; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.97); opacity: .85; }
.btn.accent { background: var(--accent); }
.btn.green { background: var(--green); }
.btn.ghost { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn.sm { min-height: 48px; font-size: 18px; width: auto; }
input[type="text"], input[type="password"], input[type="number"], input[type="tel"], textarea {
  width: 100%; min-height: 52px; padding: 10px 14px; font-size: 20px;
  border: 2px solid var(--line-strong); border-radius: 12px; background: #fff;
  transition: border-color .2s, transform .2s, box-shadow .2s; font-family: inherit;
}
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,58,92,.18); transform: scale(1.02); }
label.field { display: block; font-size: 18px; color: var(--sub); margin: 12px 0 6px; }
.error-text { color: var(--danger); font-size: 20px; font-weight: 700; margin-top: 8px; min-height: 28px; }
.muted { color: var(--sub); font-size: 18px; }
.title-lg { font-size: 24px; font-weight: 700; }
.center { text-align: center; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* 无障碍：动效降级（偏好减少动态效果时停用呼吸动画与过渡） */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
/* 大字体模式（适老化增强）规则见「标准版」之后 —— 同级选择器按顺序覆盖，
   若放在 body.std 前面，标准版会把放大全部盖掉（旧 bug：标准版下点大字体没反应）。 */
/* 聊天"正在输入"指示器（P0-2） */
.typing-dots { color: var(--sub); font-style: italic; }
.typing-dots::after { content: '…'; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
/* 记录类型徽标（替代 emoji：语义化颜色区分） */
.type-badge {
  display: inline-block; min-width: 48px; padding: 2px 10px; border-radius: 8px;
  font-size: 16px; font-weight: 700; color: #fff; text-align: center; margin-right: 8px;
}
.type-badge.photo { background: var(--primary); }
.type-badge.video { background: var(--accent); }
.type-badge.audio { background: #5b4a7a; }
.type-badge.text { background: var(--green); }
.lock-mark { color: var(--danger); font-weight: 700; margin-left: 6px; }

/* 登录 */
#view-login { justify-content: center; padding: 30px 26px; background: linear-gradient(160deg, var(--primary) 0%, #2a5078 55%, var(--bg) 55.2%); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 34px; color: #fff; letter-spacing: 4px; }
.login-logo p { color: rgba(255,255,255,.9); font-size: 18px; margin-top: 6px; }
.login-card { background: #fff; border-radius: 20px; padding: 26px 22px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 74px; }
.pwd-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); min-width: 60px; min-height: 48px; background: none; border: none; font-size: 18px; color: var(--primary); cursor: pointer; }
.link-btn { background: none; border: none; color: var(--primary); font-size: 19px; text-decoration: underline; cursor: pointer; margin-top: 12px; }

/* 主页 */
.home-main { flex: 1; overflow-y: auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.panel { display: none; }
.panel.active { display: block; animation: fadeIn .3s ease; }
.welcome { background: var(--primary); color: #fff; border-radius: 0 0 24px 24px; padding: 26px 20px 32px; }
.welcome .greet { font-size: 17px; opacity: .9; }
.welcome h2 { font-size: 28px; margin: 4px 0 8px; }
.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px; }
.module-card { background: #fff; border-radius: 16px; padding: 18px 12px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.06); cursor: pointer; min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: transform .12s; border-top: 5px solid var(--primary); }
.module-card:nth-child(2) { border-top-color: var(--accent); }
.module-card:nth-child(3) { border-top-color: var(--green); }
.module-card:nth-child(4) { border-top-color: var(--accent); }
.module-card:nth-child(5) { border-top-color: var(--primary); }
.module-card:active { transform: scale(.96); }
.module-card .ic { margin-bottom: 6px; }
.module-card .ic svg { width: 30px; height: 30px; fill: var(--primary); }
.module-card:nth-child(2) .ic svg { fill: var(--accent); }
.module-card:nth-child(3) .ic svg { fill: var(--green); }
.module-card:nth-child(4) .ic svg { fill: var(--accent); }
.module-card:nth-child(5) .ic svg { fill: var(--primary); }
.module-card span { font-size: 20px; font-weight: 600; }
.module-card .desc { font-size: 16px; color: var(--sub); margin-top: 2px; }

/* 密录 */
.will-item { background: #fff; border-radius: 16px; padding: 16px; margin: 12px 16px; box-shadow: 0 2px 6px rgba(0,0,0,.05); border-left: 6px solid var(--accent); }
.will-item .wi-t { font-size: 20px; font-weight: 600; }
.will-item .wi-d { font-size: 16px; color: var(--sub); margin-top: 2px; white-space: pre-wrap; }
.will-item .ops { display: flex; gap: 10px; margin-top: 10px; }
.will-item .ops .btn { flex: 1; min-height: 48px; font-size: 18px; margin: 0; }

/* 密录 · 结构化明细（预嘱/心愿/数字遗产/回忆录的字段级展示） */
.will-item .wi-body { margin-top: 8px; }
.will-item .wi-kv { display: grid; gap: 5px; }
.will-item .wi-kv .row { display: flex; gap: 10px; font-size: 17px; line-height: 1.5; align-items: baseline; }
.will-item .wi-kv .k { flex: none; min-width: 5.2em; color: var(--sub); font-size: 15px; }
.will-item .wi-kv .v { flex: 1; color: var(--text); word-break: break-word; }
.will-item .wi-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.will-item .wi-chip { display: inline-block; padding: 2px 9px; border-radius: 9px; background: #e9e4da; color: var(--sub); font-size: 14px; line-height: 1.7; }
.will-item .wi-chip.on { background: var(--green); color: #fff; }
.will-item .wi-chip.warn { background: #f7e6e2; color: var(--danger); }
.will-item .wi-note { margin-top: 8px; font-size: 14px; line-height: 1.55; color: var(--sub); }
.will-item .wi-note b { color: var(--text); }

/* 回忆录阅读视图 · 章节目录 */
.mv-toc { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 4px; }
.mv-toc button { border: 1px solid var(--line); background: #fbfaf6; color: var(--primary); font-size: 14px; padding: 3px 9px; border-radius: 9px; cursor: pointer; min-height: 30px; }
.mv-toc button:active { background: #efe9dd; }
.mv-sec-title { font-size: 18px; font-weight: 700; color: var(--primary); margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 1px dashed var(--line); }
.record-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 16px 0; }
/* 分类从 4 个增到 5 个（新增"遗嘱梳理"）：按内容宽度排布、放不下自动换行，
   不再平均挤压（避免挤成竖排字，也避免长辈点错相邻标签） */
.record-tab { flex: 1 0 auto; min-height: 48px; border: 2px solid var(--line-strong); border-radius: 12px; font-size: 18px; background: #efe9dd; color: var(--sub); cursor: pointer; }
.record-tab.active { background: var(--primary); color: #fff; font-weight: 700; }
/* 搜索框外壳：手机端与其它卡片同边距（电脑端由主从布局规则改成上下留白） */
.rec-search { margin: 10px 16px 0; }
/* 本类一条记录的快捷导出（多条时为"导出本类全部"） */
.rec-export-all { display: flex; justify-content: flex-end; margin: 2px 16px 0; }
.rec-export-all .link-btn { margin: 0; min-height: 44px; padding: 0 4px; font-size: 16px; }
#legacyAddWrap { margin: 12px 16px 0; }

/* AI 对话 */
.chat-box { height: 42vh; min-height: 280px; overflow-y: auto; padding: 14px; background: var(--card); border-radius: 16px; margin: 12px 16px; }
.msg { margin-bottom: 13px; display: flex; }
.msg .bubble { max-width: 82%; padding: 12px 16px; border-radius: 14px; font-size: 19px; line-height: 1.5; white-space: pre-wrap; }
.msg.ai { justify-content: flex-start; }
.msg.ai .bubble { background: #e9eef5; border-top-left-radius: 4px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--primary); color: #fff; border-top-right-radius: 4px; }
.chat-input-wrap { display: flex; gap: 10px; padding: 0 16px; }
.chat-input-wrap input { flex: 1; }
.icon-btn { min-width: 52px; min-height: 52px; border: none; border-radius: 12px; background: var(--accent); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 26px; height: 26px; fill: #fff; }
.chat-mode-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 16px 0; }

/* 介绍/遗嘱指引 */
.value-card { background: #fff; border-radius: 16px; padding: 20px; margin: 12px 16px; border-top: 5px solid var(--primary); }
.value-card h3 { font-size: 21px; color: var(--primary); margin-bottom: 6px; }
.form-card { background: #fff; border-radius: 16px; padding: 18px; margin: 12px 16px; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.form-card h4 { font-size: 20px; color: var(--primary); }
.form-card .law { font-size: 16px; color: var(--sub); }
.tip-card { border-left: 5px solid var(--danger); }

/* 我的 */
.avatar { width: 92px; height: 92px; border-radius: 50%; margin: 18px auto 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 38px; font-weight: 700; }
.profile-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 20px; }
.profile-row .k { color: var(--sub); }
.admin-entry { margin-top: 24px; border-top: 2px dashed #c8c2b8; padding-top: 16px; text-align: center; }

/* 底部导航 */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; height: 70px; background: #fff; border-top: 1px solid var(--line); display: flex; align-items: stretch; z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
.tab-item { flex: 1; background: none; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--tab); font-size: 17px; min-height: 48px; }
.tab-item svg { width: 24px; height: 24px; fill: currentColor; }
.tab-item.active { color: var(--primary); font-weight: 700; }
.tab-enter { flex: 0 0 84px; position: relative; background: none; border: none; cursor: pointer; }
.tab-enter .circle { position: absolute; left: 50%; top: -22px; transform: translateX(-50%); width: 60px; height: 60px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; letter-spacing: 2px; box-shadow: 0 6px 16px rgba(39,174,96,.4); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: translateX(-50%) scale(1); box-shadow: 0 6px 16px rgba(39,174,96,.4); } 50% { transform: translateX(-50%) scale(1.08); box-shadow: 0 8px 24px rgba(39,174,96,.55); } }

/* 管理员 */
.admin-head { background: var(--primary); color: #fff; padding: 18px; display: flex; justify-content: space-between; align-items: center; padding-right: 205px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 16px; }
.stat-card { background: #fff; border-radius: 16px; padding: 16px 10px; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.stat-card .num { font-size: 30px; font-weight: 700; color: var(--primary); }
.stat-card .lbl { font-size: 16px; color: var(--sub); }
.table-wrap { background: #fff; border-radius: 16px; margin: 12px 16px; padding: 10px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 17px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #eee; }
th { color: var(--sub); font-size: 16px; }

/* 弹窗 */
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 20px; width: 86%; max-height: 80%; overflow-y: auto; padding: 24px 20px; animation: fadeIn .25s ease; }
.modal h3 { font-size: 23px; margin-bottom: 12px; padding-right: 44px; }

/* ============================================================
   三端版面（一）：平板竖屏（768–999px）
   - 手机版（<768px）保持原样，本段规则不触及
   - 平板不再套"480px 手机壳"：通栏单列、限宽 880px 居中
   - 底部导航常驻可见（不藏进抽屉），图标与触控区同步放大，适合老人
   ============================================================ */
@media (min-width: 768px) and (max-width: 999px) {
  body { display: block; padding: 0; background: var(--bg); }
  .app { max-width: none; width: 100%; height: 100vh; height: 100dvh; margin: 0; border-radius: 0; box-shadow: none; }

  /* 单列内容：限宽居中，两侧留白随屏宽自然增长 */
  .card, .value-card, .form-card, .stat-grid, .table-wrap {
    width: calc(100% - 40px); max-width: 880px; margin: 14px auto; padding: 22px;
  }
  .module-grid {
    width: calc(100% - 40px); max-width: 880px; margin: 18px auto;
    grid-template-columns: repeat(3, 1fr); gap: 14px;
  }
  .module-card { min-height: 132px; }
  .record-tabs { width: calc(100% - 40px); max-width: 880px; margin: 14px auto 0; }
  .record-tabs .record-tab { min-height: 54px; font-size: 19px; }
  .rec-search { width: calc(100% - 40px); max-width: 880px; margin: 12px auto 0; }
  .rec-export-all { width: calc(100% - 40px); max-width: 880px; margin: 4px auto 0; }
  #legacyAddWrap { width: calc(100% - 40px); max-width: 880px; margin: 12px auto 0 !important; }
  #willList { width: calc(100% - 40px); max-width: 880px; margin: 0 auto; }
  #willList .will-item { margin: 12px 0; }

  /* 对话：消息区与输入区同宽 */
  .chat-mode-tabs, .chat-box, .chat-input-wrap {
    width: calc(100% - 40px); max-width: 880px; margin-left: auto; margin-right: auto;
  }
  .chat-box { height: 52vh; }
  .func-grid { max-width: 880px; margin-left: auto; margin-right: auto; }

  /* 欢迎区：通栏底色，文字对齐内容列 */
  .welcome { padding: 30px max(24px, calc((100vw - 880px) / 2)) 36px; }
  .welcome h2 { font-size: 32px; }

  /* 底部导航：加高、图标加大 */
  .tabbar { height: 78px; }
  .tab-item { font-size: 18px; }
  .tab-item svg { width: 27px; height: 27px; }
  .home-main { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }

  /* 弹窗：单列阅读宽度 */
  .modal { width: min(88%, 660px); max-width: 660px; }
  .top-bar { padding: 0 18px; }
}

/* ============================================================
   吸顶工具条：模式切换 / 通知 / 无障碍
   统一顶部条带定位（不再绝对定位散落），内容自动避让（padding-top）
   ============================================================ */
.top-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  height: 52px; display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 0 10px;
  background: linear-gradient(180deg, rgba(26,58,92,.18) 0%, rgba(26,58,92,0) 100%);
  pointer-events: none;   /* 条带本身不拦截点击，仅按钮可点 */
}
.top-bar button { pointer-events: auto; }

.mode-switch {
  min-height: 36px; padding: 4px 16px; border-radius: 18px;
  background: #fff; color: var(--primary); border: 2px solid var(--primary);
  font-size: 15px; font-weight: 700; letter-spacing: 1px; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  transition: transform .1s, opacity .2s;
}
.mode-switch:active { transform: scale(.95); }
/* 标准版下按钮反色（深底白字，与浅色内容区形成反差） */
body.std .mode-switch { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 通知铃铛 */
.bell-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  background: #fff; border: 2px solid var(--primary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.bell-btn svg { width: 20px; height: 20px; fill: var(--primary); }
body.std .bell-btn { background: var(--primary); }
body.std .bell-btn svg { fill: #fff; }
.bell-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.bell-btn:active { transform: scale(.94); }

/* 无障碍按钮（文字版：与模式切换按钮同款胶囊） */
.a11y-btn {
  min-height: 36px; padding: 4px 16px; border-radius: 18px;
  background: #fff; color: var(--primary); border: 2px solid var(--primary);
  font-size: 15px; font-weight: 700; letter-spacing: 1px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  transition: transform .1s, opacity .2s;
}
body.std .a11y-btn { background: var(--primary); color: #fff; border-color: var(--primary); }
.a11y-btn:active { transform: scale(.94); }

/* 内容避让：各视图顶部为工具条让出 52px 安全区 */
.home-main { padding-top: 52px; scroll-padding-top: 56px; }
#view-login { padding-top: 78px; }
.admin-head { padding-top: 64px; padding-right: 18px; }
/* 注意：必须保留 padding-top，否则返回/列表按钮会被顶部工具条压住导致点不到 */
.gen-head { padding-top: 64px; }

/* 轻提示（独立图层，不占用弹窗容器）：校验类提示不再清空表单 */
.toast-layer {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(12px);
  max-width: min(86vw, 420px); padding: 14px 20px; border-radius: 14px;
  background: rgba(26,58,92,.94); color: #fff; font-size: 18px; line-height: 1.5;
  text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  z-index: 400; word-break: break-word;
}
.toast-layer.show { opacity: 1; transform: translateX(-50%) translateY(0); }
body.std .toast-layer { font-size: 15px; padding: 10px 16px; bottom: 76px; }

/* 弹窗关闭按钮：所有弹窗均可关闭（键盘/读屏用户不再被困住） */
.modal { position: relative; }
.modal-close {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px;
  border: none; border-radius: 50%; background: #f1ece2; color: var(--primary);
  font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer;
}
.modal-close:active { transform: scale(.94); }
.modal-body { padding-top: 4px; }

/* ============================================================
   无障碍基础设施：读屏专用文本 / 跳转链接 / 关怀模式开关 / 录音态
   ============================================================ */
/* 视觉隐藏但对读屏可见（h1、实时播报区） */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* 键盘用户按 Tab 第一个就能跳过工具条直达正文 */
.skip-link {
  position: absolute; left: 50%; top: -60px; transform: translateX(-50%);
  z-index: 500; padding: 10px 18px; border-radius: 0 0 12px 12px;
  background: var(--primary); color: #fff; font-size: 17px; text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 0; outline: 3px solid var(--accent); outline-offset: 2px; }
/* 关怀模式总开关（顶部工具条最左侧，老人一眼可见） */
.care-btn {
  min-height: 36px; padding: 4px 14px; margin-right: auto; border-radius: 18px;
  background: #fff; color: var(--primary); border: 2px solid var(--primary);
  font-size: 15px; font-weight: 700; letter-spacing: 1px; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  white-space: nowrap; max-width: 230px; overflow: hidden; text-overflow: ellipsis;
}
.care-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.care-btn:active { transform: scale(.94); }
body.std .care-btn { background: var(--primary); color: #fff; }
body.std .care-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
/* 窄屏（≤430px）：顶栏要放下 4 个按钮，给「一键大字·朗读」限宽截断；
   开关状态仍由底色（accent）+ aria-pressed 表达，读屏不受影响 */
@media (max-width: 430px) {
  .top-bar { gap: 6px; padding: 0 8px; }
  .care-btn { max-width: 132px; padding: 4px 10px; font-size: 12px; letter-spacing: 0; }
  .a11y-btn, .mode-switch { padding: 4px 12px; letter-spacing: 0; }
}

/* 朗读逐句高亮：与服务端合成的分段一一对应（原文本不变，可复制、可被读屏读取） */
.tts-seg { border-radius: 6px; transition: background-color .15s ease, color .15s ease; }
.tts-seg.tts-speaking { background: rgba(168, 83, 26, .22); box-shadow: 0 0 0 2px rgba(168, 83, 26, .22); }
body.hc .tts-seg.tts-speaking { background: #000; color: #fff; }
.msg.user .bubble .tts-seg.tts-speaking { background: rgba(255,255,255,.28); color: #fff; }


/* 本条音频不可用标记（只标注，不影响文字与其它功能） */
.tts-unavailable {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 8px;
  font-size: 13px; color: var(--sub); background: #eee7db; border: 1px solid var(--line-strong);
}
.speak-mini.tts-off { opacity: .6; border-style: dashed; }
body.hc .tts-unavailable { background: #fff; color: #000; border: 1px solid #000; }

/* 语音输入录音中：按钮高亮 + 呼吸提示 */
.icon-btn.recording { background: var(--danger); animation: recPulse 1.2s ease-in-out infinite; }
@keyframes recPulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
/* 高对比度模式下确保按钮/焦点仍清晰可辨 */
body.hc .care-btn { border-color: #000; background: #000; color: #fff; }
body.hc .care-btn[aria-pressed="true"] { background: #fff; color: #000; }
body.hc .toast-layer { background: #000; border: 2px solid #fff; }
body.hc .skip-link { background: #000; color: #fff; }
/* 系统级"增强对比度"偏好 */
@media (prefers-contrast: more) {
  :root { --sub: #3f3b36; --line: #8a8478; --tab: #3f3b36; }
  .btn.ghost { border-width: 3px; }
}

/* 朗读小按钮（AI 消息/档案弹窗内） */
.speak-mini {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 32px; padding: 2px 12px; margin-left: 8px;
  border: 1.5px solid var(--primary); border-radius: 16px;
  background: #fff; color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer;
}
.speak-mini:active { transform: scale(.96); }
body.std .speak-mini { min-height: 26px; font-size: 12px; }
.speak-mini.speaking { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 高对比度模式（body.hc）：视障增强，黑白高对比 */
body.hc {
  --primary: #000; --accent: #000; --green: #000; --danger: #000;
  --bg: #fff; --card: #fff; --text: #000; --sub: #1a1a1a;
  --line: #000; --line-strong: #000; --tab: #000;
}
body.hc .welcome { background: #000; }
body.hc .type-badge { background: #000; }
body.hc .welcome .greet { opacity: 1; }
body.hc .mode-switch { border-width: 2px; box-shadow: none; }
body.hc .tabbar { border-top-width: 2px; }

/* 功能中心（我的页）：网格入口 */
.func-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.func-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 72px; padding: 10px 6px; border: 1.5px solid var(--line-strong); border-radius: 12px;
  background: #fbfaf6; cursor: pointer; transition: transform .1s, border-color .2s;
}
.func-btn b { font-size: 16px; color: var(--primary); }
.func-btn span { font-size: 12px; color: var(--sub); }
.func-btn:active { transform: scale(.96); }
.func-btn:hover { border-color: var(--primary); }
body.std .func-btn b { font-size: 14px; }
body.std .func-btn span { font-size: 11px; }
body.std .func-btn { min-height: 60px; }
@media (min-width: 768px) { .func-grid { grid-template-columns: repeat(3, 1fr); max-width: 900px; } }

/* 家系图（家族树）：辈分纵向、同辈横向、连线连接父子 */
.gtree { overflow-x: auto; padding: 14px 4px 6px; }
.gtree-root { display: flex; flex-direction: column; align-items: center; margin: 0 auto; }
.gtree-node {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 96px; padding: 8px 12px; border-radius: 12px;
  background: #fbfaf6; border: 1.5px solid var(--primary); position: relative;
}
.gtree-node .gn-name { font-size: 16px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.gtree-node .gn-life { font-size: 12px; color: var(--sub); }
.gtree-node .gn-note { font-size: 12px; color: var(--sub); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.std .gtree-node { min-width: 84px; padding: 6px 10px; }
body.std .gtree-node .gn-name { font-size: 14px; }
body.std .gtree-node .gn-life, body.std .gtree-node .gn-note { font-size: 11px; }
.gtree-children { display: flex; justify-content: center; gap: 18px; position: relative; margin-top: 16px; padding: 0 4px; }
/* 横线：连接所有子节点 */
.gtree-children::before { content: ''; position: absolute; top: -8px; left: 4%; right: 4%; height: 2px; background: #c8c2b8; }
/* 竖线：父节点下方到横线 */
.gtree-root > .gtree-node::after { content: ''; position: absolute; top: 100%; left: 50%; width: 2px; height: 8px; background: #c8c2b8; }
/* 竖线：横线到子节点 */
.gtree-item { position: relative; display: flex; flex-direction: column; align-items: center; }
.gtree-item::before { content: ''; position: absolute; top: -8px; left: 50%; width: 2px; height: 8px; background: #c8c2b8; }
/* 第一个子节点左侧到横线起点的短横（补全连接） */
.gtree-item:first-child::after { content: ''; position: absolute; top: -8px; right: 50%; width: 50%; height: 2px; background: #c8c2b8; }
.gtree-item:last-child::after { content: ''; position: absolute; top: -8px; left: 50%; width: 50%; height: 2px; background: #c8c2b8; }
/* 始祖（无父）节点 */
.gtree-root > .gtree-item:first-child::before { display: none; }
.gtree-empty { text-align: center; color: var(--sub); font-size: 15px; padding: 20px 0; }

/* ============================================================
   家系族谱全屏视图：暖色背景 + 精致树形 + 顶部返回
   ============================================================ */
#view-genealogy { background: linear-gradient(180deg, #f6f0e4 0%, #fdfbf6 45%, #f9f4ea 100%); }
.gen-head {
  background: linear-gradient(135deg, var(--primary) 0%, #2a5078 100%);
  color: #fff; padding: 64px 14px 14px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 14px rgba(26,58,92,.18);
  padding-right: 80px;   /* 避开右上角悬浮三按钮 */
}
.gen-main { flex: 1; overflow-y: auto; position: relative; scroll-padding-top: 56px; }
.gen-legend {
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 12px; font-size: 13px; color: var(--sub);
  background: rgba(255,255,255,.75); border-bottom: 1px solid rgba(216,203,180,.5);
}
.gen-legend span { display: inline-flex; align-items: center; gap: 5px; }
.gen-legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.gen-scroll { padding: 18px 14px 90px; }
.gen-actions {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px 16px;
  background: linear-gradient(180deg, rgba(249,244,234,0), #f9f4ea 40%);
}
/* 节点美化：渐变卡 + 顶部色条 + 辈分徽章 */
.gtree-node {
  background: linear-gradient(180deg, #ffffff 0%, #fdf9f1 100%);
  border: 1.5px solid var(--line-strong);
  border-top: 4px solid var(--primary);
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(26,58,92,.10);
  padding: 8px 12px 6px;
}
.gtree-node.gen2 { border-top-color: var(--accent); }
.gtree-node.gen3 { border-top-color: var(--green); }
.gtree-node .gn-badge {
  display: inline-block; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--primary); border-radius: 8px; padding: 1px 7px; margin-bottom: 3px;
  letter-spacing: 1px;
}
.gtree-node.gen2 .gn-badge { background: var(--accent); }
.gtree-node.gen3 .gn-badge { background: var(--green); }
.gtree-node .gn-name { font-size: 16px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.gtree-node .gn-life { font-size: 12px; color: var(--sub); }
.gtree-node .gn-note { font-size: 12px; color: var(--sub); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.std .gtree-node { min-width: 84px; padding: 6px 10px; }
body.std .gtree-node .gn-name { font-size: 14px; }
body.std .gtree-node .gn-life, body.std .gtree-node .gn-note { font-size: 11px; }
/* 连线精致化：暖棕 + 圆点 */
.gtree-children::before { background: #cbb99a; }
.gtree-root > .gtree-node::after { background: #cbb99a; }
.gtree-item::before { background: #cbb99a; }
.gtree-item:first-child::after, .gtree-item:last-child::after { background: #cbb99a; }

/* ---------- 标准版（body.std）：全套页面 ---------- */
body.std { font-size: 15px; }

/* 登录 */
body.std #view-login { padding: 40px 20px; background: var(--bg); }
body.std .login-logo { margin-bottom: 16px; }
body.std .login-logo h1 { font-size: 26px; color: var(--primary); letter-spacing: 2px; }
body.std .login-logo p { color: var(--sub); font-size: 14px; }
body.std .login-card { max-width: 400px; margin: 0 auto; padding: 20px; border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.08); }

/* 卡片 / 按钮 / 表单 */
body.std .card { padding: 14px 16px; margin: 8px 12px; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
body.std .btn { min-height: 42px; font-size: 15px; border-radius: 8px; }
body.std .btn.sm { min-height: 36px; font-size: 14px; }
body.std .btn.ghost { border-width: 1.5px; }
body.std input[type="text"], body.std input[type="password"], body.std input[type="number"], body.std input[type="tel"], body.std textarea {
  min-height: 42px; padding: 8px 12px; font-size: 15px; border-radius: 8px; border-width: 1.5px;
}
body.std label.field { font-size: 13px; margin: 8px 0 4px; }
body.std .muted { font-size: 13px; }
body.std .title-lg { font-size: 19px; }
body.std .error-text { font-size: 15px; }

/* 欢迎区 */
body.std .welcome { padding: 18px 20px 22px; border-radius: 0 0 16px 16px; }
body.std .welcome h2 { font-size: 22px; margin: 2px 0 4px; }
body.std .welcome .greet { font-size: 13px; }

/* 首页模块网格：3 列紧凑（桌面 5 列） */
body.std .module-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 12px; }
body.std .module-card { min-height: 88px; padding: 12px 8px; border-radius: 12px; border-top-width: 3px; }
body.std .module-card span { font-size: 15px; }
body.std .module-card .desc { font-size: 12px; }
body.std .module-card .ic { margin-bottom: 4px; }
body.std .module-card .ic svg { width: 22px; height: 22px; }

/* 密录 */
body.std .will-item { padding: 12px 14px; margin: 8px 12px; border-radius: 12px; border-left-width: 4px; }
body.std .will-item .wi-t { font-size: 15px; }
body.std .will-item .wi-d { font-size: 13px; }
body.std .will-item .ops { gap: 8px; margin-top: 8px; }
body.std .will-item .ops .btn { min-height: 36px; font-size: 14px; }
body.std .record-tab { min-height: 38px; font-size: 14px; border-radius: 8px; }
body.std .type-badge { font-size: 12px; min-width: 38px; padding: 1px 8px; margin-right: 6px; }
body.std .will-item .wi-kv .row { font-size: 13px; gap: 8px; }
body.std .will-item .wi-kv .k { font-size: 12px; min-width: 4.6em; }
body.std .will-item .wi-chip { font-size: 12px; padding: 1px 7px; }
body.std .will-item .wi-note { font-size: 12px; }

/* AI 对话 */
body.std .chat-box { height: 45vh; min-height: 240px; border-radius: 12px; margin: 8px 12px; padding: 10px; }
body.std .msg { margin-bottom: 8px; }
body.std .msg .bubble { font-size: 15px; padding: 8px 12px; border-radius: 10px; }
body.std .chat-input-wrap { padding: 0 12px; gap: 8px; }
body.std .chat-input-wrap input { flex: 1; }
body.std .icon-btn { min-width: 42px; min-height: 42px; border-radius: 8px; }
body.std .chat-mode-tabs { margin: 8px 12px 0; }

/* 介绍 / 表单 */
body.std .value-card { padding: 14px 16px; margin: 8px 12px; border-radius: 12px; border-top-width: 3px; }
body.std .value-card h3 { font-size: 17px; }
body.std .form-card { padding: 12px 14px; margin: 8px 12px; border-radius: 10px; }
body.std .form-card h4 { font-size: 16px; }
body.std .form-card .law { font-size: 13px; }

/* 我的 */
body.std .avatar { width: 64px; height: 64px; font-size: 26px; margin: 12px auto 6px; }
body.std .profile-row { font-size: 15px; padding: 10px 0; }

/* 底部导航：更窄更高密度 */
body.std .tabbar { height: 54px; }
body.std .tab-item { font-size: 12px; min-height: 40px; gap: 1px; }
body.std .tab-item svg { width: 20px; height: 20px; }
body.std .tab-enter .circle { width: 46px; height: 46px; font-size: 14px; top: -16px; }

/* 管理员 */
body.std .stat-grid { gap: 8px; margin: 10px 12px; }
body.std .stat-card { padding: 12px 8px; border-radius: 12px; }
body.std .stat-card .num { font-size: 24px; }
body.std .stat-card .lbl { font-size: 12px; }
body.std table { font-size: 13px; }
body.std th { font-size: 12px; }
body.std .table-wrap { margin: 8px 12px; border-radius: 12px; }

/* 弹窗：更窄更紧凑 */
body.std .modal { width: 92%; max-width: 560px; border-radius: 14px; padding: 18px 16px; }
body.std .modal h3 { font-size: 18px; }
body.std .modal .btn { min-height: 38px; font-size: 14px; }
body.std .modal input, body.std .modal textarea { min-height: 38px; font-size: 14px; padding: 6px 10px; }
body.std .modal .field { font-size: 13px; }

/* 标准版桌面端：同样为手机容器内布局（容器居中由全局规则处理） */
@media (min-width: 768px) {
  body.std .func-grid { max-width: 100%; }
}

/* ============================================================
   桌面版（≥1000px）：操作台布局
   结构：左侧导航 + 顶部工具条 + 宽内容区；移动端（<1000px）完全不受影响
   取舍：不改变任何业务流程与权限，只重排布局；栏宽按内容类型分别控制
   ============================================================ */
@media (min-width: 1000px) {
  body { display: flex; align-items: center; justify-content: center; padding: 16px; background: #eef1f5; }

  .app {
    max-width: none; width: calc(100vw - 32px); height: calc(100vh - 32px);
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr);
    grid-template-rows: 56px minmax(0, 1fr);
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(26,58,92,.16), 0 2px 8px rgba(26,58,92,.08);
  }

  /* 顶部条：不再是覆盖在内容上的渐变层，而是独立一行 */
  .top-bar {
    position: relative; grid-column: 1 / -1; grid-row: 1 / 2;
    height: 56px; background: #fff; background-image: none;
    border-bottom: 1px solid var(--line);
    justify-content: flex-end; padding: 0 16px;
  }

  .view { position: static; grid-column: 2; grid-row: 2; min-height: 0; }

  /* 底部标签栏 → 左侧导航栏 */
  .tabbar {
    position: static; grid-column: 1; grid-row: 2; height: auto;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    border-top: none; border-right: 1px solid var(--line);
    padding: 14px 10px; gap: 6px; background: #fff;
  }
  .tab-item {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 10px;
    min-height: 46px; padding: 0 12px; border-radius: 10px; font-size: 16px;
  }
  .tab-item:hover { background: #f4f7fa; }
  .tab-item.active { background: #eaf1f8; }
  .tab-enter {
    flex: 0 0 auto; display: flex; align-items: center;
    border: 2px solid var(--green); border-radius: 10px; min-height: 46px; padding: 0 12px; margin-top: 8px;
  }
  .tab-enter .circle {
    position: static; transform: none; width: 100%; height: auto; border-radius: 0;
    background: none; color: var(--green); box-shadow: none; animation: none;
    font-size: 0; justify-content: flex-start;
  }
  .tab-enter .circle::after { content: 'AI 访谈'; font-size: 16px; letter-spacing: 0; font-weight: 700; }

  /* 内容区：留白更大，底部不再为标签栏预留 96px */
  .home-main { padding: 20px 24px 28px; }
  .card { max-width: 980px; margin: 12px auto; }
  .module-grid { grid-template-columns: repeat(3, 1fr); max-width: 980px; margin: 16px auto; }
  .func-grid { max-width: 980px; }

  /* 首页：说明类卡片两栏排布，模块入口占满通栏 */
  #panel-home.panel.active { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-content: start; max-width: 1040px; margin: 0 auto; }
  #panel-home > .welcome { grid-column: 1 / -1; }
  /* 网格项上的 margin:auto 会退化为按内容收缩，这里显式撑满通栏 */
  #panel-home > .module-grid { grid-column: 1 / -1; margin: 16px 0; max-width: none; }
  #panel-home > .card { margin: 10px 0; max-width: none; }
  /* 规划进度通栏（此前只占两栏中的一栏，大屏上看起来很短） */
  #panel-home > #progressCard { grid-column: 1 / -1; }
  #progressBar { height: 18px; border-radius: 9px; margin-top: 12px; }
  #progressFill { border-radius: 9px; }
  #progressPct { font-size: 18px !important; }

  /* 密录（电脑 / 平板横屏）：主从布局 —— 左侧清单，右侧详情常驻，
     老人不必反复开关弹窗；手机端仍走原有弹窗查看，行为不变 */
  #panel-wills.panel.active {
    display: grid;
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    gap: 20px; align-items: start;
    max-width: 1320px; margin: 0 auto;
    padding: 6px 24px 28px;
  }
  .rec-master { min-width: 0; }
  /* 让清单与详情直接成为 #panel-wills 网格的两列（否则会被 .rec-shell 套成单列） */
  .rec-shell { display: contents; }
  .rec-master > .card { margin: 0 0 12px; max-width: none; }
  .rec-search { margin: 0 0 12px !important; }
  .rec-master .record-tabs { margin: 0 0 12px; max-width: none; }
  .rec-master #legacyAddWrap { margin: 0 0 12px !important; max-width: none; }
  .rec-master .rec-export-all { margin: 0 0 10px; }

  #willList { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; max-width: none; }
  #willList .will-item {
    margin: 0; cursor: pointer; position: relative;
    transition: box-shadow .15s ease, transform .1s ease;
  }
  #willList .will-item:hover { transform: translateY(-1px); }
  /* 清单只留摘要，完整说明放右侧详情，避免两处重复 */
  #willList .will-item .wi-note { display: none; }
  #willList .will-item .ops { margin-top: 8px; }
  /* 清单里的操作按钮：触控高≥46px；≥1200 时仍由下方大字档放大到 20px/50px */
  .rec-master .will-item .ops .btn { min-height: 46px; font-size: 17px; }
  #willList .will-item.rd-on {
    background: #fcfdff;
    box-shadow: 0 0 0 3px var(--rd-mod, var(--primary)), 0 6px 18px rgba(26,58,92,.14);
  }
  #willList .will-item.rd-on .wi-t { padding-right: 92px; }
  #willList .will-item.rd-on::after {
    content: '正在查看'; position: absolute; top: 12px; right: 12px;
    padding: 2px 9px; border-radius: 8px;
    background: var(--rd-mod, var(--primary)); color: #fff;
    font-size: 13px; font-weight: 700; letter-spacing: .5px;
  }
  #willList > p.muted { width: 100%; }
  #willList[data-kind="wills"] { --rd-mod: var(--mod-will); }
  #willList[data-kind="wishes"] { --rd-mod: var(--mod-wish); }
  #willList[data-kind="memoirs"] { --rd-mod: var(--mod-memoir); }
  #willList[data-kind="legacies"] { --rd-mod: var(--mod-legacy); }

  /* 详情面板：跟随滚动吸顶，内部独立滚动，长文不把页面撑长 */
  #recDetail {
    display: block; position: sticky; top: 6px; align-self: start;
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    padding: 22px 24px 24px; min-height: 360px;
    max-height: calc(100vh - 150px); overflow-y: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    scroll-padding-top: 12px;
  }

  #panel-wills .will-item.rd-on { border-left-color: var(--rd-mod, var(--accent)); }

  /* 弹窗：宽版；长表单也在视口内滚动，不被固定高度截断 */
  .modal-mask { position: fixed; }
  .modal { width: min(92vw, 820px); max-width: 820px; max-height: 86vh; padding: 26px 28px; }
  body.std .modal { width: min(92vw, 820px); max-width: 820px; }

  /* 访谈页：左侧进度摘要 + 右侧对话 */
  #panel-chat.panel.active {
    display: grid; grid-template-columns: 288px minmax(0, 1fr);
    grid-template-areas: "side head" "side tabs" "side chat" "side input" "side foot" "side note";
    gap: 0 20px; align-content: start;
    max-width: 1120px; margin: 0 auto;
  }
  #chatSide { grid-area: side; }
  .chat-head { grid-area: head; margin: 0 0 10px; }
  .chat-mode-tabs { grid-area: tabs; margin: 0 0 10px; }
  .chat-box { grid-area: chat; margin: 0; height: calc(100vh - 340px); min-height: 300px; }
  .chat-input-wrap { grid-area: input; margin-top: 12px; }
  .chat-foot { grid-area: foot; }
  .chat-note { grid-area: note; }

  /* 无底部导航的页面（登录/后台）：单列，不预留侧栏 */
  body[data-page="login"] .app,
  body[data-page="admin"] .app { grid-template-columns: minmax(0, 1fr); }
  body[data-page="login"] .view,
  body[data-page="admin"] .view { grid-column: 1; }
  body[data-page="login"] .home-main,
  body[data-page="admin"] .home-main { padding-top: 24px; }

  /* 回忆录阅读：控制行长，避免超宽行难读 */
  .mv-read { max-width: 46em; margin: 0 auto; }
}

/* ============================================================
   密录详情面板（电脑 / 平板横屏显示；手机端不渲染，仍用弹窗）
   ============================================================ */
.rec-detail { display: none; }
.rec-detail .rd-kicker { font-size: 14px; font-weight: 700; letter-spacing: 1px; color: var(--sub); }
.rec-detail .rd-head h3 { font-size: 25px; margin: 4px 0 2px; line-height: 1.35; }
.rec-detail .rd-meta { font-size: 14px; color: var(--sub); }
.rec-detail .rd-body { margin-top: 14px; }
.rec-detail .wi-kv { display: grid; gap: 6px; }
.rec-detail .wi-kv .row { display: flex; gap: 12px; font-size: 18px; line-height: 1.55; align-items: baseline; }
.rec-detail .wi-kv .k { flex: none; min-width: 5.6em; color: var(--sub); font-size: 16px; }
.rec-detail .wi-kv .v { flex: 1; color: var(--text); word-break: break-word; }
.rec-detail .wi-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rec-detail .wi-chip {
  display: inline-block; padding: 2px 10px; border-radius: 9px;
  background: #e9e4da; color: var(--sub); font-size: 15px; line-height: 1.7;
}
.rec-detail .wi-chip.on { background: var(--green); color: #fff; }
.rec-detail .wi-chip.warn { background: #f7e6e2; color: var(--danger); }
.rec-detail .wi-note { margin-top: 10px; font-size: 15px; line-height: 1.6; color: var(--sub); }
.rec-detail .wi-note b { color: var(--text); }
.rec-detail .rd-ops {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line);
}
.rec-detail .rd-ops .btn { flex: 1 1 140px; width: auto; min-height: 50px; font-size: 18px; margin: 0; }
.rec-detail .rd-note { margin-top: 14px; font-size: 14px; line-height: 1.6; color: var(--sub); }
.rec-detail .rd-empty { padding: 48px 12px; text-align: center; }
.rec-detail .rd-empty b { display: block; font-size: 21px; color: var(--primary); margin-bottom: 8px; }
.rec-detail .rd-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.rec-detail .rd-toc button {
  border: 1px solid var(--line); background: #fbfaf6; color: var(--primary);
  font-size: 15px; padding: 4px 10px; border-radius: 9px; min-height: 36px; cursor: pointer;
}
.rec-detail .rd-toc button:active { background: #efe9dd; }
.rec-detail .rd-sec-title {
  font-size: 20px; font-weight: 700; color: var(--primary);
  margin: 20px 0 8px; padding-bottom: 4px; border-bottom: 1px dashed var(--line);
}
.rec-detail .rd-memoir-text { max-width: 40em; margin: 0 auto; }
.rec-detail .rd-memoir-text p { font-size: 19px; line-height: 2; text-indent: 2em; margin: 0 0 12px; }
body.hc .rec-detail { border-width: 2px; }
body.hc .rec-detail .wi-chip { background: #fff; border: 1px solid #000; color: #000; }
body.hc .rec-detail .wi-chip.on { background: #000; color: #fff; }

/* 平板横屏 / 小笔记本（1000–1199px）：导航收窄为图标栏，
   给主从布局与正文让出宽度；手机与平板竖屏不受影响 */
@media (min-width: 1000px) and (max-width: 1199px) {
  .app { grid-template-columns: 112px minmax(0, 1fr); }
  .tabbar { padding: 12px 8px; gap: 4px; }
  .tab-item {
    flex-direction: column; justify-content: center; gap: 4px;
    min-height: 68px; padding: 6px 4px; font-size: 14px; text-align: center;
  }
  .tab-item svg { width: 26px; height: 26px; }
  .tab-enter { justify-content: center; min-height: 64px; padding: 6px 4px; }
  .tab-enter .circle { font-size: 0; }
  .tab-enter .circle::after { content: 'AI 访谈'; font-size: 14px; letter-spacing: 0; }
  .home-main { padding: 20px 20px 28px; }
  #panel-wills.panel.active { grid-template-columns: minmax(300px, 340px) minmax(0, 1fr); padding: 6px 20px 28px; }
  .crumb { max-width: 1180px; }
  .card { max-width: 920px; }
  #panel-home.panel.active { max-width: 980px; }
  #panel-chat.panel.active { max-width: 1040px; grid-template-columns: 260px minmax(0, 1fr); }
}

/* 访谈进度摘要卡（仅桌面显示） */
.chat-side { display: none; }
@media (min-width: 1000px) {
  .chat-side { display: block; position: sticky; top: 0; align-self: start; }
  .chat-side .cs-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 2px 6px rgba(0,0,0,.04); }
  .chat-side .cs-title { font-size: 15px; color: var(--sub); margin-bottom: 10px; font-weight: 700; }
  .chat-side .cs-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed #e7e1d6; font-size: 15px; }
  .chat-side .cs-row:last-child { border-bottom: none; }
  .chat-side .cs-k { color: var(--sub); flex: none; }
  .chat-side .cs-v { color: var(--text); font-weight: 600; text-align: right; }
  .chat-side .cs-tip { margin-top: 10px; font-size: 13px; line-height: 1.6; color: var(--sub); }
  .chat-side .cs-actions { display: flex; gap: 8px; margin-top: 12px; }
  .chat-side .cs-actions .btn { min-height: 40px; font-size: 14px; margin: 0; }
}

/* 投屏演示模式：字号上一档，但保留全部真实内容与操作 */
body.present { font-size: 22px; }
body.present .modal { width: min(94vw, 960px); max-width: 960px; }
body.present .tab-item { font-size: 17px; }
body.present .chat-box .bubble { font-size: 21px; }

/* 投屏独立态（仅电脑/大屏）：去掉外壳与投影、占满投影画面，
   字号与点按目标整体上一档；按 Esc 或再点"退出投屏"即还原 */
@media (min-width: 1000px) {
  body.present { padding: 0; background: #e9eef5; }
  body.present .app {
    width: 100vw; height: 100vh; height: 100dvh;
    border-radius: 0; box-shadow: none;
    grid-template-rows: 64px minmax(0, 1fr);
  }
  body.present .top-bar { height: 64px; padding: 0 24px; }
  body.present .home-main { padding: 24px 36px 36px; }
  body.present .crumb { display: none; }
  body.present .card { max-width: 1200px; }
  body.present #panel-home.panel.active { max-width: 1500px; }
  /* 投屏时进度条再上一档，远处也能看清 */
  body.present #progressBar { height: 24px; border-radius: 12px; }
  body.present #progressFill { border-radius: 12px; }
  body.present #progressPct { font-size: 22px !important; }
  body.present #panel-wills.panel.active {
    max-width: 1720px; grid-template-columns: minmax(380px, 440px) minmax(0, 1fr);
  }
  body.present #recDetail { max-height: calc(100vh - 128px); padding: 26px 30px; }
  body.present .tab-item { font-size: 19px; min-height: 56px; }
  body.present #willList .will-item .wi-t { font-size: 26px; }
  body.present .rec-detail .rd-head h3 { font-size: 30px; }
  body.present .rec-detail .wi-kv .row { font-size: 21px; }
  body.present .rec-detail .wi-kv .k { font-size: 18px; }
  body.present .rec-detail .rd-ops .btn { font-size: 20px; min-height: 56px; }
  body.present .rec-detail .rd-memoir-text p { font-size: 22px; }
  body.present .modal { width: min(94vw, 1100px); max-width: 1100px; }
}

/* ============================================================
   记录导出弹窗：选择导出项 → 预览 → Word / 图片 / 文本 / 打印
   ============================================================ */
#modalBox.exp-modal { width: min(94vw, 1000px); max-width: 1000px; max-height: 90vh; }
.exp-wrap { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 4px; }
.exp-form { min-width: 0; }
.exp-form .form-sec { margin: 16px 0 6px; padding-top: 10px; }
.exp-form .form-sec:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.exp-scope label, .exp-sec label {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; font-size: 18px; line-height: 1.45; color: var(--text); cursor: pointer;
}
.exp-scope input, .exp-sec input { flex: none; width: 24px; height: 24px; margin-top: 2px; accent-color: var(--primary); }
.exp-allbtn {
  float: right; border: none; background: none; color: var(--primary);
  font-size: 15px; text-decoration: underline; cursor: pointer; padding: 2px 4px; min-height: 32px;
}
.exp-fmts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.exp-files { margin-top: 12px; }
.exp-files .exp-file-btn {
  width: 100%; margin: 0 0 8px; min-height: 48px; padding: 8px 12px;
  font-size: 16px; text-align: left;
}
.exp-files .exp-file-btn:last-of-type { margin-bottom: 0; }
.exp-fmt {
  min-height: 50px; border: 2px solid var(--line-strong); border-radius: 12px;
  background: #fbfaf6; color: var(--primary); font-size: 17px; font-weight: 700; cursor: pointer;
  transition: background .15s, color .15s;
}
.exp-fmt[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.exp-fmt:active { transform: scale(.98); }
.exp-actions { display: flex; gap: 10px; margin-top: 16px; }
.exp-actions .btn { flex: 1; margin: 0; min-height: 52px; }
.exp-preview { min-width: 0; }
.exp-paper-wrap { background: #efe9dd; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.exp-paper {
  background: #fff; width: 100%; max-width: 460px; height: 560px; max-height: 58vh;
  margin: 0 auto; overflow-y: auto; padding: 26px 28px;
  font-family: "Songti SC", "SimSun", serif; font-size: 14px; line-height: 1.8; color: #222;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.exp-paper table { width: 100%; border-collapse: collapse; }
.exp-paper .doc-cover { margin: 0 0 12px; }
.exp-paper .doc-cover-bar { height: 6px; font-size: 1px; line-height: 1px; }
.exp-paper .doc-cover-cell { padding: 16px 18px; }
.exp-paper .doc-brand { font-family: "SimHei", "黑体", sans-serif; font-size: 10px; font-weight: 700; letter-spacing: 2px; margin-bottom: 5px; }
.exp-paper .doc-title { font-family: "SimHei", "黑体", sans-serif; font-size: 20px; font-weight: 700; line-height: 1.4; }
.exp-paper .doc-sub { font-size: 11.5px; color: #4a4a4a; margin-top: 5px; }
.exp-paper .doc-sec { margin: 13px 0 5px; }
.exp-paper .doc-sec-bar { width: 5px; }
.exp-paper .doc-sec-txt { font-family: "SimHei", "黑体", sans-serif; font-size: 13.5px; font-weight: 700; padding: 4px 8px; }
.exp-paper .doc-subsec { font-family: "SimHei", "黑体", sans-serif; font-size: 13px; margin: 10px 0 3px; color: #333; }
.exp-paper .doc-p { margin: 0 0 5px; font-size: 12.8px; }
.exp-paper .doc-p.indent { text-indent: 2em; }
.exp-paper .doc-kv { margin: 0 0 8px; }
.exp-paper .doc-kv td { border-bottom: 1px solid #ece5d8; padding: 3px 6px; font-size: 12.3px; vertical-align: top; }
.exp-paper .doc-k { width: 27%; font-size: 11.5px; color: #555; }
.exp-paper .doc-quote { margin: 2px 0 8px; }
.exp-paper .doc-quote td { padding: 6px 8px; }
.exp-paper .doc-quote .doc-p { margin: 0; }
.exp-paper .doc-note { margin: 3px 0 8px; }
.exp-paper .doc-note td { background: #f6f2ea; border-left: 3px solid #c9bfa9; padding: 6px 8px; font-size: 10.8px; color: #555; line-height: 1.65; }
.exp-paper .doc-rec { font-size: 15px; font-weight: 700; margin: 14px 0 6px; padding-bottom: 4px; }
.exp-paper .doc-dots { text-align: center; color: #b9ad97; letter-spacing: 8px; margin: 9px 0; font-size: 12px; }
.exp-paper .doc-foot { text-align: center; color: #666; font-size: 10px; border-top: 1px solid #ddd3c2; padding-top: 6px; margin-top: 14px; }
.exp-paper.as-png img { display: block; width: 100%; }
.exp-paper.as-txt pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: "Songti SC", "SimSun", serif; font-size: 12.5px; line-height: 1.7; }
.exp-tip { font-size: 14px; color: var(--sub); margin-top: 8px; }
body.std .exp-scope label, body.std .exp-sec label { font-size: 15px; }
body.std .exp-fmt { font-size: 15px; min-height: 44px; }
body.hc .exp-paper { border: 2px solid #000; }
body.hc .exp-fmt[aria-pressed="true"] { background: #000; }
@media (max-width: 999px) {
  #modalBox.exp-modal { width: 96%; max-width: none; padding: 18px 14px; }
  .exp-wrap { grid-template-columns: 1fr; gap: 12px; }
  .exp-preview { order: 2; }
  .exp-paper { height: 240px; max-height: 240px; padding: 18px 16px; font-size: 15px; }
  .exp-scope label, .exp-sec label { font-size: 17px; padding: 6px 0; }
  .exp-fmts { grid-template-columns: 1fr 1fr; }
  .exp-fmt { min-height: 48px; font-size: 16px; }
  .exp-actions .btn { min-height: 50px; font-size: 18px; }
}

/* 回忆录打印：只输出正文，A4 分页友好 */
@media print {
  body { background: #fff; display: block; padding: 0; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea h1 { font-size: 22pt; text-align: center; margin: 0 0 6pt; }
  #printArea .meta { text-align: center; font-size: 10pt; color: #555; margin-bottom: 12pt; }
  #printArea h2 { font-size: 14pt; margin: 14pt 0 6pt; border-bottom: 1px solid #999; padding-bottom: 3pt; }
  #printArea h3 { font-size: 12.5pt; margin: 12pt 0 4pt; }
  #printArea p { font-size: 11.5pt; line-height: 1.9; text-indent: 2em; margin: 0 0 8pt; }
  #printArea p.noindent { text-indent: 0; }
  #printArea p.exp-note { font-size: 10pt; color: #555; border-top: 1px solid #999; padding-top: 6pt; margin-top: 12pt; }
  #printArea hr { border: none; border-top: 1px solid #bbb; margin: 10pt 0; }
  /* 导出文档版式（记录导出 / 打印·PDF） */
  #printArea .doc-cover { width: 100%; border-collapse: collapse; margin: 0 0 12pt; }
  #printArea .doc-cover-cell { padding: 14pt 16pt; }
  #printArea .doc-brand { font-family: "黑体", SimHei; font-size: 9.5pt; letter-spacing: 2pt; margin-bottom: 6pt; }
  #printArea .doc-title { font-family: "黑体", SimHei; font-size: 21pt; font-weight: bold; line-height: 1.35; }
  #printArea .doc-sub { font-size: 10.5pt; color: #444; margin-top: 6pt; }
  #printArea .doc-sec { width: 100%; border-collapse: collapse; margin: 14pt 0 6pt; }
  #printArea .doc-sec-bar { width: 5pt; }
  #printArea .doc-sec-txt { font-family: "黑体", SimHei; font-size: 13pt; font-weight: bold; padding: 5pt 9pt; }
  #printArea .doc-subsec { font-family: "黑体", SimHei; font-size: 12pt; margin: 10pt 0 4pt; }
  #printArea .doc-p { font-size: 11.5pt; line-height: 1.85; text-indent: 0; margin: 0 0 6pt; }
  #printArea .doc-p.indent { text-indent: 2em; }
  #printArea .doc-kv { width: 100%; border-collapse: collapse; margin: 0 0 8pt; }
  #printArea .doc-kv td { border-bottom: 1px solid #e5ddcf; padding: 4pt 8pt; font-size: 11.5pt; vertical-align: top; }
  #printArea .doc-k { width: 26%; font-family: "黑体", SimHei; font-size: 10.5pt; color: #555; }
  #printArea .doc-quote { width: 100%; margin: 2pt 0 10pt; border-collapse: collapse; }
  #printArea .doc-quote td { padding: 8pt 10pt; }
  #printArea .doc-quote .doc-p { margin: 0; }
  #printArea .doc-note { width: 100%; margin: 4pt 0 10pt; border-collapse: collapse; }
  #printArea .doc-note td { background: #f6f2ea; border-left: 3pt solid #c9bfa9; padding: 7pt 9pt; font-size: 10pt; color: #555; }
  #printArea .doc-rec { font-family: "黑体", SimHei; font-size: 15pt; margin: 16pt 0 8pt; padding-bottom: 5pt; border-bottom: 2pt solid #999; }
  #printArea .doc-dots { text-align: center; color: #999; letter-spacing: 8pt; margin: 10pt 0; }
  #printArea .doc-foot { text-align: center; color: #666; font-size: 9.5pt; border-top: 1px solid #ccc; padding-top: 8pt; margin-top: 16pt; }
  #printArea { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 20mm 18mm; }
}
#printArea { display: none; }

/* 投屏按钮：仅桌面/投影使用，移动端顶栏空间有限故隐藏 */
@media (max-width: 999px) {
  .top-bar .present-btn { display: none !important; }
}

/* 表单分组标题（预嘱/心愿/数字遗产编辑） */
.form-sec { font-size: 16px; font-weight: 700; color: var(--primary); margin: 18px 0 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.form-sec:first-child { margin-top: 4px; padding-top: 0; border-top: none; }
body.std .form-sec { font-size: 14px; margin: 12px 0 6px; }
body.font-lg .form-sec { font-size: 18px; }



/* ============================================================
   适老化增强（依据：工信部《互联网网站适老化通用设计规范》）
   1.2.2 区域色彩区分 / 1.2.4 焦点状态 / 1.2.3 放大与大字屏
   原则2 特大鼠标 / 3.1.4 位置告知与撤销
   ============================================================ */
:root {
  /* 四个模块的识别色（低饱和、深浅分明；均通过白底 4.5:1 正文对比） */
  --mod-will: #1f4e79;
  --mod-will-bg: #e7eef6;
  --mod-wish: #8a4b16;
  --mod-wish-bg: #f8ece1;
  --mod-memoir: #2f6b4f;
  --mod-memoir-bg: #e6f1ea;
  --mod-legacy: #5b4a7a;
  --mod-legacy-bg: #efeaf6;
  --focus-ring: #0b5fa5;
  --cursor-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M8 4 L8 36 L17 27 L23 40 L29 37 L23 24 L35 24 Z' fill='%23ffffff' stroke='%23000000' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E");
  --cursor-pointer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M14 6 L14 30 L20 24 L24 34 L29 32 L25 22 L33 22 Z' fill='%23ffffff' stroke='%23000000' stroke-width='2.5' stroke-linejoin='round'/%3E%3Cpath d='M30 34 L38 34' stroke='%23000000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* 1.2.4 焦点状态：所有可聚焦控件统一 3px 外环 + 2px 偏移，不只靠颜色变化 */
:focus-visible {
  outline: 3px solid var(--focus-ring) !important;
  outline-offset: 2px !important;
  border-radius: 8px;
}
body.hc :focus-visible {
  outline-color: #000 !important;
  outline-width: 4px !important;
}

/* 原则2 特大鼠标指针（开关由无障碍弹窗控制，持久化） */
body.big-cursor,
body.big-cursor * { cursor: var(--cursor-default) 8 4, auto !important; }
body.big-cursor a, body.big-cursor button, body.big-cursor [role="button"],
body.big-cursor .tab-item, body.big-cursor .record-tab, body.big-cursor .module-card,
body.big-cursor .func-btn, body.big-cursor summary, body.big-cursor label[for] {
  cursor: var(--cursor-pointer) 6 4, pointer !important;
}

/* 1.2.2 区域色彩区分：模块入口左侧色条 + 图标底色 + 悬停描边 */
.module-card { border-left: 6px solid var(--mod, var(--primary)); }
.module-card .ic { background: var(--mod-bg, #eef3f8); color: var(--mod, var(--primary)); }
.module-card:hover { border-color: var(--mod, var(--primary)); }
.module-card[data-mod="will"] { --mod: var(--mod-will); --mod-bg: var(--mod-will-bg); }
.module-card[data-mod="wish"] { --mod: var(--mod-wish); --mod-bg: var(--mod-wish-bg); }
.module-card[data-mod="story"] { --mod: var(--mod-memoir); --mod-bg: var(--mod-memoir-bg); }
.module-card[data-mod="digital"] { --mod: var(--mod-legacy); --mod-bg: var(--mod-legacy-bg); }

/* 密录分类标签同样用模块色区分 */
.record-tabs .record-tab[data-rk="wills"].active { background: var(--mod-will); }
.record-tabs .record-tab[data-rk="wishes"].active { background: var(--mod-wish); }
.record-tabs .record-tab[data-rk="memoirs"].active { background: var(--mod-memoir); }
.record-tabs .record-tab[data-rk="legacies"].active { background: var(--mod-legacy); }

/* 3.1.4 位置告知（桌面显示，移动端隐藏以免占屏） */
.crumb { display: none; }
@media (min-width: 1000px) {
  .crumb {
    display: flex; align-items: center; gap: 8px;
    max-width: 1080px; margin: 0 auto 8px;
    font-size: 15px; color: var(--sub);
  }
  .crumb a { color: var(--primary); text-decoration: none; }
  .crumb a:hover { text-decoration: underline; }
  .crumb span[aria-current] { color: var(--text); font-weight: 600; }
}

/* 撤销提示条（独立浮层，可点击；不复用 .toast-layer 的 pointer-events:none） */
.undo-bar {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(12px);
  display: flex; align-items: center; gap: 14px;
  max-width: min(92vw, 560px); padding: 12px 14px 12px 20px;
  background: rgba(26,58,92,.96); color: #fff; border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28); z-index: 410;
  font-size: 18px; line-height: 1.5; opacity: 0;
  pointer-events: auto; transition: opacity .2s ease, transform .2s ease;
}
.undo-bar.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.undo-bar .undo-text { flex: 1; word-break: break-word; }
.undo-bar .undo-btn {
  flex: none; min-height: 44px; padding: 0 18px;
  border: 2px solid #fff; border-radius: 10px;
  background: transparent; color: #fff; font-size: 18px; font-weight: 700; cursor: pointer;
}
.undo-bar .undo-btn:hover { background: rgba(255,255,255,.16); }
body.hc .undo-bar { background: #000; border: 2px solid #fff; }
@media (min-width: 1000px) { .undo-bar { bottom: 28px; font-size: 19px; } }

/* ============================================================
   电脑/大屏显示优化（≥1200px）：默认字号上一档，重点信息放大
   注意：仅作用于非「标准版」，用户主动选紧凑版时保持原样
   ============================================================ */
@media (min-width: 1200px) {
  body:not(.std) .card p,
  body:not(.std) .card li { font-size: 19px; line-height: 1.75; }
  body:not(.std) .muted { font-size: 17px; }
  body:not(.std) .title-lg { font-size: 25px; }
  body:not(.std) .welcome h2 { font-size: 34px; }
  body:not(.std) .welcome .greet { font-size: 19px; }
  body:not(.std) .module-card span { font-size: 22px; }
  body:not(.std) .module-card .desc { font-size: 16px; }
  body:not(.std) .btn { font-size: 21px; min-height: 54px; }
  /* 压过 .will-item .ops .btn 的 18px，保证桌面操作按钮可读可点 */
  body:not(.std) .will-item .ops .btn,
  body:not(.std) .mv-toc button,
  body:not(.std) .modal .btn { font-size: 20px; min-height: 50px; }
  body:not(.std) .btn.sm { font-size: 18px; min-height: 48px; }
  body:not(.std) .record-tab { font-size: 19px; min-height: 54px; }
  body:not(.std) .will-item .wi-t { font-size: 23px; }
  body:not(.std) .will-item .wi-kv .row { font-size: 19px; gap: 12px; }
  body:not(.std) .will-item .wi-kv .k { font-size: 17px; min-width: 6em; }
  body:not(.std) .will-item .wi-chip { font-size: 16px; padding: 3px 11px; }
  body:not(.std) .will-item .wi-note { font-size: 16px; }
  body:not(.std) .chat-box .bubble { font-size: 21px; line-height: 1.7; }
  body:not(.std) .chat-input-wrap input { font-size: 21px; min-height: 56px; }
  body:not(.std) .modal h3 { font-size: 26px; }
  body:not(.std) .modal p, body:not(.std) .modal li { font-size: 19px; }
  body:not(.std) .modal .field { font-size: 18px; }
  body:not(.std) .profile-row { font-size: 21px; }
  body:not(.std) .func-btn b { font-size: 18px; }
  body:not(.std) .func-btn span { font-size: 15px; }
  body:not(.std) .tab-item { font-size: 18px; min-height: 52px; }
  body:not(.std) .mv-sec-title { font-size: 22px; }
  body:not(.std) #mvText p { font-size: 21px !important; line-height: 2 !important; }
  body:not(.std) .mv-toc button { font-size: 16px; min-height: 38px; }
  body:not(.std) .rec-detail .rd-head h3 { font-size: 27px; }
  body:not(.std) .rec-detail .wi-kv .row { font-size: 19px; }
  body:not(.std) .rec-detail .wi-kv .k { font-size: 17px; }
  body:not(.std) .rec-detail .rd-ops .btn { font-size: 19px; }
  body:not(.std) .rec-detail .rd-memoir-text p { font-size: 20px; }
}

/* 高对比度下的模块色：统一转为黑白 + 边框，避免颜色依赖 */
body.hc .module-card { --mod: #000; --mod-bg: #fff; border-left-color: #000; }
body.hc .module-card .ic { color: #000; background: #fff; }
body.hc .record-tab.active { background: #000 !important; }
body.hc #willList .will-item.rd-on { box-shadow: 0 0 0 3px #000; background: #fff; }
body.hc #willList .will-item.rd-on::after { background: #000; color: #fff; }

/* 超大屏（≥1800px）：放宽内容上限，避免"中间一条窄柱" */
@media (min-width: 1800px) {
  .card { max-width: 1180px; }
  #panel-home.panel.active { max-width: 1320px; }
  #panel-home.panel.active > .module-grid { max-width: none; }
  #panel-wills.panel.active { max-width: 1640px; grid-template-columns: minmax(380px, 440px) minmax(0, 1fr); }
  #willList { max-width: none; }
  #recDetail { max-height: calc(100vh - 140px); }
  #panel-chat { max-width: 1440px; }
  body:not(.std) .welcome h2 { font-size: 40px; }
  body:not(.std) .module-card span { font-size: 24px; }
  body:not(.std) .rec-detail .rd-head h3 { font-size: 28px; }
  body:not(.std) .rec-detail .wi-kv .row { font-size: 20px; }
  body:not(.std) .rec-detail .rd-memoir-text p { font-size: 21px; }
  .crumb { max-width: 1560px; }
}


/* ============================================================
   大字体模式 · 最终层（必须放在所有 @media 之后）
   原因：≥1200/≥1800 的"电脑展示"规则与 body.font-lg 同优先级，
        写在前面会被盖掉 —— 这就是"打开大字体没效果"的根因。
   取值均比对应大屏规则再大一档，保证任何宽度（手机/1440/1800+）都只放大、不缩小。
   ============================================================ */
body.font-lg { font-size: 24px; }
body.font-lg .muted { font-size: 21px; }
body.font-lg .card p, body.font-lg .card li { font-size: 22px; line-height: 1.8; }
body.font-lg .title-lg { font-size: 28px; }
body.font-lg .desc, body.font-lg .module-card .desc { font-size: 19px; }
body.font-lg .module-card span { font-size: 26px; }
body.font-lg .welcome h2 { font-size: 44px; }
body.font-lg .welcome .greet { font-size: 23px; }
body.font-lg .btn { font-size: 24px; min-height: 58px; }
body.font-lg .btn.sm { font-size: 21px; min-height: 52px; }
body.font-lg .will-item .ops .btn, body.font-lg .modal .btn, body.font-lg .mv-toc button { font-size: 22px; min-height: 52px; }
body.font-lg .record-tab { font-size: 22px; min-height: 58px; }
body.font-lg .tab-item { font-size: 21px; min-height: 56px; }
body.font-lg .tab-item svg { width: 27px; height: 27px; }
body.font-lg .func-btn { min-height: 72px; }
body.font-lg .func-btn b { font-size: 21px; }
body.font-lg .func-btn span { font-size: 18px; }
body.font-lg .profile-row { font-size: 24px; }
body.font-lg .modal h3 { font-size: 29px; }
body.font-lg .modal p, body.font-lg .modal li { font-size: 22px; }
body.font-lg .modal .field, body.font-lg label.field { font-size: 21px; }
body.font-lg .will-item .wi-t { font-size: 26px; }
body.font-lg .will-item .wi-d { font-size: 20px; }
body.font-lg .will-item .wi-kv .row { font-size: 22px; }
body.font-lg .will-item .wi-kv .k { font-size: 20px; }
body.font-lg .will-item .wi-chip { font-size: 19px; }
body.font-lg .will-item .wi-note { font-size: 19px; }
body.font-lg .type-badge { font-size: 19px; }
body.font-lg .law { font-size: 19px; }
body.font-lg .lbl { font-size: 20px; }
body.font-lg .error-text { font-size: 22px; }
body.font-lg .chat-box .bubble, body.font-lg .msg .bubble { font-size: 24px; line-height: 1.7; }
body.font-lg .chat-input-wrap input { font-size: 24px; min-height: 60px; }
body.font-lg .mv-sec-title { font-size: 25px; }
body.font-lg .mv-toc button { font-size: 19px; min-height: 44px; }
body.font-lg .rec-detail .rd-head h3 { font-size: 31px; }
body.font-lg .rec-detail .wi-kv .row { font-size: 22px; }
body.font-lg .rec-detail .wi-kv .k { font-size: 20px; }
body.font-lg .rec-detail .rd-ops .btn { font-size: 22px; }
body.font-lg .rec-detail .rd-memoir-text p { font-size: 24px; }
body.font-lg #mvText p { font-size: 24px !important; line-height: 2.1 !important; }
body.font-lg .toast-layer { font-size: 20px; }
body.font-lg .stat-card .num { font-size: 32px; }
body.font-lg .stat-card .lbl { font-size: 18px; }
body.font-lg .form-sec { font-size: 20px; }
/* 标准版 + 大字体：std 里被压小的控件按比例补回来 */
body.std.font-lg { font-size: 19px; }
body.std.font-lg .title-lg { font-size: 25px; }
body.std.font-lg .btn { min-height: 46px; font-size: 19px; }
body.std.font-lg .btn.sm { min-height: 42px; font-size: 17px; }
body.std.font-lg input[type="text"], body.std.font-lg input[type="password"],
body.std.font-lg input[type="number"], body.std.font-lg input[type="tel"],
body.std.font-lg textarea { min-height: 46px; font-size: 19px; }
body.std.font-lg label.field { font-size: 16px; }
body.std.font-lg .error-text { font-size: 18px; }
body.std.font-lg .module-card .desc { font-size: 15px; }
body.std.font-lg .func-btn { min-height: 68px; }
body.std.font-lg .func-btn b { font-size: 17px; }
body.std.font-lg .func-btn span { font-size: 13px; }
body.std.font-lg .modal h3 { font-size: 21px; }
body.std.font-lg .modal .btn { min-height: 42px; font-size: 17px; }
body.std.font-lg .modal .field { font-size: 15px; }
body.std.font-lg .msg .bubble { font-size: 18px; }
body.std.font-lg .tab-item { font-size: 16px; }
body.std.font-lg .record-tab { font-size: 18px; }
body.std.font-lg .will-item .wi-t { font-size: 18px; }
body.std.font-lg .will-item .wi-d { font-size: 16px; }
body.std.font-lg .law { font-size: 15px; }
body.std.font-lg .stat-card .lbl { font-size: 14px; }
body.std.font-lg .stat-card .num { font-size: 28px; }
body.std.font-lg .welcome h2 { font-size: 26px; }
body.std.font-lg .toast-layer { font-size: 17px; }

/* 首页进度百分比：大屏媒体里是 18px !important，大字体下再抬一档 */
body.font-lg #progressPct { font-size: 22px !important; }

/* 大字体：表单控件与登录标题也一起放大（此前漏了输入框） */
body.font-lg input[type="text"], body.font-lg input[type="password"], body.font-lg input[type="number"], body.font-lg input[type="tel"], body.font-lg textarea { font-size: 24px; min-height: 60px; }
body.font-lg .login-logo h1 { font-size: 32px; }
