@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap");

:root {
  --wx-green: #06ae56;
  --wx-green-hover: #059a4c;
  --wx-green-soft: rgba(6, 174, 86, 0.1);
  --wx-green-ring: rgba(6, 174, 86, 0.22);
  --chat-bg: #ededed;
  --header-bg: rgba(255, 255, 255, 0.92);
  --sidebar-bg: #f8fffb;
  --sidebar-text: #181818;
  --panel-bg: rgba(6, 174, 86, 0.06);
  --bot-bubble: #ffffff;
  --user-bubble: #06ae56;
  --user-bubble-text: #ffffff;
  --primary: #06ae56;
  --primary-hover: #059a4c;
  --primary-soft: rgba(6, 174, 86, 0.12);
  --border: rgba(0, 0, 0, 0.06);
  --muted: #8e8e93;
  --text: #181818;
  --text-secondary: #3a3a3c;
  --surface: #ffffff;
  --shadow-soft: 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --blur-glass: saturate(180%) blur(20px);
  --avatar-bot: linear-gradient(145deg, #06ae56, #059a4c);
  --avatar-user: linear-gradient(145deg, #34c759, #06ae56);
  --wx-font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --wx-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--wx-font);
  background: var(--chat-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0;
}

body.home-page {
  background: #f4f6f5;
}
.hidden {
  display: none !important;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.desktop-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.info-panel {
  display: none;
}

/* ── Login modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: modalFadeIn 0.22s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-modal-card {
  width: min(100%, 400px);
  background: var(--surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: modalSlideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.login-modal-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 52px 16px 18px;
  background: var(--surface);
  color: var(--text);
  border-bottom: 0.5px solid var(--border);
}

.login-modal-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: none;
}

.login-modal-banner h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.login-modal-banner p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.login-modal-banner .auth-subtitle-highlight {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  color: #047a3d;
  background: linear-gradient(135deg, rgba(6, 174, 86, 0.14), rgba(149, 236, 105, 0.1));
  border: 1px solid rgba(6, 174, 86, 0.28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.login-modal-banner .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(120, 120, 128, 0.12);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s ease;
}

.login-modal-banner .modal-close:hover {
  background: rgba(120, 120, 128, 0.2);
}

.login-modal-title-wrap {
  flex: 1;
  min-width: 0;
}

.login-modal-body {
  padding: 18px 18px 16px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  padding: 2px;
  border-radius: 9px;
  background: rgba(118, 118, 128, 0.12);
}

.auth-tab {
  flex: 1;
  border: none;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.auth-tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 1px rgba(0, 0, 0, 0.04);
}

.auth-tab:hover:not(.active) {
  color: #374151;
}

.login-field {
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-input-wrap:focus-within {
  border-color: rgba(6, 174, 86, 0.45);
  background: #fff;
  box-shadow: 0 0 0 3px var(--wx-green-soft);
}
.login-input-icon {
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  font-size: 0.9rem;
  color: #9ca3af;
  user-select: none;
}

.login-input-wrap input {
  flex: 1;
  min-width: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: #191919;
  padding: 10px 0;
  font: inherit;
  font-size: 0.92rem;
}

.login-input-wrap input::placeholder {
  color: #b0b7c3;
}

.login-input-wrap input:focus {
  outline: none;
}

.login-submit-btn {
  width: 100%;
  margin-top: 6px;
  min-height: 46px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}

.login-submit-btn:hover:not(:disabled) {
  transform: none;
  background: var(--primary-hover);
  box-shadow: none;
}

.login-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

.login-modal-tip {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f3f4f6;
  font-size: 0.76rem;
  line-height: 1.55;
  color: #6b7280;
  text-align: center;
}

/* legacy modal classes (admin etc.) */
.modal-card {
  width: min(100%, 360px);
  background: #fff;
  border-radius: 12px;
  padding: 18px 16px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f3f3f3;
  color: #666;
  cursor: pointer;
}

.modal-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.modal-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: #555;
}

.modal-label input {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: #191919;
  margin: 0;
}

.modal-label input:focus {
  outline: 2px solid rgba(7, 193, 96, 0.35);
  border-color: rgba(0, 122, 255, 0.35);
}

.modal-submit {
  margin-top: 4px;
}

.header-action-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease;
}

.header-action-btn:hover {
  background: var(--primary-hover);
}

.header-action-btn-muted {
  background: rgba(120, 120, 128, 0.12);
  color: var(--text);
  border: none;
}

.header-action-btn-muted:hover {
  background: rgba(120, 120, 128, 0.18);
}

/* 人工客服按钮 — 与 embed/widget.css .human-support-btn 一致 */
.human-support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 9px 15px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #12c46e 0%, #06ae56 52%, #059a4c 100%);
  box-shadow:
    0 4px 14px rgba(6, 174, 86, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
  white-space: nowrap;
}

.human-support-btn:hover {
  filter: brightness(1.06);
  box-shadow:
    0 6px 18px rgba(6, 174, 86, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.human-support-btn:active {
  transform: scale(0.97);
}

.human-support-btn__icon {
  flex-shrink: 0;
}

.human-support-btn--header {
  animation: human-support-glow 2.8s ease-in-out infinite;
}

.human-support-btn--composer {
  width: 100%;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 0.9rem;
  box-shadow:
    0 6px 16px rgba(6, 174, 86, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.human-support-btn.hidden {
  display: none;
}

.human-support-btn.return-ai-btn {
  background: rgba(6, 174, 86, 0.1);
  color: var(--green, #06ae56);
  border: 1px solid rgba(6, 174, 86, 0.28);
  box-shadow: none;
  animation: none;
}

.human-support-btn.return-ai-btn:hover {
  filter: none;
  background: rgba(6, 174, 86, 0.16);
  box-shadow: none;
}

.composer-human-bar {
  padding: 0 12px 8px;
  flex-shrink: 0;
}

@keyframes human-support-glow {
  0%,
  100% {
    box-shadow:
      0 4px 14px rgba(6, 174, 86, 0.42),
      inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }
  50% {
    box-shadow:
      0 4px 18px rgba(6, 174, 86, 0.58),
      0 0 0 3px rgba(6, 174, 86, 0.14),
      inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }
}

.dev-link-inline {  margin-left: 8px;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
}

.dev-link-inline:hover,
.dev-link-inline.active {
  color: var(--primary);
}

/* ── Sidebar (removed from layout; styles kept for legacy) ── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 40;
  pointer-events: none;
}

.sidebar-overlay.visible {
  display: block;
  pointer-events: auto;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-close {
  display: none;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--avatar-bot);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.brand p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
}

.panel {
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.panel h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.panel-hint {
  margin: 0 0 12px;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

.login-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
}

.login-tag.online {
  background: rgba(7, 193, 96, 0.2);
  color: #7dffb0;
}

.sidebar label {
  display: block;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 10px;
}

.sidebar input,
.sidebar select,
.sidebar textarea {
  width: 100%;
  margin-top: 6px;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
}

.sidebar input::placeholder,
.sidebar textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.sidebar input:focus,
.sidebar select:focus,
.sidebar textarea:focus {
  outline: 2px solid rgba(7, 193, 96, 0.45);
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  font-weight: 600;
  margin-top: 4px;
}

.btn.primary:hover {
  background: var(--primary-hover);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 100%;
  font-weight: 600;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn.secondary.subtle {
  margin-top: 8px;
  font-size: 0.82rem;
  padding: 8px 12px;
}

.subscribe-panel .sidebar-input {
  width: 100%;
  color: #f5f5f5;
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.16);
}

.subscribe-panel .sidebar-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.subscribe-panel .sidebar-input:focus {
  outline: 2px solid rgba(7, 193, 96, 0.45);
  border-color: rgba(7, 193, 96, 0.55);
}

.sidebar-copy-row {
  margin-top: 4px;
}

.sidebar-copy-row .copy-field-btn {
  min-width: 64px;
}

.header-copy-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 0.82rem;
  font-weight: 700;
}

.header-copy-btn:hover {
  background: #d4f5e0;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.quick-pill {
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.chip {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
}

.chip:hover {
  background: rgba(7, 193, 96, 0.25);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 8px;
}

.dev-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
}

.dev-link:hover {
  color: rgba(255, 255, 255, 0.6);
}

.dev-link.active {
  color: #7dffb0;
}

/* ── Chat main ── */

.chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  background: var(--chat-bg);
  position: relative;
  overflow: hidden;
}

.chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--header-bg);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-bottom: 0.5px solid var(--border);
}

.header-spacer {
  flex: 1;
}

.menu-btn {
  display: none;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--avatar-bot);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--wx-green-ring);
}
.header-meta {
  min-width: 0;
}

.header-meta h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.header-status {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-status.ok {
  color: var(--primary);
}

.header-status.ok::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wx-green);
  box-shadow: 0 0 0 2px var(--wx-green-soft);
  margin-right: 4px;
  vertical-align: middle;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ── Messages ── */

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.time-divider {
  display: flex;
  justify-content: center;
  margin: 6px 0 14px;
}

.time-divider span {
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(120, 120, 128, 0.12);
  padding: 4px 12px;
  border-radius: 999px;
}

.msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  animation: msgIn 0.22s ease;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg.user {
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.msg.bot .msg-avatar {
  background: var(--avatar-bot);
}

.msg.user .msg-avatar {
  background: var(--avatar-user);
}

.msg-body {
  max-width: min(72%, 520px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg.user .msg-body {
  align-items: flex-end;
}

.bubble {
  padding: 10px 14px;
  line-height: 1.5;
  font-size: 0.94rem;
  word-break: break-word;
  position: relative;
  box-shadow: none;
}

.msg.bot .bubble {
  background: var(--bot-bubble);
  color: var(--text);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.msg.user .bubble {
  background: var(--user-bubble);
  color: var(--user-bubble-text);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}

.msg.agent .msg-avatar {
  background: linear-gradient(135deg, #34c759, #248a3d);
}

.msg.agent .bubble {
  background: #e8f7ed;
  color: #1d4d2b;
  border: 1px solid rgba(52, 199, 89, 0.25);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
}

.bubble-rich {
  background: var(--surface) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-soft);
  border: 0.5px solid var(--border);
}

.bubble a.inline-link {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
  word-break: break-all;
}

.bubble a.inline-link:hover {
  text-decoration: underline;
}

.bubble-formatted {
  padding: 12px 14px;
  overflow: hidden;
  min-width: 0;
}

.msg-formatted {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-formatted .msg-paragraph {
  margin: 0;
  line-height: 1.6;
}

.msg-formatted .msg-paragraph + .msg-paragraph {
  margin-top: 2px;
}

.msg-highlight {
  color: var(--primary);
  font-weight: 600;
  background: rgba(7, 193, 96, 0.08);
  border-radius: 4px;
  padding: 0 2px;
}

.msg-list {
  margin: 0;
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1.55;
}

.msg-list li {
  padding-left: 2px;
}

.msg-tips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(7, 193, 96, 0.06);
  border: 0.5px solid rgba(7, 193, 96, 0.15);
}

.msg-tip-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.msg-tip-tag {
  flex-shrink: 0;
  min-width: 52px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.6;
}

.msg-tip-value {
  color: #333;
  padding-top: 1px;
}

.msg-rich-html {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.msg-rich-html p {
  margin: 0 0 8px;
  line-height: 1.6;
}

.msg-rich-html p:last-child {
  margin-bottom: 0;
}

.msg-rich-html ul,
.msg-rich-html ol {
  margin: 0 0 8px;
  padding-left: 1.2em;
}

.msg-rich-html .msg-rich-media {
  margin: 0 0 8px;
  overflow: hidden;
}

.msg-rich-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(360px, 56vh);
  object-fit: contain;
  border-radius: 10px;
  margin: 6px 0;
  background: rgba(0, 0, 0, 0.04);
}

.msg-rich-video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(280px, 48vh);
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 10px;
  margin: 6px 0;
  background: #000;
}

.guide-text-intro {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(6, 174, 86, 0.12), rgba(149, 236, 105, 0.08));
  border: 1px solid rgba(6, 174, 86, 0.3);
}

.guide-text-intro-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #047a3d;
}

.guide-text-intro-icon {
  font-size: 1rem;
  line-height: 1;
}

.guide-text-intro-body {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  font-weight: 600;
  color: #1a3d2a;
}

.guide-emphasis-block {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.14), rgba(255, 204, 0, 0.1));
  border: 1.5px solid rgba(230, 126, 0, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.guide-emphasis-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  color: #b45309;
}

.guide-emphasis-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(230, 126, 0, 0.18);
  font-size: 0.82rem;
  font-weight: 700;
}

