*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* 默认暗色主题 */
  --bg-page: radial-gradient(
      circle at top,
      rgba(56, 189, 248, 0.22) 0,
      transparent 40%
    ),
    radial-gradient(
      circle at 80% -20%,
      rgba(52, 211, 153, 0.22) 0,
      transparent 45%
    ),
    radial-gradient(
      circle at 0 120%,
      rgba(59, 130, 246, 0.24) 0,
      transparent 55%
    ),
    #020617;
  --bg-glow-overlay: radial-gradient(
      circle at 0 0,
      rgba(96, 165, 250, 0.24),
      transparent 55%
    ),
    radial-gradient(
      circle at 100% 100%,
      rgba(34, 197, 94, 0.18),
      transparent 55%
    );

  --color-text: #e5e7eb;
  --color-text-subtle: #9ca3af;
  --color-border-subtle: rgba(148, 163, 184, 0.28);
  --color-border-strong: rgba(148, 163, 184, 0.4);

  --sidebar-bg: rgba(15, 23, 42, 0.9);
  --sidebar-section-bg: radial-gradient(circle at top left, #0f172a, #020617);

  --conversation-list-bg: radial-gradient(
    circle at top left,
    rgba(15, 23, 42, 0.96),
    #020617
  );

  --chat-card-bg: radial-gradient(
    circle at top left,
    rgba(15, 23, 42, 0.95),
    rgba(15, 23, 42, 0.92)
  );

  --bubble-bg: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.98),
    rgba(15, 23, 42, 0.94)
  );
  --bubble-border: rgba(148, 163, 184, 0.5);
  --bubble-shadow:
    0 12px 30px rgba(15, 23, 42, 0.85);

  --input-bg: rgba(15, 23, 42, 0.95);

  --brand-logo-bg: radial-gradient(circle at 30% 20%, #22c55e, #15803d);
  --assistant-avatar-bg: radial-gradient(circle at 30% 20%, #22c55e, #15803d);
  --user-avatar-bg: radial-gradient(
    circle at 30% 20%,
    rgba(37, 99, 235, 0.75),
    rgba(15, 118, 110, 0.8)
  );

  --user-bubble-bg: linear-gradient(
    145deg,
    rgba(34, 197, 94, 0.5),
    rgba(56, 189, 248, 0.45)
  );
  --user-bubble-shadow:
    0 10px 24px rgba(15, 23, 42, 0.8);

  --primary-btn-bg: linear-gradient(135deg, #22c55e, #16a34a);
  --primary-btn-color: #022c22;
  --primary-btn-shadow: 0 12px 30px rgba(21, 128, 61, 0.75),
    0 0 0 1px rgba(22, 163, 74, 0.9);

  --new-conv-bg: radial-gradient(
    circle at 0 0,
    rgba(52, 211, 153, 0.18),
    rgba(15, 23, 42, 0.95)
  );
  --new-conv-border: rgba(148, 163, 184, 0.7);

  --header-border: rgba(148, 163, 184, 0.3);

  /* 桌面端整体阴影调轻，偏扁平 */
  --shadow-sidebar: 0 6px 18px rgba(15, 23, 42, 0.22);
  --shadow-chat: 0 8px 22px rgba(15, 23, 42, 0.26);

  --conversation-active-bg: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.8),
    rgba(34, 197, 94, 0.9)
  );

  --conversation-hover-bg: rgba(30, 64, 175, 0.55);

  --scrollbar-thumb: rgba(148, 163, 184, 0.6);
  --scrollbar-thumb-hover: rgba(191, 219, 254, 0.9);

  --theme-toggle-bg: rgba(15, 23, 42, 0.95);
  --theme-toggle-border: rgba(148, 163, 184, 0.6);
  --theme-toggle-hover-bg: rgba(30, 64, 175, 0.9);
  --theme-toggle-hover-border: rgba(191, 219, 254, 0.9);
}

