/* =============================================================
   移动端组件 · 麦穗健康（Apple Health 风格）
   ============================================================= */

/* ============================== 分组容器（iOS 风格） ============================== */
.group {
  background: var(--bg-group);
  border-radius: var(--r-lg);
  margin: 0 var(--edge) var(--sp-4);
  overflow: hidden;
}
.group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px 8px;
}
.group-head h4 { font-size: 15px; font-weight: 650; letter-spacing: -.2px; }
.group-head .gh-ic {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; flex: none;
}
.group-head .gh-ic .ic { width: 15px; height: 15px; }
.group-head .gh-r { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.group-head .more { font-size: 13px; color: var(--tx-3); display: inline-flex; align-items: center; gap: 2px; }
.group-head .more .ic { width: 13px; height: 13px; }
.group-note {
  padding: 0 14px 13px; font-size: 12.5px; color: var(--tx-3); line-height: 1.55;
}

/* 行（列表项） */
.row {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; min-height: 52px;
  border-top: 1px solid var(--line-1);
  transition: background var(--dur-fast) var(--ease);
  width: 100%; text-align: left;
}
.row:first-child { border-top: 0; }
.row:active { background: var(--bg-hover); }
.row-ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
}
.row-ic .ic { width: 17px; height: 17px; }
.row-main { flex: 1; min-width: 0; }
.row-t { font-size: 15px; font-weight: 500; }
.row-d { font-size: 12.5px; color: var(--tx-3); margin-top: 1px; }
.row-r { flex: none; display: flex; align-items: center; gap: 5px; color: var(--tx-3); font-size: 13px; }
.row-r .ic { width: 15px; height: 15px; opacity: .5; }
.row-r .val { color: var(--tx-2); font-family: var(--font-mono); }
.row.tappable .row-r { color: var(--tx-2); }
.row.danger .row-t { color: var(--danger); }

/* ============================== 长辈切换 chip ============================== */
.fm-bar {
  display: flex; gap: var(--sp-2);
  /* 上内距留给未读角标，否则 overflow-x 会把它裁掉 */
  padding: 8px var(--edge) var(--sp-3);
  overflow-x: auto; scrollbar-width: none;
}
.fm-bar::-webkit-scrollbar { display: none; }
.fm-chip {
  display: flex; align-items: center; gap: 8px; flex: none;
  position: relative;
  height: 44px; padding-right: 14px; padding-left: 5px;
  border-radius: var(--r-pill);
  background: var(--bg-group);
  border: 1px solid var(--line-1);
  font-size: 14px; color: var(--tx-2);
  transition: all var(--dur-fast) var(--ease);
}
.fm-chip .av {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 650;
}
.fm-chip.on { background: var(--brand); color: #fff; border-color: transparent; font-weight: 600; }
.fm-chip.on .av { box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
.fm-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; }

/* 未读动态数：长辈头像右上角的小红圈 */
.fm-chip .fm-badge {
  position: absolute; top: -5px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: 0;
  display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg-app, #fff);
  z-index: 2;
}

/* ============================== 安全状态大卡 ============================== */
.hero {
  margin: 0 var(--edge) var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--r-xl);
  background: var(--bg-group);
  display: flex; flex-direction: column; gap: 14px;
}
.hero.safe { background: linear-gradient(180deg, var(--tint-green), var(--bg-group) 58%); }
.hero.alert { background: linear-gradient(180deg, var(--danger-soft), var(--bg-group) 58%); }
.hero-top { display: flex; align-items: center; gap: 12px; }
.hero-av {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 20px; font-weight: 650;
}
.hero-info { flex: 1; min-width: 0; }
.hero-nm { font-size: 19px; font-weight: 700; letter-spacing: -.4px; }
.hero-nm span { font-size: 13px; font-weight: 500; color: var(--tx-2); margin-left: 5px; }
.hero-sb { font-size: 12.5px; color: var(--tx-3); margin-top: 1px; }
.pill-status {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 28px; padding: 0 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 650;
  background: var(--ok-soft); color: var(--ok);
}
.pill-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-status.bad { background: var(--danger-soft); color: var(--danger); }
.hero-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--line-1);
  border-radius: var(--r-md); overflow: hidden;
}
.hero-metrics > div { background: var(--bg-group); padding: 9px 10px; }
.hero-metrics .k { font-size: 11.5px; color: var(--tx-3); }
.hero-metrics .v { font-size: 14.5px; font-weight: 650; font-family: var(--font-mono); margin-top: 1px; }

/* 快捷操作 2×2 */
.quick-actions {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin: 0 var(--edge) var(--sp-4);
}
.qa {
  height: 78px; border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 13.5px; font-weight: 600;
  background: var(--bg-group); color: var(--tx-1);
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast);
}
.qa:active { transform: scale(.97); opacity: .8; }
.qa .ic { width: 24px; height: 24px; }
.qa.primary { background: var(--brand); color: #fff; }
.qa.danger { background: var(--danger-soft); color: var(--danger); }
.qa.green { background: var(--tint-green); color: var(--tint-green-fg); }

/* ============================== 指标卡（Apple Health） ============================== */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 14px 14px; }
.stat {
  background: var(--bg-card); border: 1px solid var(--line-1);
  border-radius: var(--r-md); padding: 12px; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.stat-k { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--tx-3); font-weight: 500; }
.stat-k .ic { width: 14px; height: 14px; }
.stat-v { display: flex; align-items: baseline; gap: 3px; margin-top: 3px; }
.stat-v .readout { font-size: 24px; }
.stat-v u { font-size: 11.5px; color: var(--tx-3); text-decoration: none; }
.stat-d { font-size: 11.5px; color: var(--tx-3); margin-top: 2px; }
.stat.alert { background: var(--danger-soft); border-color: var(--danger-line); }
.stat.alert .readout, .stat.alert .stat-k { color: var(--danger); }
.stat.warn { background: var(--warn-soft); border-color: transparent; }
.stat.warn .readout, .stat.warn .stat-k { color: var(--warn); }
.stat.good .readout { color: var(--ok); }