.guide-emphasis-body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  font-weight: 700;
  color: #7c2d12;
}

.guide-emphasis-body strong {
  color: #9a3412;
}

.guide-video-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(6, 174, 86, 0.28);
}

.guide-video-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  color: var(--wx-green-hover, #059a4c);
}

.guide-video-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(6, 174, 86, 0.14);
  font-size: 0.72rem;
}

.guide-video-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.8rem;
}

.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.choice-btn {
  display: block;
  width: 100%;
  border: 0.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.choice-btn-recommended {
  border-color: rgba(6, 174, 86, 0.45);
  background: linear-gradient(135deg, rgba(6, 174, 86, 0.12), rgba(149, 236, 105, 0.08));
  color: #047a3d;
  font-weight: 650;
}

.choice-btn:hover:not(:disabled) {
  background: var(--wx-green-soft);
  border-color: rgba(6, 174, 86, 0.35);
}

.choice-btn-recommended:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(6, 174, 86, 0.18), rgba(149, 236, 105, 0.12));
  border-color: rgba(6, 174, 86, 0.55);
}
.choice-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.choice-btn.is-used,
.choice-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.action-import-clash {
  background: rgba(24, 144, 255, 0.12);
  color: #1677ff;
}

.action-import-clash:hover {
  background: rgba(24, 144, 255, 0.2);
  color: #0958d9;
}

