:root {
  --brand-blue: #426EFE;
  --brand-blue-bg: #EDF2FF;
  --brand-blue-border: rgba(66, 110, 254, 0.16);
  --bg-page: #FFFFFF;
  --bg-settings: #F6F7F9;
  --bg-card: #FFFFFF;
  --bg-input-gray: #F4F5F7;
  --bg-hover: #F2F3F6;
  --bg-code: #F7F8FA;
  --bg-user-bubble: #EFF3FA;
  --bg-tag: #EAECEF;
  --text-primary: #0F0F0F;
  --text-body: #1A1D21;
  --text-secondary: #7F8590;
  --text-muted: #8F959E;
  --text-placeholder: #B2B6BE;
  --text-disclaimer: #D0D3D9;
  --border-subtle: #E5E6EB;
  --divider-hairline: #F0F1F4;
  --danger-red: #E5484D;
  --switch-green: #18C37D;
  --chat-font-scale: 1;
  --preview-font-scale: 1;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ime-height: 0px;
  --drawer-width: min(80.5vw, 314px);
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "MiSans", "PingFang SC", "Noto Sans SC", "Helvetica Neue", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.hidden {
  display: none !important;
}

.app-root {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-page);
}

/* ========================
   侧边栏（1:1 还原截图3）
   ======================== */
.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--drawer-width);
  background: #FFFFFF;
  z-index: 10;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  display: flex;
  flex-direction: column;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.sidebar-search-wrap {
  padding: 10px 16px 10px;
  flex-shrink: 0;
}

.sidebar-search-box {
  height: 40px;
  background: var(--bg-input-gray);
  border-radius: 20px;
  padding: 0 12px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-search-clear {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(143, 149, 158, 0.22);
  color: var(--bg-page);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.sidebar-search-clear svg {
  width: 12px;
  height: 12px;
}

.sidebar-search-icon {
  width: 17px;
  height: 17px;
  color: #8E939D;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-search-icon svg {
  width: 17px;
  height: 17px;
}

#sidebar-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14.5px;
  color: var(--text-primary);
  padding: 0;
  font-family: inherit;
}

#sidebar-search-input::placeholder {
  color: #9A9FA8;
}

.sidebar-list-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 26px;
  scrollbar-width: none;
}

.sidebar-list-scroll::-webkit-scrollbar {
  display: none;
}

.sidebar-list-fade {
  position: sticky;
  bottom: -26px;
  left: 0;
  right: 0;
  height: 28px;
  margin-top: -28px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.94));
}

.sidebar-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px 6px;
  font-size: 12.5px;
  color: #8F959E;
  font-weight: 400;
}

.sidebar-group-icon {
  width: 30px;
  height: 28px;
  margin: -5px -6px;
  color: #8F959E;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.sidebar-group-icon svg {
  width: 16px;
  height: 16px;
}

.sidebar-divider {
  height: 1px;
  background: #F0F1F4;
  margin: 10px 2px 6px;
}

.sidebar-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 11px 8px;
  border-radius: 10px;
  font-size: 15.5px;
  line-height: 22px;
  color: var(--text-body);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: background-color 0.14s ease, transform 0.12s ease;
}

.sidebar-item-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.6px solid #C5C9D0;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #FFFFFF;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.14s ease;
}

.sidebar-item-check svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.sidebar.multiselect-mode .sidebar-item-check {
  display: inline-flex;
}

.sidebar.multiselect-mode .sidebar-item.selected .sidebar-item-check {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

.sidebar.multiselect-mode .sidebar-item.selected .sidebar-item-check svg {
  opacity: 1;
  transform: scale(1);
}

.sidebar.multiselect-mode .sidebar-group-icon {
  display: none;
}

.sidebar-item.active {
  background: var(--bg-input-gray);
  font-weight: 500;
  padding-left: 10px;
  padding-right: 10px;
}

.sidebar-item:active,
.sidebar-item.pressing {
  background: var(--bg-hover);
}

.sidebar-item.pressing {
  transform: scale(0.985);
}

.sidebar-profile {
  flex-shrink: 0;
  height: 58px;
  padding: 4px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
}

.sidebar-profile:active {
  background: #F8F9FB;
}

.sidebar-profile-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #EAECEF;
}

.profile-avatar img,
.profile-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-name {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-ellipsis-btn {
  width: 36px;
  height: 36px;
  margin-right: -8px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.profile-ellipsis-btn:active {
  background: rgba(0, 0, 0, 0.06);
}

.profile-ellipsis {
  width: 20px;
  height: 20px;
  color: #8A8F98;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-edit-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}

.profile-edit-avatar-btn {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: #EAECEF;
  cursor: pointer;
}

.profile-edit-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.profile-edit-avatar-inner img,
.profile-edit-avatar-inner svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-edit-camera-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #FFFFFF;
  border: 2px solid var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-edit-camera-badge svg {
  width: 14px;
  height: 14px;
}

.profile-edit-sub-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-tertiary);
}

.profile-edit-reset-btn {
  border: none;
  background: transparent;
  color: var(--brand-blue);
  font-size: 12.5px;
  font-family: inherit;
  padding: 2px 4px;
}

.profile-edit-input {
  width: 100%;
  height: 44px;
  border: none;
  outline: none;
  background: var(--bg-input-gray);
  border-radius: 12px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-primary);
  margin-top: 2px;
}

.profile-ellipsis svg {
  width: 18px;
  height: 18px;
}

