/* ==========================================================
   舆情报告分析系统 · 视觉系统 v2
   设计语言：深海军蓝主调 + 玻璃质感 + 克制的层次
   ========================================================== */

:root {
  /* 主色系 */
  --ink-900: #0b1020;
  --ink-800: #131a30;
  --ink-700: #1b2440;
  --ink-600: #263152;
  --primary: #131a30;

  /* 强调色 */
  --accent: #3b6ef0;
  --accent-soft: #6d95ff;
  --accent-ink: #2450c8;
  --accent-wash: #eef3ff;

  /* 语义色 */
  --success: #17a673;
  --success-wash: #e8f8f1;
  --danger: #e0484b;
  --danger-wash: #fdedee;
  --warn: #e08a2e;

  /* 中性色 */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --line: #e5e9f2;
  --line-soft: #eef1f7;
  --text: #1c2333;
  --text-2: #5a6480;
  --gray: #98a1b8;

  /* 形状与动效 */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --radius: 16px;

  /* 阴影：多层叠加，模拟真实光照 */
  --sh-xs: 0 1px 2px rgba(16, 24, 48, .05);
  --sh-sm: 0 2px 8px rgba(16, 24, 48, .06), 0 1px 2px rgba(16, 24, 48, .04);
  --sh-md: 0 8px 24px rgba(16, 24, 48, .08), 0 2px 6px rgba(16, 24, 48, .04);
  --sh-lg: 0 20px 48px rgba(16, 24, 48, .14), 0 4px 12px rgba(16, 24, 48, .06);
  --sh-accent: 0 6px 18px rgba(59, 110, 240, .28);

  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: .16s var(--ease);
  --t: .28s var(--ease);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum";
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:active { transform: scale(.975); }
[hidden] { display: none !important; }

::selection { background: rgba(59, 110, 240, .18); }

/* 滚动条：细、低调 */
.messages::-webkit-scrollbar,
.history-list::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
  background: rgba(26, 36, 64, .14);
  border-radius: 99px;
}
.messages::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover { background: rgba(26, 36, 64, .26); }
.messages::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================
   登录界面
   ========================================================== */
.login-screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1000px 600px at 15% 10%, rgba(59, 110, 240, .30), transparent 55%),
    radial-gradient(800px 520px at 85% 90%, rgba(109, 149, 255, .20), transparent 55%),
    linear-gradient(165deg, #0d1428 0%, #131c36 48%, #0a0f1e 100%);
}

/* 细网格纹理，增加质感 */
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 72%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--r-xl);
  padding: 40px 32px 32px;
  text-align: center;
  box-shadow: 0 32px 70px rgba(4, 8, 20, .48), 0 8px 20px rgba(4, 8, 20, .28);
  animation: cardIn .55s var(--ease-out);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  margin-bottom: 20px;
  display: inline-flex;
  padding: 12px;
  border-radius: 20px;
  background: linear-gradient(150deg, var(--ink-700), var(--ink-900));
  box-shadow: var(--sh-md);
}

.login-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: 2px;
  margin-bottom: 7px;
}

.login-subtitle {
  font-size: 12.5px;
  color: var(--gray);
  letter-spacing: .6px;
  margin-bottom: 30px;
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  font-size: 15.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.login-input::placeholder { color: var(--gray); }
.login-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 110, 240, .13);
}

.login-error {
  min-height: 20px;
  margin-top: 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--danger);
}

.login-btn {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-ink), var(--accent));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 6px;
  text-indent: 6px;
  border-radius: var(--r-md);
  box-shadow: var(--sh-accent);
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.login-btn:hover { box-shadow: 0 8px 24px rgba(59, 110, 240, .38); }
.login-btn:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(59, 110, 240, .3); }
.login-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ==========================================================
   聊天整体布局
   ========================================================== */
.chat-screen {
  position: fixed;
  inset: 0;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  box-shadow: 0 0 60px rgba(11, 16, 32, .12);
}

/* ---------- 顶栏 ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 11px 16px 12px;
  position: relative;
  z-index: 20;
  color: #fff;
  background: linear-gradient(160deg, var(--ink-700) 0%, var(--ink-900) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 4px 20px rgba(11, 16, 32, .18);
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* Logo 方块：给纯 SVG 加一层容器质感 */
.topbar-logo {
  display: inline-flex;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), #2a55cc);
  box-shadow: 0 3px 10px rgba(59, 110, 240, .4), 0 0 0 1px rgba(255, 255, 255, .1) inset;
}

.topbar-title {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: .8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 在线状态点 */
.topbar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ddc97;
  box-shadow: 0 0 0 3px rgba(61, 220, 151, .16);
  flex: 0 0 auto;
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .09);
}

