/* Mobile chat surface shared by the browser and WeChat web-view. */
.mobile-chat-page, .mobile-agents-page {
  /* Colors inherit the personal-center theme from mobile.css. */
  background: var(--paper); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.mobile-chat-page { margin: 0; overflow: hidden; }
.mobile-chat-page [hidden] { display: none !important; }
.mobile-chat-page button, .mobile-chat-page a { touch-action: manipulation; }
.mobile-chat-page button { cursor: pointer; font-family: inherit; }
.mobile-chat-page button:focus-visible, .mobile-chat-page a:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.mobile-chat-page svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mobile-chat-page .chat-shell { width: 100%; max-width: 800px; margin: auto; height: var(--chat-height, 100dvh); position: relative; }
.mobile-chat-page .mobile-topbar { padding: calc(8px + env(safe-area-inset-top)) 14px 8px; gap: 6px; border: 0; background: var(--paper); align-items: center; }
.mobile-chat-page .icon-button { width: 44px; min-width: 44px; height: 44px; padding: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); border: 0; border-radius: 50%; background: transparent; }
.mobile-chat-page .icon-button:active { background: var(--panel-soft); }
.mobile-chat-page .chat-topbar-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; background: none; border: 0; text-align: left; padding: 8px 4px; color: var(--ink); }
.chat-topbar-main strong { font-size: 19px; font-weight: 650; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mobile-chat-page .chat-topbar-main svg { width: 17px; height: 17px; color: var(--muted); }
.mobile-chat-page .messages { padding: 24px 22px 16px; overscroll-behavior: contain; scroll-behavior: auto; }
.mobile-chat-page .messages:has(.chat-welcome) { display: flex; flex-direction: column; }
.chat-welcome { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 16px 0 70px; }
.welcome-mark { width: 52px; height: 52px; display: grid; place-items: center; background: var(--panel-soft); border-radius: 18px; margin-bottom: 24px; }
.mobile-chat-page .welcome-mark svg { width: 28px; height: 28px; }
.chat-welcome h1 { margin: 0; font-size: 27px; font-weight: 600; letter-spacing: -.8px; }
.chat-welcome p { margin: 12px 0 28px; color: var(--muted); font-size: 14px; }
.welcome-prompts { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; max-width: 340px; }
.mobile-chat-page .welcome-prompts button { padding: 10px 15px; min-height: 42px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); color: var(--muted); font-size: 13px; }
.mobile-chat-page .welcome-prompts button:active { background: var(--panel-soft); }
.mobile-chat-page .message { margin-bottom: 26px; }
.mobile-chat-page .bubble { font-size: 16px; line-height: 1.85; color: var(--ink); overflow-wrap: anywhere; }
.mobile-chat-page .message.assistant .bubble { max-width: 100%; border: 0; padding: 0; border-radius: 0; background: transparent; }
:root .mobile-chat-page .message.user .bubble { max-width: 86%; padding: 10px 17px; background: var(--brand-soft); color: var(--ink) !important; border: 0; border-radius: 22px; font-weight: 400; }
.mobile-chat-page .message.assistant .typing-bubble { color: var(--muted); font-size: 13px; }
.mobile-chat-page .composer { padding: 4px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--paper); border: 0; }
.mobile-chat-page .composer-box { border: 1px solid var(--line); box-shadow: 0 2px 8px #00000005; border-radius: 28px; padding: 5px 8px 7px; background: var(--panel); }
.mobile-chat-page .composer textarea { display: block; box-sizing: border-box; min-height: 48px; max-height: 144px; padding: 14px 10px 6px; border: 0; border-radius: 0; background: transparent; font: inherit; font-size: 16px; line-height: 24px; }
.mobile-chat-page .composer textarea::placeholder { color: var(--muted); }
.mobile-chat-page .composer-actions { margin-top: 0; gap: 2px; }
.composer-send-tools { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.mobile-chat-page .context-button { min-width: 0; max-width: 44%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; background: none; border: 0; padding: 10px 6px; color: var(--muted); font-size: 12px; }
.mobile-chat-page .send-button { width: 36px; min-width: 36px; height: 36px; border: 0; border-radius: 50%; padding: 7px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); }
.mobile-chat-page .send-button svg { width: 22px; height: 22px; }
:root .mobile-chat-page .send-button:disabled { background: var(--line-strong); color: var(--muted) !important; opacity: 1; cursor: default; }
.mobile-chat-page .chat-status { max-width: none !important; text-align: center; color: var(--muted); font-size: 11px; line-height: 18px; min-height: 0; padding: 0 10px 4px; white-space: normal !important; }
.chat-status:empty { display: none; }
.mobile-chat-page .sheet { z-index: 85; max-width: 800px; margin: auto; padding-bottom: env(safe-area-inset-bottom); border-radius: 24px 24px 0 0; border: 0; box-shadow: none; background: var(--paper); }
.mobile-chat-page .sheet-head { padding: 22px 20px 16px; }
.mobile-chat-page .sheet-head button { background: var(--brand-soft); color: var(--muted); border: 0; border-radius: 20px; padding: 8px 13px; }
.panel-backdrop { position: fixed; inset: 0; background: #0005; z-index: 80; }
.attachment-tools { display: flex; gap: 12px; padding: 8px 20px 20px; }
.mobile-chat-page .attachment-tools button { flex: 1; min-height: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: var(--panel-soft); color: var(--ink); border: 0; border-radius: 16px; font-size: 13px; }
.mobile-chat-page .tools-row { padding: 17px 22px; display: block; width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--paper); text-align: left; color: var(--ink); font-size: 15px; }
.drawer-overlay { position: fixed; inset: 0; z-index: 95; background: #0005; }
.chat-drawer { width: min(86vw, 340px); height: 100%; box-sizing: border-box; padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); background: var(--panel); display: flex; flex-direction: column; animation: drawer-in .18s ease-out; }
.drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 0 0 10px 10px; font-size: 20px; }
.mobile-chat-page .drawer-new { display: flex; align-items: center; gap: 14px; padding: 14px; background: transparent; border: 0; color: var(--ink); font-size: 22px; }
.drawer-new span { font-size: 15px; }
#historySearch { width: 100%; padding: 12px 15px; font: inherit; font-size: 14px; color: var(--ink); background: var(--panel-soft); border: 0; border-radius: 12px; margin: 8px 0 22px; }
.drawer-section-label { font-size: 12px; color: var(--muted); padding: 0 12px 10px; }
.history-list { flex: 1; min-height: 0; overflow: auto; }
.mobile-chat-page .history-item { width: 100%; display: block; padding: 13px 12px; border: 0; border-radius: 10px; text-align: left; background: transparent; color: var(--ink); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-chat-page .history-item.active { background: var(--brand-soft); }
.history-empty { padding: 16px 12px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.drawer-manage { display: flex; justify-content: space-between; padding: 18px 12px; color: var(--ink); text-decoration: none; font-size: 13px; }
.drawer-nav { display: flex; border-top: 1px solid var(--line); padding: 16px 4px; justify-content: space-around; }
.drawer-nav a { color: var(--muted); text-decoration: none; font-size: 12px; padding: 6px; }
.drawer-profile { display: flex; align-items: center; gap: 12px; padding: 8px 10px 0; }
.profile-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); font-size: 14px; }
.drawer-profile strong { display: block; font-size: 14px; font-weight: 500; }
.drawer-profile small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.mobile-agents-page .ah-block { border: 0; background: var(--paper); }
.mobile-agents-page .ah-row { padding: 16px 13px; }
.mobile-agents-page .ah-head { background: var(--panel-soft); border-radius: 12px; }
.mobile-agents-page .ah-topbar { padding-bottom: 24px; }
.agents-start { display: block; margin: 0 16px 20px; padding: 15px; border-radius: 16px; background: var(--brand); color: var(--brand-ink); text-align: center; text-decoration: none; }
@keyframes drawer-in { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .chat-drawer { animation: none; } }
@media (max-height: 560px) { .chat-welcome { padding: 8px 0; } .welcome-mark { display: none; } .chat-welcome p { margin: 8px 0 16px; } }

.mobile-chat-page .composer textarea:focus { box-shadow: none; }