/* ========================
   主界面容器（含抽屉展开圆角卡片态）
   ======================== */
.main-shell {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--ime-height) + var(--safe-bottom));
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              top 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              bottom 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              border-radius 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

body.keyboard-open .main-shell {
  padding-bottom: var(--ime-height);
}

.main-shell.drawer-open {
  transform: translateX(var(--drawer-width));
  top: calc(var(--safe-top) + 4px);
  bottom: calc(var(--safe-bottom) + 8px);
  padding-top: 0;
  padding-bottom: 0;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: -6px 6px 26px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.drawer-scrim {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  background: transparent;
}

.main-shell.drawer-open .drawer-scrim {
  display: block;
}

/* ========================
   顶部栏（截图1/4/5/6/7）
   ======================== */
.top-bar {
  height: 50px;
  padding: 0 12px 0 8px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  background: #FFFFFF;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
}

.icon-btn:active {
  background: rgba(0, 0, 0, 0.05);
}

.top-bar-title {
  flex: 1;
  min-width: 0;
  margin-left: 8px;
  margin-right: 8px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-24,
.icon-24 svg {
  width: 24px;
  height: 24px;
  display: block;
}

.icon-23,
.icon-23 svg {
  width: 23px;
  height: 23px;
  display: block;
}

.icon-26,
.icon-26 svg {
  width: 26px;
  height: 26px;
  display: block;
}

.icon-20,
.icon-20 svg {
  width: 20px;
  height: 20px;
  display: block;
}

.icon-18,
.icon-18 svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* ========================
   对话内容区 & 欢迎页
   ======================== */
.chat-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-page);
  -webkit-overflow-scrolling: touch;
  overflow-anchor: auto;
}

.welcome-view {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px 20px;
}

.welcome-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.welcome-logo svg {
  width: 45px;
  height: 34px;
  display: block;
}

.welcome-text {
  margin-top: 14px;
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.15px;
}

/* ========================
   消息流与 Markdown（截图1/7）
   ======================== */
.messages-container {
  padding: 6px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.msg-row-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  contain: layout style;
}

.chat-load-more-bar {
  display: flex;
  justify-content: center;
  padding: 6px 0 4px;
}

.chat-load-more-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-input-gray);
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  cursor: pointer;
}

.chat-load-more-btn:active {
  opacity: 0.72;
}

.user-bubble {
  max-width: 82%;
  background: var(--bg-user-bubble);
  color: var(--text-primary);
  border-radius: 18px;
  padding: 11px 16px;
  font-size: calc(16px * var(--chat-font-scale));
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  user-select: text;
}

.user-att-images {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 82%;
}

.user-att-thumb {
  display: block;
  max-width: 220px;
  max-height: 260px;
  min-width: 72px;
  min-height: 72px;
  border-radius: 14px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.user-att-images.multi .user-att-thumb {
  width: 108px;
  height: 108px;
  max-width: 108px;
  max-height: 108px;
  border-radius: 12px;
}

.user-att-files {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: 82%;
}

.user-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 268px;
  padding: 10px 13px;
  border-radius: 14px;
  background: #F4F5F8;
  border: 1px solid #EAECEF;
}

.user-file-badge {
  width: 34px;
  height: 38px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #FFFFFF;
  background: #4D6BFE;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  text-transform: uppercase;
}

.user-file-badge.ext-pdf,
.composer-att-ext.ext-pdf {
  background: #EA580C;
}

.user-file-badge.ext-doc,
.composer-att-ext.ext-doc {
  background: #2563EB;
}

.user-file-badge.ext-xls,
.composer-att-ext.ext-xls {
  background: #16A34A;
}

.user-file-badge.ext-ppt,
.composer-att-ext.ext-ppt {
  background: #D97706;
}

.user-file-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-file-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-file-size {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.user-attachment-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #3B4048;
  background: #EAECEF;
  border-radius: 10px;
  padding: 5px 10px;
  max-width: 100%;
}

.user-attachment-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #FFFFFF;
  background: #4D6BFE;
  text-transform: uppercase;
  flex: none;
}

.user-attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-row-assistant {
  width: 100%;
  background: #FFFFFF;
  contain: layout style;
}

.md-stream-frozen:empty,
.md-stream-tail:empty {
  display: none;
}

.web-search-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px 0 10px;
  border-radius: 999px;
  border: 1px solid #EAECEF;
  background: #FFFFFF;
  margin-bottom: 12px;
  font-size: 13.5px;
  color: #262A30;
  font-family: inherit;
}

.web-search-pill:active {
  background: #F7F8FA;
}

.web-search-dots {
  display: inline-flex;
  align-items: center;
}

.web-search-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #FFFFFF;
}

.web-search-dot + .web-search-dot {
  margin-left: -5px;
}

.thinking-block {
  margin-bottom: 14px;
}

.thinking-toggle {
  border: none;
  background: transparent;
  padding: 2px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  color: #757A82;
  font-family: inherit;
}

.thinking-toggle-arrow {
  width: 14px;
  height: 14px;
  color: #757A82;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.thinking-toggle-arrow svg {
  width: 14px;
  height: 14px;
}

.thinking-toggle.collapsed .thinking-toggle-arrow {
  transform: rotate(-90deg);
}

.thinking-body-wrap {
  display: flex;
  align-items: stretch;
  margin-top: 10px;
}