.action-import-shadowrocket {
  background: rgba(114, 46, 209, 0.12);
  color: #722ed1;
}

.action-import-shadowrocket:hover {
  background: rgba(114, 46, 209, 0.2);
  color: #531dab;
}

.action-copy {
  background: var(--wx-green-soft);
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--wx-green-soft);
  border: none;
  color: var(--primary);  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.action-link:hover {
  background: rgba(6, 174, 86, 0.18);
  border-color: transparent;
  color: var(--primary-hover);
}
.action-link:active {
  transform: scale(0.98);
}

.action-humanSupport {
  background: linear-gradient(135deg, #12c46e 0%, #06ae56 100%);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(6, 174, 86, 0.28);
}

.action-humanSupport:hover {
  background: linear-gradient(135deg, #14d077 0%, #07b85c 100%);
  border-color: transparent;
  color: #fff;
}

.quick-pill-human {
  background: var(--wx-green-soft);
  border-color: rgba(6, 174, 86, 0.28);
  color: var(--wx-green-hover);
  font-weight: 600;
}

.quick-pill-human:hover {
  background: rgba(6, 174, 86, 0.18);
}
.msg.user .action-link {
  background: #fff;
}

.copy-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  max-width: min(100%, 420px);
}

.copy-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.copy-field-label {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0 4px;
}

.copy-field-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.copy-field-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.78rem;
  color: #333;
  background: #fafafa;
}

