/* 嗡嗡 HR 助手 — Apple UI 风格 */
/* 参考 Apple Human Interface Guidelines: system colors, SF Pro, vibrancy */

/* Apple System Colors - Light */
[data-theme="light"] {
  --bg-base: #f2f2f7;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-chip: #e5e5ea;
  --bg-secondary: #f2f2f7;
  --accent: #007aff;
  --accent-dim: rgba(0, 122, 255, 0.12);
  --text-primary: #000000;
  --text-secondary: #3c3c43;
  --text-tertiary: #8e8e93;
  --text-quaternary: #aeaeb2;
  --border: rgba(60, 60, 67, 0.12);
  --separator: rgba(60, 60, 67, 0.29);
  --user-bubble: #007aff;
  --user-bubble-text: #ffffff;
  --assistant-bubble: #ffffff;
  --assistant-border: rgba(60, 60, 67, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --gray-1: #8e8e93;
  --gray-2: #aeaeb2;
  --gray-3: #c7c7cc;
  --gray-4: #d1d1d6;
  --gray-5: #e5e5ea;
  --gray-6: #f2f2f7;
}

/* Apple System Colors - Dark */
:root,
[data-theme="dark"] {
  --bg-base: #000000;
  --bg-surface: #1c1c1e;
  --bg-elevated: #2c2c2e;
  --bg-chip: #3a3a3c;
  --bg-secondary: #1c1c1e;
  --accent: #0a84ff;
  --accent-dim: rgba(10, 132, 255, 0.2);
  --text-primary: #ffffff;
  --text-secondary: #ebebf5;
  --text-tertiary: #8e8e93;
  --text-quaternary: #636366;
  --border: rgba(84, 84, 88, 0.5);
  --separator: rgba(84, 84, 88, 0.6);
  --user-bubble: #0a84ff;
  --user-bubble-text: #ffffff;
  --assistant-bubble: #2c2c2e;
  --assistant-border: rgba(84, 84, 88, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --gray-1: #8e8e93;
  --gray-2: #636366;
  --gray-3: #48484a;
  --gray-4: #3a3a3c;
  --gray-5: #2c2c2e;
  --gray-6: #1c1c1e;
}

/* Apple 风格暖色主题（保留琥珀，适配 Apple 设计语言）*/
[data-theme="amber"] {
  --bg-base: #1c1917;
  --bg-surface: #292524;
  --bg-elevated: #44403c;
  --bg-chip: #57534e;
  --bg-secondary: #292524;
  --accent: #f59e0b;
  --accent-dim: rgba(245, 158, 11, 0.18);
  --text-primary: #fafaf9;
  --text-secondary: #e7e5e4;
  --text-tertiary: #a8a29e;
  --text-quaternary: #78716c;
  --border: rgba(168, 162, 158, 0.3);
  --separator: rgba(168, 162, 158, 0.4);
  --user-bubble: #f59e0b;
  --user-bubble-text: #1c1917;
  --assistant-bubble: #292524;
  --assistant-border: rgba(168, 162, 158, 0.25);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.47;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.35s ease, color 0.25s ease;
}

/* ========== ChatGPT/KIMI 风格布局 ========== */
.app {
  display: flex;
  min-height: 100vh;
  width: 100%;
  transition: opacity 0.25s, visibility 0.25s;
}

/* 侧边栏 */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 0.5px solid var(--separator);
  transition: transform 0.2s, box-shadow 0.2s;
}

.sidebar-header {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 0.5px solid var(--separator);
}

.new-chat-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.new-chat-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.sidebar-close {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.sidebar-close:hover {
  background: var(--bg-chip);
  color: var(--text-primary);
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-item-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
  transition: background 0.2s;
}

.conv-item-wrap:hover {
  background: var(--bg-chip);
}

.conv-item {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item-wrap:hover .conv-item {
  color: var(--text-primary);
}

.conv-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s, background 0.2s;
}

.conv-item-wrap:hover .conv-delete {
  opacity: 1;
}

.conv-delete:hover {
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.12);
}

.conv-delete:focus {
  opacity: 1;
  outline: none;
}

.sidebar-footer {
  padding: 12px;
  border-top: 0.5px solid var(--separator);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logo-mini {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.sidebar-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sidebar-footer .theme-select,
.sidebar-footer .lang-switch,
.sidebar-footer .logout-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

/* 主区域 */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

body.app-locked .app {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

/* Apple 风格：简洁纯色背景，无几何图案 */
.app::before {
  display: none;
}

/* 导航栏：与页面融合，仅用细线分隔，无独立“框”感 */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-base);
  border-bottom: 0.5px solid var(--separator);
}

.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: var(--bg-chip);
  color: var(--text-primary);
}

.chat-title {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-select-compact,
.lang-switch-compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

/* 控件：轻量幽灵风格，不抢视觉 */
.theme-select {
  min-height: 32px;
  padding: 0 10px 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%238e8e93' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.theme-select:hover,
.theme-select:focus {
  color: var(--text-primary);
  background: var(--bg-chip);
  outline: none;
}

.lang-switch {
  min-height: 32px;
  padding: 0 10px;
  font-size: 14px;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.lang-switch:hover {
  color: var(--text-primary);
  background: var(--bg-chip);
}

.lang-switch [data-lang].active {
  color: var(--accent);
  font-weight: 600;
}

.lang-switch .sep {
  margin: 0 2px;
  opacity: 0.5;
}

.logout-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 14px;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.logout-btn:hover {
  color: var(--accent);
  background: var(--bg-chip);
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow-x: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 16px;
  min-width: 0;
}

.welcome {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
}

.welcome p {
  margin: 0 0 24px 0;
  font-size: 17px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.welcome .quick-chips {
  margin-top: 8px;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--bg-chip);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1), background 0.2s, color 0.2s;
}

.chip:hover {
  background: var(--accent-dim);
  color: var(--accent);
  transform: scale(1.02);
}

.chip:active {
  transform: scale(0.98);
}

.chip-emoji {
  font-size: 16px;
  line-height: 1;
}

.chip-text {
  white-space: nowrap;
}

/* 消息气泡 — Apple Messages 风格 */
.message {
  display: flex;
  margin-bottom: 16px;
  animation: fadeIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message.user {
  justify-content: flex-end;
}

.message .bubble {
  max-width: 82%;
  min-width: 0;
  width: fit-content;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 17px;
  line-height: 1.47;
  border: none;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

/* 气泡横向滚动条：窄屏下更易发现 */
.message .bubble::-webkit-scrollbar {
  height: 6px;
}

.message .bubble::-webkit-scrollbar-track {
  background: transparent;
}

.message .bubble::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 3px;
}

/* 用户消息：蓝色填充（类似 iMessage 发送） */
.message.user .bubble {
  background: var(--user-bubble);
  color: var(--user-bubble-text);
  border-bottom-right-radius: 6px;
}

/* 助手消息：灰色填充（类似 iMessage 接收）*/
.message.assistant .bubble {
  background: var(--assistant-bubble);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.message .bubble .bubble-content {
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  min-width: 0;
}

/* 富文本/自定义元素：强制约束在气泡内，防止溢出 */
.message .bubble .bubble-content > * {
  min-width: 0;
  max-width: 100%;
}

.message .bubble .bubble-content div,
.message .bubble .bubble-content section,
.message .bubble .bubble-content article {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.message .bubble .bubble-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 0.5em 0;
}

.message .bubble .bubble-content img.img-error {
  min-height: 60px;
  background: var(--bg-chip);
  padding: 1em;
}

.message .bubble .bubble-content svg {
  max-width: 100%;
  height: auto;
}


.message .bubble .bubble-content p {
  margin: 0 0 0.5em 0;
}

.message .bubble .bubble-content p:last-child {
  margin-bottom: 0;
}

.message .bubble .bubble-content ul,
.message .bubble .bubble-content ol {
  margin: 0.5em 0;
  padding-left: 1.25em;
}

.message .bubble .bubble-content li {
  margin: 0.2em 0;
}

.message .bubble .bubble-content h1,
.message .bubble .bubble-content h2,
.message .bubble .bubble-content h3 {
  margin: 0.75em 0 0.4em 0;
  font-size: 1em;
  font-weight: 600;
}

.message .bubble .bubble-content h1:first-child,
.message .bubble .bubble-content h2:first-child,
.message .bubble .bubble-content h3:first-child {
  margin-top: 0;
}

.message .bubble .bubble-content blockquote {
  margin: 0.5em 0;
  padding-left: 1em;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
}

.message .bubble a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 2px;
  transition: opacity 0.2s;
  overflow-wrap: break-word;
  word-break: break-all;
}

.message .bubble a:hover {
  text-decoration: underline;
  opacity: 0.9;
}

/* 用户气泡内的链接需要反色 */
.message.user .bubble a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: underline;
}

.message .bubble pre,
.message .bubble code {
  background: rgba(0, 0, 0, 0.15);
  padding: 0.2em 0.5em;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
  overflow-wrap: break-word;
  word-break: break-all;
  max-width: 100%;
  overflow-x: auto;
}

.message .bubble pre {
  white-space: pre-wrap;
  word-break: break-all;
}

/* 回复表格 — 参考图一：清晰边框、专业排版 */
.message .bubble table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  margin: 0.75em 0;
  border-radius: 8px;
  overflow: hidden;
  display: table;
  border: 1px solid var(--border);
}

.message .bubble .bubble-content table {
  display: table;
}

.message .bubble thead th {
  background: var(--bg-chip);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.message .bubble tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-secondary);
  line-height: 1.5;
}

.message .bubble tbody tr:last-child td {
  border-bottom: none;
}

.message .bubble tbody tr:nth-child(even) {
  background: rgba(128, 128, 128, 0.06);
}

[data-theme="dark"] .message .bubble tbody tr:nth-child(even),
[data-theme="amber"] .message .bubble tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.04);
}