/* 浅色主题覆盖 */
.theme-light {
  --bg-page: radial-gradient(
      circle at top,
      rgba(56, 189, 248, 0.15) 0,
      transparent 45%
    ),
    radial-gradient(
      circle at 90% -10%,
      rgba(34, 197, 94, 0.14) 0,
      transparent 45%
    ),
    #f3f4f6;
  --bg-glow-overlay: radial-gradient(
      circle at 0 0,
      rgba(59, 130, 246, 0.18),
      transparent 55%
    ),
    radial-gradient(
      circle at 100% 100%,
      rgba(16, 185, 129, 0.14),
      transparent 55%
    );

  --color-text: #0f172a;
  --color-text-subtle: #6b7280;
  --color-border-subtle: rgba(148, 163, 184, 0.4);
  --color-border-strong: rgba(148, 163, 184, 0.7);

  --sidebar-bg: rgba(255, 255, 255, 0.9);
  --sidebar-section-bg: radial-gradient(
    circle at top left,
    #e5f6ff,
    #f9fafb
  );

  --conversation-list-bg: radial-gradient(
    circle at top left,
    #f3f4ff,
    #ffffff
  );

  --chat-card-bg: radial-gradient(
    circle at top left,
    #ffffff,
    #f9fafb
  );

  --bubble-bg: linear-gradient(
    145deg,
    #ffffff,
    #f3f4f6
  );
  --bubble-border: rgba(148, 163, 184, 0.5);
  --bubble-shadow:
    0 12px 26px rgba(148, 163, 184, 0.25);

  --input-bg: #f9fafb;

  --brand-logo-bg: radial-gradient(circle at 30% 20%, #22c55e, #16a34a);
  --assistant-avatar-bg: radial-gradient(
    circle at 30% 20%,
    #22c55e,
    #16a34a
  );
  --user-avatar-bg: radial-gradient(
    circle at 30% 20%,
    rgba(96, 165, 250, 0.75),
    rgba(45, 212, 191, 0.75)
  );

  --user-bubble-bg: linear-gradient(
    145deg,
    rgba(34, 197, 94, 0.24),
    rgba(56, 189, 248, 0.22)
  );
  --user-bubble-shadow:
    0 8px 20px rgba(148, 163, 184, 0.28);

  --primary-btn-bg: linear-gradient(135deg, #22c55e, #16a34a);
  --primary-btn-color: #022c22;
  --primary-btn-shadow: 0 10px 24px rgba(22, 163, 74, 0.45),
    0 0 0 1px rgba(16, 185, 129, 0.7);

  --new-conv-bg: radial-gradient(
    circle at 0 0,
    rgba(52, 211, 153, 0.16),
    #f9fafb
  );
  --new-conv-border: rgba(148, 163, 184, 0.8);

  --header-border: rgba(209, 213, 219, 0.9);

  /* 浅色主题下也降低阴影强度，更扁平 */
  --shadow-sidebar: 0 4px 16px rgba(148, 163, 184, 0.35);
  --shadow-chat: 0 6px 20px rgba(148, 163, 184, 0.35);

  --conversation-active-bg: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.26),
    rgba(34, 197, 94, 0.28)
  );

  --conversation-hover-bg: rgba(59, 130, 246, 0.12);

  --scrollbar-thumb: rgba(148, 163, 184, 0.9);
  --scrollbar-thumb-hover: rgba(30, 64, 175, 0.9);

  --theme-toggle-bg: #ffffff;
  --theme-toggle-border: rgba(148, 163, 184, 0.8);
  --theme-toggle-hover-bg: rgba(37, 99, 235, 0.06);
  --theme-toggle-hover-border: rgba(37, 99, 235, 0.7);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg-page);
  color: var(--color-text);
  min-height: 100vh;
  transition: background 220ms ease-out, color 180ms ease-out;
}

.page-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
      circle at top,
      rgba(15, 23, 42, 0.9) 0,
      rgba(15, 23, 42, 0.98) 45%
    );
  z-index: 9999;
}

.page-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.95),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

.page-loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.5);
  border-top-color: #22c55e;
  border-right-color: #3b82f6;
  animation: page-loading-spin 0.9s linear infinite;
}

.page-loading-text {
  font-size: 13px;
  color: #e5e7eb;
}

@keyframes page-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--bg-glow-overlay);
  mix-blend-mode: screen;
  /* 整体发光叠加适当减弱，避免过亮 */
  opacity: 0.35;
  z-index: -1;
}

.::-webkit-scrollbar {
  width: 8px;
}

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

.::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.6);
  border-radius: 999px;
}

.::-webkit-scrollbar-thumb:hover {
  background: rgba(191, 219, 254, 0.9);
}

.page {
  display: flex;
  min-height: 100vh;
  height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px 32px;
  gap: 16px;
  /* 保证子元素在垂直布局时同宽对齐 */
  align-items: stretch;
}

.sidebar {
  padding: 16px 14px;
  /* 扁平设计：统一为卡片背景色，不再使用右侧描边和强模糊 */
  background: var(--sidebar-bg);
  border: 1px solid var(--color-border-subtle);
  backdrop-filter: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: 14px;
  /* 外层侧边栏卡片不再有明显阴影，与中间卡片处于同一垂直平面 */
  box-shadow: none;
}