.thinking-body-wrap.collapsed {
  display: none;
}

.thinking-timeline {
  width: 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 9px;
  margin-right: 6px;
}

.thinking-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #969AA3;
  flex-shrink: 0;
}

.thinking-block.thinking-active .thinking-dot {
  background: var(--brand-blue);
  animation: thinkPulse 1.3s ease-in-out infinite;
}

@keyframes thinkPulse {
  0%, 100% {
    opacity: 0.45;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.35);
  }
}

.thinking-line {
  width: 1px;
  flex: 1;
  background: var(--border-subtle);
  margin-top: 6px;
}

.thinking-content {
  flex: 1;
  min-width: 0;
  font-size: calc(14.5px * var(--chat-font-scale));
  line-height: 1.68;
  color: #757A82;
  word-break: break-word;
  user-select: text;
}

.thinking-content p {
  margin: 0 0 12px;
}

.thinking-content p:last-child,
.thinking-content ul:last-child,
.thinking-content ol:last-child {
  margin-bottom: 0;
}

.thinking-content ul,
.thinking-content ol {
  margin: 4px 0 12px;
  padding-left: 18px;
}

.thinking-content li {
  margin: 4px 0;
}

.thinking-content code.inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: inherit;
  background: var(--bg-input-gray);
  padding: 1px 6px;
  border-radius: 5px;
}

.web-disclaimer-inline {
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #8A8F99;
  font-style: italic;
}

.assistant-markdown {
  color: var(--text-body);
  font-size: calc(15.5px * var(--chat-font-scale));
  line-height: 1.72;
  word-break: break-word;
  user-select: text;
}

.assistant-markdown > :first-child {
  margin-top: 0;
}

.assistant-markdown > :last-child {
  margin-bottom: 0;
}

.assistant-markdown p {
  margin: 0 0 12px;
}

.assistant-markdown h1,
.assistant-markdown h2,
.assistant-markdown h3,
.assistant-markdown h4 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.45;
  margin: 18px 0 10px;
}

.assistant-markdown h1 {
  font-size: 18px;
}

.assistant-markdown h2 {
  font-size: 17px;
}

.assistant-markdown h3,
.assistant-markdown h4 {
  font-size: 16.5px;
}

.assistant-markdown strong {
  font-weight: 700;
  color: var(--text-primary);
}

.assistant-markdown em {
  font-style: italic;
}

.assistant-markdown ul,
.assistant-markdown ol {
  margin: 6px 0 12px;
  padding-left: 20px;
}

.assistant-markdown li {
  margin: 4px 0;
}

.assistant-markdown blockquote {
  margin: 10px 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid #D8DCE3;
  color: #5D646E;
}

.assistant-markdown code.inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  color: #6B7280;
  background: #F4F5F7;
  padding: 1px 5px;
  border-radius: 5px;
  overflow-wrap: break-word;
}

.rp-text-card {
  background: #F4F5F7;
  color: var(--text-body);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 8px 0;
  font-size: calc(15.5px * var(--chat-font-scale));
  line-height: 1.68;
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-markdown h1 code.inline-code,
.assistant-markdown h2 code.inline-code,
.assistant-markdown h3 code.inline-code,
.assistant-markdown h4 code.inline-code {
  background: transparent;
  padding: 0 2px;
  color: #707782;
  font-weight: 500;
}

/* 代码块卡片（1:1 还原截图1） */
.code-card {
  background: var(--bg-code);
  border-radius: 12px;
  margin: 12px 0 16px;
  overflow: hidden;
}

.code-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 4px;
}

.code-card-lang {
  font-size: 13px;
  color: #868C96;
  font-weight: 400;
}

.code-copy-btn {
  border: none;
  background: transparent;
  padding: 2px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: #7B818B;
  font-family: inherit;
}

.code-copy-btn:active {
  opacity: 0.65;
}

.code-copy-icon,
.code-copy-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.code-card-pre {
  margin: 0;
  padding: 6px 14px 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #24292F;
  white-space: pre;
}

.code-card-pre.wrap-pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: hidden;
  font-family: inherit;
  font-size: calc(14.5px * var(--chat-font-scale));
}

.tok-kw {
  color: #A626A4;
}

.tok-lit {
  color: #0184BC;
}

.tok-str {
  color: #50A14F;
}

.tok-cmt {
  color: #989FB1;
  font-style: italic;
}

.assistant-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px;
  font-size: 13.5px;
}

.assistant-markdown th,
.assistant-markdown td {
  border: 1px solid #E5E7EB;
  padding: 7px 10px;
  text-align: left;
}

.assistant-markdown th {
  background: #F7F8FA;
  font-weight: 600;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #B3B8C2;
  animation: dotPulse 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.85);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* 消息底部操作栏（截图1/7） */
.msg-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 2px 0;
  gap: 8px;
}

.msg-actions-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  row-gap: 8px;
}

.branch-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.045);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  margin-right: 2px;
  user-select: none;
}

.branch-nav-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.branch-nav-btn svg {
  width: 13px;
  height: 13px;
  display: block;
}

.branch-nav-btn:disabled {
  opacity: 0.32;
}

.branch-count {
  padding: 0 2px;
  font-variant-numeric: tabular-nums;
}

.user-branch-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: -2px;
}

.msg-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.msg-edit-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.msg-edit-textarea {
  width: 100%;
  min-height: 112px;
  max-height: 220px;
  border: 1px solid var(--border-subtle);
  outline: none;
  resize: vertical;
  background: var(--bg-input-gray);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-primary);
}