.message .bubble tbody tr:hover {
  background: var(--accent-dim);
}

/* 表格等宽内容：在气泡内横向滚动 */
.message .bubble .bubble-content > table {
  min-width: 320px;
}

/* 用户气泡内的表格（若有）保持可读 */
.message.user .bubble thead th {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.95);
}

.message.user .bubble tbody td {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}

.message.user .bubble tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.08);
}

.message.user .bubble table {
  border-color: rgba(255, 255, 255, 0.25);
}

[data-theme="light"] .message .bubble pre,
[data-theme="light"] .message .bubble code {
  background: rgba(0, 0, 0, 0.06);
}

.message.typing .bubble::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1em;
  background: currentColor;
  margin-left: 3px;
  vertical-align: -0.15em;
  opacity: 0.8;
  animation: blink 0.7s ease-in-out infinite;
}

@keyframes blink {
  0%, 50% { opacity: 0.8; }
  51%, 100% { opacity: 0.25; }
}

.input-area {
  position: sticky;
  bottom: 0;
  padding: 16px 20px 24px;
  background: linear-gradient(to top, var(--bg-base) 60%, transparent);
}

/* ChatGPT/KIMI 风格大输入框 */
.input-form {
  max-width: 768px;
  margin: 0 auto;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 12px 16px 12px 24px;
  transition: box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

#input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  resize: none;
  outline: none;
  padding: 6px 0;
  min-height: 24px;
  max-height: 200px;
  color: var(--text-primary);
}

