/* Assistant App — 移动优先，微信风格 */
:root {
  --bg: #111418;
  --bg-card: #1a1f26;
  --bg-input: #232a33;
  --border: #2a323d;
  --text: #e8edf2;
  --text-dim: #8b98a5;
  --accent: #07C160;
  --accent-dim: #05914a;
  --bubble-me: #07C160;
  --bubble-me-text: #062b17;
  --bubble-other: #232a33;
  --danger: #e5484d;
  --nav-h: 56px;
  --nav-h-safe: calc(var(--nav-h) + env(safe-area-inset-bottom));
  --header-h: 48px;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ===== 页面容器 ===== */
.page {
  display: none;
  position: fixed;
  inset: 0 0 var(--nav-h-safe) 0;
  flex-direction: column;
  background: var(--bg);
}
body.immersive .page {
  /* 聊天/编辑等沉浸页：无底部导航，且跟随虚拟键盘（--kb 由 JS 设置） */
  inset: 0 0 var(--kb, 0px) 0;
}
.page.active { display: flex; }

/* ===== 线性图标 ===== */
.ic { width: 22px; height: 22px; vertical-align: middle; flex-shrink: 0; }
.icon-btn .ic { width: 22px; height: 22px; display: block; }
.icon-btn:active .ic { opacity: .7; }

/* ===== 顶栏 ===== */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top);
}
.header-title { font-size: 17px; font-weight: 600; }
.header-left, .header-right { display: flex; align-items: center; gap: 8px; min-width: 60px; }
.header-right { justify-content: flex-end; }
.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.icon-btn:active { background: var(--bg-input); }