/* ============================== 用药时间轴 ============================== */
.med-item {
  display: grid; grid-template-columns: 50px 3px 1fr auto;
  gap: 11px; align-items: center;
  padding: 12px 14px; border-top: 1px solid var(--line-1);
}
.med-item:first-child { border-top: 0; }
.med-time { text-align: right; }
.med-time b { display: block; font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.med-time span { font-size: 10.5px; color: var(--tx-3); }
.med-bar { align-self: stretch; border-radius: 3px; background: var(--line-2); }
.med-bar.done { background: var(--ok); }
.med-bar.now { background: var(--brand); }
.med-bar.miss { background: var(--danger); }
.med-main { min-width: 0; }
.med-main b { font-size: 14.5px; font-weight: 600; }
.med-main .dose { font-size: 12px; color: var(--tx-2); margin-left: 5px; }
.med-main .rule { font-size: 11.5px; color: var(--tx-3); margin-top: 2px; }
.med-state { font-size: 12px; font-weight: 650; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.med-state .ic { width: 13px; height: 13px; }
.med-state.done { color: var(--ok); }
.med-state.now { color: var(--brand); }
.med-state.miss { color: var(--danger); }
.med-state.wait { color: var(--tx-3); }

/* 余量预警 */
.stock {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: var(--r-md);
  background: var(--tint-amber); color: var(--tint-amber-fg);
  font-size: 13px; line-height: 1.45;
}
.stock .ic { width: 17px; height: 17px; flex: none; }
.stock b { font-weight: 700; }

/* 服药进度环 */
.med-ring { display: flex; align-items: center; gap: 16px; padding: 4px 14px 14px; }
.med-ring canvas { width: 84px; height: 84px; flex: none; }
.med-ring .mr-txt { flex: 1; min-width: 0; }
.med-ring .mr-big { font-size: 17px; font-weight: 700; }
.med-ring .mr-sub { font-size: 13px; color: var(--tx-2); margin-top: 3px; }

/* ============================== 用药日历 ============================== */
.cal {
  margin: 0 var(--edge) var(--sp-4);
  background: var(--bg-group); border-radius: var(--r-lg); padding: 12px 12px 14px;
}
.cal-head { display: flex; align-items: center; gap: 10px; padding: 0 2px 10px; }
.cal-head b { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.cal-head .ch-b {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: var(--tx-2); background: var(--bg-raise);
}
.cal-head .ch-r { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week { padding-bottom: 4px; }
.cal-week span { text-align: center; font-size: 11px; color: var(--tx-3); padding: 4px 0; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: var(--r-sm); font-size: 13.5px; font-family: var(--font-mono);
  color: var(--tx-1); transition: background var(--dur-fast) var(--ease);
}
.cal-day.out { color: var(--tx-3); opacity: .45; }
.cal-day.future { color: var(--tx-3); }
.cal-day .cd-dot {
  width: 5px; height: 5px; border-radius: 50%; background: transparent;
}
.cal-day.done .cd-dot { background: var(--ok); }
.cal-day.miss .cd-dot { background: var(--danger); }
.cal-day.skip .cd-dot { background: transparent; box-shadow: inset 0 0 0 1px var(--tx-3); }
.cal-day.today { font-weight: 700; }
.cal-day.today::before {
  content: ""; position: absolute; inset: 2px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
}
.cal-day.on { background: var(--brand); color: #fff; font-weight: 700; }
.cal-day.on .cd-dot { background: #fff; }
.cal-day.on::before { border-color: transparent; }
.cal-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 12px 2px 0; margin-top: 10px; border-top: 1px solid var(--line-1);
  font-size: 11.5px; color: var(--tx-3);
}
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 6px; height: 6px; border-radius: 50%; }
.cal-stat {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 2px 12px;
}
.cal-stat div { background: var(--bg-raise); border-radius: var(--r-sm); padding: 8px; text-align: center; }
.cal-stat .v { font-family: var(--font-mono); font-size: 16px; font-weight: 700; }
.cal-stat .k { font-size: 10.5px; color: var(--tx-3); margin-top: 1px; }

/* ============================== 家族树 ============================== */
.tree-wrap { padding: 8px var(--edge) var(--sp-4); }
.tree-root {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  margin: 0 auto; padding: 14px 20px; width: fit-content;
  border-radius: var(--r-xl); background: var(--brand-soft);
  border: 1px solid var(--brand-line);
}
.tree-root .tr-av {
  width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 700;
}
.tree-root .tr-nm { font-size: 17px; font-weight: 700; }
.tree-root .tr-rl { font-size: 12px; color: var(--tx-2); margin-top: -3px; }
.tree-link { width: 1px; height: 20px; background: var(--line-2); margin: 0 auto; }
.tree-branch { display: flex; position: relative; }
.tree-branch::before {
  content: ""; position: absolute; top: 0; height: 1px; background: var(--line-2);
  left: calc(100% / (2 * var(--n))); right: calc(100% / (2 * var(--n)));
}
.tree-child {
  flex: 1; min-width: 0; position: relative; padding-top: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.tree-child::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 20px; background: var(--line-2);
}
.tree-child .tc-av {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 17px; font-weight: 650;
  border: 2px solid var(--bg-app);
}
.tree-child .tc-nm { font-size: 13px; font-weight: 650; }
.tree-child .tc-rl { font-size: 11.5px; color: var(--tx-3); }
.tree-child .tc-badge {
  position: absolute; top: 14px; right: calc(50% - 30px);
  width: 9px; height: 9px; border-radius: 50%; background: var(--ok);
  border: 1.5px solid var(--bg-app);
}
.tree-child.inactive .tc-badge { background: var(--line-2); }
.tree-grand { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; padding-top: 4px; }
.tree-gc { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 56px; }
.tree-gc .tg-av {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 650;
  border: 2px solid var(--bg-app);
}
.tree-gc .tg-nm { font-size: 11.5px; font-weight: 600; }
.tree-gc .tg-rl { font-size: 10.5px; color: var(--tx-3); }

/* ============================== 待办 ============================== */
.todo-item { display: flex; gap: 11px; padding: 12px 14px; border-top: 1px solid var(--line-1); }
.todo-item:first-child { border-top: 0; }
.todo-ic { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; }
.todo-ic .ic { width: 16px; height: 16px; }
.todo-txt { flex: 1; min-width: 0; }
.todo-title { font-size: 14.5px; font-weight: 600; }
.todo-desc { font-size: 12.5px; color: var(--tx-2); margin-top: 2px; line-height: 1.45; }
.todo-time { font-size: 11.5px; color: var(--tx-3); font-family: var(--font-mono); flex: none; }

/* ============================== 预警（横幅 + 卡） ============================== */
.alarm-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 0 var(--edge) var(--sp-3); padding: 11px 13px;
  border-radius: var(--r-md); background: var(--danger-soft);
  border: 1px solid var(--danger-line); color: var(--tx-1);
  font-size: 13.5px; font-weight: 600;
}
.alarm-banner .ic { color: var(--danger); flex: none; }
.alarm-banner .ab-txt { flex: 1; min-width: 0; }
.alarm-banner .ab-txt span { display: block; font-weight: 500; font-size: 12px; color: var(--tx-2); margin-top: 1px; }
.alarm-banner:active { opacity: .7; }
/* 守护页/预警中心入口：整条横幅水平居中 */
.alarm-banner.ab-center {
  justify-content: center; text-align: center;
  margin: 2px var(--edge) 8px; padding: 13px 14px;
}
.alarm-banner.ab-center .ab-txt { flex: 0 1 auto; min-width: 0; }

.alarm-list { padding: 0 var(--edge); display: flex; flex-direction: column; gap: 10px; }
.alarm {
  background: var(--bg-group); border: 1px solid var(--line-1);
  border-radius: var(--r-lg); overflow: hidden;
  transition: opacity var(--dur-fast);
}
.alarm.p0 { border-color: var(--danger-line); }
.alarm:active { opacity: .7; }
.alarm.done { opacity: .58; }
.a-head { display: flex; align-items: center; gap: 9px; padding: 13px 14px 9px; }
.a-ic { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; }
.a-ic .ic { width: 18px; height: 18px; }
.a-t { flex: 1; min-width: 0; }
.a-type { font-size: 15px; font-weight: 650; letter-spacing: -.2px; display: flex; align-items: center; gap: 6px; }
.a-meta { font-size: 12px; color: var(--tx-3); margin-top: 2px; }
.a-badges { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.a-body { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 7px; }
.a-ev { display: flex; gap: 8px; font-size: 13px; }
.a-ev .k { color: var(--tx-3); flex: none; min-width: 62px; }
.a-ev .v { color: var(--tx-1); flex: 1; }
.a-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--line-1); background: var(--bg-raise);
}
.a-foot .sla { flex: 1; }
.a-sla-top { display: flex; align-items: baseline; gap: 5px; font-size: 11.5px; color: var(--tx-3); }
.a-sla-top b { font-family: var(--font-mono); font-size: 13px; color: var(--tx-1); }
.a-sla-bar { height: 3px; border-radius: 3px; background: var(--line-2); margin-top: 4px; overflow: hidden; }
.a-sla-bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.sla-warn .a-sla-top b { color: var(--warn); } .sla-warn .a-sla-bar i { background: var(--warn); }
.sla-over .a-sla-top b { color: var(--danger); } .sla-over .a-sla-bar i { background: var(--danger); }

.kw-lv { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-xs); }
.kw-lv.l1 { background: var(--danger-soft); color: var(--danger); }
.kw-lv.l2 { background: var(--warn-soft); color: var(--warn); }
.kw-lv.l3 { background: var(--bg-sunken); color: var(--tx-3); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: 11.5px; font-weight: 650;
  background: var(--bg-raise); color: var(--tx-2);
}
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.blue { background: var(--tint-blue); color: var(--tint-blue-fg); }
.badge.green { background: var(--tint-green); color: var(--tint-green-fg); }
.badge.purple { background: var(--tint-purple); color: var(--tint-purple-fg); }
.badge.teal { background: var(--tint-teal); color: var(--tint-teal-fg); }

/* ============================== 按钮 ============================== */
.btn {
  height: 44px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--r-sm); font-size: 15px; font-weight: 600;
  background: var(--bg-raise); color: var(--tx-1);
  transition: opacity var(--dur-fast), background var(--dur-fast);
  white-space: nowrap;
}
.btn:active { opacity: .65; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: var(--r-xs); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--tx-2); }
.btn-outline { background: transparent; border: 1px solid var(--line-2); }
.btn-sos { background: var(--danger); color: #fff; animation: pulse-ring 2s var(--ease) infinite; }

/* ============================== 分段控件 / chips ============================== */
.seg {
  display: flex; gap: 3px; padding: 3px;
  background: var(--bg-sunken); border-radius: var(--r-sm);
  margin: 0 var(--edge) var(--sp-4);
}
.seg button {
  flex: 1; height: 32px; border-radius: 7px;
  font-size: 13.5px; color: var(--tx-2); font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  transition: all var(--dur-fast) var(--ease);
}
.seg button.on { background: var(--bg-group); color: var(--tx-1); font-weight: 650; box-shadow: var(--sh-1); }
.seg .cnt { font-family: var(--font-mono); font-size: 11px; opacity: .7; }

/* 小红书式顶部话题条 */
.topic-bar {
  display: flex; gap: 7px; padding: 0 var(--edge) var(--sp-3);
  overflow-x: auto; scrollbar-width: none;
}
.topic-bar::-webkit-scrollbar { display: none; }
.topic {
  flex: none; height: 30px; padding: 0 13px; border-radius: var(--r-pill);
  background: var(--bg-group); border: 1px solid var(--line-1);
  font-size: 13px; color: var(--tx-2); display: inline-flex; align-items: center; gap: 5px;
}
.topic.on { background: var(--brand); border-color: transparent; color: #fff; font-weight: 600; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 14px 13px; }
.chip {
  height: 30px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--bg-raise); color: var(--tx-2); font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 5px;
}

/* ============================== 提示条 ============================== */
.notice {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--tint-blue); font-size: 13.5px; line-height: 1.55;
}
.notice .ic { width: 17px; height: 17px; flex: none; margin-top: 2px; color: var(--tint-blue-fg); }
.notice.warn { background: var(--tint-amber); }
.notice.warn .ic { color: var(--tint-amber-fg); }
.notice.danger { background: var(--danger-soft); }
.notice.danger .ic { color: var(--danger); }
.notice.green { background: var(--tint-green); }
.notice.green .ic { color: var(--tint-green-fg); }
.notice b { font-weight: 700; }
.notice-wrap { padding: 0 var(--edge) var(--sp-4); }