.msg-edit-textarea.reasoning {
  min-height: 68px;
  max-height: 130px;
  font-size: 13px;
  color: var(--text-secondary);
}

.msg-action-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  padding: 0;
  color: #7E848E;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.msg-action-btn.active {
  color: var(--brand-blue);
}

.msg-action-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.msg-action-btn:active {
  opacity: 0.6;
}

/* ========================
   底部输入区域（截图1/4/5/6/7）
   ======================== */
.composer-region {
  position: relative;
  flex-shrink: 0;
  background: #FFFFFF;
  padding-top: 4px;
  padding-bottom: 6px;
}

body.keyboard-open .composer-region {
  padding-bottom: 12px;
}

.scroll-bottom-btn {
  position: absolute;
  right: 16px;
  top: -46px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #FFFFFF;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.09);
  color: #1A1D21;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 25;
}

.scroll-bottom-btn:active {
  background: #F4F5F7;
}

.composer-card {
  margin: 0 12px;
  background: #FFFFFF;
  border-radius: 24px;
  border: 1px solid rgba(0, 0, 0, 0.055);
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.045);
}

.composer-attachments {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.composer-attachments::-webkit-scrollbar {
  display: none;
}

.composer-att-img-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  flex: none;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #F4F5F7;
}

.composer-att-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.composer-att-file-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  max-width: 196px;
  padding: 8px 28px 8px 10px;
  border-radius: 12px;
  background: #F4F6FA;
  border: 1px solid #E8EBF2;
  flex: none;
}

.composer-att-ext {
  width: 34px;
  height: 36px;
  border-radius: 8px;
  background: #4D6BFE;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  text-transform: uppercase;
}

.composer-att-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.composer-att-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-att-size {
  font-size: 11px;
  color: var(--text-tertiary);
}

.composer-att-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(17, 20, 26, 0.65);
  color: #FFFFFF;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 44px) 14px calc(var(--safe-bottom) + 20px);
}

.image-preview-close {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.image-preview-full {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.text-input-wrap {
  padding: 14px 18px 8px;
}

.message-input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 16px;
  line-height: 22px;
  min-height: 22px;
  max-height: 112px;
  color: var(--text-primary);
  overflow-y: auto;
}

.message-input::placeholder {
  color: var(--text-placeholder);
}

/* 按住说话模式（截图4） */
.voice-hold-wrap {
  padding: 6px 14px 4px;
}

.hold-talk-btn {
  width: 100%;
  height: 40px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}

.hold-talk-btn:active,
.hold-talk-btn.pressing {
  background: #F4F5F7;
}

.hold-talk-divider {
  height: 1px;
  background: #F0F1F4;
  margin-top: 4px;
}

.composer-toolbar {
  padding: 6px 12px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-pill {
  height: 33px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #FFFFFF;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.mode-pill.active {
  background: var(--brand-blue-bg);
  border-color: var(--brand-blue-border);
  color: var(--brand-blue);
}

.pill-icon {
  width: 15.5px;
  height: 15.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pill-icon svg {
  width: 15.5px;
  height: 15.5px;
}

.composer-right-actions {
  display: flex;
  align-items: center;
  gap: 11px;
}

.circle-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  border-radius: 50%;
}

.circle-action-btn:active {
  opacity: 0.7;
}

.circle-action-btn.send-active {
  background: var(--brand-blue);
  color: #FFFFFF;
}

.circle-action-btn.send-active .icon-26,
.circle-action-btn.send-active .icon-26 svg {
  width: 15px;
  height: 15px;
}

/* + 附件抽屉（截图5） */
.attach-drawer {
  padding: 12px 0 6px;
}

.attach-preview-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 0 14px 12px;
  scrollbar-width: none;
}

.attach-preview-strip::-webkit-scrollbar {
  display: none;
}

.attach-thumb {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 12px;
  border: 1px solid #ECEEF2;
  background: #F6F7F9;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}

.attach-thumb-check {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #FFFFFF;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-thumb.selected .attach-thumb-check {
  background: var(--brand-blue);
  border-color: #FFFFFF;
}

.attach-action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 14px;
}

.attach-tile {
  height: 76px;
  border: none;
  border-radius: 16px;
  background: #F5F6F8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-primary);
  font-family: inherit;
}

.attach-tile:active {
  background: #ECEDF1;
}

.attach-tile-icon,
.attach-tile-icon svg {
  width: 21px;
  height: 21px;
  display: block;
}

.attach-tile-label {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 400;
}

.ai-disclaimer {
  font-size: 11px;
  line-height: 15px;
  color: var(--text-disclaimer);
  text-align: center;
  padding-top: 6px;
}

/* ========================
   设置页 & 账号管理页（截图2）
   ======================== */
.subpage {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: var(--bg-settings);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  display: flex;
  flex-direction: column;
  transform: translate3d(100%, 0, 0);
  opacity: 0.96;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.24s ease,
              visibility 0s linear 0.28s;
  will-change: transform;
}

.subpage.open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.22s ease,
              visibility 0s linear 0s;
}

.subpage.no-anim {
  transition: none !important;
}

.subpage-l2,
#account-page,
#data-page {
  z-index: 45;
}

#table-fullscreen-overlay {
  z-index: 65;
}

.subpage-white {
  background: var(--bg-page);
}