.copy-field-input:focus {
  outline: 2px solid rgba(7, 193, 96, 0.35);
  border-color: rgba(0, 122, 255, 0.35);
}

.copy-field-btn {
  flex-shrink: 0;
  min-width: 72px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  color: var(--primary);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.copy-field-btn:hover {
  background: var(--primary-soft);
  border-color: rgba(0, 122, 255, 0.35);
  color: var(--primary-hover);
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.msg-time {
  font-size: 0.68rem;
  color: var(--muted);
  padding: 0 4px;
}

/* ── Rich help cards ── */

.msg.bot .msg-body:has(.bubble-rich) {
  max-width: min(92%, 440px);
}

.bubble-rich {
  padding: 12px 12px 10px;
}

.bubble-lead {
  margin: 0 0 10px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

.bubble-foot {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  font-size: 0.78rem;
  color: #888;
  line-height: 1.5;
}

.service-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fafafa;
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-left: 4px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.service-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.service-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.service-card-body strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: #191919;
  margin-bottom: 2px;
}

.service-card-body p {
  margin: 0;
  font-size: 0.78rem;
  color: #666;
  line-height: 1.45;
}

.service-card.tone-blue {
  background: #f0f7ff;
  border-left-color: #4facfe;
}

.service-card.tone-blue .service-card-icon {
  background: linear-gradient(135deg, #4facfe, #00c6fb);
}

.service-card.tone-green {
  background: #f0fff4;
  border-left-color: #43e97b;
}

.service-card.tone-green .service-card-icon {
  background: linear-gradient(135deg, #43e97b, #38f9d7);
  color: #0b4d2c;
}

.service-card.tone-apple {
  background: #f5f6f7;
  border-left-color: #596164;
}

.service-card.tone-apple .service-card-icon {
  background: linear-gradient(135deg, #868f96, #596164);
}

.service-card.tone-orange {
  background: #fff8f0;
  border-left-color: #f7971e;
}

.service-card.tone-orange .service-card-icon {
  background: linear-gradient(135deg, #f7971e, #ffd200);
  color: #5a3e00;
}

.service-card.tone-purple {
  background: #f8f0ff;
  border-left-color: #a18cd1;
}

.service-card.tone-purple .service-card-icon {
  background: linear-gradient(135deg, #a18cd1, #fbc2eb);
  color: #4a3066;
}

.welcome-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: #888;
  line-height: 1.5;
}

.bubble-intro {
  margin: 8px 0 6px;
  font-size: 0.88rem;
  color: #555;
  line-height: 1.55;
}

.welcome-text {
  line-height: 1.6;
}

.welcome-quick-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.welcome-quick-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: #888;
  line-height: 1.4;
}

.welcome-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.welcome-chip {
  flex: 0 0 auto;
  border: 0.5px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.welcome-chip:hover {
  background: var(--wx-green-soft);
  border-color: rgba(6, 174, 86, 0.35);
  color: var(--primary);
}

.welcome-chip:active {
  transform: scale(0.97);
}

/* ── Member status bars ── */

.status-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  border-left: none;
}

.status-bar-label {
  font-size: 0.8rem;
  color: #666;
  flex-shrink: 0;
}

.status-bar-value {
  font-size: 0.86rem;
  font-weight: 600;
  color: #191919;
  text-align: right;
  word-break: break-word;
}

.status-bar.tone-blue {
  background: linear-gradient(90deg, rgba(79, 172, 254, 0.16), rgba(79, 172, 254, 0.05));
  border-left-color: #4facfe;
}

.status-bar.tone-green {
  background: linear-gradient(90deg, rgba(7, 193, 96, 0.16), rgba(7, 193, 96, 0.05));
  border-left-color: var(--primary);
}

.status-bar.tone-orange {
  background: linear-gradient(90deg, rgba(247, 151, 30, 0.16), rgba(247, 151, 30, 0.05));
  border-left-color: #f7971e;
}

.status-bar.tone-purple {
  background: linear-gradient(90deg, rgba(161, 140, 209, 0.18), rgba(161, 140, 209, 0.06));
  border-left-color: #a18cd1;
}

.status-bar.tone-red {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.14), rgba(239, 68, 68, 0.05));
  border-left-color: #ef4444;
}

.status-bar.tone-red .status-bar-value {
  color: #b91c1c;
}

.status-bar.tone-green .status-bar-value {
  color: #047857;
}

/* ── Apple ID panel ── */

.apple-id-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apple-id-copy-fields {
  margin-top: 2px;
}

.apple-id-warning {
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff4e5 0%, #ffe8cc 100%);
  border: 1px solid #ffb84d;
  box-shadow: 0 4px 14px rgba(255, 152, 0, 0.12);
}

.apple-id-warning strong {
  display: block;
  font-size: 0.95rem;
  color: #b45309;
  margin-bottom: 6px;
}

.apple-id-warning p {
  margin: 0 0 10px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #7c4a03;
}

.apple-id-buy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6b00, #ff9800);
  color: #fff !important;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 6px 16px rgba(255, 107, 0, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.apple-id-buy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(255, 107, 0, 0.34);
}

.apple-id-video-block {
  padding: 12px;
  border-radius: 12px;
  background: #f7f9fc;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.apple-id-video-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.88rem;
  color: #191919;
}

.apple-id-video-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 0.62rem;
}

.apple-id-video {
  width: 100%;
  max-height: 240px;
  border-radius: 10px;
  background: #000;
}

.apple-id-video-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
}