/* ============================== 对讲面板 ============================== */
.intercom {
  margin: 0 var(--edge) var(--sp-4);
  background: var(--bg-group); border-radius: var(--r-lg); overflow: hidden;
}
.ic-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; border-bottom: 1px solid var(--line-1);
  font-size: 14px; font-weight: 650;
}
.ic-head .r { margin-left: auto; }
.ic-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ic-timer { display: flex; align-items: baseline; gap: 9px; }
.ic-timer .readout { font-size: 24px; }
.ic-wave { height: 54px; border-radius: var(--r-sm); background: var(--bg-sunken); }
.ic-ctrls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ic-btn {
  height: 56px; border-radius: var(--r-md); background: var(--bg-raise);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; color: var(--tx-2);
  transition: all var(--dur-fast) var(--ease);
}
.ic-btn:active { opacity: .7; }
.ic-btn .ic { width: 21px; height: 21px; }
.ic-btn.talk.on { background: var(--brand); color: #fff; }
.ic-btn.mute.on { background: var(--warn-soft); color: var(--warn); }
.ic-btn.sos { background: var(--danger-soft); color: var(--danger); }
.ic-log {
  border-radius: var(--r-sm); background: var(--bg-sunken); padding: 11px;
  display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; max-height: 150px; overflow: auto;
}
.ic-log .l { display: flex; gap: 7px; }
.ic-log .w { flex: none; font-size: 11px; color: var(--tx-3); font-family: var(--font-mono); min-width: 54px; padding-top: 2px; }
.ic-log .ai .t { color: var(--audio); }
.ic-log .sys .t { color: var(--tx-3); }

.clip {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: var(--r-md);
  background: var(--audio-soft); border: 1px solid rgba(122, 92, 240, .2);
}
.clip .play { width: 34px; height: 34px; border-radius: 50%; background: var(--audio); color: #fff; display: grid; place-items: center; flex: none; }
.clip .ct { flex: 1; min-width: 0; }
.clip .ct b { font-size: 13.5px; font-weight: 650; display: block; }
.clip .ct span { font-size: 12px; color: var(--tx-2); }
.clip .dur { font-family: var(--font-mono); font-size: 12px; color: var(--tx-2); }

/* ============================== 开关 / 滑块 ============================== */
.switch { display: inline-flex; align-items: center; flex: none; }
.switch input { display: none; }
.switch .track {
  width: 51px; height: 31px; border-radius: var(--r-pill); background: var(--line-2);
  position: relative; transition: background var(--dur) var(--ease); display: block;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff; box-shadow: var(--sh-2);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(20px); }

.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  border-radius: 4px; background: var(--line-2); outline: none; margin: 8px 0;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: var(--sh-2); border: .5px solid var(--line-1);
}

/* ============================== 家族圈瀑布流（小红书式） ============================== */
.feed { columns: 2; column-gap: 10px; padding: 0 var(--edge); }
.feed-card {
  break-inside: avoid; margin-bottom: 10px;
  background: var(--bg-group); border: 1px solid var(--line-1);
  border-radius: var(--r-md); overflow: hidden;
  transition: transform var(--dur-fast) var(--ease);
}
/* 未读动态：右上角小红点 */
.feed-card { position: relative; }
.feed-card .feed-unread {
  position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 2px var(--bg-group); z-index: 3;
}
.feed-card:active { transform: scale(.98); }
.feed-media {
  display: grid; place-items: center; position: relative;
  width: 100%;
}

.feed-media .fm-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.feed-media .ic { width: 38px; height: 38px; opacity: .5; }
.feed-media .dur {
  position: absolute; right: 8px; bottom: 8px;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: rgba(0, 0, 0, .48); color: #fff; font-size: 10.5px; font-family: var(--font-mono);
  display: inline-flex; align-items: center; gap: 3px;
}
.feed-media .tag {
  position: absolute; left: 8px; top: 8px;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .82); color: #5f6673; font-size: 10.5px; font-weight: 600;
}
.feed-body { padding: 9px 10px 10px; }
.feed-body .txt {
  font-size: 13px; line-height: 1.5; color: var(--tx-1);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.feed-meta { display: flex; align-items: center; gap: 5px; margin-top: 8px; }
.feed-meta .av {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 10px; font-weight: 650; flex: none;
}
.feed-meta .nm { font-size: 11.5px; color: var(--tx-3); font-weight: 500; }
.feed-meta .lk {
  margin-left: auto; display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; color: var(--tx-3); font-family: var(--font-mono);
}
.feed-meta .lk.on { color: var(--danger); }
.feed-meta .lk .ic { width: 13px; height: 13px; }
.feed-who {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; padding: 1px 7px; border-radius: var(--r-xs);
  background: var(--bg-raise); font-size: 10.5px; color: var(--tx-2);
}

/* ============================== 成员列表（家族树辅助） ============================== */
.member { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-1); }
.member:first-child { border-top: 0; }
.member .av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 650; flex: none; }
.member .nm { font-size: 15px; font-weight: 650; }
.member .rl { font-size: 12px; color: var(--tx-3); margin-top: 1px; }
.member .r { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.member.root { background: var(--brand-soft); }

/* ============================== 设备 ============================== */
.dev-scroll { display: flex; gap: 10px; padding: 0 var(--edge) var(--sp-4); overflow-x: auto; scrollbar-width: none; }
.dev-scroll::-webkit-scrollbar { display: none; }
.dev-card {
  flex: none; width: 208px; padding: 13px;
  background: var(--bg-group); border: 1px solid var(--line-1); border-radius: var(--r-lg);
  display: flex; flex-direction: column; gap: 9px;
}
.dev-card.off { opacity: .6; border-style: dashed; }
.dev-top { display: flex; align-items: center; gap: 9px; }
.dev-top .ic-b { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.dev-top .ic-b .ic { width: 16px; height: 16px; }
.dev-top b { font-size: 12.5px; font-family: var(--font-mono); display: block; }
.dev-top .t-cap { font-size: 11.5px; }
.dev-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.dev-metrics div { background: var(--bg-raise); border-radius: var(--r-xs); padding: 6px 4px; text-align: center; }
.dev-metrics .v { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.dev-metrics .k { font-size: 10px; color: var(--tx-3); }
.sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.sig i { width: 3px; border-radius: 1px; background: var(--line-2); }
.sig i:nth-child(1) { height: 4px; } .sig i:nth-child(2) { height: 7px; }
.sig i:nth-child(3) { height: 10px; } .sig i:nth-child(4) { height: 13px; }
.sig.on i { background: var(--ok); } .sig.mid i { background: var(--warn); } .sig.low i { background: var(--danger); }
.sig i.off { background: var(--line-2) !important; }

.light-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-1); }
.light-row:first-child { border-top: 0; }
.light-bulb { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.light-bulb .ic { width: 21px; height: 21px; }
.slider-row { padding: 4px 14px 14px; }
.slider-row .sr-k { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 2px; }
.slider-row .sr-k b { font-family: var(--font-mono); font-weight: 600; }

/* ============================== 睡眠 ============================== */
.chart-card {
  margin: 0 var(--edge) var(--sp-4); padding: 14px;
  background: var(--bg-group); border-radius: var(--r-lg);
}
.chart-card h4 { font-size: 15px; font-weight: 650; }
.chart-card .cap { font-size: 12.5px; color: var(--tx-3); margin-top: 2px; }
.sleep-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--tx-2); }
.sleep-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sleep-legend i { width: 10px; height: 10px; border-radius: 3px; }
.def-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 12px; }
.def { padding: 10px 12px; background: var(--bg-raise); border-radius: var(--r-sm); }
.def .k { font-size: 11.5px; color: var(--tx-3); }
.def .v { font-size: 15px; font-weight: 650; margin-top: 1px; font-family: var(--font-mono); }
.def.alert { background: var(--danger-soft); }
.def.alert .v { color: var(--danger); }