.subpage-header {
  position: relative;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.round-back-btn {
  position: absolute;
  left: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tag);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.12s ease, background-color 0.14s ease;
}

.round-back-btn:active {
  background: var(--border-subtle);
  transform: scale(0.94);
}

.subpage-header-right-btn {
  position: absolute;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tag);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.subpage-header-right-btn svg {
  width: 18px;
  height: 18px;
}

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

.settings-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 16px 32px;
}

.settings-group-label {
  font-size: 12.5px;
  color: #9398A1;
  padding: 14px 4px 7px;
}

.settings-card {
  background: #FFFFFF;
  border-radius: 14px;
  overflow: hidden;
}

.settings-card-standalone {
  margin-top: 16px;
}

.settings-row {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: none;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 13px;
  font-family: inherit;
  text-align: left;
}

.settings-row:active {
  background: #F5F6F8;
}

.settings-row-icon {
  width: 20px;
  height: 20px;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-row-icon svg {
  width: 20px;
  height: 20px;
}

.settings-row-label {
  flex: 1;
  font-size: 15.5px;
  color: var(--text-primary);
  font-weight: 400;
}

.settings-row-value {
  font-size: 14px;
  color: #8F959E;
  margin-right: -4px;
}

.settings-row-chevron {
  width: 15px;
  height: 15px;
  color: #B4B8C0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-row-chevron svg {
  width: 15px;
  height: 15px;
}

.settings-row-redirect {
  width: 18px;
  height: 18px;
  color: #8F959E;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-row-redirect svg {
  width: 17px;
  height: 17px;
}

/* 账号管理页 API Key 卡片 */
.apikey-card {
  background: #FFFFFF;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.apikey-input-wrap {
  display: flex;
  align-items: center;
  background: #F5F6F8;
  border-radius: 12px;
  padding: 0 12px;
  height: 46px;
}

.apikey-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.apikey-input::placeholder {
  color: #B0B4BC;
}

.apikey-eye-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  padding: 0;
  color: #6B7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.apikey-save-btn {
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--brand-blue);
  color: #FFFFFF;
  font-size: 15.5px;
  font-weight: 600;
  font-family: inherit;
}

.apikey-save-btn:active {
  opacity: 0.88;
}

.share-title-input {
  width: 100%;
  height: 42px;
  border: none;
  outline: none;
  background: #F5F6F8;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
}

.share-title-input::placeholder {
  color: #A9ADB5;
}

.share-textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: #F5F6F8;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  font-family: inherit;
  user-select: text;
}

.share-textarea::placeholder {
  color: #A9ADB5;
}

.share-btn-row {
  display: flex;
  gap: 10px;
}

.share-secondary-btn {
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  background: #F4F5F7;
  color: var(--text-primary);
  font-size: 14.5px;
  font-weight: 500;
  font-family: inherit;
  flex-shrink: 0;
}

.share-secondary-btn:active {
  background: #E8EAEE;
}

.share-primary-btn {
  flex: 1;
}

.share-primary-btn:disabled {
  opacity: 0.6;
}

.share-hint {
  font-size: 12px;
  color: #8F959E;
  text-align: center;
}

/* ========================
   轻量弹窗与 Toast
   ======================== */
.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

body.keyboard-open .modal-overlay {
  padding-bottom: calc(var(--ime-height) + 16px);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease, visibility 0s linear 0s;
}

.modal-sheet {
  width: 100%;
  max-width: 320px;
  background: var(--bg-card);
  border-radius: 22px;
  padding: 22px 20px 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.18, 0.89, 0.32, 1.15), opacity 0.18s ease;
}

.modal-overlay.open .modal-sheet {
  transform: scale(1);
  opacity: 1;
}

.modal-sheet.modal-sheet-compact {
  padding: 20px 0 0;
  overflow: hidden;
}

.modal-top-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.modal-top-icon svg {
  width: 24px;
  height: 24px;
}

.modal-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  padding: 0 18px;
}

.modal-body {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  text-align: center;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}

.modal-actions.modal-actions-multi {
  flex-direction: column-reverse;
  gap: 8px;
}

.modal-actions.modal-actions-multi .modal-btn {
  flex: none;
  width: 100%;
  height: 42px;
}

.modal-sheet.modal-sheet-compact .modal-actions {
  margin-top: 8px;
  border-top: 1px solid var(--divider-hairline);
  gap: 0;
}

.modal-sheet.modal-sheet-compact .modal-btn {
  height: 50px;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  color: var(--brand-blue);
}

.modal-btn {
  flex: 1;
  height: 40px;
  border: none;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  font-family: inherit;
}

.modal-btn-secondary {
  background: var(--bg-input-gray);
  color: var(--text-primary);
}

.modal-btn-primary {
  background: var(--brand-blue);
  color: #FFFFFF;
}

.modal-btn-danger {
  background: #FEECEE;
  color: var(--danger-red);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(108px + var(--safe-bottom));
  transform: translate(-50%, 6px);
  z-index: 120;
  background: rgba(24, 26, 30, 0.9);
  color: #FFFFFF;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  animation: toastRise 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes toastRise {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ========================
   侧边栏多选管理 + 长按上下文菜单
   ======================== */
.sidebar-multiselect-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 10px;
  height: 60px;
  flex-shrink: 0;
}

.multiselect-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.multiselect-all-btn {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: none;
  background: var(--bg-input-gray);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
}