.user-name {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, .92);
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .07) inset;
  white-space: nowrap;
  line-height: 1.3;
}

/* 头像小圆：让姓名区有层次 */
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-900);
  background: linear-gradient(140deg, #7ea6ff, #b9cfff);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 2px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  color: rgba(255, 255, 255, .78);
  padding: 7px 9px;
  min-width: 36px;
  border-radius: 10px;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.icon-btn:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.icon-btn:active { background: rgba(255, 255, 255, .2); }
.logout-text { font-size: 12.5px; }

@media (max-width: 400px) {
  .logout-text { display: none; }
  .user-name { font-size: 12px; padding: 5px 10px 5px 8px; }
  .topbar { padding: 10px 12px 11px; }
}

/* ---------- 消息区 ---------- */
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 16px 24px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.msg-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  animation: rowIn .34s var(--ease-out);
}
.msg-row.user { align-items: flex-end; }
.msg-row.bot { align-items: flex-start; }

@keyframes rowIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14.8px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: .1px;
}

/* 用户气泡：渐变 + 微光边 */
.msg-row.user .bubble {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-ink) 100%);
  color: #fff;
  border-radius: var(--radius) var(--radius) 5px var(--radius);
  box-shadow: 0 4px 14px rgba(59, 110, 240, .3);
}

/* 助手气泡：白卡 + 细边，比纯灰更通透 */
.msg-row.bot .bubble {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius) var(--radius) var(--radius) 5px;
  border: 1px solid var(--line-soft);
  box-shadow: var(--sh-sm);
}

.msg-time {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--gray);
  margin-top: 6px;
  padding: 0 4px;
  letter-spacing: .3px;
}

/* ---------- 消息内附件 ---------- */
.msg-file {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 7px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gray);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-2);
  max-width: 100%;
  overflow: hidden;
  box-shadow: var(--sh-xs);
}
.msg-file--ref {
  border-left-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-color: #d8e2fd;
}
.msg-file--data {
  border-left-color: var(--success);
  color: #0f7d55;
  background: var(--success-wash);
  border-color: #c9eddd;
}
.msg-file-tag {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(59, 110, 240, .13);
  white-space: nowrap;
}
.msg-file--data .msg-file-tag { background: rgba(23, 166, 115, .14); }
.msg-file span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row.bot .msg-file {
  background: var(--surface);
  border-left-color: var(--gray);
  border-color: var(--line);
  color: var(--text-2);
}

/* ---------- 任务进度卡片 ---------- */
.task-card {
  margin-top: 10px;
  min-width: 250px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--sh-sm);
  animation: rowIn .3s var(--ease-out);
}

.task-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 10px;
}

.task-pct {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #6d95ff 100%);
  transition: width .6s var(--ease-out);
  position: relative;
}

/* 进度条流光：让等待过程有生命感 */
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* 完成卡片 */
.task-card.done {
  border-color: #c4ead8;
  background: linear-gradient(150deg, #f2fbf7, #e9f7f0);
}
.task-done-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #0f7d55;
  font-size: 14px;
  font-weight: 600;
}
.task-done-file {
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-2);
  word-break: break-all;
  line-height: 1.5;
}
.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #17a673, #0f8f60);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--r-sm);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(23, 166, 115, .28);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.btn-download:hover { box-shadow: 0 6px 18px rgba(23, 166, 115, .36); }
.btn-download:active { transform: translateY(1px); }

/* 失败卡片 */
.task-card.failed {
  border-color: #f8cfd0;
  background: linear-gradient(150deg, #fef6f6, #fdf0f0);
}
.task-failed-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #b83c3e;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
}

/* ---------- 打字指示器 ---------- */
.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  padding: 15px 18px;
  border-radius: var(--radius) var(--radius) var(--radius) 5px;
  border: 1px solid var(--line-soft);
  box-shadow: var(--sh-sm);
}
.typing-bubble i {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: inline-block;
  animation: bounce 1.3s infinite;
}
.typing-bubble i:nth-child(2) { animation-delay: .16s; }
.typing-bubble i:nth-child(3) { animation-delay: .32s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ==========================================================
   输入区
   ========================================================== */
.input-bar {
  position: relative;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  z-index: 20;
  box-shadow: 0 -2px 16px rgba(16, 24, 48, .05);
}

/* ---------- 附件 chip ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 9px; }

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 6px 6px 6px 9px;
  background: var(--accent-wash);
  border: 1px solid #d8e2fd;
  border-left: 3px solid var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  box-shadow: var(--sh-xs);
  animation: chipIn .22s var(--ease-out);
}
@keyframes chipIn {
  from { opacity: 0; transform: translateY(5px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.file-chip--data {
  background: var(--success-wash);
  border-color: #c9eddd;
  border-left-color: var(--success);
  color: #0f7d55;
}
.file-chip-ico { display: inline-flex; flex: 0 0 auto; }
.file-chip-tag {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(59, 110, 240, .13);
  white-space: nowrap;
}
.file-chip--data .file-chip-tag { background: rgba(23, 166, 115, .14); }
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.file-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 22px;
  min-height: 22px;
  padding: 4px;
  border-radius: 50%;
  color: inherit;
  opacity: .6;
  transition: background var(--t-fast), opacity var(--t-fast);
}
.file-chip-x:hover { opacity: 1; background: rgba(59, 110, 240, .16); }
.file-chip--data .file-chip-x:hover { background: rgba(23, 166, 115, .18); }

/* ---------- 输入行 ---------- */
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 4px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--sh-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input-row:focus-within {
  border-color: rgba(59, 110, 240, .5);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 110, 240, .1), var(--sh-sm);
}