.apnea-row { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-top: 1px solid var(--line-1); }
.apnea-row:first-child { border-top: 0; }
.apnea-row .t { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.apnea-row .d { flex: 1; font-size: 13px; color: var(--tx-2); }
.apnea-row .d b { color: var(--danger); font-family: var(--font-mono); font-size: 15px; }

/* ============================== 时间轴 ============================== */
.timeline { padding: 12px 14px 14px; }
.tl-item { position: relative; padding-left: 20px; padding-bottom: 14px; }
.tl-item::before {
  content: ""; position: absolute; left: 2px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg-group); border: 2px solid var(--line-2);
}
.tl-item::after {
  content: ""; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 1px; background: var(--line-2);
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::after { display: none; }
.tl-item.now::before { background: var(--brand); border-color: var(--brand); }
.tl-item.done::before { background: var(--ok); border-color: var(--ok); }
.tl-item.bad::before { background: var(--danger); border-color: var(--danger); }
.tl-t { font-size: 11.5px; color: var(--tx-3); font-family: var(--font-mono); }
.tl-c { font-size: 13.5px; line-height: 1.5; margin-top: 1px; }
.tl-c b { font-weight: 650; }

/* ============================== 空态 ============================== */
.empty {
  padding: 48px 24px; text-align: center; color: var(--tx-3);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty .ic { width: 40px; height: 40px; opacity: .4; }
.empty b { font-size: 15px; color: var(--tx-2); font-weight: 600; }
.empty span { font-size: 13px; }

.sc-title {
  display: flex; align-items: center; gap: 6px;
  padding: 4px var(--edge) 8px;
  font-size: 13px; font-weight: 650; color: var(--tx-3);
}
.sc-title .ic { width: 14px; height: 14px; }

/* ============================== 实时通讯（微信式） ============================== */
.chat-search {
  margin: 0 var(--edge) var(--sp-3);
  height: 36px; border-radius: var(--r-sm);
  background: var(--bg-raise);
  display: flex; align-items: center; gap: 7px; padding: 0 12px;
  color: var(--tx-3); font-size: 14px;
}
.chat-search .ic { width: 16px; height: 16px; }

.chat-list { padding: 0 var(--edge); }
.chat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line-1);
  width: 100%; text-align: left;
}
.chat-item:first-child { border-top: 0; }
.chat-item:active { opacity: .7; }
.ci-av {
  width: 48px; height: 48px; border-radius: var(--r-md); flex: none; position: relative;
  display: grid; place-items: center; color: #fff; font-size: 17px; font-weight: 650;
}
.ci-av.group { border-radius: var(--r-md); }
.ci-av .unread {
  position: absolute; top: -5px; right: -5px;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  font-family: var(--font-mono); display: grid; place-items: center;
  border: 1.5px solid var(--bg-app);
}
.ci-av .live {
  position: absolute; bottom: -2px; right: -2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--bg-app);
}
.ci-main { flex: 1; min-width: 0; }
.ci-top { display: flex; align-items: baseline; gap: 8px; }
.ci-nm { font-size: 16px; font-weight: 500; flex: 1; min-width: 0; }
.ci-nm .tag {
  margin-left: 6px; font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: var(--r-xs);
  background: var(--bg-raise); color: var(--tx-3);
}
.ci-nm .tag.dev { background: var(--tint-teal); color: var(--tint-teal-fg); }
.ci-nm .tag.grp { background: var(--tint-blue); color: var(--tint-blue-fg); }
.ci-tm { font-size: 11.5px; color: var(--tx-3); flex: none; font-family: var(--font-mono); }
.ci-sub {
  font-size: 13px; color: var(--tx-3); margin-top: 3px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ci-pin { width: 14px; height: 14px; color: var(--tx-3); opacity: .5; flex: none; }

/* 聊天页（从右滑入） */
.sheet.push {
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease);
}
.sheet.push.show { transform: none; }
.chat-wrap {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.chat-msgs {
  flex: 1; min-height: 0; overflow: auto; padding: 12px var(--edge) 8px;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.msg-sys {
  align-self: center; max-width: 82%; text-align: center;
  font-size: 11.5px; color: var(--tx-3); padding: 4px 10px;
  background: var(--bg-raise); border-radius: var(--r-xs); line-height: 1.45;
}
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.msg.me { flex-direction: row-reverse; }
.msg .av {
  width: 32px; height: 32px; border-radius: var(--r-xs); flex: none;
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 650;
}
.msg .who { font-size: 11px; color: var(--tx-3); margin-bottom: 3px; }
.msg.me .who { text-align: right; }
.bubble {
  max-width: 72%; padding: 9px 12px; border-radius: var(--r-md);
  background: var(--bg-group); font-size: 14.5px; line-height: 1.48;
  position: relative; word-break: break-word;
  border-bottom-left-radius: 4px;
}
.msg.me .bubble {
  background: var(--brand); color: #fff;
  border-bottom-left-radius: var(--r-md); border-bottom-right-radius: 4px;
}
.bubble.voice { display: flex; align-items: center; gap: 9px; cursor: pointer; min-width: 96px; }
.bubble.voice .wave { display: flex; align-items: center; gap: 2px; height: 18px; flex: 1; }
.bubble.voice .wave i {
  width: 2px; border-radius: 2px; background: currentColor; opacity: .55;
}
.bubble.voice .dur { font-size: 11.5px; opacity: .8; font-family: var(--font-mono); flex: none; }
.bubble.voice .play { width: 15px; height: 15px; flex: none; opacity: .85; }
.msg.me .bubble.voice { flex-direction: row-reverse; }

/* 告警卡片消息 */
.bubble.alert {
  background: var(--bg-group); border: 1px solid var(--line-2);
  padding: 11px 12px; max-width: 78%; border-radius: var(--r-md);
}
.bubble.alert .al-t { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 650; }
.bubble.alert .al-t .ic { width: 15px; height: 15px; }
.bubble.alert .al-d { font-size: 12.5px; color: var(--tx-2); margin-top: 5px; line-height: 1.5; }
.bubble.alert .al-a {
  margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-1);
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; color: var(--brand);
}

/* 输入栏 */
.chat-input {
  flex: none; display: flex; align-items: flex-end; gap: 9px;
  padding: 8px var(--edge) calc(8px + var(--safe-b));
  background: var(--bg-group); border-top: 1px solid var(--line-1);
}
.chat-input .ci-btn {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: var(--tx-2); background: var(--bg-raise);
}
.chat-input .ci-box {
  flex: 1; min-height: 34px; border-radius: var(--r-sm);
  background: var(--bg-raise); padding: 7px 12px;
  font-size: 14.5px; color: var(--tx-3);
  display: flex; align-items: center;
}
.chat-input .ci-send {
  height: 34px; padding: 0 14px; border-radius: var(--r-sm); flex: none;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center;
}

/* 会话内顶部设备条 */
.chat-dev {
  display: flex; align-items: center; gap: 8px;
  padding: 8px var(--edge); margin: 0 0 4px;
  background: var(--tint-teal); color: var(--tint-teal-fg);
  font-size: 12.5px; font-weight: 600;
}
.chat-dev .ic { width: 15px; height: 15px; }
.chat-dev .cd-r { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; }

/* ============================ 实时状态（长辈档案） ============================ */
.stat.tap {
  border: 0; background: none; text-align: left; cursor: pointer; font: inherit;
  border-radius: var(--r-sm, 12px); padding: 12px;
  margin: -12px; transition: background 160ms var(--ease);
}
.stat.tap:active { background: var(--bg-sunken, rgba(120,130,150,.12)); }
.stat.tap .stat-d { color: var(--brand, #0a84ff); }
.live-flag {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px 12px; font-size: 12px; color: var(--tx-3, #979cab);
}
.live-flag .live, .ci-av .live {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok, #2fbf71);
  display: inline-block; animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 191, 113, .45); }
  50% { box-shadow: 0 0 0 5px rgba(47, 191, 113, 0); }
}
@keyframes readoutTick { 0% { color: var(--brand); transform: scale(1.12); } 100% { transform: scale(1); } }
.readout.tick { animation: readoutTick 480ms var(--ease); display: inline-block; }

/* ============================ 发布动态 ============================ */
#cmpText {
  width: 100%; margin-top: 14px; padding: 12px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md, 14px);
  background: var(--bg-group); color: var(--tx-1);
  font: inherit; font-size: 15px; line-height: 1.6; resize: none; outline: none;
  transition: border-color 160ms var(--ease);
}
#cmpText:focus { border-color: var(--brand); }

