/* =========================================================
   家庭保单 · MyPolicy — 框架样式
   设计语言：Apple 风格 / 白底 / 圆角卡片 / 动态玻璃
   ========================================================= */

:root {
  --bg: #f2f3f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #9a9aa0;
  --blue: #0071e3;
  --blue-soft: rgba(0, 113, 227, 0.1);
  --red: #ff3b30;
  --orange: #ff9500;
  --mint: #34c759;
  --purple: #af52de;
  --gray: #8e8e93;

  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-line: rgba(255, 255, 255, 0.75);
  --hairline: rgba(0, 0, 0, 0.07);

  --r-lg: 22px;
  --r-md: 18px;
  --r-sm: 14px;
  --gap: 18px;

  --shadow: 0 10px 30px rgba(17, 20, 45, 0.07), 0 1px 2px rgba(17, 20, 45, 0.04);
  --shadow-hi: 0 16px 44px rgba(17, 20, 45, 0.11);

  --sidebar-w: 248px;
  --ai-w: 336px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  letter-spacing: -0.01em;
}

/* ---------- 动态玻璃背景：缓慢漂移的柔光色块 ---------- */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #f4f5f9 55%, #eef0f6 100%);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}
.blob-1 { width: 46vw; height: 46vw; left: -8vw; top: -10vh; background: #7bb8ff; animation: drift1 26s ease-in-out infinite; }
.blob-2 { width: 38vw; height: 38vw; right: -6vw; top: 4vh; background: #c7a6ff; animation: drift2 32s ease-in-out infinite; }
.blob-3 { width: 40vw; height: 40vw; left: 22vw; bottom: -16vh; background: #8fe3d0; animation: drift3 29s ease-in-out infinite; }
.blob-4 { width: 30vw; height: 30vw; right: 18vw; bottom: -10vh; background: #ffc9a8; opacity: .42; animation: drift4 35s ease-in-out infinite; }

@keyframes drift1 { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(8vw,6vh,0) scale(1.12); } }
@keyframes drift2 { 0%,100% { transform: translate3d(0,0,0) scale(1.05); } 50% { transform: translate3d(-7vw,8vh,0) scale(.92); } }
@keyframes drift3 { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(-9vw,-7vh,0) scale(1.15); } }
@keyframes drift4 { 0%,100% { transform: translate3d(0,0,0) scale(1.1); } 50% { transform: translate3d(6vw,-9vh,0) scale(.95); } }

/* ---------- 玻璃基类 ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow);
}
.glass-soft {
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

/* ---------- 三栏骨架 ---------- */
.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--ai-w);
  gap: var(--gap);
  padding: var(--gap);
}