.sidebar-left {
  width: 260px;
}

.sidebar-right {
  width: 260px;
}

.sidebar-conversations {
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.new-conversation-button {
  border: none;
  outline: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--new-conv-bg);
  border: 1px solid var(--new-conv-border);
  color: var(--color-text);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition:
    background 160ms ease-out,
    box-shadow 160ms ease-out,
    transform 120ms ease-out,
    border-color 160ms ease-out;
}

.new-conversation-button:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.9), rgba(34, 197, 94, 0.95));
  border-color: rgba(191, 219, 254, 0.9);
  /* 新建对话按钮发光柔和一些 */
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
  transform: translateY(-1px);
}

.new-conversation-button:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.8);
}

.conversation-list {
  margin-top: 4px;
  border-radius: 10px;
  background: var(--conversation-list-bg);
  border: 1px solid var(--color-border-strong);
  padding: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.conversation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}

.conversation-item-title {
  flex: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.conversation-item-meta {
  font-size: 11px;
  color: var(--color-text-subtle);
}

.conversation-item-active {
  background: var(--conversation-active-bg);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.6),
    0 10px 25px rgba(15, 23, 42, 0.9);
}

.conversation-item:hover {
  background: var(--conversation-hover-bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-logo-bg);
  box-shadow:
    /* 品牌标识光晕减弱，范围更小 */
    0 0 18px rgba(34, 197, 94, 0.55),
    0 0 0 1px rgba(15, 23, 42, 0.85);
}

.brand-logo-image {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 600;
  font-size: 18px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--color-text-subtle);
}

.sidebar-section {
  padding: 14px 12px;
  border-radius: 12px;
  background: var(--sidebar-section-bg);
  border: 1px solid var(--color-border-subtle);
  /* PC 端侧边内容卡片阴影减弱，接近扁平 */
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
}

.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.sidebar-text {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-subtle);
  line-height: 1.5;
}

.sidebar-text-subtle {
  margin-top: 6px;
  font-size: 12px;
}

.suggestions {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--color-text-subtle);
}

.suggestions li + li {
  margin-top: 4px;
}

.calendar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border-subtle);
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 140ms ease-out,
    border-color 140ms ease-out,
    color 140ms ease-out;
}

.calendar-button:hover {
  background: rgba(148, 163, 184, 0.12);
  border-color: var(--color-border-strong);
}

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 20px 22px 14px;
  /* 扁平设计：与两侧侧边栏统一为同一“卡片”外轮廓与视觉层级 */
  border-radius: 14px;
  background: var(--sidebar-bg);
  border: 1px solid var(--color-border-subtle);
  box-shadow: none;
}

.chat-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--header-border);
  margin-bottom: 12px;
}

.chat-header-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.chat-header h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.04em;
}

.chat-header p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--color-text-subtle);
}

.agent-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-tab {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  background: rgba(15, 23, 42, 0.1);
  color: var(--color-text-subtle);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(16px);
  transition:
    background 150ms ease-out,
    color 150ms ease-out,
    border-color 150ms ease-out,
    box-shadow 150ms ease-out,
    transform 120ms ease-out;
}

.agent-tab:hover {
  background: rgba(37, 99, 235, 0.15);
  color: var(--color-text);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.3);
  transform: translateY(-1px);
}

.agent-tab.agent-tab-active {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.95),
    rgba(34, 197, 94, 0.95)
  );
  color: #f9fafb;
  border-color: transparent;
  box-shadow:
    /* 激活态标签发光范围和强度减弱 */
    0 8px 18px rgba(15, 23, 42, 0.7),
    0 0 12px rgba(56, 189, 248, 0.65);
}

.theme-light .agent-tab {
  background: rgba(255, 255, 255, 0.8);
  color: var(--color-text-subtle);
  border-color: rgba(209, 213, 219, 0.9);
}

.theme-light .agent-tab:hover {
  background: rgba(59, 130, 246, 0.12);
  color: var(--color-text);
}

.theme-light .agent-tab.agent-tab-active {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.9),
    rgba(34, 197, 94, 0.95)
  );
  color: #f9fafb;
  border-color: transparent;
  box-shadow:
    0 6px 16px rgba(148, 163, 184, 0.45),
    0 0 10px rgba(59, 130, 246, 0.6);
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 16px 4px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.assistant-avatar {
  background: var(--assistant-avatar-bg);
}