/* ============================ 助眠音频 ============================ */
.slp-row { display: flex; align-items: center; gap: 12px; padding: 12px 2px 4px; }
.slp-left {
  flex: none; min-width: 96px; text-align: center;
  font-size: 13.5px; font-weight: 650; color: var(--tx-2);
  font-variant-numeric: tabular-nums;
  background: var(--bg-sunken, rgba(120,130,150,.12));
  border-radius: 10px; padding: 10px 8px;
}

/* ============================ 长辈栏红点图例 ============================ */
.fm-legend {
  display: flex; align-items: center; gap: 6px;
  padding: 0 2px 2px; font-size: 11.5px; color: var(--tx-3, #979cab);
}
.fm-legend .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger, #e0343e); flex: none;
}

/* ============================ 实时监护页 ============================ */
.lv-person {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 14px; border: 0; background: none; cursor: pointer;
  font: inherit; text-align: left; border-bottom: 1px solid var(--line-1);
}
.lv-person:last-child { border-bottom: 0; }
.lv-person:active { background: var(--bg-sunken); }
.lv-person > .av {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 650;
}
.lv-person .lv-main { flex: 1; min-width: 0; }
.lv-person .lv-top { display: flex; align-items: center; gap: 8px; }
.lv-person .lv-name { font-size: 15.5px; font-weight: 700; color: var(--tx-1); }
.lv-person .lv-name .lv-realname { font-style: normal; font-weight: 400; font-size: 12.5px; color: var(--tx-3); margin-left: 6px; }
.lv-person .lv-top .badge { margin-left: auto; }
.lv-person .lv-meta {
  display: flex; flex-wrap: wrap; gap: 3px 14px; margin-top: 6px;
  font-size: 12.5px; color: var(--tx-2);
}
/* 每个信息块整体换行，绝不把「雷达 3 台」「1 台已接入」拆开 */
.lv-person .lv-meta > span {
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap; flex: none;
}
.lv-person .lv-on { color: var(--ok); white-space: nowrap; }
.lv-person .lv-rooms { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.lv-person .lv-rooms i {
  font-style: normal; font-size: 11px; padding: 2px 8px; border-radius: 8px;
  background: var(--bg-sunken); color: var(--tx-3);
}
.lv-person .lv-rooms i.real { background: rgba(47,191,113,.15); color: var(--ok); font-weight: 600; }
.lv-person > .ic { color: var(--tx-3); flex: none; }

/* 房间选择（雷达分页面顶部） */
.radar-rooms { display: flex; gap: 8px; padding: 12px var(--edge) 0; overflow-x: auto; }
.radar-rooms .topic { position: relative; white-space: nowrap; }
.radar-rooms .rd-real {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); margin-left: 5px; vertical-align: 1px;
}