/* ============ 左栏：菜单栏 ============ */
.sidebar {
  border-radius: var(--r-lg);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 4px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #4facfe, #0071e3);
  color: #fff; font-size: 17px; font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 113, 227, .32);
  flex: none;
}
.brand-mark.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15.5px; letter-spacing: -0.02em; }
.brand-text span { font-size: 11.5px; color: var(--text-3); letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  border: 0; border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit; font-size: 14.5px; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background .22s ease, color .22s ease, transform .22s ease;
}
.nav-item .ico { width: 20px; height: 20px; flex: none; color: var(--text-2); transition: color .22s ease; }
.nav-item:hover { background: rgba(0, 0, 0, .04); }
.nav-item.is-active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 4px 14px rgba(17, 20, 45, .09);
}
.nav-item.is-active .ico { color: var(--blue); }
.nav-label { flex: 1; min-width: 0; }
.nav-badge {
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  background: rgba(0, 0, 0, .05); border-radius: 999px; padding: 2px 8px;
}
.nav-item.is-active .nav-badge { background: var(--blue-soft); color: var(--blue); }
.nav-badge.dot { background: var(--red); color: #fff; padding: 2px 7px; }

.sidebar-footer { margin-top: auto; }
.family-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(255, 255, 255, .8);
}
.avatars { display: flex; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff;
  border: 2px solid #fff; margin-left: -8px;
}
.avatar:first-child { margin-left: 0; }
.avatar.a1 { background: linear-gradient(145deg, #5ac8fa, #007aff); }
.avatar.a2 { background: linear-gradient(145deg, #ff9a9e, #ff5a7a); }
.avatar.a3 { background: linear-gradient(145deg, #a0e57c, #34c759); }
.avatar.a4 { background: linear-gradient(145deg, #c99bff, #af52de); }
.avatar.lg { width: 38px; height: 38px; font-size: 13px; margin-left: 0; border-width: 0; }
.family-chip-text { display: flex; flex-direction: column; min-width: 0; }
.family-chip-text strong { font-size: 12.5px; }
.family-chip-text span { font-size: 11px; color: var(--text-3); }

/* ============ 中栏：详情页 ============ */
.content {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0; gap: var(--gap);
}
.content-header {
  border-radius: var(--r-lg);
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex: none;
}
.content-heading { min-width: 0; }
.content-heading h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.025em; }
.content-heading p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2); }
.header-actions { display: flex; gap: 9px; flex: none; }

.btn {
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  border-radius: 999px; padding: 8px 16px; cursor: pointer;
  border: 1px solid transparent; transition: transform .18s ease, box-shadow .22s ease, background .22s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 5px 16px rgba(0, 113, 227, .3); }
.btn.primary:hover { background: #0077ed; }
.btn.ghost { background: rgba(255, 255, 255, .7); color: var(--text); border-color: rgba(0, 0, 0, .07); }
.btn.ghost:hover { background: #fff; box-shadow: 0 4px 12px rgba(17, 20, 45, .08); }
.btn.sm { padding: 6px 13px; font-size: 12.5px; }

.content-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 2px 4px 8px 2px;
  scrollbar-width: thin;
}
.content-scroll::-webkit-scrollbar { width: 7px; }
.content-scroll::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .14); border-radius: 99px; }
.content-scroll::-webkit-scrollbar-track { background: transparent; }

.view { display: none; flex-direction: column; gap: var(--gap); }
.view.is-active { display: flex; animation: viewIn .3s cubic-bezier(.22, .8, .3, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 卡片 */
.card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { box-shadow: var(--shadow-hi); }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap);
}
.stat { padding: 15px 17px; display: flex; flex-direction: column; gap: 5px; }
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-value { font-size: 23px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.stat-value em { font-size: 12.5px; font-style: normal; font-weight: 500; color: var(--text-2); margin-left: 1px; }
.stat-value.alert { color: var(--red); }
.stat-note { font-size: 11.5px; color: var(--text-3); }

.block { padding: 16px 18px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.block-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.hint { font-size: 11.5px; color: var(--text-3); }
.link-btn {
  border: 0; background: none; font-family: inherit; font-size: 12.5px;
  color: var(--blue); cursor: pointer; padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }

/* 成员列表 */
.member-list, .policy-list, .remind-list, .gap-list, .kv-list, .faq-list { list-style: none; margin: 0; padding: 0; }
.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--hairline);
}
.member-row:first-child { border-top: 0; padding-top: 2px; }
.member-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.member-meta strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-meta span { font-size: 11.5px; color: var(--text-2); }
.tag { font-size: 10.5px; font-weight: 500; color: var(--text-2); background: rgba(0, 0, 0, .05); border-radius: 6px; padding: 1px 6px; margin-left: 5px; }
.member-bar { width: 88px; height: 6px; border-radius: 99px; background: rgba(0, 0, 0, .06); overflow: hidden; flex: none; }
.member-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #4facfe, #0071e3); }

/* 保单清单 */
.policy-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--hairline);
}
.policy-row:first-child { border-top: 0; padding-top: 2px; }
.policy-main { display: flex; flex-direction: column; min-width: 0; }
.policy-main strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.policy-main span { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.policy-side { display: flex; align-items: center; gap: 10px; flex: none; }
.policy-amount { font-size: 13.5px; font-weight: 600; }

.chip {
  font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.chip-blue { background: rgba(0, 113, 227, .1); color: #0071e3; }
.chip-mint { background: rgba(52, 199, 89, .13); color: #248a3d; }
.chip-orange { background: rgba(255, 149, 0, .15); color: #b35f00; }
.chip-purple { background: rgba(175, 82, 222, .13); color: #8944ab; }
.chip-red { background: rgba(255, 59, 48, .12); color: var(--red); }
.chip-gray { background: rgba(0, 0, 0, .055); color: var(--text-2); cursor: pointer; }
.chip-gray.is-on { background: var(--blue-soft); color: var(--blue); }

/* 缺口提示 */
.gap-list { display: grid; gap: 10px; }
.gap-list li { display: flex; gap: 10px; align-items: flex-start; }
.gap-list div { display: flex; flex-direction: column; min-width: 0; }
.gap-list strong { font-size: 13px; font-weight: 600; }
.gap-list span { font-size: 11.5px; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.dot.warn { background: var(--orange); box-shadow: 0 0 0 3px rgba(255, 149, 0, .16); }
.dot.ok { background: var(--mint); box-shadow: 0 0 0 3px rgba(52, 199, 89, .16); }

/* 缴费提醒 */
.remind-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 0; border-top: 1px solid var(--hairline);
}
.remind-row:first-child { border-top: 0; padding-top: 2px; }
.remind-date {
  width: 44px; flex: none; text-align: center;
  background: rgba(255, 255, 255, .8); border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 12px; padding: 5px 0; display: flex; flex-direction: column;
}
.remind-date strong { font-size: 14px; font-weight: 600; line-height: 1.1; }
.remind-date span { font-size: 10.5px; color: var(--text-3); }
.remind-row.overdue .remind-date { background: rgba(255, 59, 48, .1); border-color: rgba(255, 59, 48, .18); }
.remind-row.overdue .remind-date strong { color: var(--red); }
.remind-row.soon .remind-date { background: rgba(255, 149, 0, .12); border-color: rgba(255, 149, 0, .2); }
.remind-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.remind-main strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.remind-main span { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 日历占位 */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { text-align: center; font-size: 11px; color: var(--text-3); padding-bottom: 2px; }
.cal-cell {
  aspect-ratio: 1 / 1; display: grid; place-items: center;
  font-size: 12px; color: var(--text); border-radius: 9px;
  background: rgba(255, 255, 255, .5);
  position: relative;
}
.cal-cell.has-dot::after { content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--orange); }
.cal-cell.active { background: var(--blue); color: #fff; font-weight: 600; }
.cal-cell.active::after { background: #fff; }

.kv-list li {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--hairline); font-size: 13px;
}
.kv-list li:first-child { border-top: 0; padding-top: 2px; }
.kv-list span { color: var(--text-2); font-size: 12.5px; }
.kv-list strong { font-weight: 600; }

/* 说明书 */
.search-block { display: flex; flex-direction: column; gap: 12px; }
.search-box { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .75); border: 1px solid rgba(0, 0, 0, .06); border-radius: 14px; padding: 9px 13px; }
.search-box svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.search-box input { border: 0; background: none; outline: none; font-family: inherit; font-size: 13.5px; color: var(--text); width: 100%; }
.search-box input::placeholder { color: var(--text-3); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); }
.doc { padding: 14px; display: flex; flex-direction: column; gap: 11px; }
.doc-cover {
  height: 92px; border-radius: var(--r-sm); display: grid; place-items: center;
  position: relative; overflow: hidden;
}
.doc-cover span { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: rgba(255, 255, 255, .92); background: rgba(0, 0, 0, .18); padding: 3px 9px; border-radius: 7px; }
.doc-cover.c1 { background: linear-gradient(140deg, #6fb7ff, #0071e3); }
.doc-cover.c2 { background: linear-gradient(140deg, #7fe3c4, #21a179); }
.doc-cover.c3 { background: linear-gradient(140deg, #ffc48a, #ff8a3d); }
.doc-cover.c4 { background: linear-gradient(140deg, #c9a4ff, #8e44d6); }
.doc-body { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.doc-body strong { font-size: 13.5px; font-weight: 600; }
.doc-body span { font-size: 11.5px; color: var(--text-3); }
.doc-body p { margin: 4px 0 0; font-size: 12px; color: var(--text-2); line-height: 1.55; }
.doc .btn { align-self: flex-start; }

.faq-list li { padding: 11px 0; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 3px; }
.faq-list li:first-child { border-top: 0; padding-top: 2px; }
.faq-list strong { font-size: 13px; font-weight: 600; }
.faq-list span { font-size: 12px; color: var(--text-2); line-height: 1.6; }

/* ============ 右栏：AI 助理 ============ */
.ai-panel {
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.ai-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 16px 12px; border-bottom: 1px solid var(--hairline); flex: none;
}
.ai-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ai-title div { display: flex; flex-direction: column; min-width: 0; }
.ai-title strong { font-size: 14px; font-weight: 600; }
.ai-title span { font-size: 11px; color: var(--text-3); }
.ai-orb {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: conic-gradient(from 0deg, #4facfe, #af52de, #34c759, #4facfe);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .8), 0 4px 12px rgba(0, 113, 227, .28);
  animation: spin 9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  border: 1px solid rgba(0, 0, 0, .06); background: rgba(255, 255, 255, .7);
  color: var(--text-2); cursor: pointer; transition: background .2s ease, color .2s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: #fff; color: var(--text); }
.ai-close { display: none; }

.ai-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
}
.ai-scroll::-webkit-scrollbar { width: 6px; }
.ai-scroll::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .13); border-radius: 99px; }

.msg { display: flex; }
.bubble {
  max-width: 92%;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 16px 16px 16px 6px;
  padding: 11px 13px;
  font-size: 13px; line-height: 1.6;
  box-shadow: 0 3px 10px rgba(17, 20, 45, .06);
}
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  background: var(--blue); color: #fff; border-color: var(--blue);
  border-radius: 16px 16px 6px 16px;
}
.ai-suggests { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest {
  font-family: inherit; font-size: 12.5px; cursor: pointer;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, .07);
  background: rgba(255, 255, 255, .72); color: var(--text);
  transition: background .2s ease, transform .18s ease;
}
.suggest:hover { background: #fff; transform: translateY(-1px); }

.ai-input {
  margin: 0 12px 12px; padding: 8px 8px 8px 14px;
  border-radius: 20px;
  display: flex; align-items: flex-end; gap: 8px; flex: none;
}
.ai-input textarea {
  flex: 1; border: 0; background: none; outline: none; resize: none;
  font-family: inherit; font-size: 13.5px; line-height: 1.5; color: var(--text);
  max-height: 110px; padding: 6px 0;
}
.ai-input textarea::placeholder { color: var(--text-3); }
.send-btn {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; border: 0; cursor: pointer;
  background: var(--blue); color: #fff;
  box-shadow: 0 4px 12px rgba(0, 113, 227, .3);
  transition: transform .18s ease, opacity .2s ease;
}
.send-btn svg { width: 17px; height: 17px; }
.send-btn:active { transform: scale(.93); }
.send-btn:disabled { opacity: .4; cursor: default; }

/* ============ 手机端组件（默认隐藏） ============ */
.mobile-topbar { display: none; }
.ai-fab { display: none; }
.ai-backdrop { display: none; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 16px);
  background: rgba(29, 29, 31, .9); color: #fff;
  font-size: 13px; padding: 9px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  z-index: 90; backdrop-filter: blur(10px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   响应式：≤1180px 收起右侧 AI 面板为抽屉；≤820px 变手机布局
   ========================================================= */

/* 中等屏：AI 面板收窄 */
@media (max-width: 1180px) {
  :root { --ai-w: 300px; --sidebar-w: 220px; --gap: 14px; }
}

@media (max-width: 1024px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    padding: 0;
    gap: 0;
  }

  /* 顶部栏 */
  .mobile-topbar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0; height: 52px;
    padding: 0 14px; z-index: 40; border-radius: 0; border-width: 0 0 1px 0;
  }
  .mobile-title { flex: 1; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }

  /* 左菜单 → 底部标签栏 */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    border-radius: 0; border-width: 1px 0 0 0;
    padding: 6px 8px env(safe-area-inset-bottom, 0px);
    flex-direction: row; align-items: stretch; gap: 0;
    z-index: 45; box-shadow: 0 -8px 26px rgba(17, 20, 45, .1);
  }
  .brand, .sidebar-footer { display: none; }
  .nav { flex-direction: row; width: 100%; gap: 4px; }
  .nav-item {
    flex: 1; flex-direction: column; justify-content: center; gap: 3px;
    padding: 7px 4px; font-size: 11px; text-align: center;
  }
  .nav-item .ico { width: 21px; height: 21px; }
  .nav-item.is-active { background: var(--blue-soft); box-shadow: none; }
  .nav-label { flex: none; }
  .nav-badge { display: none; }

  /* 内容区：给顶部栏和底部标签栏留出空间，内容满宽 */
  .content {
    padding: calc(52px + 12px) 12px calc(62px + 20px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
  }
  .content-header { border-radius: var(--r-md); padding: 14px 15px; }
  .content-heading h1 { font-size: 18px; }
  .content-heading p {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.45;
  }
  .content-scroll { padding: 2px 2px 4px; }
  .view { gap: 12px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .two-col { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .doc-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

  /* AI 面板 → 底部抽屉 */
  .ai-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    height: 84dvh; max-height: 84dvh;
    border-radius: 26px 26px 0 0;
    z-index: 70;
    transform: translateY(101%);
    transition: transform .34s cubic-bezier(.22, .9, .28, 1);
    box-shadow: 0 -14px 40px rgba(17, 20, 45, .18);
  }
  body.ai-open .ai-panel { transform: translateY(0); }
  .ai-close { display: grid; }
  .ai-input { margin: 0 12px calc(12px + env(safe-area-inset-bottom, 0px)); }

  .ai-fab {
    display: grid; place-items: center;
    position: fixed; z-index: 50;
    right: 14px; bottom: calc(62px + 16px + env(safe-area-inset-bottom, 0px));
    width: 50px; height: 50px; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .8);
    color: var(--blue); cursor: pointer;
    box-shadow: 0 8px 22px rgba(17, 20, 45, .16);
    transition: transform .22s ease, opacity .22s ease;
  }
  .ai-fab svg { width: 22px; height: 22px; }
  .ai-fab:active { transform: scale(.94); }
  body.ai-open .ai-fab { opacity: 0; pointer-events: none; }

  .ai-backdrop {
    display: block; position: fixed; inset: 0; z-index: 60;
    background: rgba(20, 22, 30, .28);
    backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none; transition: opacity .3s ease;
  }
  body.ai-open .ai-backdrop { opacity: 1; pointer-events: auto; }
}

@media (max-width: 480px) {
  :root { --r-md: 16px; --r-sm: 12px; }
  .content { padding-left: 10px; padding-right: 10px; }
  .stat { padding: 12px 13px; }
  .stat-value { font-size: 20px; }
  .block { padding: 13px 14px; }
  .member-bar { width: 56px; }
  .doc-cover { height: 78px; }
  .header-actions .btn { padding: 7px 12px; font-size: 12.5px; }
  .mobile-topbar { padding: 0 12px; }
}

/* ============ AI 助理：上下文条 / 流式输出 / 极简 Markdown ============ */
.ctx-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 16px; flex: none;
  font-size: 11.5px; color: var(--text-2);
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, .38);
}
.ctx-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--mint); flex: none;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, .16);
}
#aiState.is-busy { color: var(--orange); }
#aiState.is-err { color: var(--red); }

.bubble p { margin: 0 0 7px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble .md-h { font-weight: 600; }
.bubble .md-list { margin: 0 0 8px; padding-left: 18px; }
.bubble .md-list li { margin: 3px 0; line-height: 1.6; }
.bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; background: rgba(0, 0, 0, .06);
  padding: 1px 5px; border-radius: 5px;
}
.msg.user .bubble code { background: rgba(255, 255, 255, .22); }
.bubble .muted { color: var(--text-3); }
.bubble .err { color: var(--red); }

/* 思考中的三点 */
.typing { display: inline-flex; gap: 4px; align-items: center; height: 14px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-3);
  animation: blink 1.2s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 80%, 100% { opacity: .28; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

.caret {
  display: inline-block; width: 6px; height: 14px; margin-left: 2px;
  background: var(--blue); border-radius: 2px; vertical-align: -2px;
  animation: caretBlink 1s steps(2) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }

.cal-cell.empty { background: transparent; }
.cal-cell.overdue-cell::after { background: var(--red); }

/* =========================================================
   保单清单 / 说明书卡片：AI 标记与可点击态
   ========================================================= */
.policy-row.is-click { cursor: pointer; border-radius: 12px; transition: background .2s ease, transform .18s ease; }
.policy-row.is-click:hover { background: rgba(255, 255, 255, .62); }
.policy-row.is-click:active { transform: scale(.995); }
.policy-main strong { display: flex; align-items: center; gap: 7px; min-width: 0; }
.policy-main strong span { flex: none; }
.ai-tag {
  font-size: 10px; font-weight: 600; color: #0a7d4b;
  background: rgba(52, 199, 89, .16); border-radius: 6px; padding: 1px 6px; letter-spacing: .02em;
}
.policy-ai { font-size: 11px !important; color: var(--blue) !important; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.doc-cover { position: relative; }
.cov-tag {
  position: absolute; right: 8px; top: 8px; font-style: normal;
  font-size: 10px; font-weight: 600; color: #fff;
  background: rgba(255, 255, 255, .26); border: 1px solid rgba(255, 255, 255, .5);
  padding: 2px 7px; border-radius: 999px; backdrop-filter: blur(6px);
}
.doc-pts { margin-top: 6px; font-size: 11px; color: var(--blue); opacity: .85; }
.btn.danger { color: var(--red); }

/* =========================================================
   通用弹层（上传解析 / 详情）
   ========================================================= */
.sheet-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.sheet-root[hidden] { display: none; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(20, 22, 30, .3);
  backdrop-filter: blur(3px); opacity: 0; transition: opacity .26s ease;
}
.sheet-root.show .sheet-backdrop { opacity: 1; }

.sheet {
  position: relative; z-index: 1;
  width: min(760px, calc(100vw - 40px));
  max-height: min(84dvh, 880px);
  border-radius: 26px; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 80px rgba(17, 20, 45, .26);
  opacity: 0; transform: translateY(16px) scale(.985);
  transition: transform .32s cubic-bezier(.22, .9, .28, 1), opacity .24s ease;
}
.sheet-root.show .sheet { opacity: 1; transform: none; }
.sheet[data-size="sm"] { width: min(460px, calc(100vw - 40px)); }
.sheet[data-size="lg"] { width: min(880px, calc(100vw - 40px)); }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px 12px; border-bottom: 1px solid var(--hairline); flex: none;
}
.sheet-titles { display: flex; flex-direction: column; min-width: 0; }
.sheet-titles strong { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.sheet-titles span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin;
}
.sheet-body::-webkit-scrollbar { width: 7px; }
.sheet-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .14); border-radius: 99px; }

.sheet-foot {
  flex: none; display: flex; justify-content: flex-end; align-items: center; gap: 9px;
  padding: 12px 18px 14px; border-top: 1px solid var(--hairline);
  background: rgba(255, 255, 255, .48);
}
.sheet-foot .btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.sheet-foot .btn[disabled] { opacity: .5; cursor: default; transform: none; }

/* 拖拽上传区 */
.drop-zone {
  border: 1.5px dashed rgba(0, 113, 227, .35);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .6);
  padding: 30px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; text-align: center; transition: background .2s ease, border-color .2s ease, transform .18s ease;
}
.drop-zone:hover { background: rgba(255, 255, 255, .88); border-color: rgba(0, 113, 227, .55); }
.drop-zone.is-over { background: rgba(0, 113, 227, .07); border-color: var(--blue); transform: scale(1.01); }
.drop-zone svg { width: 30px; height: 30px; color: var(--blue); }
.drop-zone strong { font-size: 14.5px; font-weight: 600; }
.drop-zone span { font-size: 12px; color: var(--text-2); }

.up-note, .up-tip, .miss-note, .notes-box, .src-box, .empty-note {
  font-size: 12.5px; line-height: 1.65; color: var(--text-2);
  background: rgba(255, 255, 255, .62); border: 1px solid rgba(0, 0, 0, .05);
  border-radius: var(--r-sm); padding: 10px 13px;
}
.up-note strong { color: var(--text); }
.up-tip { color: var(--text-3); font-size: 12px; }
.miss-note { background: rgba(255, 149, 0, .09); border-color: rgba(255, 149, 0, .2); }
.miss-note b { color: #b35f00; font-weight: 600; }
.src-box { display: flex; gap: 6px; flex-wrap: wrap; }
.src-box a { color: var(--blue); text-decoration: none; word-break: break-all; }
.src-box a:hover { text-decoration: underline; }
.empty-note { color: var(--text-3); }

/* 解析中 */
.parse-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 10px 18px; text-align: center; }
.parse-state strong { font-size: 14.5px; font-weight: 600; }
.parse-state span { font-size: 12px; color: var(--text-3); }
.parse-orb {
  width: 46px; height: 46px; border-radius: 50%;
  background: conic-gradient(from 0deg, #4facfe, #af52de, #34c759, #4facfe);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .8), 0 8px 20px rgba(0, 113, 227, .26);
  animation: spin 2.4s linear infinite;
}
.parse-bar { width: 100%; max-width: 300px; height: 5px; border-radius: 99px; background: rgba(0, 0, 0, .07); overflow: hidden; }
.parse-bar i { display: block; height: 100%; width: 40%; border-radius: 99px; background: linear-gradient(90deg, #4facfe, #0071e3); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(280%); } }

.err-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 4px; }
.err-box svg { width: 26px; height: 26px; color: var(--red); flex: none; margin-top: 2px; }
.err-box div { display: flex; flex-direction: column; gap: 5px; }
.err-box strong { font-size: 13.5px; line-height: 1.55; }
.err-box span { font-size: 12px; color: var(--text-2); line-height: 1.6; }

/* 结果头部 */
.res-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.res-meta { font-size: 11.5px; color: var(--text-3); word-break: break-all; }

/* 表单网格 */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f span { font-size: 11.5px; color: var(--text-2); }
.f-in {
  font-family: inherit; font-size: 13px; color: var(--text);
  border: 1px solid rgba(0, 0, 0, .09); border-radius: 11px;
  background: rgba(255, 255, 255, .85);
  padding: 8px 11px; outline: none; width: 100%;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.f-in:focus { border-color: rgba(0, 113, 227, .55); box-shadow: 0 0 0 3px rgba(0, 113, 227, .14); }
select.f-in { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, rgba(0,0,0,.35) 50%), linear-gradient(135deg, rgba(0,0,0,.35) 50%, transparent 50%); background-position: calc(100% - 16px) center, calc(100% - 11px) center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

/* 预览区块 */
.doc-preview, .preview-wrap { display: flex; flex-direction: column; gap: 14px; }
.pv-lead { font-size: 13.5px; line-height: 1.65; color: var(--text); }
.pv-sec { display: flex; flex-direction: column; gap: 8px; }
.pv-sec h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.pv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.pv-list li {
  font-size: 12.5px; line-height: 1.6; color: var(--text-2);
  background: rgba(255, 255, 255, .6); border: 1px solid rgba(0, 0, 0, .05);
  border-radius: 11px; padding: 8px 11px;
}
.pv-list.kv li { display: flex; flex-direction: column; gap: 3px; }
.pv-list.kv strong { font-size: 12.5px; color: var(--text); font-weight: 600; }
.pv-list.hi li { background: rgba(0, 113, 227, .06); border-color: rgba(0, 113, 227, .12); color: var(--text); }
.pv-list.ol { counter-reset: step; }
.pv-list.ol li { counter-increment: step; padding-left: 30px; position: relative; }
.pv-list.ol li::before {
  content: counter(step); position: absolute; left: 10px; top: 8px;
  width: 15px; height: 15px; border-radius: 50%; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; background: var(--blue); color: #fff;
}
.notes-box { display: flex; flex-direction: column; gap: 4px; }
.notes-box strong { font-size: 12.5px; color: var(--text); }

.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding-bottom: 4px;
}
.detail-head > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.detail-head strong { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.detail-head span { font-size: 12px; color: var(--text-3); }
.detail-head .chip { flex: none; margin-top: 2px; }

@media (max-width: 720px) {
  .sheet-root { place-items: end center; }
  .sheet {
    width: 100vw; max-height: 92dvh; border-radius: 24px 24px 0 0;
    transform: translateY(100%); opacity: 1;
  }
  .sheet-root.show .sheet { transform: none; }
  .sheet-foot { flex-wrap: wrap; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .sheet-foot .btn { flex: 1; }
  .form-grid, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
  .drop-zone { padding: 24px 14px; }
}

/* 说明书卡片：由保单同步的标记（蓝色，区别于 AI 生成的绿色） */
.cov-tag.cov-sync {
  background: rgba(90, 120, 255, .92);
  color: #fff;
}

/* ============ 成员管理 ============ */
.family-chip { cursor: pointer; transition: background .18s ease, transform .18s ease; text-align: left; font: inherit; color: inherit; }
.family-chip:hover { background: rgba(255, 255, 255, .8); }
.family-chip:active { transform: scale(.98); }

.member-row.is-click { cursor: pointer; border-radius: 10px; transition: background .16s ease; }
.member-row.is-click:hover { background: rgba(0, 0, 0, .035); }

.avatar.a0 { background: linear-gradient(145deg, #c7c7cc, #8e8e93); }

.mem-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mem-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 13px 14px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(255, 255, 255, .85);
}
.mem-top { display: flex; align-items: flex-start; gap: 11px; }
.mem-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.mem-meta strong { font-size: 14px; font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.mem-meta strong .tag { margin-left: 0; }
.mem-meta > span { font-size: 11.5px; color: var(--text-2); }
.mem-cats { font-size: 11px; color: var(--text-3); }
.mem-note { font-size: 11px; color: var(--text-2); background: rgba(0, 0, 0, .04); border-radius: 7px; padding: 4px 7px; }
.mem-acts { display: flex; gap: 7px; flex-wrap: wrap; }

.theme-row { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.theme-pick input { position: absolute; opacity: 0; pointer-events: none; }
.theme-pick .avatar { border: 2px solid transparent; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .08); }
.theme-pick input:checked + .avatar { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0, 122, 255, .18); }
.theme-pick em { font-size: 10.5px; font-style: normal; color: var(--text-3); }

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

/* =========================================================
   系统升级页
   ========================================================= */
.upgrade-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px; border-radius: var(--r-md);
  background: rgba(255, 196, 0, .14);
  border: 1px solid rgba(214, 158, 0, .35);
  color: #6b5410;
}
.upgrade-banner svg { width: 22px; height: 22px; flex: none; color: #b8860b; margin-top: 1px; }
.upgrade-banner strong { display: block; font-size: 13px; margin-bottom: 2px; color: #6b5410; }
.upgrade-banner span { font-size: 12.5px; line-height: 1.6; color: #7a6420; }

.view[data-view="upgrade"] .card { padding: 16px 18px; }
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 12px; }
.card-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.7; margin: 0 0 14px; }
.card-desc b { color: var(--text); font-weight: 600; }

.drop-zone {
  border: 1.5px dashed rgba(0, 113, 227, .35);
  border-radius: var(--r-sm);
  background: rgba(0, 113, 227, .04);
  padding: 26px 18px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--blue); background: rgba(0, 113, 227, .09); }
.up-hint { font-size: 13px; color: var(--text-2); }
.up-hint b { color: var(--blue); }
.up-file {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--hairline); border-radius: 999px;
  padding: 6px 8px 6px 14px;
}
.up-file-name { font-size: 13px; font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-file-size { font-size: 12px; color: var(--text-3); }
.up-remove {
  width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,.06); color: var(--text-2); font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.up-remove:hover { background: rgba(255,59,48,.15); color: var(--red); }

.up-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.up-status { font-size: 12.5px; color: var(--text-2); }
.up-result { margin-top: 14px; font-size: 13px; line-height: 1.7; }
.up-result .ok { color: #1a8a3c; font-weight: 600; }
.up-result .err { color: var(--red); font-weight: 600; }
.up-result .muted { color: var(--text-3); font-weight: 400; }
.up-restart { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.link { border: 0; background: none; padding: 0; font-family: inherit; font-size: 12.5px; color: var(--blue); cursor: pointer; }
.link:hover { text-decoration: underline; }

.backup-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.backup-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 13px; border: 1px solid var(--hairline); border-radius: var(--r-sm); background: rgba(255,255,255,.5);
}
.backup-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.backup-info strong { font-size: 13px; font-weight: 600; word-break: break-all; }
.backup-info span { font-size: 11.5px; color: var(--text-3); }

.btn.ghost.danger { color: var(--red); border-color: rgba(255,59,48,.3); background: rgba(255,59,48,.06); }
.btn.ghost.danger:hover { background: rgba(255,59,48,.12); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }

/* 无障碍：减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