.apple-id-video-link:hover {
  text-decoration: underline;
}

/* Typing indicator */

.msg.typing .bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  min-width: 56px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b2b2b2;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ── Composer ── */

.composer {
  flex-shrink: 0;
  background: rgba(249, 249, 249, 0.86);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-top: 0.5px solid var(--border);
  padding: 10px 12px calc(10px + var(--safe-bottom));
}

.quick-pill {
  background: var(--surface);
  color: var(--primary);
  border: 0.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  box-shadow: none;
}

.quick-pill:hover {
  background: var(--primary-soft);
  border-color: rgba(0, 122, 255, 0.2);
}

.input-wrap {
  flex: 1;
  background: var(--surface);
  border-radius: 22px;
  border: 0.5px solid var(--border);
  min-height: 52px;
  display: flex;
  align-items: center;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.send-btn {
  flex-shrink: 0;
  min-width: 64px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--wx-green-ring);
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}
.send-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.quick-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.quick-bar::-webkit-scrollbar {
  display: none;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.live-media-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.live-chat-composer-panel {
  display: none;
}

.live-chat-composer-panel.is-visible {
  display: block;
}

.live-chat-composer-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 6px;
}

.live-chat-tool-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.live-chat-tool-btn svg {
  width: 22px;
  height: 22px;
}