/* 实时参数卡（布局参照电脑端 bh.html 的五卡） */
.rparams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 12px 14px; }
.pcard {
  background: var(--bg-sunken); border-radius: var(--r-sm); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px; min-height: 92px;
}
.pcard.empty { opacity: .55; }
.pcard .name { font-size: 12px; color: var(--tx-3); }
.pcard .body { flex: 1; display: flex; align-items: center; }
.pcard .big { font-size: 22px; font-weight: 750; color: var(--tx-1); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pcard .big .unit { font-size: 12px; font-weight: 500; color: var(--tx-3); margin-left: 3px; }
.pcard .big.ok { color: var(--tx-1); }
.pcard .big.warn { color: var(--warn); }
.pcard .big.idle { color: var(--tx-3); }
.pcard .big.nosig { font-size: 15px; color: var(--tx-3); font-weight: 600; }
.pcard .sub { font-size: 11px; color: var(--tx-3); }
.pcard .pose-v { font-size: 19px; font-weight: 750; color: var(--tx-1); }
.pcard .pose-v.fall { color: var(--danger); }
.pcard .qrow { display: flex; align-items: center; gap: 10px; }
.qring {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c, var(--line-strong)) calc(var(--p, 0) * 1%), var(--bg-raise) 0);
  display: grid; place-items: center; position: relative;
}
.qring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg-group); }
.qring b { position: relative; font-size: 13px; color: var(--tx-1); font-variant-numeric: tabular-nums; }
.qtiers { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--tx-3); }
.qtiers span { display: inline-flex; align-items: center; gap: 5px; }
.qtiers span i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--ok)); }
.qtiers span.act { color: var(--tx-1); font-weight: 600; }

