/* 家校沟通模块 · 独立样式（全部 .msg- 前缀，沿用主工程主题变量，不覆盖任何现有类）
 * UI 规范按需求第五部分：rpx → px（375px 屏 = 750rpx，即 1rpx=0.5px）
 *   标题32rpx=16px / 名称30rpx=15px / 正文28rpx=14px / 辅助24rpx=12px
 *   会话行112rpx=56px / 头像80rpx=40px / 输入栏96rpx=48px / 角标32rpx=16px
 * 专用色：未读红 #FA5151 / 辅助灰 #999 / 页面底 #F7F7F7 / 卡片白 #FFF / 分割线 #EEE 1px */
:root{
  --msg-red:#FA5151; --msg-muted:#999; --msg-bg:#F7F7F7; --msg-card:#fff; --msg-line:#EEE;
}
.msg-body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  color:var(--text);background:var(--msg-bg);min-height:100vh;-webkit-tap-highlight-color:transparent}
.msg-wrap{max-width:520px;margin:0 auto;min-height:100vh;display:flex;flex-direction:column;background:var(--msg-bg);position:relative}
.msg-top{flex:none;position:sticky;top:0;z-index:20;background:var(--msg-card);border-bottom:1px solid var(--msg-line)}
.msg-top-row{height:48px;display:flex;align-items:center;gap:10px;padding:0 14px}
.msg-back{font-size:22px;color:var(--text);background:none;border:none;padding:0;width:24px;line-height:1;cursor:pointer}
.msg-top-title{font-size:16px;font-weight:700;flex:1;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.msg-top-right{font-size:12px;color:var(--primary-d);background:none;border:none;min-width:24px;text-align:right;cursor:pointer;font-weight:600}
.msg-top-sub{font-size:12px;color:var(--msg-muted);text-align:center;padding:0 14px 10px}
.msg-scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch}
.msg-toast{position:fixed;left:50%;bottom:80px;transform:translateX(-50%);background:rgba(60,55,50,.92);color:#fff;
  font-size:13px;padding:10px 18px;border-radius:20px;z-index:99;max-width:80%;text-align:center}
.msg-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--msg-muted);
  font-size:13px;gap:10px;padding:80px 20px;text-align:center}
.msg-empty .ic{font-size:46px;opacity:.55}