.multiselect-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input-gray);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.multiselect-close-btn svg {
  width: 17px;
  height: 17px;
}

.sidebar-multiselect-footer {
  flex-shrink: 0;
  height: 56px;
  border-top: 1px solid var(--divider-hairline);
  background: var(--bg-page);
  display: flex;
  align-items: center;
  animation: slideUpFast 0.18s ease-out;
}

@keyframes slideUpFast {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.multiselect-action-btn {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  transition: opacity 0.15s ease;
}

.multiselect-action-btn.danger {
  color: var(--danger-red);
}

.multiselect-action-btn:disabled {
  color: var(--text-placeholder);
  opacity: 0.72;
}

.multiselect-action-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.multiselect-action-icon svg {
  width: 18px;
  height: 18px;
}

.multiselect-footer-divider {
  width: 1px;
  height: 22px;
  background: var(--divider-hairline);
}

.conv-menu-overlay {
  position: absolute;
  inset: 0;
  z-index: 75;
  background: rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease, visibility 0s linear 0.16s;
}

.conv-menu-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.16s ease, visibility 0s linear 0s;
}

.conv-context-menu {
  position: absolute;
  width: 196px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transform-origin: top right;
  transform: scale(0.88);
  opacity: 0;
  transition: transform 0.18s cubic-bezier(0.18, 0.89, 0.32, 1.15), opacity 0.15s ease;
}

.conv-menu-overlay.open .conv-context-menu {
  transform: scale(1);
  opacity: 1;
}

.conv-menu-item {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: none;
  border-bottom: 1px solid var(--divider-hairline);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
}

.conv-menu-item:last-child {
  border-bottom: none;
}

.conv-menu-item:active {
  background: var(--bg-hover);
}

.conv-menu-item.danger {
  color: var(--danger-red);
}

.conv-menu-item.active {
  color: var(--brand-blue);
}

/* 按住说话浮动波浪条 */
.voice-recording-pill {
  position: absolute;
  left: 50%;
  top: -54px;
  transform: translateX(-50%);
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(66, 110, 254, 0.28);
  z-index: 30;
  white-space: nowrap;
  animation: slideUpFast 0.16s ease-out;
}

.voice-recording-pill.cancel {
  background: var(--danger-red);
  box-shadow: 0 6px 20px rgba(229, 72, 77, 0.28);
}

.voice-wave-bars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.voice-wave-bars span {
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.92);
  height: 6px;
  animation: waveBar 0.7s ease-in-out infinite alternate;
}

.voice-wave-bars span:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.voice-wave-bars span:nth-child(3) { height: 15px; animation-delay: 0.3s; }
.voice-wave-bars span:nth-child(4) { height: 10px; animation-delay: 0.12s; }
.voice-wave-bars span:nth-child(5) { height: 7px; animation-delay: 0.25s; }

@keyframes waveBar {
  from { transform: scaleY(0.45); }
  to { transform: scaleY(1.05); }
}

.conv-menu-icon {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conv-menu-icon svg {
  width: 19px;
  height: 19px;
}

/* ========================
   Markdown 表格卡片（1:1 还原官方表格）
   ======================== */
.table-card {
  margin: 12px 0 16px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  overflow: hidden;
}

.table-card-header {
  height: 38px;
  padding: 0 12px 0 14px;
  background: var(--bg-code);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.table-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-card-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 6px;
}

.table-card-btn:active {
  background: var(--bg-hover);
}

.table-card-btn svg {
  width: 15px;
  height: 15px;
}

.table-card-scroll {
  width: 100%;
  overflow-x: auto;
}

.table-card-scroll table {
  margin: 0 !important;
  border: none;
}

.table-card-scroll th,
.table-card-scroll td {
  white-space: nowrap;
  border-left: none;
  border-right: 1px solid var(--divider-hairline);
  border-top: none;
  border-bottom: 1px solid var(--divider-hairline);
}

.table-card-scroll tr:last-child td {
  border-bottom: none;
}

.table-fs-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 28px;
}

.table-fs-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-fs-body th,
.table-fs-body td {
  border: 1px solid var(--border-subtle);
  padding: 9px 12px;
  text-align: left;
  color: var(--text-primary);
}

.table-fs-body th {
  background: var(--bg-code);
  font-weight: 600;
}

/* ========================
   开关、单选列表与设置子页面
   ======================== */
.ds-switch {
  width: 50px;
  height: 30px;
  border-radius: 999px;
  border: none;
  background: #D5D8DE;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.ds-switch.active {
  background: var(--switch-green);
}

.ds-switch-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
  transform: translateX(0);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.ds-switch.active .ds-switch-thumb {
  transform: translateX(20px);
}

.settings-row-static:active {
  background: var(--bg-card);
}

.settings-caption {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 8px 4px 2px;
}

/* 单选列表（语言、外观中心弹窗） */
.radio-list {
  max-height: 290px;
  overflow-y: auto;
  text-align: left;
  padding: 6px 20px 8px;
}

.radio-row {
  width: 100%;
  min-height: 48px;
  padding: 6px 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15.5px;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
}

.radio-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.7px solid #4B5058;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.radio-row.checked .radio-circle {
  border-color: var(--text-primary);
  border-width: 1.8px;
}

.radio-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transform: scale(0.4);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.radio-row.checked .radio-dot {
  background: var(--text-primary);
  transform: scale(1);
}