/* 波形行 */
.wave-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.wave-row .wave-tag { flex: none; font-size: 11.5px; font-weight: 600; width: 28px; }
.wave-row canvas { flex: 1; background: var(--bg-sunken); border-radius: 8px; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--tx-3); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 3px; border-radius: 2px; }

/* 实时监护页：人物卡独占一行 */
.lv-person { display: flex; width: 100%; }

/* ============ 雷达分页面：24 小时姿态时间线 ============ */
.pose-tl { padding: 2px 14px 4px; }
.tl-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.tl-k { flex: none; width: 54px; font-size: 11.5px; color: var(--tx-3); text-align: right; }
.tl-track {
  position: relative; flex: 1; height: 14px; border-radius: 7px;
  background: var(--bg-sunken); overflow: hidden;
}
.tl-seg {
  position: absolute; top: 0; bottom: 0; border-radius: 4px; cursor: pointer;
  transition: filter .15s ease;
}
.tl-seg:hover { filter: brightness(1.25); }
.tl-seg.sel { outline: 1.5px solid var(--tx-1); outline-offset: -1.5px; }
.tl-seg.k-stand { background: #f0a63c; }
.tl-seg.k-sit   { background: #56b8f5; }
.tl-seg.k-lie   { background: #0a84ff; }
.tl-seg.k-edge  { background: #7a5cf0; }
.tl-seg.k-none  { background: var(--line-strong); }
.tl-seg.k-fall {
  background: var(--danger);
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.55) inset, 0 0 8px rgba(255,60,80,.85);
  animation: tlfall 1.1s ease-in-out infinite;
  display: grid; place-items: center; color: #fff; font-style: normal;
  font-size: 11px; font-weight: 800; line-height: 1; min-width: 12px;
}
@keyframes tlfall { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.tl-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--tx-3); padding: 2px 0 0 62px; }

/* 时间轴手势：纵向滚动交给浏览器，横向拖动/双指缩放交给 JS */
.pose-tl { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
#wvH, #wvB { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.tl-zoom { font-size: 10.5px; color: var(--tx-3); padding: 2px 0 0 62px; }

/* 睡眠监测报告（方案D）：区间微调 / 小睡开关 / 建议条目 */
.sr-adj { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; color: var(--tx-2); }
.sr-adj span { width: 62px; flex: none; color: var(--tx-3); font-size: 12px; }
.sr-adj b { flex: 1; text-align: center; font-size: 15px; color: var(--tx-1); font-variant-numeric: tabular-nums; }
.sr-btn {
  flex: none; width: 46px; height: 30px; border-radius: 8px; border: 1.5px solid var(--line-strong);
  background: var(--bg-raise); color: var(--tx-2); font-size: 12.5px; font-weight: 600;
}
.sr-btn:active { background: var(--bg-sunken); }
.sr-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tx-3); }
.sr-toggle input { width: 16px; height: 16px; }
.sr-advice { font-size: 13.5px; line-height: 1.65; color: var(--tx-2); padding: 7px 0; border-bottom: 1px solid var(--line-1); }
.sr-advice:last-child { border-bottom: 0; padding-bottom: 0; }

/* 睡眠报告：生成进度条 / 元信息 / 上次报告卡 */
.sr-prog-wrap { padding: 26px 4px; }
.sr-prog-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; color: var(--tx-2); margin-bottom: 10px; }
.sr-prog-head b { font-size: 14px; color: var(--tx-1); }
.sr-prog-head span { font-variant-numeric: tabular-nums; color: var(--tx-3); }
.sr-prog { height: 8px; border-radius: 4px; background: var(--bg-sunken); overflow: hidden; }
.sr-prog-bar { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #7c5cff, #b06bff); transition: width .18s linear; }
.sr-prog-stage { margin-top: 9px; font-size: 12px; color: var(--tx-3); }
.sr-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 2px; font-size: 11.5px; color: var(--tx-3); }
.sr-refresh {
  flex: none; padding: 5px 12px; border-radius: 9px; border: 1.5px solid var(--line-strong);
  background: var(--bg-raise); color: var(--tx-1); font-size: 12px; font-weight: 600;
}
.sr-refresh:active { background: var(--bg-sunken); }
.sr-stale {
  margin: 6px 0 0; padding: 8px 11px; border-radius: 10px; font-size: 12px; line-height: 1.55;
  color: var(--tint-amber-fg); background: var(--tint-amber-bg);
}
.sr-last {
  display: flex; align-items: center; width: 100%; gap: 10px; margin-top: 10px;
  padding: 11px 12px; border-radius: 12px; border: 1.5px solid var(--line-1);
  background: var(--bg-raise); text-align: left;
}
.sr-last-l { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sr-last-l i { font-style: normal; font-size: 11.5px; color: var(--tx-3); }
.sr-last-l b { font-size: 14px; color: var(--tx-1); }
.sr-last-l em { font-style: normal; font-size: 11px; color: var(--tx-3); }

/* 报告页顶部：生成时间 + 居中的重新生成按钮 */
.sr-topbar { display: flex; flex-direction: column; align-items: center; gap: 7px; margin: 12px 0 6px; }
.sr-genat { font-size: 11.5px; color: var(--tx-3); }
.sr-refresh {
  width: 78%; max-width: 340px; height: 40px; border-radius: 12px;
  border: 1.5px solid var(--line-strong); background: var(--bg-raise);
  color: var(--tx-1); font-size: 14.5px; font-weight: 600; letter-spacing: .5px;
}
.sr-refresh:active { background: var(--bg-sunken); }

/* ============ 窄屏排版加固（360px 及以下） ============ */
/* 通用：长串（药名、地址、电话、URL）不再撑破容器 */
.row-d, .group-note, .def .v, .a-meta, .chat .bubble, .feed-body .txt,
.med-main .rule, .lv-rooms i { overflow-wrap: anywhere; word-break: break-word; }

/* 标题类：单行省略，避免把整行挤成多行 */
.row-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 徽标 / 按钮 / 标签不参与压缩、不换行 */
.badge, .btn, .kw-lv, .chip, .topic, .sr-btn, .sr-refresh { white-space: nowrap; flex: none; }

/* 行布局：右侧操作区不被挤没 */
.row-r { flex: none; white-space: nowrap; }

/* 用药行：时间列固定、药名可缩、状态/打卡不被压 */
.med-item { grid-template-columns: 46px 3px minmax(0, 1fr) auto; column-gap: 9px; }
.med-main { min-width: 0; }
.med-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.med-main .dose { display: inline-block; white-space: nowrap; }
.med-state { white-space: nowrap; }

/* 两列卡片：窄屏自适应，避免每列过窄导致文字竖排 */
.def-grid, .stat-grid { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }

/* 房间/设备标签 */
.lv-rooms i { white-space: nowrap; }

/* 表格与图表容器不溢出 */
.chart-card canvas, table { max-width: 100%; }

/* 用药行：状态与打卡按钮同一列，避免换行 */
.med-tail { display: flex; align-items: center; gap: 8px; justify-self: end; }
.med-tail .btn { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }

/* ============================== 家族树（移动端 · 多框架） ============================== */
.ft-sum {
  display: flex; align-items: center; gap: 10px;
  padding: 12px var(--edge) 8px;
}
.ft-sum-t { flex: 1; min-width: 0; font-size: 12.5px; color: var(--tx-2); }
.ft-sum-t b { font-size: 15px; font-weight: 700; color: var(--tx-1); font-family: var(--font-mono); }
.ft-add {
  flex: none; padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 650;
}
.ft-add:active { opacity: .8; }

.ft-frames { padding: 0 var(--edge) 8px; }

/* 一个家庭 = 一个框 */
.fm-box {
  padding: 12px 10px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-group);
  border: 1.5px solid var(--line-1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}
.fm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fm-gen {
  font-size: 11.5px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); padding: 2px 8px; border-radius: var(--r-pill);
}
.fm-cnt { font-size: 11.5px; color: var(--tx-3); }