/* ===== 搜索 ===== */
.search-bar { padding: 8px 12px; background: var(--bg); flex-shrink: 0; }
.search-bar input {
  width: 100%;
  padding: 8px 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

/* ===== 列表 ===== */
.list { flex: 1; overflow-y: auto; padding: 4px 0; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.list-item:active { background: var(--bg-card); }
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2c8e4d, #07C160);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: #fff; font-weight: 600;
  flex-shrink: 0;
}
.avatar.group { background: linear-gradient(135deg, #4169a8, #5b8fd6); }
.avatar.ai { background: linear-gradient(135deg, #4553b8, #6d6bd8); }
.avatar .ic { width: 22px; height: 22px; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 15px; font-weight: 500; display: flex; justify-content: space-between; align-items: baseline; }
.item-sub { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.item-time { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.conv-unread {
  display: inline-block; margin-left: 8px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #fa5151; color: #fff; font-size: 11px; line-height: 18px;
  text-align: center; font-weight: 600; vertical-align: 1px;
}
.contact-meta { font-size: 12px; color: var(--text-dim); }

/* ===== 聊天 ===== */
.chat-header { height: calc(var(--header-h) + env(safe-area-inset-top)); }
.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-row {
  display: flex; gap: 8px; align-items: flex-end;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: pan-y;
}
.msg-row.me { flex-direction: row-reverse; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #3a6ea5, #5b9bd5);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff; flex-shrink: 0;
}
.msg-row.me .msg-avatar { background: linear-gradient(135deg, #2c8e4d, #07C160); }
.msg-row.ai .msg-avatar { background: linear-gradient(135deg, #4553b8, #6d6bd8); }
.msg-avatar .ic { width: 18px; height: 18px; }
.msg-body { max-width: 72%; }
.msg-sender { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; padding: 0 4px; }
.ai-tag { display: inline-block; font-size: 10px; line-height: 1.4; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; margin-right: 5px; vertical-align: 1px; font-weight: 600; }
.bubble {
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--bubble-other);
  color: var(--text);
  font-size: 15px;
  word-break: break-word;
  position: relative;
}
.msg-row.me .bubble { background: var(--bubble-me); color: var(--bubble-me-text); }
.bubble.ai { border: 1px solid rgba(109, 107, 216, .35); }
.bubble img { max-width: 100%; border-radius: 8px; display: block; }
.bubble .file-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12); padding: 8px 10px; border-radius: 8px;
  font-size: 13px;
}
.bubble .file-chip .f-icon { width: 20px; display: flex; align-items: center; justify-content: center; }
.bubble .file-chip .f-icon .ic { width: 18px; height: 18px; }
.bubble .translate-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.bubble .translate-row button {
  background: rgba(255,255,255,.18); border: none; color: inherit;
  padding: 3px 10px; border-radius: 12px; font-size: 12px; cursor: pointer;
}
.msg-time { font-size: 10px; color: var(--text-dim); margin-top: 3px; padding: 0 4px; }
.msg-row.me .msg-time { text-align: right; }
.typing-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-dim); animation: blink 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

/* ===== 输入栏 ===== */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.input-wrap { flex: 1; background: var(--bg-input); border-radius: 20px; padding: 8px 14px; }
.input-wrap textarea {
  width: 100%; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px; font-family: inherit;
  resize: none; max-height: 90px; line-height: 1.4;
}
.send-btn {
  background: var(--accent); color: var(--bubble-me-text);
  border: none; border-radius: 20px; padding: 9px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.send-btn:disabled { opacity: .4; }
.input-icon { padding: 4px 6px; }
.input-icon .ic { width: 24px; height: 24px; }

/* 附件面板 */
.attach-panel {
  display: flex;
  gap: 14px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* 斗图面板（😊） */
.meme-panel {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  max-height: 40vh;
  overflow-y: auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
.meme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.meme-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg-input);
  cursor: pointer;
}
.meme-grid img:active { opacity: .7; transform: scale(.96); }
.attach-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: none; color: var(--text); font-size: 12px; cursor: pointer;
}
.attach-item .ai-icon {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--bg-input); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.attach-item .ai-icon .ic { width: 24px; height: 24px; }
.attach-item:active .ai-icon { border-color: var(--accent); color: var(--accent); }

/* 按住说话按钮（微信式） */
.hold-to-talk {
  width: 100%; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text); font-size: 15px; font-weight: 500;
  cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.hold-to-talk:active { border-color: var(--accent); color: var(--accent); }
.hold-to-talk.hidden { display: none; }
/* 录音期间全局禁止文字选中（防按住说话时选中按钮/消息文字） */
body.recording, body.recording * { user-select: none !important; -webkit-user-select: none !important; -webkit-touch-callout: none !important; }

/* 录音状态条（按住说话时显示） */
.recording-bar {
  position: fixed; bottom: calc(var(--nav-h) + 90px); left: 0; right: 0;
  display: flex; justify-content: center; z-index: 110; pointer-events: none;
}
body.immersive .recording-bar { bottom: 96px; }
.rec-bar-inner {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.85); color: #fff;
  padding: 10px 20px; border-radius: 24px; font-size: 14px;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.rec-text { font-weight: 600; min-width: 34px; text-align: center; }
.rec-hint { color: #ccc; font-size: 12px; }
.recording-bar.cancel .rec-bar-inner { background: var(--danger); }
.recording-bar.cancel .rec-hint { color: #fff; }

/* 微信式语音条 */
.voice-bubble {
  display: flex; align-items: center; gap: 8px;
  min-width: 140px; max-width: 210px;
  padding: 8px 12px;
  background: rgba(255,255,255,.10); border-radius: 12px;
  cursor: pointer;
}
.voice-play {
  width: 26px; height: 26px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--bubble-me-text);
  font-size: 11px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer; padding: 0 0 0 2px;
}
.voice-wave {
  flex: 1; display: flex; align-items: center; gap: 2px; height: 24px; overflow: hidden;
}
.voice-wave span {
  width: 2.5px; height: 30%; border-radius: 1px; background: currentColor; opacity: .55;
  transition: height .15s;
}
.voice-dur { font-size: 12px; opacity: .75; flex-shrink: 0; }
.msg-row.me .voice-bubble { background: rgba(255,255,255,.14); }
.voice-bubble.playing .voice-play { animation: voicePulse 1s infinite; }
.voice-bubble.playing .voice-wave span { animation: waveAnim .9s infinite alternate; }
.voice-bubble.playing .voice-wave span:nth-child(2n) { animation-delay: .15s; }
.voice-bubble.playing .voice-wave span:nth-child(3n) { animation-delay: .3s; }
@keyframes voicePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes waveAnim { from { height: 20%; } to { height: 95%; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* ===== 快速操作 ===== */
.quick-actions { display: flex; gap: 10px; padding: 10px 12px; flex-shrink: 0; }
.qa-btn {
  flex: 1; padding: 10px;
  border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.qa-btn .ic { width: 19px; height: 19px; }
.qa-btn:active { border-color: var(--accent); color: var(--accent); }

/* ===== 筛选 tab ===== */
.filter-tabs { display: flex; gap: 6px; padding: 8px 12px; background: var(--bg); flex-shrink: 0; overflow-x: auto; }
.ftab {
  padding: 6px 14px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-dim); font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
.ftab.active { background: var(--accent); color: var(--bubble-me-text); border-color: var(--accent); font-weight: 600; }

/* ===== 文件卡片 ===== */
.file-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.file-card .f-icon { width: 40px; display: flex; align-items: center; justify-content: center; color: var(--text-dim); }
.file-card .f-icon .ic { width: 24px; height: 24px; }
.file-card .f-main { flex: 1; min-width: 0; }
.file-card .f-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .f-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.file-card .f-del { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 4px; }
.file-card .f-del .ic { width: 18px; height: 18px; }
.file-card .f-del:active { color: var(--danger); }

/* ===== 日历网格 ===== */
.cal-nav { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; flex-shrink: 0; }
.cal-month { font-size: 16px; font-weight: 600; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); padding: 0 8px; flex-shrink: 0; }
.cal-weekdays span { text-align: center; font-size: 12px; color: var(--text-dim); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 4px 8px; flex-shrink: 0; }
.cal-day {
  position: relative;
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 6px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  overflow: hidden;
}
.cal-day.empty { cursor: default; }
.cal-day.other-month { color: var(--text-dim); opacity: .45; }
.cal-day.today .cal-num { background: var(--accent); color: var(--bubble-me-text); border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.cal-day.selected { background: var(--bg-input); }
.cal-day.selected .cal-num { border: 1px solid var(--accent); border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.cal-num { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.cal-dots { display: flex; gap: 3px; margin-top: 2px; flex-wrap: wrap; justify-content: center; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-dot.ring { background: var(--danger); }
.cal-dot.done { background: var(--text-dim); opacity: .4; }
.cal-day-title { padding: 10px 14px 4px; font-size: 14px; font-weight: 600; color: var(--text-dim); flex-shrink: 0; border-top: 1px solid var(--border); }

/* ===== 文件编辑器 ===== */
.editor-meta { padding: 8px 14px; font-size: 12px; color: var(--text-dim); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.editor-ver { font-size: 12px; color: var(--accent); margin-right: 8px; }
.editor-textarea {
  flex: 1;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: none;
  outline: none;
  resize: none;
  padding: 14px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.editor-textarea:focus { background: var(--bg); }

/* ===== 日程列表 ===== */
.rm-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.rm-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--text-dim); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.rm-item.done .rm-check { background: var(--accent); border-color: var(--accent); color: var(--bubble-me-text); }
.rm-item.done .rm-title { text-decoration: line-through; color: var(--text-dim); }
.rm-main { flex: 1; min-width: 0; }
.rm-title { font-size: 14px; }
.rm-time { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.rm-kind { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--bg-input); color: var(--text-dim); flex-shrink: 0; }

/* ===== 我的页 ===== */
.me-card {
  margin: 16px 14px; padding: 18px; border-radius: var(--radius);
  background: linear-gradient(135deg, #232a33, #1a1f26);
  border: 1px solid var(--border); text-align: center;
}
.me-card .me-name { font-size: 19px; font-weight: 600; }
.me-card .me-ai { font-size: 13px; color: var(--accent); margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.me-card .me-ai .ic { width: 15px; height: 15px; }
.me-section { margin: 0 14px 12px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); overflow: hidden; }
.me-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.me-row:last-child { border-bottom: none; }
.me-row select { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 13px; }
.me-row.center { justify-content: center; color: var(--text-dim); font-size: 12px; }
.mini-btn { background: var(--bg-input); border: 1px solid var(--border); color: var(--text); border-radius: 14px; padding: 5px 10px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; }
.mini-btn .ic { width: 14px; height: 14px; }

/* ===== 底部导航 ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h-safe);
  background: var(--bg-card); border-top: 1px solid var(--border);
  display: flex; z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
/* 键盘弹出时悬浮 tab 会被 iOS 顶到键盘上方：直接隐藏，避免遮输入/弹窗。
   用 display:none 而非 transform（避免与桌面端 translateX(-50%) 冲突）。 */
body.kb-open .bottom-nav { display: none; }
/* 键盘弹出时非沉浸页底部跟随视觉视口（tab 已隐藏，内容伸展到键盘上方） */
body.kb-open .page:not(.immersive) { bottom: 0; }
.nav-item {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  position: relative;
}
.nav-item .ic { width: 24px; height: 24px; }
.nav-item.active { color: var(--accent); }
.nav-badge {
  position: absolute; top: 4px; left: 50%; margin-left: 4px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: #fa5151; color: #fff; font-size: 10px; line-height: 16px;
  text-align: center; font-weight: 600;
}

/* ===== 通知中心 ===== */
.notif-item.unread { background: rgba(7, 193, 96, .06); }
.notif-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-input); display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.notif-time { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.notif-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #fa5151; flex-shrink: 0;
}

/* ===== PDF 查看器 ===== */
.pdf-pages { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.pdf-page { position: relative; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); border-radius: 4px; overflow: hidden; flex: 0 0 auto; margin: 0 auto; }
.pdf-page canvas { display: block; }
.pdf-overlay { position: absolute; inset: 0; pointer-events: none; }
.pdf-overlay .pdf-annot { position: absolute; pointer-events: auto; cursor: move; box-sizing: border-box; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pdf-overlay .pdf-annot img { display: block; max-width: none; pointer-events: none; }
.pdf-overlay .pdf-annot.selected { outline: 2px solid #1a56c4; outline-offset: 0; border-radius: 2px; }
.pdf-resize { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: #1a56c4; border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; display: none; box-shadow: 0 1px 3px rgba(0,0,0,.4); touch-action: none; }
.pdf-annot.selected .pdf-resize { display: block; }
/* AcroForm 字段高亮：虚线边框，点击可填 */
.pdf-field { position: absolute; pointer-events: none; box-sizing: border-box; border: 1.5px dashed #1a56c4; border-radius: 2px; background: rgba(26, 86, 196, 0.06); cursor: pointer; }
.pdf-field.checkbox { background: rgba(26, 86, 196, 0.10); }
.pdf-tip { padding: 6px 14px; font-size: 12px; color: var(--text-dim); background: var(--bg-input); border-bottom: 1px solid var(--border); }
.pdf-tip.hint { color: #e65100; }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.65); display: flex; align-items: flex-end; justify-content: center; }
/* 键盘弹出时（--kb 由 JS 设置），底部弹层整体抬升到键盘上方，输入框不被遮挡 */
.modal:not(.hidden), .sheet:not(.hidden) { bottom: var(--kb, 0px); transition: bottom .2s ease; }
.modal-box {
  width: 100%; max-width: 480px; background: var(--bg-card);
  border-radius: 18px 18px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
.modal-title { font-size: 16px; font-weight: 600; text-align: center; }
.media-preview-box { max-width: 560px; width: 92%; }
.modal-box input, .modal-box select, .modal-box textarea, .ask-ai-input {
  background: var(--bg-input); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; width: 100%; outline: none;
}
.ask-ai-input, .modal-box textarea {
  resize: none; font-family: inherit; line-height: 1.5;
}
.modal-row { display: flex; align-items: center; gap: 10px; }
.modal-row label { font-size: 13px; color: var(--text-dim); width: 44px; flex-shrink: 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions button { flex: 1; padding: 11px; border-radius: 12px; font-size: 14px; border: none; cursor: pointer; }
.btn-ghost { background: var(--bg-input); color: var(--text); }
.btn-primary { background: var(--accent); color: var(--bubble-me-text); font-weight: 600; }

/* ===== 底部弹层 ===== */
.sheet { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.65); display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--bg-card); border-radius: 16px 16px 0 0; border-top: 1px solid var(--border); font-size: 15px; font-weight: 600; }
.sheet .list { max-height: 50vh; background: var(--bg-card); }
.menu-list { background: var(--bg-card); border-radius: 0 0 16px 16px; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 13px 18px;
  background: none; border: none; color: var(--text);
  font-size: 15px; cursor: pointer; text-align: left;
}
.menu-item .ic { width: 20px; height: 20px; color: var(--text-dim); }
.menu-item:active { background: var(--bg-input); }
.menu-item.cancel { color: var(--text-dim); justify-content: center; border-top: 1px solid var(--border); margin-top: 4px; }

/* ===== Toast ===== */
#toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 10px 22px; border-radius: 20px;
  font-size: 14px; z-index: 200; max-width: 80vw; text-align: center;
}
/* 微信式新消息顶部提醒条（点击跳会话，3.5s 自动消失） */
#toast.msg-toast {
  top: calc(var(--nav-h-safe, 0px) + 10px); transform: none; left: 10px; right: 10px;
  max-width: none; text-align: left; border-radius: 12px;
  background: rgba(20,20,20,.95); border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.35); padding: 10px 14px; font-size: 13px;
  line-height: 1.45; z-index: 210;
}

/* ===== PWA 安装引导 ===== */
.pwa-tip {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h-safe) + 12px);
  z-index: 60;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--accent);
  color: var(--text); border-radius: 22px;
  padding: 8px 12px 8px 14px; font-size: 13px;
  max-width: 90vw; white-space: nowrap;
}
.pwa-tip .ic { color: var(--accent); }
.pwa-tip span { overflow: hidden; text-overflow: ellipsis; }

/* ===== 桌面适配 ===== */
@media (min-width: 768px) {
  body { display: flex; justify-content: center; }
  .page, .bottom-nav, .app-header { max-width: 520px; left: 50%; right: auto; transform: translateX(-50%); width: 100%; }
  .page { inset: 0 auto var(--nav-h-safe) auto; }
  .bottom-nav { left: 50%; right: auto; transform: translateX(-50%); width: 100%; }
  .modal { justify-content: center; }
  .modal-box { border-radius: 18px; }
  /* 底部弹层（长按菜单/群成员面板）桌面端同样居中限宽 */
  .sheet { justify-content: center; }
  .sheet .sheet-header, .sheet .list, .menu-list { max-width: 520px; margin: 0 auto; width: 100%; }
}
@media (min-width: 1024px) {
  /* 桌面：保持移动优先单栏体验（居中 520px），后续迭代再做分栏布局 */
}