/* 字体大小页（1:1 还原官方预览 + 7档滑块） */
.fontsize-preview-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fontsize-preview-area .user-bubble {
  font-size: calc(16px * var(--preview-font-scale));
}

.fontsize-preview-ai {
  font-size: calc(15.5px * var(--preview-font-scale));
  line-height: 1.7;
  color: var(--text-primary);
}

.fontsize-preview-ai p {
  margin: 0 0 16px;
}

.fontsize-bottom-panel {
  flex-shrink: 0;
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 22px rgba(0, 0, 0, 0.05);
  padding: 18px 20px calc(22px + var(--safe-bottom));
}

.fontsize-system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
}

.fontsize-system-label {
  font-size: 16px;
  color: var(--text-primary);
}

.fontsize-slider-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fontsize-step-label {
  font-size: 13.5px;
  color: var(--text-secondary);
  text-align: center;
  min-height: 20px;
}

.fontsize-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fontsize-glyph-small,
.fontsize-glyph-large {
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fontsize-glyph-small svg {
  width: 15px;
  height: 22px;
}

.fontsize-glyph-large svg {
  width: 18px;
  height: 26px;
}

.fontsize-track-wrap {
  position: relative;
  flex: 1;
  height: 36px;
  display: flex;
  align-items: center;
}

.fontsize-ticks {
  position: absolute;
  left: 11px;
  right: 11px;
  height: 2px;
  background: var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.fontsize-ticks span {
  width: 2px;
  height: 8px;
  background: #C8CCD4;
  border-radius: 1px;
}

.fontsize-range {
  position: relative;
  width: 100%;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  height: 36px;
  outline: none;
  z-index: 2;
}

.fontsize-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

/* 个性化偏好标签 */
.persona-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.persona-chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input-gray);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.persona-chip.active {
  background: var(--brand-blue-bg);
  border-color: var(--brand-blue-border);
  color: var(--brand-blue);
  font-weight: 500;
}

/* 朗读音色底部弹出 Sheet（1:1 还原官方卡片） */
.sheet-overlay {
  position: absolute;
  inset: 0;
  z-index: 78;
  background: rgba(0, 0, 0, 0.36);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0s linear 0.24s;
}

.sheet-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.24s ease, visibility 0s linear 0s;
}

.voice-sheet {
  background: var(--bg-card);
  border-radius: 26px 26px 0 0;
  padding: 20px 20px calc(22px + var(--safe-bottom));
  transform: translate3d(0, 100%, 0);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-overlay.open .voice-sheet {
  transform: translate3d(0, 0, 0);
}

.voice-sheet-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
}