.input-tool {
  flex: 0 0 auto;
  display: inline-flex;
  padding: 9px;
  color: var(--text-2);
  border-radius: 11px;
  transition: background var(--t-fast), color var(--t-fast);
}
.input-tool:hover { background: rgba(59, 110, 240, .1); color: var(--accent); }
.input-tool--active { color: var(--accent); background: var(--accent-wash); }

.msg-input {
  flex: 1 1 auto;
  resize: none;
  border: none;
  background: transparent;
  padding: 9px 2px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  max-height: 76px;
  outline: none;
  color: var(--text);
}
.msg-input::placeholder { color: var(--gray); }

.send-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(140deg, var(--accent), var(--accent-ink));
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(59, 110, 240, .3);
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.send-btn:hover { box-shadow: 0 6px 18px rgba(59, 110, 240, .42); }
.send-btn:active { transform: scale(.94); }
.send-btn:disabled {
  opacity: .38;
  cursor: not-allowed;
  box-shadow: none;
  background: var(--gray);
}

/* ---------- 附件菜单 ---------- */
.attach-wrap { position: relative; flex: 0 0 auto; }

.attach-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: min(306px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 6px;
  box-shadow: var(--sh-lg);
  z-index: 40;
  animation: menuIn .2s var(--ease-out);
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.attach-menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  border-radius: 11px;
  text-align: left;
  transition: background var(--t-fast);
}
.attach-menu-item:hover,
.attach-menu-item:focus-visible { background: var(--surface-2); outline: none; }

.attach-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-wash);
  color: var(--accent);
}
.attach-menu-icon--data { background: var(--success-wash); color: #0f8f60; }

.attach-menu-body { flex: 1 1 auto; min-width: 0; }
.attach-menu-title { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-900); }
.attach-menu-desc { display: block; margin-top: 2px; font-size: 11px; line-height: 1.45; color: var(--gray); }
.attach-menu-state { flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--success); white-space: nowrap; }
.attach-menu-state.is-set::before { content: "✓ "; }

/* 附件数量徽标 */
.attach-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.attach-badge--max { background: var(--success); }

/* ---------- 轻提示 ---------- */
.hint-toast {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 4px);
  padding: 9px 13px;
  background: var(--ink-800);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  border-radius: var(--r-sm);
  box-shadow: var(--sh-lg);
  z-index: 45;
  animation: menuIn .2s var(--ease-out);
}

/* ==========================================================
   侧边抽屉面板（历史报告 / 案例库）
   ========================================================== */
.history-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 16, 32, .38);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 30;
  animation: fadeIn .25s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.history-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 88%);
  background: var(--surface);
  z-index: 31;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(11, 16, 32, .2);
  animation: slideIn .34s var(--ease-out);
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.history-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .8px;
  background: linear-gradient(160deg, var(--ink-700), var(--ink-900));
}

/* 抽屉里的关闭按钮改为浅色适配 */
.history-head .icon-btn { color: rgba(255, 255, 255, .82); min-width: 32px; padding: 6px; }

.history-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg);
}

.history-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 11px;
  box-shadow: var(--sh-xs);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.history-item:hover { box-shadow: var(--sh-sm); transform: translateY(-1px); }

.history-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.55;
  word-break: break-all;
}
.history-item-meta { font-size: 11.5px; color: var(--gray); margin-top: 6px; }
.history-item .btn-download { width: 100%; margin-top: 11px; padding: 9px; font-size: 13px; }

.history-empty {
  text-align: center;
  color: var(--gray);
  font-size: 13.5px;
  padding: 44px 12px;
  line-height: 1.7;
}