.assistant-avatar-image {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
}

.user-avatar {
  background: var(--user-avatar-bg);
}

.bubble {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bubble-bg);
  border: 1px solid var(--bubble-border);
  /* 默认用于 Markdown，按正常换行渲染 */
  white-space: normal;
  box-shadow: var(--bubble-shadow);
  backdrop-filter: blur(18px);
}

.bubble-content {
  white-space: normal;
}

.bubble-footer {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 11px;
  color: var(--color-text-subtle);
}

/* Markdown 内容微排版，收紧行距与段间距 */
.bubble p {
  margin: 2px 0;
}

.bubble p + p {
  margin-top: 4px;
}

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

.bubble li + li {
  margin-top: 2px;
}

.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
  margin: 4px 0 2px;
  font-size: 1em;
  font-weight: 600;
}

.bubble pre {
  margin: 4px 0;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  overflow-x: auto;
}

.bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 13px;
}

.message.user {
  flex-direction: row-reverse;
}

.message.user .bubble {
  background: var(--user-bubble-bg);
  border-color: rgba(191, 219, 254, 0.9);
  box-shadow: var(--user-bubble-shadow);
  /* 用户输入仍然按原样换行展示 */
  white-space: pre-wrap;
}

.chat-input {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 18px;
  background: var(--input-bg);
  border: 1px solid var(--color-border-subtle);
  /* 输入区阴影降低，弱化“浮起感” */
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.15);
}

.chat-input textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text);
  font-size: 14px;
  max-height: 120px;
}

.chat-input textarea::placeholder {
  font-size: 13px;
  color: var(--color-text-subtle);
}

.chat-input button {
  border: none;
  outline: none;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--primary-btn-bg);
  color: var(--primary-btn-color);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 按钮阴影减弱，整体更扁平 */
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.6);
  transition:
    transform 120ms ease-out,
    box-shadow 140ms ease-out,
    filter 160ms ease-out,
    opacity 120ms ease-out;
}

.chat-input button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    /* 发送按钮发光减弱，且范围缩小 */
    0 12px 26px rgba(21, 128, 61, 0.75),
    0 0 14px rgba(52, 211, 153, 0.7);
}

.chat-input button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow:
    0 8px 18px rgba(21, 128, 61, 0.7),
    0 0 10px rgba(34, 197, 94, 0.75);
}

.chat-input button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.typing-indicator {
  font-size: 12px;
  color: var(--color-text-subtle);
  padding-left: 42px;
}

.theme-toggle {
  border: 1px solid var(--theme-toggle-border);
  background: var(--theme-toggle-bg);
  color: var(--color-text);
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  /* 主题切换按钮阴影减弱 */
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.4);
  transition:
    background 160ms ease-out,
    border-color 160ms ease-out,
    box-shadow 160ms ease-out,
    transform 120ms ease-out,
    color 160ms ease-out;
}

.theme-toggle:hover {
  background: var(--theme-toggle-hover-bg);
  border-color: var(--theme-toggle-hover-border);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.6);
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: translateY(0);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.5);
}

.theme-toggle-icon {
  font-size: 14px;
}

.theme-toggle-text {
  white-space: nowrap;
}

/* 维护提示样式 */
.maintenance-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 20px;
}

.maintenance-icon {
  font-size: 64px;
  line-height: 1;
  opacity: 0.8;
}

.maintenance-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}

.maintenance-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.maintenance-message {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-subtle);
}

.chat-input textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(15, 23, 42, 0.3);
}

.theme-light .chat-input textarea:disabled {
  background: rgba(209, 213, 219, 0.3);
}

@media (max-width: 900px) {
  .page {
    flex-direction: column;
    /* 移动端采用自适应高度，避免内容被压缩在 100vh 内导致重叠 */
    height: auto;
    min-height: 100vh;
    padding: 12px 10px;
    gap: 12px;
  }

  .sidebar {
    width: 100%;
    padding: 14px 12px;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.35);
  }

  .sidebar-title-row {
    flex-wrap: wrap;
  }

  .new-conversation-button {
    font-size: 12px;
  }

  .sidebar-left {
    order: 1;
  }

  .chat {
    max-width: 100%;
    width: 100%;
    padding: 14px 12px 10px;
    order: 2;
  }

  .sidebar-right {
    order: 3;
  }

  .maintenance-notice {
    padding: 40px 20px;
  }

  .maintenance-icon {
    font-size: 48px;
  }

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

  .maintenance-message {
    font-size: 14px;
  }
}