#input::placeholder {
  color: var(--text-tertiary);
}

.send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, opacity 0.2s;
}

.send-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.hidden {
  display: none !important;
}

/* 鉴权登录 — Apple 风格弹窗 */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-box {
  width: 100%;
  max-width: 340px;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.auth-title {
  margin: 0 0 8px 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-desc {
  margin: 0 0 20px 0;
  font-size: 15px;
  color: var(--text-secondary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-input {
  padding: 12px 16px;
  font-family: inherit;
  font-size: 17px;
  color: var(--text-primary);
  background: var(--bg-chip);
  border: none;
  border-radius: 10px;
  outline: none;
  transition: box-shadow 0.2s;
}

.auth-input:focus {
  box-shadow: 0 0 0 2px var(--accent);
}

.auth-submit {
  padding: 12px 20px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.auth-submit:hover {
  opacity: 0.9;
}

.auth-submit:active {
  opacity: 0.8;
}

.auth-error {
  margin: 12px 0 0 0;
  font-size: 15px;
  color: #ff3b30;
}

/* ========== 移动端适配 ========== */
/* 安全区域：刘海屏、底部横条 */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

.app {
  padding-left: 0;
  padding-right: 0;
}

.sidebar-backdrop {
  display: none;
}

/* 防止横向滚动 */
html, body {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }

  .sidebar-backdrop {
    display: none;
  }

  .sidebar.open ~ .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
  }

  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-toggle.sidebar-open {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .header {
    padding: 10px 16px;
  }

  .header-actions .theme-select-compact,
  .header-actions .lang-switch-compact {
    display: none;
  }

  .chat-container {
    padding: 12px 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .welcome {
    padding: 32px 12px;
  }

  .welcome p {
    font-size: 16px;
    max-width: 100%;
  }

  .quick-chips {
    gap: 6px;
    margin-bottom: 10px;
  }

  .chip {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 18px;
  }

  .chip-emoji {
    font-size: 14px;
  }

  .message .bubble {
    max-width: 88%;
    padding: 10px 14px;
    font-size: 16px;
    border-radius: 18px;
  }

  .message.user .bubble {
    border-bottom-right-radius: 6px;
  }

  .message.assistant .bubble {
    border-bottom-left-radius: 6px;
  }

  .messages {
    padding-bottom: 12px;
  }

  .input-area {
    padding-top: 10px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .input-wrapper {
    border-radius: 20px;
    padding: 10px 12px 10px 20px;
  }

  #input {
    font-size: 16px;
  }

  .send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  /* 鉴权登录 — 移动端 */
  .auth-overlay {
    padding: 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .auth-box {
    max-width: 100%;
    padding: 20px;
    border-radius: 12px;
  }

  .auth-title {
    font-size: 20px;
  }

  .auth-desc {
    font-size: 15px;
    margin-bottom: 16px;
  }

  .auth-input,
  .auth-submit {
    font-size: 16px;
    padding: 12px 16px;
    min-height: 48px;
  }

  .message .bubble thead th,
  .message .bubble tbody td {
    padding: 8px 10px;
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  .header {
    padding: 8px 12px;
  }

  .chat-container {
    padding: 10px 12px;
  }

  .message .bubble {
    max-width: 92%;
    padding: 10px 12px;
  }

  .input-wrapper {
    padding: 10px 12px 10px 16px;
  }

  .chip {
    padding: 6px 10px;
    font-size: 13px;
  }
}