/* ---------- 案例库搜索 ---------- */
.archive-search {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: var(--ink-800);
}
.archive-search input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, .07);
  color: #e8ecf6;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.archive-search input:focus { outline: none; border-color: var(--accent); background: rgba(255, 255, 255, .11); }
.archive-search input::placeholder { color: rgba(255, 255, 255, .38); }

.archive-go {
  background: linear-gradient(135deg, var(--accent), var(--accent-ink));
  color: #fff;
  border-radius: var(--r-sm);
  padding: 0 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(59, 110, 240, .3);
  transition: opacity var(--t-fast);
}
.archive-go:active { opacity: .85; }

.archive-stats {
  padding: 9px 14px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .55);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  line-height: 1.55;
  background: var(--ink-800);
}

.history-item-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 6px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chip {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  margin-right: 5px;
}

/* ==========================================================
   桌面端
   ========================================================== */
@media (min-width: 600px) {
  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 24px;
  }
  .topbar-right { padding-top: 0; border-top: 0; flex: 0 0 auto; }
  .user-name { flex: 0 0 auto; }
  .messages { padding: 26px 28px 30px; }
  .input-bar { padding: 12px 20px 14px; }
  .bubble { max-width: 78%; }
}

/* ==========================================================
   试运行标注 + 反馈闭环
   ========================================================== */

/* 登录页试运行徽标 */
.trial-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  margin-bottom: 22px;
  border-radius: 999px;
  background: rgba(224, 138, 46, .1);
  border: 1px solid rgba(224, 138, 46, .3);
  color: #b5701c;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
}
.trial-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(224, 138, 46, .18);
  animation: pulseDot 2.4s ease-in-out infinite;
}

/* 顶栏试运行标签 */
.trial-tag {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(224, 138, 46, .18);
  border: 1px solid rgba(224, 138, 46, .35);
  color: #f0b464;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .5px;
  white-space: nowrap;
}

/* 完成卡片里的核验提醒 */
.task-review-tip {
  margin-top: 13px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: rgba(224, 138, 46, .08);
  border: 1px solid rgba(224, 138, 46, .22);
  border-left: 3px solid var(--warn);
}
.task-review-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #b5701c;
  margin-bottom: 5px;
  letter-spacing: .3px;
}
.task-review-body {
  font-size: 12px;
  line-height: 1.7;
  color: #7a6236;
}
.task-review-body b { color: #8a5a10; font-weight: 700; }

/* 反馈按钮 */
.btn-feedback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 9px;
  padding: 9px;
  background: #fff;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #cfdcfb;
  border-radius: var(--r-sm);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.btn-feedback:hover { background: var(--accent-wash); border-color: var(--accent); }

/* ---------- 反馈面板表单 ---------- */
.fb-form {
  flex: 0 0 auto;
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.fb-form-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 12px;
  letter-spacing: .3px;
}
.fb-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  margin: 10px 0 5px;
}
.fb-select,
.fb-input,
.fb-textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.fb-select:focus,
.fb-input:focus,
.fb-textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 110, 240, .12);
}
.fb-textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
.fb-textarea::placeholder,
.fb-input::placeholder { color: var(--gray); }

.fb-submit {
  width: 100%;
  margin-top: 13px;
  padding: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-ink));
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--r-sm);
  box-shadow: var(--sh-accent);
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.fb-submit:active { transform: translateY(1px); }
.fb-submit:disabled { opacity: .6; cursor: not-allowed; }

.fb-hint {
  margin-top: 9px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--gray);
  text-align: center;
}

.fb-stats {
  flex: 0 0 auto;
  padding: 9px 16px;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

/* ---------- 反馈列表 ---------- */
.fb-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px;
  margin-bottom: 11px;
  box-shadow: var(--sh-xs);
}
.fb-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}
.fb-item-user { font-size: 13px; font-weight: 700; color: var(--ink-900); }

.fb-status {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.fb-status--pending { background: #fdf1de; color: #b5701c; }
.fb-status--reviewing { background: var(--accent-wash); color: var(--accent-ink); }
.fb-status--fixed { background: var(--success-wash); color: #0f7d55; }
.fb-status--rejected,
.fb-status--closed { background: #f1f3f7; color: var(--text-2); }

.fb-item-type {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  margin-bottom: 7px;
}
.fb-item-content {
  font-size: 13px;
  line-height: 1.68;
  color: var(--text);
  word-break: break-word;
}
.fb-item-file {
  margin-top: 7px;
  font-size: 11px;
  color: var(--text-2);
  word-break: break-all;
}
.fb-item-time {
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--gray);
}
.fb-item-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--success-wash);
  border-left: 3px solid var(--success);
  font-size: 11.5px;
  line-height: 1.6;
  color: #0f6b4a;
}