.fm-couple { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.fm-bond { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.fm-bond i { width: 26px; height: 2px; border-radius: 1px; background: var(--line-strong); }
.fm-bond em { font-style: normal; font-size: 10px; color: var(--tx-3); }

.fm-down { display: grid; place-items: center; height: 16px; }
.fm-down i { width: 2px; height: 16px; background: var(--line-strong); }
.fm-kids { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* 一个人 = 一个小方块 */
.fm-node {
  width: 80px; padding: 8px 4px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  border-radius: var(--r-md); background: var(--bg-raise);
  border: 1.5px solid var(--line-1);
  position: relative;
}
.fm-node .fm-av {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 18px;
  background: var(--bg-group); margin-bottom: 2px;
}
.fm-node b {
  font-size: 12px; font-weight: 650; color: var(--tx-1);
  max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fm-node em {
  font-style: normal; font-size: 10.5px; color: var(--tx-3);
  max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fm-node.core { background: var(--brand-soft); border-color: var(--brand); }
.fm-node .fm-dot {
  position: absolute; top: -4px; right: -4px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--bg-group);
}
.fm-node:active { opacity: .7; }

/* 框与框之间的连线 */
.fm-link { display: grid; place-items: center; gap: 1px; padding: 4px 0; }
.fm-link i { width: 2px; height: 14px; background: var(--line-strong); opacity: .55; }
.fm-link span {
  font-size: 10.5px; color: var(--tx-3);
  background: var(--bg-app); padding: 1px 8px; border-radius: var(--r-pill);
}
.fm-gap { height: 10px; }
.fm-more { align-self: center; font-size: 11px; color: var(--tx-3); }

/* 家族树 · 金字塔视图 */
.pyr { padding: 4px var(--edge) 10px; }
.pyr-gen {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11.5px; font-weight: 650; color: var(--tx-3);
  margin-bottom: 6px;
}
.pyr-gen span { font-weight: 400; opacity: .8; }
.pyr-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.pyr-link { display: grid; place-items: center; height: 20px; }
.pyr-link i { width: 2px; height: 20px; background: var(--line-strong); opacity: .55; }

/* 家族树 · 列表视图 */
.ft-row .row-t { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ft-av {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 22px; background: var(--bg-raise);
}
.ft-tag { flex: none; font-size: 10.5px; font-weight: 700; font-style: normal; padding: 2px 7px; border-radius: var(--r-pill); line-height: 1.5; }
.ft-tag.ok { background: var(--ok-soft); color: var(--ok); }
/* 金字塔：一行最多放 5 个人，避免单个掉到下一行 */
.pyr-row { gap: 6px; }
.pyr-row .fm-node { width: 65px; padding: 7px 3px 6px; }
.pyr-row .fm-node .fm-av { width: 30px; height: 30px; font-size: 16px; margin-bottom: 1px; }
.pyr-row .fm-node b { font-size: 11.5px; max-width: 60px; }
.pyr-row .fm-node em { font-size: 10px; max-width: 60px; }

/* 金字塔 · 带导线的框架图 */
.pyr-board { position: relative; margin: 4px var(--edge) 10px; }
.pyr-svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.pyr-svg .ln { stroke: var(--line-strong); stroke-width: 1.6; stroke-linecap: round; }
.pyr-svg .ln-blood { stroke: #8fa3bf; stroke-width: 1.8; }
.pyr-svg .ln-kin { stroke: #c3ccd9; stroke-width: 1.4; stroke-dasharray: 4 4; }
.pyr-svg .ln-bond { stroke: #b9c4d4; stroke-width: 1.4; }
.pyr-svg .ln-tx { font-size: 9px; fill: var(--tx-3); }
.pyr-card { position: absolute; }
.pyr-card .fm-node { width: 100%; padding: 7px 2px 6px; }
.pyr-card .fm-node .fm-av { width: 30px; height: 30px; font-size: 16px; margin-bottom: 1px; }
.pyr-card .fm-node b { font-size: 11.5px; max-width: 60px; }
.pyr-card .fm-node em { font-size: 10px; max-width: 60px; }
.pyr-board .pyr-gen {
  position: absolute; margin: 0; text-align: center;
  display: block; font-size: 11px; font-weight: 650; color: var(--tx-3);
}
.pyr-board .pyr-gen span { font-weight: 400; opacity: .8; margin-left: 4px; }

/* 家族树 · 家人资料页 */
.tp-hero { padding: 18px var(--edge) 10px; text-align: center; }
.tp-hero .fm-av {
  width: 64px; height: 64px; font-size: 32px; margin: 0 auto 10px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-raise);
}
.tp-hero b { display: block; font-size: 20px; font-weight: 700; color: var(--tx-1); }
.tp-hero span { display: block; margin-top: 4px; font-size: 12.5px; color: var(--tx-3); }

.tp-field { padding: 12px var(--edge); border-bottom: 1px solid var(--line-1); }
.tp-field:last-child { border-bottom: none; }
.tp-field label {
  display: block; margin-bottom: 7px;
  font-size: 12px; font-weight: 600; color: var(--tx-3);
}
.tp-rel {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px var(--edge); border-bottom: 1px solid var(--line-1);
}
.tp-rel:last-child { border-bottom: none; }
.tp-rel .tp-k { flex: none; width: 42px; font-size: 13.5px; color: var(--tx-2); }
.tp-rel .tp-v { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--tx-1); word-break: break-all; }