/* 更小屏幕下的移动端优化 */
@media (max-width: 640px) {
  .page {
    /* 小屏下整体采用自适应高度 + 竖向排列，视觉更扁平 */
    padding: 6px 4px;
    gap: 6px;
  }

  /* 扁平化整体背景与光晕效果，减少炫光与噪点 */
  body {
    background: #f3f4f6;
  }

  body::before {
    opacity: 0;
  }

  .chat {
    padding: 8px 8px 6px;
    border-radius: 10px;
    /* 扁平化：弱化阴影，只保留轻微层次感 */
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    background: #ffffff;
    border-color: rgba(209, 213, 219, 0.9);
  }

  /* 极小屏：先展示对话列表栏，再展示聊天卡片，右侧说明最后 */
  .sidebar-left {
    order: 1;
    width: 100%;
    max-width: 100%;
    border-radius: 6px;
    box-shadow: none;
    background: #ffffff;
    border: 1px solid rgba(229, 231, 235, 1);
  }

  .chat {
    order: 2;
    width: 100%;
    max-width: 100%;
    /* 限制聊天卡片最大高度，超过后由内部对话区滚动；略放大高度，让对话区域更长 */
    max-height: 70vh;
  }

  .sidebar-right {
    order: 3;
    width: 100%;
    max-width: 100%;
    border-radius: 6px;
    box-shadow: none;
    background: #ffffff;
    border: 1px solid rgba(229, 231, 235, 1);
  }

  /* 侧边内容区改为更扁平的卡片视觉 */
  .sidebar-section {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    padding: 6px 6px;
  }

  /* 移动端提示信息收紧，避免占用过多竖向空间 */
  .sidebar-text {
    font-size: 11px;
    line-height: 1.35;
  }

  .suggestions {
    font-size: 11px;
    margin-top: 0;
  }

  /* 每组最多展示前两条示例，减少列表高度 */
  .suggestions li:nth-child(n + 3) {
    display: none;
  }

  /* 对话列表区域扁平化（去渐变、去投影，弱化分割） */
  .sidebar-conversations {
    max-height: 40vh;
    gap: 6px;
  }

  .conversation-list {
    background: #f9fafb;
    border-radius: 6px;
    border-color: rgba(229, 231, 235, 1);
    padding: 4px 4px;
  }

  .conversation-item {
    padding: 8px 10px;
    border-radius: 6px;
    background: transparent;
  }

  .conversation-item-active {
    background: #e5f2ff;
    box-shadow: none;
  }

  .conversation-item:hover {
    background: #edf2ff;
  }

  .sidebar-title-row {
    margin-bottom: 6px;
  }

  .sidebar-title {
    font-size: 13px;
  }

  /* 新建对话按钮扁平化 */
  .new-conversation-button {
    background: #ffffff;
    border-radius: 999px;
    border-color: rgba(209, 213, 219, 1);
    box-shadow: none;
  }

  .new-conversation-button:hover {
    background: #f3f4f6;
    border-color: rgba(156, 163, 175, 1);
    box-shadow: none;
    transform: none;
  }

  /* 输入区也改为更扁平的条形样式 */
  .chat-input {
    border-radius: 12px;
    background: #f9fafb;
    box-shadow: 0 0 0 1px rgba(229, 231, 235, 1);
  }

  .chat-input button {
    box-shadow: none;
  }

  /* 收紧对话列表高度，避免侧边栏挤占过多竖向空间 */
  .sidebar-conversations {
    max-height: 40vh;
  }

  .chat-header h1 {
    font-size: 20px;
  }

  .chat-header p {
    font-size: 12px;
  }

  .bubble {
    padding: 8px 10px;
    font-size: 13px;
  }

  .chat-header-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-header-main > div {
    width: 100%;
  }

  /* 移动端不再展示深浅色切换按钮，节省空间并简化交互 */
  .theme-toggle {
    display: none;
  }

  .chat-input {
    padding: 8px 10px;
    border-radius: 14px;
  }

  .chat-input textarea::placeholder {
    font-size: 12px;
  }

  .chat-input button {
    padding: 6px 10px;
    font-size: 13px;
  }

  .agent-tabs {
    width: 100%;
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .agent-tabs::-webkit-scrollbar {
    height: 4px;
  }

  .agent-tab {
    flex-shrink: 0;
    max-width: none;
  }

  .sidebar-left,
  .sidebar-right {
    border-radius: 14px;
    width: 100%;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
  }
}