.voice-sheet-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.voice-close-btn {
  position: absolute;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input-gray);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.voice-carousel {
  padding: 40px 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.voice-orb-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.voice-orb {
  display: block;
  width: 146px;
  height: 92px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 28% 35%, rgba(114, 168, 255, 0.72), transparent 55%),
    radial-gradient(circle at 72% 65%, rgba(132, 185, 255, 0.65), transparent 58%),
    linear-gradient(135deg, #EBF3FF 0%, #B8D5FF 52%, #DFECFF 100%);
  box-shadow: inset 0 0 26px rgba(255, 255, 255, 0.8), 0 8px 24px rgba(66, 110, 254, 0.14);
  transition: transform 0.28s ease, background 0.35s ease;
}

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

.voice-orb.speaking {
  animation: orbFloat 1.6s ease-in-out infinite;
}

@keyframes orbFloat {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.voice-name {
  margin-top: 16px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.voice-desc {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.voice-dots {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: #D7DBE2;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.voice-dot.active {
  background: var(--brand-blue);
  transform: scale(1.15);
}

.voice-confirm-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
}

.voice-confirm-btn:active {
  opacity: 0.9;
}

/* 附件抽屉弹出动画 */
.attach-drawer:not(.hidden) {
  animation: slideUpFast 0.18s ease-out;
}

/* 消息底部图标点击微动效 */
.msg-action-btn {
  transition: transform 0.14s ease, color 0.14s ease, opacity 0.14s ease;
}

.msg-action-btn:active {
  transform: scale(0.86);
}

/* ========================
   深色模式（1:1 匹配官方夜色系）
   ======================== */
:root[data-theme="dark"] {
  --brand-blue: #507BF2;
  --brand-blue-bg: rgba(80, 123, 242, 0.16);
  --brand-blue-border: rgba(80, 123, 242, 0.34);
  --bg-page: #0F0F11;
  --bg-settings: #111215;
  --bg-card: #1C1D22;
  --bg-input-gray: #24262D;
  --bg-hover: #2A2D35;
  --bg-code: #17191E;
  --bg-user-bubble: #1D253B;
  --bg-tag: #2A2C34;
  --text-primary: #F2F4F8;
  --text-body: #E3E6EC;
  --text-secondary: #9EA4B0;
  --text-muted: #7C828E;
  --text-placeholder: #626874;
  --text-disclaimer: #565C66;
  --border-subtle: #2C2F37;
  --divider-hairline: #262930;
  --danger-red: #F25A5A;
}

:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .sidebar-profile,
:root[data-theme="dark"] .main-shell,
:root[data-theme="dark"] .top-bar,
:root[data-theme="dark"] .chat-viewport,
:root[data-theme="dark"] .welcome-view,
:root[data-theme="dark"] .messages-container,
:root[data-theme="dark"] .msg-row-assistant,
:root[data-theme="dark"] .composer-region,
:root[data-theme="dark"] .composer-card,
:root[data-theme="dark"] .mode-pill,
:root[data-theme="dark"] .web-search-pill,
:root[data-theme="dark"] .scroll-bottom-btn {
  background: var(--bg-page);
}

:root[data-theme="dark"] .composer-card {
  background: #1A1B20;
  border-color: #2A2C34;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.36);
}

:root[data-theme="dark"] .mode-pill {
  background: #1A1B20;
}

:root[data-theme="dark"] .mode-pill.active {
  background: var(--brand-blue-bg);
  border-color: var(--brand-blue-border);
  color: var(--brand-blue);
}

:root[data-theme="dark"] .settings-card,
:root[data-theme="dark"] .settings-row,
:root[data-theme="dark"] .apikey-card {
  background: var(--bg-card);
}

:root[data-theme="dark"] .settings-row:active {
  background: var(--bg-hover);
}

:root[data-theme="dark"] .apikey-input-wrap,
:root[data-theme="dark"] .share-title-input,
:root[data-theme="dark"] .share-textarea,
:root[data-theme="dark"] .attach-tile,
:root[data-theme="dark"] .assistant-markdown code.inline-code,
:root[data-theme="dark"] .assistant-markdown th,
:root[data-theme="dark"] .hold-talk-btn:active,
:root[data-theme="dark"] .hold-talk-btn.pressing {
  background: var(--bg-input-gray);
}

:root[data-theme="dark"] .user-attachment-tag {
  background: var(--bg-tag);
  color: var(--text-secondary);
}

:root[data-theme="dark"] .sidebar-list-fade {
  background: linear-gradient(to bottom, rgba(15, 15, 17, 0), rgba(15, 15, 17, 0.94));
}

:root[data-theme="dark"] .main-shell.drawer-open {
  border-color: #2A2C34;
  box-shadow: -6px 6px 26px rgba(0, 0, 0, 0.45);
}

:root[data-theme="dark"] .web-search-dot {
  border-color: var(--bg-page);
}

:root[data-theme="dark"] .ds-switch {
  background: #3A3D47;
}

:root[data-theme="dark"] .ds-switch.active {
  background: var(--switch-green);
}

:root[data-theme="dark"] .modal-btn-danger {
  background: rgba(242, 90, 90, 0.16);
}

:root[data-theme="dark"] .code-card-pre {
  color: #D4D8E0;
}

:root[data-theme="dark"] .assistant-markdown code.inline-code {
  color: #B8C0CE;
}

:root[data-theme="dark"] .rp-text-card {
  background: #232429;
  color: #E3E5EA;
}

:root[data-theme="dark"] .assistant-markdown blockquote {
  border-left-color: #363A45;
  color: #9CA3AF;
}

:root[data-theme="dark"] .assistant-markdown th,
:root[data-theme="dark"] .assistant-markdown td {
  border-color: var(--border-subtle);
}

:root[data-theme="dark"] .sidebar-divider {
  background: var(--divider-hairline);
}

:root[data-theme="dark"] .thinking-content,
:root[data-theme="dark"] .thinking-toggle,
:root[data-theme="dark"] .thinking-toggle-arrow {
  color: #9DA3AE;
}

:root[data-theme="dark"] .composer-att-img-wrap {
  background: #23252D;
  border-color: #343742;
}

:root[data-theme="dark"] .composer-att-file-chip {
  background: #23252D;
  border-color: #343742;
}

:root[data-theme="dark"] .user-att-thumb {
  border-color: rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] .user-file-card {
  background: #1E2027;
  border-color: #2E313B;
}

:root[data-theme="dark"] .branch-switcher {
  background: rgba(255, 255, 255, 0.09);
}

/* ========================
   头像交互式裁剪弹窗
   ======================== */
.avatar-crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 960;
  background: #0B0D12;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  user-select: none;
  touch-action: none;
}

.avatar-crop-overlay.hidden {
  display: none !important;
}

.avatar-crop-header {
  height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 13, 18, 0.92);
  z-index: 2;
}

.avatar-crop-title {
  font-size: 16.5px;
  font-weight: 600;
  color: #FFFFFF;
}

.avatar-crop-top-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  padding: 8px 6px;
  border-radius: 8px;
}

.avatar-crop-top-btn:active {
  background: rgba(255, 255, 255, 0.1);
}

.avatar-crop-confirm-btn {
  border: none;
  background: var(--brand-blue);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 15px;
  border-radius: 999px;
}

.avatar-crop-confirm-btn:active {
  opacity: 0.86;
}

.avatar-crop-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  touch-action: none;
}

.avatar-crop-canvas {
  width: min(88vw, 340px);
  height: min(88vw, 340px);
  border-radius: 16px;
  touch-action: none;
  display: block;
}

.avatar-crop-footer {
  padding: 12px 20px 24px;
  background: rgba(11, 13, 18, 0.94);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
}

.avatar-crop-hint {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.58);
  text-align: center;
}

.avatar-crop-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-crop-tool-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-size: 12.5px;
  padding: 6px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.avatar-crop-tool-btn:active {
  background: rgba(255, 255, 255, 0.16);
}

.avatar-crop-zoom {
  flex: 1;
  accent-color: var(--brand-blue);
  height: 4px;
}

@supports (-webkit-touch-callout: none) {
  input,
  textarea {
    font-size: max(16px, 1em);
  }
}