.live-chat-tool-btn:hover:not(:disabled) {
  background: rgba(0, 122, 255, 0.08);
  color: var(--primary);
}

.live-chat-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.live-chat-recalled {
  color: #888;
  font-size: 0.85rem;
  font-style: italic;
}

.msg.is-recalled .bubble,
.msg.is-recalled .live-chat-media-bubble {
  background: #ececec !important;
  color: #888 !important;
  box-shadow: none;
}

.live-chat-media-bubble {
  padding: 6px;
}

.live-chat-media-img,
.live-chat-media-video {
  display: block;
  max-width: min(100%, 320px);
  border-radius: 12px;
}

.live-chat-media-video {
  max-height: 240px;
  background: #000;
}

.composer textarea {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: none;
  resize: none;
  margin: 0;
  padding: 12px 16px;
  min-height: 52px;
  max-height: 160px;
  font-size: 16px;
  line-height: 1.5;
  field-sizing: content;
}

.composer textarea:focus {
  outline: none;
}

.send-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.composer-hint {
  margin: 6px 2px 0;
  font-size: 0.68rem;
  color: #b2b2b2;
  text-align: center;
}

/* ── Log panel ── */

.log-panel {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #1e2422;
  color: #d4e8dc;
  height: 168px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-radius: 14px 14px 0 0;
  margin: 0 12px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  animation: log-slide-up 0.28s var(--wx-ease);
}

@keyframes log-slide-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #252525;
}

.log-toolbar-left,
.log-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-title {
  font-size: 0.82rem;
  font-weight: 600;
}

.log-status {
  font-size: 0.72rem;
  color: #888;
}

.log-status.live {
  color: #7dffb0;
}

.log-status.error {
  color: #ff8a8a;
}

.log-filter {
  width: auto;
  min-width: 88px;
  margin: 0;
  padding: 5px 8px;
  font-size: 0.72rem;
}

.btn-log {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e5e5e5;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.72rem;
  cursor: pointer;
}

.log-viewer {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.72rem;
  line-height: 1.45;
}