/* 通知卡片 */
.msg-sec{font-size:12px;color:var(--msg-muted);padding:14px 16px 8px;display:flex;align-items:center;justify-content:space-between}
.msg-sec b{font-weight:600;color:var(--msg-muted)}
.msg-notice-unread{font-size:11px;color:var(--msg-red);font-weight:700}
.msg-notice-card{background:var(--msg-card);border-radius:8px;margin:0 12px 8px;padding:12px;display:flex;gap:10px;position:relative;cursor:pointer}
.msg-notice-card:active{background:#fcfaf6}
.msg-notice-card.unread::before{content:"";position:absolute;left:0;top:12px;bottom:12px;width:3px;background:var(--msg-red);border-radius:2px}
.msg-nic{width:20px;flex:none;display:flex;align-items:flex-start;justify-content:center;font-size:19px}
.msg-nbody{flex:1;min-width:0}
.msg-nbody .t{font-size:15px;font-weight:600;display:flex;align-items:center;gap:6px}
.msg-nbody .t .tm{margin-left:auto;font-size:12px;color:var(--msg-muted);font-weight:400;flex:none}
.msg-nbody .d{font-size:14px;color:#555;margin-top:5px;line-height:1.5;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* 会话列表行：112rpx=56px 行高，头像80rpx=40px */
.msg-conv{background:var(--msg-card);height:64px;display:flex;align-items:center;gap:11px;padding:0 14px;position:relative;cursor:pointer}
.msg-conv:active{background:#fcfaf6}
.msg-conv + .msg-conv::before{content:"";position:absolute;left:65px;right:0;top:0;height:1px;background:var(--msg-line)}
.msg-avatar{width:40px;height:40px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;
  font-size:16px;font-weight:700;color:#fff;position:relative;background:var(--primary)}
.msg-avatar.t{background:var(--green)}
.msg-badge{position:absolute;top:-4px;right:-5px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;
  background:var(--msg-red);color:#fff;font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;line-height:1}
.msg-cbody{flex:1;min-width:0}
.msg-cname{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.msg-cname .closed{font-size:10px;color:var(--msg-muted);font-weight:400;margin-left:4px}
.msg-csum{font-size:14px;color:var(--msg-muted);margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.msg-ctime{font-size:12px;color:var(--msg-muted);align-self:flex-start;margin-top:16px;flex:none}

/* 对话气泡 */
.msg-chat{background:var(--msg-bg);min-height:100vh;padding:12px 12px 20px}
.msg-time{text-align:center;font-size:12px;color:var(--msg-muted);margin:14px 0}
.msg-row{display:flex;margin-bottom:12px;gap:8px}
.msg-row.mine{flex-direction:row-reverse}
.msg-row.gap-sm{margin-top:4px}
.msg-row.gap-lg{margin-top:14px}
.msg-bub{max-width:70%;padding:8px 10px;border-radius:8px;font-size:14px;line-height:1.55;word-break:break-word;position:relative}
.msg-row:not(.mine) .msg-bub{background:var(--msg-card);color:var(--text)}
.msg-row.mine .msg-bub{background:var(--primary);color:#fff}
.msg-bub img,.msg-bub video{max-width:100%;border-radius:6px;display:block}
.msg-bub .voice{display:flex;align-items:center;gap:6px}
.msg-bub .voice.playing{animation:msgWave 1s infinite}
@keyframes msgWave{0%,100%{opacity:1}50%{opacity:.5}}
.msg-read{font-size:11px;color:var(--msg-muted);text-align:right;margin-top:3px}
.msg-sending{opacity:.55}
.msg-fail{display:inline-flex;align-items:center;gap:4px;color:var(--msg-red);font-size:12px;cursor:pointer}

/* 输入栏：固定底部 96rpx=48px + 工具条 */
.msg-inputbar{flex:none;background:var(--msg-card);border-top:1px solid var(--msg-line);padding:6px 8px calc(6px + env(safe-area-inset-bottom));position:sticky;bottom:0;z-index:20}
.msg-tools{display:flex;gap:14px;padding:2px 4px 8px}
.msg-tool{font-size:11px;color:var(--primary-d);background:var(--soft);border:none;border-radius:14px;padding:5px 10px;cursor:pointer;font-weight:600}
.msg-inputrow{display:flex;align-items:center;gap:6px}
.msg-kbd{width:30px;height:30px;flex:none;border:none;background:none;font-size:19px;color:var(--text);cursor:pointer}
.msg-field{flex:1;min-width:0;border:none;background:var(--msg-bg);border-radius:16px;padding:9px 12px;font-size:14px;font-family:inherit;outline:none;color:var(--text)}
.msg-send{border:none;border-radius:16px;padding:8px 15px;font-size:13px;font-weight:700;flex:none;cursor:pointer;background:var(--primary);color:#fff}
.msg-send:disabled{background:#ece5d9;color:#b3a696;cursor:not-allowed}

/* 通用卡片/表单/按钮（设置页、风险页） */
.msg-panel{background:var(--msg-card);border-radius:12px;margin:12px;padding:14px}
.msg-panel h3{font-size:15px;margin:0 0 12px;font-weight:700}
.msg-switch-row{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--msg-line);gap:12px}
.msg-switch-row:last-child{border-bottom:none}
.msg-switch-label{font-size:14px;font-weight:600}
.msg-switch-desc{font-size:12px;color:var(--msg-muted);margin-top:3px;line-height:1.5}
.msg-switch{width:44px;height:25px;border-radius:14px;background:#ddd;position:relative;flex:none;transition:background .15s;border:none;cursor:pointer}
.msg-switch.on{background:var(--primary)}
.msg-switch i{position:absolute;top:2px;left:2px;width:21px;height:21px;border-radius:50%;background:#fff;transition:left .15s}
.msg-switch.on i{left:21px}
.msg-fieldlabel{font-size:12px;color:var(--msg-muted);display:block;margin:12px 0 5px}
.msg-input{width:100%;border:1px solid var(--msg-line);border-radius:10px;padding:10px 11px;font-size:14px;font-family:inherit;outline:none;color:var(--text)}
.msg-input:focus{border-color:var(--primary)}
.msg-btn{border:none;border-radius:10px;padding:11px 14px;font-size:14px;font-weight:700;cursor:pointer;background:var(--primary);color:#fff;width:100%;margin-top:14px}
.msg-btn:disabled{background:#ece5d9;color:#b3a696}
.msg-btn.ghost{background:var(--soft);color:var(--primary-d)}
.msg-notice-bar{background:#fff6e8;color:#9a6a2e;font-size:12px;padding:10px 12px;border-radius:10px;margin:12px;line-height:1.6}
.msg-risk-card{background:var(--msg-card);border-radius:10px;margin:10px 12px;padding:12px}
.msg-risk-hit{display:inline-block;font-size:11px;color:var(--msg-red);background:#fdecec;border-radius:6px;padding:2px 7px;margin-right:5px;font-weight:700}
.msg-risk-snip{font-size:14px;margin-top:8px;line-height:1.55;color:#444}
.msg-risk-meta{font-size:12px;color:var(--msg-muted);margin-top:8px;display:flex;align-items:center;gap:8px}
.msg-risk-actions{display:flex;gap:8px;margin-top:10px}
.msg-risk-actions button{flex:1;font-size:12px;padding:7px;border-radius:8px;border:1px solid var(--line);background:#fff;color:var(--text);cursor:pointer}
.msg-row-inline{display:flex;gap:8px;align-items:center}
.msg-chip{font-size:11px;padding:3px 8px;border-radius:10px;background:var(--soft);color:var(--primary-d);font-weight:600}

/* 登录 */
.msg-login{padding:54px 26px}
.msg-login .logo{width:60px;height:60px;border-radius:18px;background:linear-gradient(135deg,#e8b980,#d29a5c);
  display:flex;align-items:center;justify-content:center;font-size:30px;margin:0 auto 16px;color:#fff}
.msg-login h2{text-align:center;font-size:20px;margin:0 0 6px}
.msg-login .sub{text-align:center;font-size:12px;color:var(--msg-muted);line-height:1.7;margin-bottom:26px}
.msg-demobtns{display:flex;flex-direction:column;gap:8px;margin-top:18px}
.msg-demobtns button{background:var(--msg-card);border:1px solid var(--msg-line);border-radius:10px;padding:11px 13px;
  font-size:13px;text-align:left;cursor:pointer;color:var(--text)}
.msg-demobtns b{color:var(--primary-d);margin-right:8px}

/* 骨架屏 */
.msg-skel{padding:14px}
.msg-skel-row{height:56px;background:linear-gradient(90deg,#f2eee8 25%,#eae4da 50%,#f2eee8 75%);
  background-size:200% 100%;animation:msgSk 1.2s infinite;border-radius:8px;margin-bottom:8px}
@keyframes msgSk{0%{background-position:200% 0}100%{background-position:-200% 0}}
