/* Mobile shell: tab pages share a persistent bottom navigation; chat is a detail page. */
.mobile-list-title { display:none; }
.mobile-chat-options { display:none; }
.quick-add { flex-shrink:0; }
.list-search { min-width:0; }
.group-notice { display:flex; align-items:center; gap:8px; width:100%; text-align:left; border:0; border-bottom:1px solid var(--line); min-height:36px; }
.group-notice-label { flex-shrink:0; font-size:12px; }
.group-notice-preview { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.peer-insights { display:flex; flex-wrap:wrap; gap:4px 18px; padding:8px 16px; background:var(--panel); color:var(--muted); font-size:12px; border-bottom:1px solid var(--line); flex-shrink:0; overflow-wrap:anywhere; }
.mobile-action-row { display:flex; align-items:center; gap:16px; width:100%; min-height:56px; padding:12px 8px; border:0; background:none; text-align:left; }
.mobile-action-row + .mobile-action-row { border-top:1px solid var(--line); }
.mobile-action-row .icon { color:var(--accent); }
@media (max-width:760px), (pointer:coarse) and (max-width:1100px) and (max-height:600px) {
  html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  html, body { overscroll-behavior:none; touch-action:manipulation; }
  /* 16px prevents Safari's automatic focus zoom. Pinch zoom remains available. */
  input:not([type=checkbox]):not([type=radio]), textarea, select,
  .list-search input, .composer-input, .auth-field input,
  .admin-open .modal .input, .admin-content .input { font-size:16px; }
  button, a, input, textarea, select { touch-action:manipulation; }
  #app { position:fixed; top:var(--mobile-top,0px); left:0; right:0; height:var(--mobile-height,100dvh); min-height:0; overflow:hidden; }
  .app:not(.admin-view), .app.rail-collapsed:not(.admin-view) {
    display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr) auto;
    width:100%; height:100%; min-height:0;
    padding:env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
    background:var(--panel);
  }
  .app:not(.admin-view) > .rail {
    grid-column:1; grid-row:2; display:flex; flex-direction:row; align-items:stretch; justify-content:space-around;
    visibility:visible; overflow:visible; gap:0; border:0; border-top:1px solid var(--line);
    padding:5px 8px calc(5px + env(safe-area-inset-bottom)); background:var(--panel); z-index:5;
  }
  .app:not(.admin-view) .rail-me, .app:not(.admin-view) .rail-btn[data-tab=admin] { display:none; }
  .app:not(.admin-view) .rail-btn { flex:1; width:auto; max-width:150px; min-height:48px; padding:4px 0; gap:3px; border-radius:10px; }
  .app:not(.admin-view) .rail-btn.active { background:none; color:var(--accent); }
  .app:not(.admin-view) .rail-btn .icon { width:24px; height:24px; }
  .app:not(.admin-view) .rail-label { font-size:11px; line-height:16px; }
  .app:not(.admin-view) .rail-btn .badge { right:calc(50% - 26px); top:0; }
  .app:not(.admin-view) > .list { grid-column:1; grid-row:1; min-width:0; min-height:0; flex:none; border:0; }
  .app:not(.admin-view) > .main { display:none; position:relative; inset:auto; height:auto; min-height:0; z-index:auto; }
  .app[data-screen=me]:not(.admin-view) > .list,
  .app[data-screen=chat]:not(.admin-view) > .list { display:none; }
  .app[data-screen=me]:not(.admin-view) > .main { display:flex; grid-row:1; grid-column:1; }
  .app[data-screen=chat]:not(.admin-view) > .main { display:flex; grid-row:1 / -1; grid-column:1; }
  .app[data-screen=chat]:not(.admin-view) > .rail { display:none; }
  .list-head { display:grid; grid-template-columns:44px minmax(0,1fr) 44px; grid-template-rows:48px 42px; gap:4px 6px; padding:2px 12px 10px; flex-shrink:0; }
  .list-head > .btn[aria-label="打开菜单"] { grid-column:1; grid-row:1; }
  .list-head .mobile-list-title { display:block; grid-column:2; grid-row:1; text-align:center; font-size:18px; font-weight:650; }
  .list-head .quick-add { grid-column:3; grid-row:1; color:var(--text); }
  .list-head .list-search { grid-row:2; grid-column:1 / -1; width:100%; height:38px; min-height:38px; margin:0; padding:0 12px; background:var(--panel2); border-radius:12px; }
  .list-search input { width:100%; min-width:0; }
  .list-body, .mobile-me-page, .msgs, .modal-body { -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
  .list-body { padding-bottom:12px; min-height:0; }
  .list-body > .item { min-height:76px; padding:12px 16px; gap:12px; }
  .list-body .avatar { width:48px; height:48px; border-radius:15px; }
  .item-top strong, .item-text > strong { font-size:16px; }
  .preview { font-size:13px; line-height:21px; }
  .item-top time { font-size:11px; }
  .list-body > .row.pad { gap:8px; padding:12px 16px; }
  .list-body > .row.pad .btn { flex:1; padding:10px 6px; min-height:44px; font-size:13px; }
  .section { background:var(--panel2); padding:8px 16px; margin-top:4px; }
  .btn.icon-btn { min-width:44px; min-height:44px; padding:10px; flex-shrink:0; }
  .chat-head { min-height:56px; height:56px; padding:0 4px; gap:0; flex-shrink:0; }
  .chat-head .back { display:inline-flex; }
  .chat-head > .avatar, .chat-actions .layout-action { display:none; }
  .chat-title { align-items:center; }
  .chat-actions { gap:0; }
  .chat-actions .btn[aria-label="聊天设置"], .chat-actions .btn[aria-label="会话信息"], .chat-actions .search-action { display:none; }
  .chat-actions .mobile-chat-options { display:inline-flex; }
  .chat-workspace { flex-direction:column; }
  .msgs { min-height:0; padding:12px; background-size:auto,360px 360px; }
  .peer-insights { display:grid; gap:2px; padding:6px 12px; font-size:11px; }
  .msg { gap:8px; }
  .message-more { opacity:.7; }
  .msg-body { max-width:calc(100% - 56px); }
  .msg .avatar { width:38px; height:38px; border-radius:12px; }
  .composer { flex-shrink:0; align-items:flex-end; gap:1px; min-height:58px; padding:7px 4px calc(7px + env(safe-area-inset-bottom)); }
  .composer .attach-image { display:none; }
  .composer .btn.icon-btn, .composer .send { width:40px; min-width:40px; height:44px; min-height:44px; padding:9px; }
  .composer-input { flex:1; min-width:0; min-height:44px; max-height:120px; line-height:24px; padding:10px; margin:0; border:0; border-radius:16px; background:var(--panel2); }
  .composer .send { background:var(--accent); color:var(--accent-ink); border-radius:12px; }
  .keyboard-open .composer { padding-bottom:7px; }
  .emoji-panel { width:100%; min-width:0; height:min(290px,40dvh); flex:0 0 min(290px,40dvh); border-left:0; border-top:1px solid var(--line); padding-bottom:env(safe-area-inset-bottom); }
  .emoji-open .composer { padding-bottom:7px; }
  .emoji-panel .emoji-search { display:none; }
  .emoji-head { height:40px; min-height:40px; color:var(--text); }
  .emoji-head strong { border:0; font-size:13px; font-weight:500; }
  .emoji-head .btn.icon-btn { min-height:36px; height:36px; padding:8px; }
  .emoji-content { padding:6px 12px 12px; -webkit-overflow-scrolling:touch; }
  .emoji-char { min-height:42px; font-size:25px; }
  .group-notice { padding:7px 12px; min-height:36px; max-height:36px; }
  .mobile-page-head { display:flex; align-items:center; justify-content:space-between; flex-shrink:0; min-height:56px; padding:0 12px 0 20px; background:var(--panel); }
  .mobile-page-head h2 { font-size:20px; }
  .mobile-me-page { display:block; padding:8px 16px 20px; background:var(--panel2); min-height:0; overflow-y:auto; }
  .mobile-me-page > * { flex-shrink:0; }
  .mobile-profile { display:flex; align-items:center; gap:14px; width:100%; padding:20px 2px 24px; text-align:left; background:none; border:0; }
  .mobile-profile .avatar { width:64px; height:64px; border-radius:20px; font-size:24px; }
  .mobile-profile strong { display:block; font-size:22px; overflow-wrap:anywhere; }
  .mobile-profile p { margin-top:6px; overflow-wrap:anywhere; }
  .mobile-profile > .icon { width:18px; color:var(--muted); }
  .mobile-settings-group { border-radius:16px; background:var(--panel); margin-bottom:14px; overflow:hidden; }
  .mobile-setting-row { display:flex; align-items:center; gap:12px; width:100%; min-height:55px; padding:10px 14px; text-align:left; border:0; background:none; font-size:15px; }
  .mobile-setting-row + .mobile-setting-row { border-top:1px solid var(--line); }
  .mobile-setting-icon { width:30px; height:30px; display:grid; place-items:center; color:var(--accent); }
  .mobile-setting-row > .icon { width:16px; height:16px; color:var(--muted); }
  .mobile-logout { min-height:48px; color:var(--danger); background:var(--panel); border:0; border-radius:14px; }
  .mobile-form-actions { margin-top:18px; justify-content:flex-end; }
  .modal-wrap { padding:12px; }
  dialog.modal, .modal { width:calc(100% - 24px); max-width:560px; max-height:calc(var(--mobile-height,100dvh) - 24px); border-radius:18px; }
  dialog.modal { top:var(--mobile-top,0px); bottom:auto; margin:12px auto; }
  .modal > header { min-height:56px; padding:8px 16px; flex-shrink:0; }
  .modal > header h3 { font-size:17px; }
  .modal > header .btn { min-height:40px; }
  .modal-body { padding:16px; overflow-x:hidden; min-height:0; }
  .modal-body .input { min-height:44px; }
  .modal-body .grid2 { grid-template-columns:minmax(0,1fr); }
  .modal-body .row { flex-wrap:wrap; }
  .modal-body .row .input { flex:1 1 140px; }
  dialog.modal.action-sheet { top:auto; bottom:0; margin:0 auto; width:100%; max-width:560px; border-radius:24px 24px 0 0; max-height:80%; padding-bottom:env(safe-area-inset-bottom); animation:sheet-in .18s ease-out; }
  .action-sheet::before { content:''; display:block; width:36px; height:4px; background:var(--control-border); border-radius:3px; margin:9px auto 0; flex-shrink:0; }
  .action-sheet > header { min-height:50px; }
  .action-sheet .modal-body { padding:0 18px 14px; }
  .action-sheet .mobile-action-row { min-height:56px; }
  @keyframes sheet-in { from { transform:translateY(16px); opacity:.5; } to { transform:translateY(0); opacity:1; } }
  @media (prefers-reduced-motion:reduce) { dialog.modal.action-sheet { animation:none; } }
  .auth { padding:max(76px,calc(env(safe-area-inset-top) + 56px)) 28px 30px; align-items:flex-start; }
  .auth-card { margin:auto; width:min(380px,100%); }
  .auth-top { top:calc(12px + env(safe-area-inset-top)); left:20px; right:20px; }
  .auth-logo { width:88px; height:88px; border-radius:24px; }
  .auth-card h1 { font-size:30px; margin:16px 0 28px; }
  .auth-field { height:58px; border-radius:16px; margin-bottom:16px; }
  .auth-form .btn.primary { min-height:52px; border-radius:16px; }
}