.log-line {
  padding: 2px 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-line.level-ERROR {
  color: #ff8a8a;
}

.log-line.level-WARN {
  color: #ffd666;
}

.log-line.level-DEBUG {
  color: #888;
}

.log-line.level-INFO {
  color: #ccc;
}

/* ── Mobile ── */

@media (max-width: 860px) {
  .desktop-shell {
    flex: 1;
    min-height: 0;
    height: 100%;
  }

  .msg.user .msg-avatar {
    display: none;
  }

  .msg.user .msg-body {
    max-width: 88%;
  }

  .msg.bot .msg-body {
    max-width: 88%;
  }

  .chat-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .header-action-btn {
    padding: 7px 12px;
    font-size: 0.8rem;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .login-modal-card {
    width: 100%;
    max-height: min(92dvh, 92vh);
    border-radius: 18px 18px 0 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
  }

  .login-modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-card {
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* ── Desktop ── */

@media (min-width: 861px) {
  body.home-page {
    background:
      radial-gradient(circle at 12% 8%, rgba(6, 174, 86, 0.12), transparent 42%),
      radial-gradient(circle at 88% 92%, rgba(149, 236, 105, 0.15), transparent 40%),
      #f4f6f5;
  }

  .app {
    align-items: center;
    justify-content: center;
    padding: 28px 24px;
  }

  .desktop-shell {
    flex-direction: row;
    width: min(1120px, 100%);
    height: min(860px, calc(100vh - 56px));
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    background: var(--surface);
  }

  .info-panel {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 280px;
    padding: 28px 24px;
    color: var(--text);
    background: linear-gradient(180deg, #f8fffb 0%, #ffffff 55%, #f5f5f5 100%);
    border-right: 1px solid var(--border);
  }

  .info-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
  }

  .info-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--wx-green), var(--wx-green-hover));
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 6px 18px var(--wx-green-ring);
    flex-shrink: 0;
  }

  .info-brand h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  .info-brand p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .info-brand p::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--wx-green);
    box-shadow: 0 0 0 2px var(--wx-green-soft);
  }

  .info-lead {
    margin: 0 0 18px;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-secondary);
  }

  .info-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .info-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
  }

  .info-list li:hover {
    border-color: rgba(6, 174, 86, 0.25);
    box-shadow: var(--shadow-soft);
  }

  .info-list li::before {
    display: none;
  }

  .info-list-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--wx-green-soft);
    color: var(--wx-green);
    font-size: 0.72rem;
    font-weight: 700;
    display: grid;
    place-items: center;
  }

  .info-foot {
    margin-top: auto;
    padding-top: 20px;
    font-size: 0.76rem;
    color: var(--muted);
  }
  .chat {
    flex: 1;
    min-width: 0;
    background: var(--chat-bg);
  }

  .chat-header {
    padding: 16px 22px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border-bottom: 0.5px solid var(--border);
  }

  .header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .header-meta h2 {
    font-size: 1.05rem;
  }

  .header-status {
    font-size: 0.78rem;
  }

  .header-action-btn {
    padding: 8px 18px;
    border-radius: 10px;
  }

  .messages {
    padding: 22px 24px 12px;
  }

  .msg-body {
    max-width: min(68%, 520px);
  }

  .bubble {
    font-size: 0.94rem;
  }

  .composer {
    padding: 14px 22px 18px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border-top: 0.5px solid var(--border);
  }

  .quick-bar {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 8px 10px;
    padding-bottom: 12px;
  }

  .quick-pill {
    padding: 6px 14px;
    font-size: 0.8rem;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  }

  .quick-pill:hover {
    border-color: rgba(6, 174, 86, 0.28);
    transform: translateY(-1px);
  }
  .input-wrap {
    min-height: 52px;
    border-radius: 12px;
  }

  .composer textarea {
    padding: 12px 16px;
    min-height: 52px;
    max-height: 180px;
    font-size: 16px;
  }

  .send-btn {
    min-width: 76px;
    height: 48px;
    border-radius: 10px;
    font-size: 0.92rem;
    box-shadow: 0 4px 12px var(--wx-green-ring);
  }

  .human-support-btn--header {
    padding: 10px 16px;
  }
  .composer-hint {
    text-align: left;
    font-size: 0.72rem;
    color: #aaa;
  }

  .modal-overlay {
    padding: 24px;
  }

  .modal-card {
    width: min(100%, 420px);
    padding: 22px 22px 20px;
    border-radius: 16px;
  }

  .log-panel {
    height: 240px;
  }

  .copy-toast {
    bottom: calc(108px + var(--safe-bottom));
  }
}

@media (min-width: 1200px) {
  .app {
    padding: 36px 32px;
  }

  .desktop-shell {
    width: min(1180px, 100%);
    height: min(880px, calc(100vh - 72px));
  }

  .info-panel {
    width: 320px;
    padding: 36px 32px;
  }
}
