/* ══════════════════════════════════════════════════════════════════
   同频 ToneLink · 客户端样式
   深空墨蓝 + 信号绿 · 纯原生 CSS，无外部依赖
   ══════════════════════════════════════════════════════════════════ */

/* ── 设计令牌 ─────────────────────────────────────────────────── */
:root {
  --bg: #0B1020;
  --bg-deep: #070C18;
  --panel: #0F1729;
  --panel-2: #121C33;
  --panel-3: #18233D;
  --line: #22304D;
  --line-soft: rgba(34, 48, 77, 0.62);
  --line-strong: rgba(34, 48, 77, 0.95);

  --text: #EEF3FF;
  --text-2: #94A2BE;
  --text-3: #5D6A87;

  --green: #2EE6A8;
  --green-deep: #17D2A4;
  --green-ink: #052018;
  --green-dim: rgba(46, 230, 168, 0.1);
  --green-line: rgba(46, 230, 168, 0.2);

  --red: #FF7A8A;
  --red-dim: rgba(255, 122, 138, 0.1);
  --amber: #FFB454;
  --amber-dim: rgba(255, 180, 84, 0.1);
  --blue: #7AA2FF;

  --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  --mono: Consolas, "Cascadia Mono", "SFMono-Regular", monospace;

  --r-xs: 5px;
  --r-sm: 7px;
  --r: 9px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --shadow-1: 0 2px 10px rgba(0, 0, 0, 0.18);
  --shadow-2: 0 16px 44px -12px rgba(0, 0, 0, 0.55);
  --shadow-3: 0 30px 80px -20px rgba(0, 0, 0, 0.75);
  --ring-green: 0 0 0 3px rgba(46, 230, 168, 0.1);

  --titlebar-h: 40px;
  --rail-w: 64px;
  --conv-w: 272px;
  --detail-w: 300px;

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ── 基础重置 ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea { background: none; border: 0; outline: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
code, kbd { font-family: var(--mono); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid rgba(46, 230, 168, 0.55); outline-offset: 2px; }
::selection { background: rgba(46, 230, 168, 0.28); color: #fff; }

/* 滚动条：细、暗、克制 */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 162, 190, 0.18) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 162, 190, 0.16);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 162, 190, 0.3); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ── 图标 ─────────────────────────────────────────────────────── */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
  pointer-events: none;
}

/* ── 通用原子 ─────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex: none;
}
.tag-green { color: var(--green); background: var(--green-dim); border-color: rgba(46, 230, 168, 0.18); }
.tag-amber { color: var(--amber); background: var(--amber-dim); border-color: rgba(255, 180, 84, 0.2); }
.tag-muted { color: var(--text-3); background: rgba(148, 162, 190, 0.06); border-color: rgba(148, 162, 190, 0.13); }
.tag-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.dot-live {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(46, 230, 168, 0.75);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.12s var(--ease);
}
.btn .ic { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; filter: saturate(0.6); }

.btn-primary {
  color: var(--green-ink);
  font-weight: 600;
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  box-shadow: 0 5px 18px -6px rgba(46, 230, 168, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 8px 22px -6px rgba(46, 230, 168, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.28); }

.btn-ghost {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--line);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--panel-2); border-color: rgba(148, 162, 190, 0.28); }

.btn-danger { color: var(--red); }
.btn-danger:hover:not(:disabled) { color: #FFA3B0; background: var(--red-dim); border-color: rgba(255, 122, 138, 0.3); }

.btn-lg { height: 44px; width: 100%; border-radius: var(--r-md); font-size: 13.5px; }
.btn-lg .btn-arrow { width: 16px; height: 16px; transition: transform 0.18s var(--ease); }
.btn-lg:hover .btn-arrow { transform: translateX(3px); }

.btn-send { height: 32px; min-width: 70px; padding: 0 17px; border-radius: 8px; font-size: 12.5px; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
  flex: none;
}
.icon-btn .ic { width: 17px; height: 17px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.055); color: var(--text); }
.icon-btn.is-on { color: var(--green); background: var(--green-dim); }
.icon-btn-accent {
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(46, 230, 168, 0.16);
}
.icon-btn-accent:hover { background: rgba(46, 230, 168, 0.18); color: var(--green); }

/* 顶栏图标按钮 / 头像的自定义 tooltip（避免原生 title 的浏览器观感） */
.icon-btn[data-tip] { position: relative; }
.icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-3px);
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 10.5px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
  box-shadow: var(--shadow-2);
  z-index: 80;
}
.icon-btn[data-tip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.rail-avatar[data-tip] { position: relative; }
.rail-avatar[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 42px;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 10.5px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
  box-shadow: var(--shadow-2);
  z-index: 60;
}
.rail-avatar[data-tip]:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }

.kbd {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--line-soft);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text-3);
  font-size: 9px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 20px;
  border: 1px solid transparent;
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill-live { color: var(--green); background: rgba(46, 230, 168, 0.07); border-color: rgba(46, 230, 168, 0.2); }
.pill-live .dot { box-shadow: 0 0 7px rgba(46, 230, 168, 0.8); }
.pill-warn { color: var(--amber); background: var(--amber-dim); border-color: rgba(255, 180, 84, 0.24); }
.pill-warn .dot { animation: pulse 1.3s ease-in-out infinite; }
.pill-off { color: var(--red); background: var(--red-dim); border-color: rgba(255, 122, 138, 0.24); }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-2);
  font-size: inherit;
  cursor: pointer;
  transition: color 0.14s;
}
.linklike:hover { color: var(--green); }

/* ── 启动遮罩 ─────────────────────────────────────────────────── */
.boot {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background:
    radial-gradient(600px 400px at 50% 42%, rgba(46, 230, 168, 0.055), transparent 65%),
    var(--bg-deep);
  transition: opacity 0.28s var(--ease), visibility 0.28s;
}
.boot.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner { display: flex; flex-direction: column; align-items: center; }
.boot-logo {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 0 22px rgba(46, 230, 168, 0.55));
  animation: breathe 2.2s ease-in-out infinite;
}
.boot-name { margin-top: 12px; font-size: 14px; font-weight: 600; letter-spacing: 0.02em; }
.boot-name span { margin-left: 4px; color: var(--text-3); font-weight: 400; font-size: 10px; letter-spacing: 0.16em; }
.boot-bar {
  width: 116px;
  height: 3px;
  margin-top: 18px;
  border-radius: 3px;
  background: var(--panel-2);
  overflow: hidden;
}
.boot-bar i {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  animation: bootslide 1.25s ease-in-out infinite;
}
.boot p { margin-top: 12px; font-size: 10.5px; color: var(--text-3); letter-spacing: 0.04em; }

/* ══════════════════════════════════════════════════════════════
   登录页
   ══════════════════════════════════════════════════════════════ */
.screen { height: 100vh; }

.login {
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
}
.login-aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(720px 520px at 12% 18%, rgba(46, 230, 168, 0.1), transparent 62%),
    radial-gradient(760px 560px at 88% 4%, rgba(90, 132, 255, 0.09), transparent 60%),
    radial-gradient(700px 620px at 72% 96%, rgba(122, 90, 255, 0.07), transparent 62%),
    linear-gradient(180deg, #080D1A 0%, #0B1020 58%, #090E1C 100%);
}
.login-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 162, 190, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 162, 190, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 72% 62% at 34% 44%, #000 0%, transparent 78%);
  mask-image: radial-gradient(ellipse 72% 62% at 34% 44%, #000 0%, transparent 78%);
  opacity: 0.75;
}
.login-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 34px;
}
/* Electron 无边框壳：登录页也要能拖动 / 最小化 / 关闭 */
body.is-electron .login-top { -webkit-app-region: drag; padding-top: 0; height: 64px; padding-right: 152px; }
body.is-electron .login-top-meta { display: none; }
body.is-electron .login-main { -webkit-app-region: no-drag; }
.login-winctl { position: absolute; top: 0; right: 0; z-index: 6; display: flex; height: 40px; align-items: stretch; margin-left: 0; -webkit-app-region: no-drag; }
.login-winctl .win-btn { height: 40px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; filter: drop-shadow(0 0 14px rgba(46, 230, 168, 0.45)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 14.5px; font-weight: 600; letter-spacing: 0.02em; }
.brand-text span { font-size: 9px; color: var(--text-3); letter-spacing: 0.2em; text-transform: uppercase; margin-top: 1px; }
.login-top-meta { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--text-3); letter-spacing: 0.02em; }
.login-top-meta .sep { color: var(--line); }

.login-main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(400px, 0.82fr);
  align-items: center;
  gap: 56px;
  width: 100%;
  max-width: 1330px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 96px 64px 56px;
}
.login-hero { min-width: 0; }
.hero-eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.hero-eyebrow-text { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.08em; }
.login-hero h1 {
  font-size: clamp(36px, 3.9vw, 54px);
  line-height: 1.16;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}
.login-hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #8CF3CE 0%, var(--green) 48%, var(--green-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(46, 230, 168, 0.18));
}
.hero-lead {
  max-width: 480px;
  margin-top: 22px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-2);
}
.hero-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 560px;
  margin-top: 34px;
}
.hero-points li {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.hero-points li:hover { border-color: rgba(46, 230, 168, 0.18); background: rgba(46, 230, 168, 0.025); }
.hero-ic {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 11px;
  border-radius: 9px;
  border: 1px solid rgba(46, 230, 168, 0.16);
  background: rgba(46, 230, 168, 0.075);
  color: var(--green);
}
.hero-ic .ic { width: 16px; height: 16px; }
.hero-points b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.hero-points span { display: block; margin-top: 4px; font-size: 10.5px; line-height: 1.6; color: var(--text-3); }
.hero-signal { max-width: 560px; margin-top: 38px; opacity: 0.9; }
.hero-signal svg { width: 100%; height: 92px; display: block; }

.login-side { display: flex; flex-direction: column; align-items: center; position: relative; }
.login-side::before {
  content: "";
  position: absolute;
  inset: -70px -50px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(46, 230, 168, 0.09), transparent 72%);
  pointer-events: none;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 408px;
  padding: 28px;
  border: 1px solid rgba(148, 162, 190, 0.11);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(18px);
}
.login-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(46, 230, 168, 0.7), transparent);
}
.login-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-card-badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  border: 1px solid rgba(46, 230, 168, 0.2);
  background: var(--green-dim);
  color: var(--green);
}
.login-card-badge .ic { width: 19px; height: 19px; }
.login-card-head h2 { font-size: 18px; font-weight: 600; letter-spacing: 0.01em; }
.login-card-head p { margin-top: 4px; font-size: 11px; color: var(--text-3); }

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
}
.field-hint { font-size: 9.5px; font-weight: 400; color: var(--text-3); }
.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}
.field input::placeholder { color: var(--text-3); }
.field input:hover { border-color: rgba(148, 162, 190, 0.3); }
.field input:focus { border-color: rgba(46, 230, 168, 0.55); box-shadow: var(--ring-green); background: var(--panel-2); }

.login-error {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 122, 138, 0.25);
  border-radius: 8px;
  background: var(--red-dim);
  color: #FFA3B0;
  font-size: 11.5px;
  line-height: 1.5;
}
.login-error .ic { width: 15px; height: 15px; flex: none; }
.login-error.is-shake { animation: shake 0.32s var(--ease); }
.login-error.is-ok {
  border-color: rgba(46, 230, 168, 0.25);
  background: var(--green-dim);
  color: #8CF3CE;
}
.login-error.is-info {
  border-color: var(--line);
  background: rgba(148, 162, 190, 0.055);
  color: var(--text-2);
}
.btn.is-busy { cursor: progress; }
.btn.is-busy .btn-arrow { display: none; }
.btn.is-busy::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(5, 32, 24, 0.22);
  border-top-color: var(--green-ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.login-links { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 17px; font-size: 11px; color: var(--text-3); }
.login-links a { color: var(--text-2); transition: color 0.14s; }
.login-links a:hover { color: var(--green); }
.dot-sep { color: var(--line); }
.login-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 19px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 10px;
  color: var(--text-3);
}
.login-foot .ic { width: 12px; height: 12px; }
.login-legal { margin-top: 20px; font-size: 10px; color: var(--text-3); letter-spacing: 0.04em; text-align: center; }

/* ══════════════════════════════════════════════════════════════
   主界面骨架
   ══════════════════════════════════════════════════════════════ */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* 标题栏 */
.titlebar {
  position: relative;
  z-index: 30;
  height: var(--titlebar-h);
  flex: none;
  display: flex;
  align-items: center;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line-soft);
  -webkit-app-region: drag;
}
.tb-left { display: flex; align-items: center; gap: 8px; padding-left: 16px; flex: none; }
.tb-logo { width: 20px; height: 20px; filter: drop-shadow(0 0 8px rgba(46, 230, 168, 0.4)); }
.tb-name { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.tb-sub { font-size: 9px; color: var(--text-3); letter-spacing: 0.18em; margin-top: 1px; }
.tb-divider { width: 1px; height: 14px; margin: 0 6px; background: var(--line); }
.tb-space { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.02em; }
.tb-drag { flex: 1; align-self: stretch; }
.tb-right { display: flex; align-items: center; gap: 12px; padding-left: 18px; flex: none; -webkit-app-region: no-drag; }
.conn-state { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 10.5px; color: var(--text-3); }
.conn-state .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex: none; }
.conn-state.is-online { color: var(--text-2); }
.conn-state.is-online .dot { background: var(--green); box-shadow: 0 0 8px rgba(46, 230, 168, 0.75); }
.conn-state.is-connecting .dot,
.conn-state.is-reconnecting .dot { background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
.conn-state.is-reconnecting { color: var(--amber); background: var(--amber-dim); }
.conn-state.is-offline { color: var(--red); }
.conn-state.is-offline .dot { background: var(--red); }

.win-controls { display: flex; align-self: stretch; margin-left: 2px; }
.win-btn {
  width: 46px;
  height: var(--titlebar-h);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background 0.12s, color 0.12s;
  -webkit-app-region: no-drag;
}
.win-btn .ic { width: 13px; height: 13px; stroke-width: 1.4; }
.win-btn:hover { background: rgba(255, 255, 255, 0.065); color: var(--text); }
.win-btn-close:hover { background: #E81123; color: #fff; }

.app-body { flex: 1; min-height: 0; display: flex; }

/* ── 多标签工作区：标签条 ─────────────────────────────────────── */
.tabs-bar {
  height: 36px;
  flex: none;
  display: flex;
  align-items: stretch;
  padding: 0 10px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  z-index: 25;
  -webkit-app-region: no-drag;
}
.tabs-list {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tabs-list::-webkit-scrollbar { display: none; }
.tabs-empty {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.01em;
}
.tabs-empty .ic { width: 13px; height: 13px; opacity: 0.65; }
.tab {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  min-width: 112px;
  max-width: 190px;
  padding: 0 6px 0 10px;
  border-radius: 8px 8px 0 0;
  color: var(--text-3);
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.tab:hover { background: rgba(255, 255, 255, 0.032); color: var(--text-2); }
.tab.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: inset 0 -2px 0 rgba(46, 230, 168, 0.7), 0 -1px 0 rgba(255, 255, 255, 0.04);
}
.tab.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--green);
  opacity: 0.9;
  box-shadow: 0 0 8px rgba(46, 230, 168, 0.55);
}
.tab .tab-avatar { width: 18px; height: 18px; border-radius: 5px; font-size: 8px; flex: none; }
.tab-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.tab-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 7px rgba(46, 230, 168, 0.8);
}
.tab-close {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--text-3);
  opacity: 0.5;
  transition: background 0.12s, color 0.12s, opacity 0.12s;
}
.tab-close .ic { width: 11px; height: 11px; }
.tab-close:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); opacity: 1; }
.tab:hover .tab-close, .tab.is-active .tab-close { opacity: 0.8; }
.tab.is-menu-open { background: rgba(255, 255, 255, 0.05); }
.app.is-tab-dragging { cursor: grabbing; user-select: none; }
.app.is-tab-dragging .tab { transition: none; }
.menu.tab-menu { position: fixed; z-index: 160; min-width: 186px; }

/* ── 侧栏调宽 / 折叠 ─────────────────────────────────────────── */
.conv-pane { position: relative; }
.pane-head-actions { display: flex; align-items: center; gap: 6px; }
.conv-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 6;
}
.conv-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  background: transparent;
  transition: background 0.12s, box-shadow 0.12s;
}
.conv-resizer:hover::after,
body.is-resizing-sidebar .conv-resizer::after {
  background: rgba(46, 230, 168, 0.5);
  box-shadow: 0 0 8px rgba(46, 230, 168, 0.35);
}
body.is-resizing-sidebar { cursor: col-resize; user-select: none; }
body.is-resizing-sidebar .conv-pane { transition: none; }
.app.conv-collapsed .conv-pane { width: 72px; }
.app.conv-collapsed .pane-head { height: 56px; justify-content: center; padding: 0; }
.app.conv-collapsed .pane-title,
.app.conv-collapsed #btn-new-conv,
.app.conv-collapsed .search-box,
.app.conv-collapsed .conv-section,
.app.conv-collapsed .conv-foot,
.app.conv-collapsed .conv-main,
.app.conv-collapsed .conv-resizer { display: none; }
.app.conv-collapsed .pane-head-actions { gap: 0; }
.app.conv-collapsed #btn-collapse-conv { width: 34px; height: 34px; border-radius: 10px; }
.app.conv-collapsed .conv-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0 10px;
}
.app.conv-collapsed .conv-item {
  width: 52px;
  height: 52px;
  padding: 0;
  justify-content: center;
  gap: 0;
  border-radius: 12px;
}
.app.conv-collapsed .conv-item .av { width: 36px; height: 36px; font-size: 13px; }
.app.conv-collapsed .conv-item.is-active::before { top: 8px; bottom: 8px; }
.conv-unread-dot {
  display: none;
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--panel);
  box-shadow: 0 0 8px rgba(46, 230, 168, 0.6);
}
.app.conv-collapsed .conv-unread-dot { display: block; }

/* ── 拆窗（单会话视图） ─────────────────────────────────────── */
.app.is-detached .tabs-bar,
.app.is-detached .rail,
.app.is-detached .conv-pane { display: none !important; }
.app.is-detached .app-body { background: var(--panel); }
.app.is-detached #empty-new { display: none; }
.app.is-detached .detail-pane { border-left: 1px solid var(--line-soft); }

/* 图标栏 */
.rail {
  width: var(--rail-w);
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 12px;
  background: var(--bg-deep);
  border-right: 1px solid var(--line-soft);
}
.rail-top, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.rail-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.rail-btn .ic { width: 20px; height: 20px; stroke-width: 1.65; }
.rail-btn:hover { background: rgba(255, 255, 255, 0.045); color: var(--text-2); }
.rail-btn.is-active { color: var(--green); background: var(--green-dim); }
.rail-btn.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
  box-shadow: 0 0 12px rgba(46, 230, 168, 0.65);
}
.rail-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: 50px;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 10.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
  box-shadow: var(--shadow-2);
  z-index: 60;
}
.rail-btn:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }
.rail-bottom { margin-top: auto; }
.rail-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  margin-top: 4px;
  overflow: visible;
  position: relative;
  box-shadow: 0 0 0 1px rgba(46, 230, 168, 0.22), 0 4px 14px -4px rgba(46, 230, 168, 0.35);
  transition: transform 0.14s var(--ease), box-shadow 0.14s;
}
.rail-avatar:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(46, 230, 168, 0.4), 0 6px 18px -4px rgba(46, 230, 168, 0.45); }

/* 头像通用 */
.av {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  user-select: none;
  background: linear-gradient(145deg, hsl(var(--av-h, 160) 42% 30%), hsl(var(--av-h, 160) 52% 21%));
  color: hsl(var(--av-h, 160) 78% 82%);
  border: 1px solid hsl(var(--av-h, 160) 45% 38% / 0.45);
}
.av-wrap { position: relative; flex: none; }
.online-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--ring-color, var(--panel));
  box-shadow: 0 0 7px rgba(46, 230, 168, 0.6);
  z-index: 1;
}

/* 会话列表 */
.conv-pane {
  width: var(--conv-w);
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
}
.pane-head {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 18px;
}
.pane-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; letter-spacing: 0.01em; }
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  border-radius: 20px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 500;
}
.pane-head .icon-btn { width: 28px; height: 28px; border-radius: 8px; }
.pane-head .icon-btn .ic { width: 16px; height: 16px; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  flex: none;
  margin: 0 14px 12px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 12, 24, 0.6);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.search-box .ic { width: 14px; height: 14px; color: var(--text-3); }
.search-box input { flex: 1; min-width: 0; font-size: 11.5px; color: var(--text); }
.search-box input::placeholder { color: var(--text-3); }
.search-box:focus-within { border-color: rgba(46, 230, 168, 0.42); box-shadow: 0 0 0 3px rgba(46, 230, 168, 0.07); }
.search-box:focus-within .kbd { display: none; }
.search-box .kbd { font-size: 8.5px; }

.conv-section {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 18px 8px;
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}
.conv-section-count { color: var(--text-3); opacity: 0.8; }

.conv-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 8px 8px; }
.conv-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.13s var(--ease);
}
.conv-item + .conv-item { margin-top: 1px; }
.conv-item:hover { background: rgba(255, 255, 255, 0.028); }
.conv-item.is-active { background: linear-gradient(90deg, rgba(46, 230, 168, 0.105), rgba(46, 230, 168, 0.022) 62%, transparent); }
.conv-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
  box-shadow: 0 0 10px rgba(46, 230, 168, 0.55);
}
.conv-item .av { width: 38px; height: 38px; font-size: 14px; }
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.conv-item.is-active .conv-name, .conv-item:hover .conv-name { color: var(--text); }
.conv-time { flex: none; font-size: 9.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.conv-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; }
.conv-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.5;
}
.conv-item.is-active .conv-preview { color: var(--text-2); }
.conv-preview.is-typing { color: var(--green); }
.conv-preview .pv-me { color: var(--text-3); }
.unread {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--green);
  color: var(--green-ink);
  font-size: 9.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 10px rgba(46, 230, 168, 0.28);
}
.conv-empty { padding: 30px 16px; text-align: center; font-size: 11.5px; color: var(--text-3); line-height: 1.8; }

.conv-foot {
  flex: none;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.conv-foot .dot-live { width: 5px; height: 5px; }
.conv-foot.is-warn { color: var(--amber); }
.conv-foot.is-warn .dot-live { background: var(--amber); box-shadow: 0 0 8px rgba(255, 180, 84, 0.6); animation: pulse 1.2s infinite; }

/* ── 聊天区骨架 ───────────────────────────────────────────────── */
.chat-pane {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 480px at 72% -18%, rgba(46, 230, 168, 0.035), transparent 62%),
    radial-gradient(700px 500px at 8% 112%, rgba(88, 120, 255, 0.045), transparent 60%),
    var(--bg);
}
.chat-view { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: fadeUp 0.22s var(--ease); }

.chat-head {
  position: relative;
  z-index: 6;
  height: 64px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 16px 0 22px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 64%, transparent));
  backdrop-filter: blur(12px);
}
.ch-id { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ch-avatar .av { width: 38px; height: 38px; font-size: 14px; border-radius: 11px; }
.ch-text { min-width: 0; }
.ch-title-row { display: flex; align-items: center; gap: 8px; }
.ch-title-row h1 {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.ch-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}
.ch-sub.is-typing { color: var(--green); }
.ch-sub .sep { color: var(--line); }
.ch-actions { display: flex; align-items: center; gap: 5px; flex: none; }
.ch-actions .pill { margin-right: 5px; }
.menu-wrap { position: relative; }

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 186px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  box-shadow: var(--shadow-2);
  z-index: 70;
  animation: pop 0.14s var(--ease);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 11.5px;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.menu-item .ic { width: 14px; height: 14px; color: var(--text-3); }
.menu-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--line-soft); }

/* 消息滚动区 */
.msg-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.msg-stage {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 28px 18px;
}
.msg-list { display: flex; flex-direction: column; }
.msg-list:has(.msg-empty),
.msg-list:has(.msg-skeleton) {
  flex: 1;
  justify-content: center;
}
.msg-bottom { height: 2px; flex: none; }

.msg-date {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 4px 14px;
  color: var(--text-3);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  user-select: none;
}
.msg-date::before, .msg-date::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-soft));
}
.msg-date::after { background: linear-gradient(90deg, var(--line-soft), transparent); }
.msg-date span {
  flex: none;
  padding: 2px 9px;
  border: 1px solid rgba(34, 48, 77, 0.55);
  border-radius: 20px;
  background: rgba(18, 28, 51, 0.5);
  font-variant-numeric: tabular-nums;
}

.msg-row { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; }
.msg-row.is-cont { margin-top: 4px; }
.msg-row.is-mine { flex-direction: row-reverse; }
.msg-row .av { width: 30px; height: 30px; font-size: 11.5px; border-radius: 8px; }
.msg-avatar-spacer { width: 30px; flex: none; }
.msg-main { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: min(74%, 600px); }
.msg-row.is-mine .msg-main { align-items: flex-end; }
.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 3px 4px;
  font-size: 9.5px;
  color: var(--text-3);
  line-height: 1.2;
  white-space: nowrap;
}
.msg-row.is-cont .msg-meta { display: none; }
.msg-sender { font-size: 10.5px; font-weight: 600; color: var(--msg-sender, var(--text-2)); }
.msg-time { font-variant-numeric: tabular-nums; color: var(--text-3); }
.msg-row.is-mine .msg-meta { flex-direction: row; }

.msg-bubble {
  position: relative;
  max-width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.68;
  letter-spacing: 0.005em;
  word-break: break-word;
  white-space: pre-wrap;
  user-select: text;
  cursor: text;
}
.msg-row.is-theirs .msg-bubble {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid rgba(34, 48, 77, 0.85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
}
.msg-row.is-theirs.group-start .msg-bubble { border-top-left-radius: 4px; }
.msg-row.is-mine .msg-bubble {
  color: var(--green-ink);
  background: linear-gradient(135deg, #2EE6A8, #17D2A4);
  box-shadow: 0 6px 20px -10px rgba(46, 230, 168, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-weight: 500;
}
.msg-row.is-mine.group-start .msg-bubble { border-top-right-radius: 4px; }
.msg-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg-bubble .msg-mention { color: var(--green); font-weight: 600; }
.msg-row.is-mine .msg-bubble .msg-mention { color: #0B4A37; }

.msg-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--text-3);
  white-space: nowrap;
}
.msg-status .ic { width: 12px; height: 12px; stroke-width: 1.9; }
.msg-status.is-read { color: var(--green); }
.msg-status.is-read .ic { filter: drop-shadow(0 0 5px rgba(46, 230, 168, 0.35)); }
.msg-status.is-sending .ic { animation: spin 1.4s linear infinite; }
.msg-status.is-failed { color: var(--red); cursor: pointer; }
.msg-status.is-failed:hover { text-decoration: underline; }

/* 文件卡片（演示 / v2 预留渲染） */
.msg-file {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 252px;
  max-width: 100%;
  padding: 10px;
  border: 1px solid rgba(34, 48, 77, 0.9);
  border-radius: 10px;
  background: var(--panel-2);
  box-shadow: 0 4px 16px -8px rgba(0, 0, 0, 0.5);
}
.msg-file-ic {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  border: 1px solid rgba(46, 230, 168, 0.16);
  background: var(--green-dim);
  color: var(--green);
}
.msg-file-ic .ic { width: 17px; height: 17px; }
.msg-file-main { flex: 1; min-width: 0; }
.msg-file-name { font-size: 11.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file-meta { margin-top: 3px; font-size: 9.5px; color: var(--text-3); }
.msg-file-btn {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.14s, color 0.14s;
}
.msg-file-btn:hover { background: var(--green-dim); color: var(--green); }
.msg-file-btn .ic { width: 14px; height: 14px; }

/* 正在输入 */
.typing-row { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; }
.typing-row .av { width: 30px; height: 30px; font-size: 11.5px; border-radius: 8px; }
.typing-main { display: flex; flex-direction: column; align-items: flex-start; }
.typing-label { margin: 0 3px 5px; font-size: 9.5px; color: var(--text-3); }
.typing-label b { font-weight: 600; }
.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 13px;
  border: 1px solid rgba(34, 48, 77, 0.85);
  border-radius: 10px;
  border-top-left-radius: 4px;
  background: var(--panel-2);
}
.typing-bubble i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-2);
  animation: blink 1.3s ease-in-out infinite;
}
.typing-bubble i:nth-child(2) { animation-delay: 0.18s; }
.typing-bubble i:nth-child(3) { animation-delay: 0.36s; }

.msg-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 60px;
  text-align: center;
}
.msg-empty-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  border: 1px solid rgba(46, 230, 168, 0.16);
  border-radius: 15px;
  background: var(--green-dim);
  color: var(--green);
}
.msg-empty-mark .ic { width: 23px; height: 23px; }
.msg-empty b { font-size: 13px; font-weight: 600; }
.msg-empty p { margin-top: 6px; font-size: 11px; color: var(--text-3); line-height: 1.7; }
.msg-skeleton { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 70px 0; }
.msg-skeleton span { width: 140px; height: 9px; border-radius: 5px; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.msg-skeleton span:nth-child(2) { width: 96px; animation-delay: 0.12s; }
.msg-skeleton span:nth-child(3) { width: 120px; animation-delay: 0.24s; }

.new-msg-pill {
  position: absolute;
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 13px;
  border: 1px solid rgba(46, 230, 168, 0.22);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 10.5px;
  box-shadow: var(--shadow-2);
  z-index: 8;
  animation: fadeUp 0.2s var(--ease);
}
.new-msg-pill .ic { width: 12px; height: 12px; transform: rotate(90deg); color: var(--green); }
.new-msg-pill:hover { border-color: rgba(46, 230, 168, 0.42); background: var(--panel-3); }

/* 输入区 */
.composer { flex: none; padding: 8px 20px 16px; }
.reply-bar{display:flex;align-items:center;gap:8px;margin:0 2px 8px;padding:7px 10px;border-left:3px solid var(--green);border-radius:8px;background:rgba(46,230,168,0.08)}
.reply-bar[hidden]{display:none!important}
.reply-bar-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.reply-bar-label{font-size:11px;color:var(--text-3)}
.reply-bar-label b{color:var(--green);font-weight:600}
.reply-bar-text{font-size:12px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.reply-bar .icon-btn{width:26px;height:26px;flex:none}
.msg-menu{position:fixed!important;z-index:400;width:190px;padding:5px;border:1px solid var(--line);border-radius:10px;background:var(--panel-2);box-shadow:var(--shadow-3);animation:pop .14s var(--ease)}
.msg-menu .menu-item{height:38px;font-size:12.5px}
.msg-reply-quote{max-width:100%;margin:2px 0 5px;padding:5px 8px;border-left:3px solid var(--green-line);border-radius:6px;background:rgba(46,230,168,0.07);font-size:11px;line-height:1.45;color:var(--text-3);overflow:hidden}
.msg-reply-name{display:block;font-size:10.5px;color:var(--green);margin-bottom:2px}
.msg-reply-text{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.forward-menu{position:fixed;z-index:400;left:50%;top:28%;transform:translateX(-50%);width:220px;max-height:55vh;overflow-y:auto;padding:5px;border:1px solid var(--line);border-radius:10px;background:var(--panel-2);box-shadow:var(--shadow-3)}
.forward-title{padding:6px 9px;font-size:11px;color:var(--text-3)}
.forward-menu .menu-item{height:38px;font-size:12.5px}
.composer-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 12px 34px -18px rgba(0, 0, 0, 0.8);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s;
}
.composer-box:focus-within {
  border-color: rgba(46, 230, 168, 0.42);
  background: var(--panel-2);
  box-shadow: var(--ring-green), 0 12px 34px -18px rgba(0, 0, 0, 0.8);
}
.composer-box.is-warn { border-color: rgba(255, 180, 84, 0.35); }
#composer {
  display: block;
  width: 100%;
  min-height: 40px;
  max-height: 168px;
  padding: 11px 14px 2px;
  resize: none;
  overflow-y: auto;
  color: var(--text);
  font: 13px/1.66 var(--font);
  letter-spacing: 0.005em;
  user-select: text;
}
#composer::placeholder { color: var(--text-3); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 10px 10px 14px; }
.composer-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.composer-hint { font-size: 9.5px; color: var(--text-3); letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer-hint.is-warn { color: var(--amber); }
.composer-hint kbd { font-size: inherit; }
.composer-count { font-size: 9.5px; color: var(--amber); flex: none; }
.composer-right { display: flex; align-items: center; gap: 10px; flex: none; }
.composer-len { font-size: 9px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 空聊天 */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}
.empty-art { position: relative; width: 142px; height: 142px; margin-bottom: 24px; display: grid; place-items: center; }
.empty-ring { position: absolute; border: 1px solid rgba(46, 230, 168, 0.1); border-radius: 50%; }
.empty-ring.r1 { width: 142px; height: 142px; animation: ringPulse 5s ease-in-out infinite; }
.empty-ring.r2 { width: 104px; height: 104px; border-color: rgba(46, 230, 168, 0.14); animation: ringPulse 5s ease-in-out 0.6s infinite; }
.empty-ring.r3 { width: 68px; height: 68px; border-color: rgba(46, 230, 168, 0.18); animation: ringPulse 5s ease-in-out 1.2s infinite; }
.empty-core {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(46, 230, 168, 0.22);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(46, 230, 168, 0.14), rgba(46, 230, 168, 0.04));
  color: var(--green);
  box-shadow: 0 0 30px -6px rgba(46, 230, 168, 0.35);
}
.empty-core .ic { width: 22px; height: 22px; }
.chat-empty h2 { font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
.chat-empty p { max-width: 300px; margin-top: 8px; font-size: 11.5px; line-height: 1.8; color: var(--text-3); }
.chat-empty .btn { margin-top: 20px; height: 34px; font-size: 11.5px; }

/* ══════════════════════════════════════════════════════════════
   详情面板
   ══════════════════════════════════════════════════════════════ */
.detail-pane {
  width: var(--detail-w);
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line-soft);
  animation: slideInRight 0.2s var(--ease);
}
.app.detail-closed .detail-pane { display: none; }
.detail-head {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--line-soft);
}
.detail-head h3 { font-size: 12.5px; font-weight: 600; color: var(--text-2); letter-spacing: 0.03em; }
.detail-head .icon-btn { width: 28px; height: 28px; }
.detail-head .icon-btn .ic { width: 15px; height: 15px; }
.detail-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 16px 24px; }

.dt-identity { display: flex; align-items: center; gap: 12px; }
.dt-identity .av { width: 48px; height: 48px; font-size: 18px; border-radius: 13px; }
.dt-id-text { min-width: 0; }
.dt-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 10.5px; color: var(--text-3); }
.dt-meta .sep { color: var(--line); }
.dt-online { display: inline-flex; align-items: center; gap: 4px; color: var(--green); }
.dt-online::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px rgba(46, 230, 168, 0.7); }
.dt-divider { height: 1px; margin: 18px 0 2px; background: var(--line-soft); }

.dt-section { margin-top: 20px; }
.dt-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.dt-section-head h4 { font-size: 10.5px; font-weight: 600; color: var(--text-3); letter-spacing: 0.08em; }
.dt-section-head span { font-size: 9.5px; color: var(--text-3); }
.dt-members { display: flex; flex-direction: column; gap: 1px; }
.dt-member {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px;
  border-radius: 8px;
  transition: background 0.13s;
}
.dt-member:hover { background: rgba(255, 255, 255, 0.03); }
.dt-member .av { width: 25px; height: 25px; font-size: 10px; border-radius: 7px; }
.dt-member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--text-2); }
.dt-member:hover .dt-member-name { color: var(--text); }
.dt-me-tag { flex: none; padding: 1px 5px; border-radius: 4px; border: 1px solid rgba(46, 230, 168, 0.2); background: var(--green-dim); color: var(--green); font-size: 8.5px; }
.dt-member-state { flex: none; display: flex; align-items: center; gap: 4px; font-size: 9.5px; color: var(--text-3); }
.dt-member-state.is-online { color: rgba(46, 230, 168, 0.7); }

.dt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 14px;
  border: 1px dashed rgba(34, 48, 77, 0.95);
  border-radius: 10px;
  background: rgba(18, 28, 51, 0.32);
  text-align: center;
}
.dt-card .ic { width: 19px; height: 19px; color: var(--text-3); margin-bottom: 4px; }
.dt-card b { font-size: 11px; font-weight: 500; color: var(--text-2); }
.dt-card span { font-size: 9.5px; color: var(--text-3); line-height: 1.6; }

.dt-kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 1px; border-bottom: 1px solid rgba(34, 48, 77, 0.4); font-size: 10.5px; }
.dt-kv:last-child { border-bottom: 0; }
.dt-kv .k { color: var(--text-3); flex: none; }
.dt-kv .v { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--text-2); }
.dt-kv code { font-family: var(--mono); font-size: 9.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 168px; }
.dt-copy { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 5px; color: var(--text-3); flex: none; transition: background 0.13s, color 0.13s; }
.dt-copy:hover { background: var(--green-dim); color: var(--green); }
.dt-copy .ic { width: 12px; height: 12px; }

/* ══════════════════════════════════════════════════════════════
   弹窗 / 菜单 / 提示
   ══════════════════════════════════════════════════════════════ */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 14, 0.66);
  backdrop-filter: blur(7px);
  animation: fade 0.18s var(--ease);
}
.modal {
  position: relative;
  z-index: 1;
  width: 560px;
  max-width: calc(100vw - 48px);
  max-height: min(84vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(148, 162, 190, 0.13);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: pop 0.18s var(--ease);
}
.modal::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 22%;
  right: 22%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(46, 230, 168, 0.55), transparent);
}
.modal-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 14px; }
.modal-head h3 { font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
.modal-head p { margin-top: 5px; font-size: 11px; color: var(--text-3); line-height: 1.6; }
.modal-head .icon-btn { width: 28px; height: 28px; margin-top: -2px; }
.modal-search {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  margin: 0 22px 12px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(7, 12, 24, 0.62);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-search .ic { width: 15px; height: 15px; color: var(--text-3); }
.modal-search input { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text); }
.modal-search input::placeholder { color: var(--text-3); }
.modal-search:focus-within { border-color: rgba(46, 230, 168, 0.42); box-shadow: 0 0 0 3px rgba(46, 230, 168, 0.07); }

.new-user-list { flex: 1; min-height: 120px; max-height: 344px; overflow-y: auto; padding: 2px 14px 8px; }
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s;
}
.user-row:hover { background: rgba(255, 255, 255, 0.03); }
.user-row.is-on { background: rgba(46, 230, 168, 0.06); border-color: rgba(46, 230, 168, 0.16); }
.user-row .av { width: 30px; height: 30px; font-size: 11px; border-radius: 8px; }
.user-main { flex: 1; min-width: 0; }
.user-name-row { display: flex; align-items: center; gap: 6px; }
.user-name { font-size: 12.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-tag { flex: none; padding: 0 4px; border: 1px solid var(--line-soft); border-radius: 4px; font-size: 8.5px; color: var(--text-3); line-height: 15px; }
.user-sub { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 9.5px; color: var(--text-3); }
.user-sub .online-dot { position: static; width: 5px; height: 5px; border: 0; box-shadow: none; }
.sel-box {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(148, 162, 190, 0.3);
  border-radius: 6px;
  color: transparent;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
}
.sel-box .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.user-row.is-on .sel-box { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.user-row.is-on .online-dot { border-color: var(--panel-2); }
.list-empty { padding: 34px 0; text-align: center; font-size: 11.5px; color: var(--text-3); }

.new-group-field { flex: none; margin: 6px 22px 0; animation: fadeUp 0.16s var(--ease); }
.field-compact { margin-bottom: 0; }
.field-compact input { height: 38px; font-size: 12.5px; }

.modal-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line-soft);
}
.sel-count { font-size: 10.5px; color: var(--text-3); }
.foot-actions { display: flex; gap: 8px; flex: none; }
.foot-actions .btn { height: 34px; font-size: 12px; }

.modal-settings { width: 464px; overflow-y: auto; }
.settings-profile {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 22px 16px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(18, 28, 51, 0.55);
}
.settings-profile .av { width: 40px; height: 40px; font-size: 15px; border-radius: 11px; }
.settings-profile-text { flex: 1; min-width: 0; }
.settings-profile-text b { display: block; font-size: 13.5px; font-weight: 600; }
.settings-profile-text span { display: block; margin-top: 3px; font-size: 10px; color: var(--text-3); }
.set-rows { flex: none; margin: 0 22px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid rgba(34, 48, 77, 0.45); }
.set-row:last-child { border-bottom: 0; }
.set-key { font-size: 11px; color: var(--text-3); flex: none; }
.set-val { font-size: 11px; color: var(--text-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-val code, code.set-val { font-family: var(--mono); font-size: 10px; }
.set-weak { color: var(--text-3); }
.set-actions { flex: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 22px 0; }
.set-actions .btn { height: 33px; font-size: 11.5px; }
.modal-note { flex: none; padding: 16px 22px 20px; font-size: 9.5px; color: var(--text-3); line-height: 1.7; }

/* Toast */
.toast-root {
  position: fixed;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 440px;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(22, 33, 59, 0.97);
  box-shadow: var(--shadow-2);
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.5;
  animation: toastIn 0.18s var(--ease);
  pointer-events: auto;
}
.toast .ic { width: 15px; height: 15px; flex: none; color: var(--green); }
.toast.is-error { border-color: rgba(255, 122, 138, 0.3); }
.toast.is-error .ic { color: var(--red); }
.toast.is-warn .ic { color: var(--amber); }
.toast.is-leaving { animation: toastOut 0.2s var(--ease) forwards; }

/* ══════════════════════════════════════════════════════════════
   动画
   ══════════════════════════════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes blink { 0%, 60%, 100% { opacity: 0.28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.92; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes bootslide { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes ringPulse { 0%, 100% { transform: scale(1); opacity: 0.75; } 50% { transform: scale(1.045); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(-3px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  65% { transform: translateX(3px); }
}

/* ══════════════════════════════════════════════════════════════
   文件 / 图片 / 上传进度 / 图片查看器
   ══════════════════════════════════════════════════════════════ */

/* 输入框工具栏 */
.tool-btn {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--text-3);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.tool-btn .ic { width: 16px; height: 16px; }
.tool-btn:hover { color: var(--green); background: var(--green-dim); }
.tool-btn[data-tip] { position: relative; }
.tool-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 10.5px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
  transform: translateY(3px);
  box-shadow: var(--shadow-2);
  z-index: 80;
}
.tool-btn[data-tip]:hover::after { opacity: 1; transform: translateY(0); }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* 文件卡 */
.msg-file { width: 268px; }
.msg-file-name { font-size: 12px; }
.msg-file-meta { display: flex; align-items: center; gap: 5px; }
.msg-file-meta .dot-sep { color: var(--line); }
.file-e2ee-badge { color: var(--green); font-size: 9px; letter-spacing: .4px; }
.msg-file-btn { text-decoration: none; }
.msg-file.is-uploading { border-color: rgba(46, 230, 168, 0.3); background: rgba(18, 28, 51, 0.72); }
.msg-file.is-failed { border-color: rgba(255, 122, 138, 0.3); }
.msg-file-state {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--text-3);
  animation: pulse 1.4s ease-in-out infinite;
}
.msg-file-state .ic { width: 15px; height: 15px; }

.upload-block { width: 100%; margin-top: 7px; }
.upload-track {
  height: 3px;
  border-radius: 3px;
  background: rgba(148, 162, 190, 0.16);
  overflow: hidden;
}
.upl-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--green), var(--green-deep));
  box-shadow: 0 0 8px rgba(46, 230, 168, 0.5);
  transition: width 0.15s linear;
}
.upload-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 9px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.upl-pct { color: var(--green); font-weight: 600; }
.upload-error {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 9.5px;
  color: var(--red);
  min-width: 0;
}
.upload-error .ic { width: 12px; height: 12px; flex: none; }
.upload-error span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-retry {
  flex: none;
  margin-left: auto;
  height: 20px;
  padding: 0 8px;
  border: 1px solid rgba(255, 122, 138, 0.3);
  border-radius: 5px;
  background: var(--red-dim);
  color: var(--red);
  font-size: 9.5px;
  transition: background 0.14s, color 0.14s;
}
.upload-retry:hover { background: rgba(255, 122, 138, 0.18); color: #FFA3B0; }
.upload-instant {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 9px;
  font-weight: 500;
  color: var(--green);
  letter-spacing: 0.02em;
}
.upload-instant .ic { width: 11px; height: 11px; filter: drop-shadow(0 0 5px rgba(46, 230, 168, 0.5)); }

/* 文件分类配色（--cat-* 供图标继承） */
.file-cat-image { --cat-color: #2EE6A8; --cat-bg: rgba(46, 230, 168, 0.1); --cat-line: rgba(46, 230, 168, 0.2); }
.file-cat-doc { --cat-color: #7AA2FF; --cat-bg: rgba(122, 162, 255, 0.1); --cat-line: rgba(122, 162, 255, 0.2); }
.file-cat-archive { --cat-color: #FFB454; --cat-bg: rgba(255, 180, 84, 0.1); --cat-line: rgba(255, 180, 84, 0.2); }
.file-cat-code { --cat-color: #B18CFF; --cat-bg: rgba(177, 140, 255, 0.1); --cat-line: rgba(177, 140, 255, 0.2); }
.file-cat-other { --cat-color: #94A2BE; --cat-bg: rgba(148, 162, 190, 0.08); --cat-line: rgba(148, 162, 190, 0.18); }
.msg-file-ic,
.dt-file-ic {
  color: var(--cat-color, var(--text-2));
  background: var(--cat-bg, rgba(148, 162, 190, 0.08));
  border-color: var(--cat-line, rgba(148, 162, 190, 0.18));
}

/* 图片缩略图 */
.msg-image {
  position: relative;
  display: inline-block;
  max-width: min(320px, 100%);
  border: 1px solid rgba(34, 48, 77, 0.9);
  border-radius: 10px;
  overflow: hidden;
  background: #0C1425;
  box-shadow: 0 6px 22px -10px rgba(0, 0, 0, 0.6);
  cursor: zoom-in;
}
.msg-image-el {
  display: block;
  width: auto;
  height: auto;
  max-width: 320px;
  max-height: 240px;
  object-fit: cover;
  min-width: 140px;
  min-height: 90px;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.msg-image.is-loaded .msg-image-el { opacity: 1; min-width: 0; min-height: 0; }
.msg-image:not(.is-loaded)::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 240px;
  height: 160px;
  background: linear-gradient(110deg, #121C33 20%, #1A2844 40%, #121C33 60%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
.msg-image.is-uploading { cursor: default; width: 240px; }
.msg-image.is-uploading .msg-image-el {
  opacity: 1;
  width: 100%;
  height: auto;
  max-height: 240px;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
}
.msg-image.is-uploading:not(.is-loaded)::before { display: none; }
.image-upload-mask {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(5, 10, 20, 0.15), rgba(4, 8, 16, 0.86));
}
.image-upload-state { font-size: 10px; font-weight: 500; color: var(--green); letter-spacing: 0.02em; }
.image-upload-bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.image-upload-bar .upl-fill { height: 100%; }
.image-upload-info { display: flex; align-items: center; justify-content: space-between; font-size: 9px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.image-open {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 162, 190, 0.24);
  border-radius: 7px;
  background: rgba(7, 12, 24, 0.66);
  color: var(--text);
  opacity: 0;
  transition: opacity 0.16s var(--ease), background 0.14s, color 0.14s;
  backdrop-filter: blur(6px);
}
.image-open .ic { width: 14px; height: 14px; }
.msg-image:hover .image-open { opacity: 1; }
.image-open:hover { background: rgba(46, 230, 168, 0.18); color: var(--green); border-color: rgba(46, 230, 168, 0.35); }
.image-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 10px 8px;
  background: linear-gradient(180deg, transparent, rgba(4, 8, 16, 0.85));
  font-size: 9.5px;
  opacity: 0;
  transition: opacity 0.16s var(--ease);
  pointer-events: none;
}
.msg-image:hover .image-caption { opacity: 1; }
.image-name { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.image-sub { color: var(--text-3); flex: none; font-variant-numeric: tabular-nums; }
.image-instant { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; color: var(--green); flex: none; font-size: 9px; }
.image-instant .ic { width: 10px; height: 10px; }

/* 详情面板：共享文件列表 */
.dt-files { display: flex; flex-direction: column; gap: 2px; }
.dt-file {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 6px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: background 0.13s;
  min-width: 0;
}
.dt-file:hover { background: rgba(255, 255, 255, 0.04); }
.dt-file-ic {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
}
.dt-file-ic .ic { width: 14px; height: 14px; }
.dt-file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dt-file-name { font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-file:hover .dt-file-name { color: var(--text); }
.dt-file-size { font-size: 9px; color: var(--text-3); }
.dt-file-dl { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 5px; color: var(--text-3); transition: background 0.13s, color 0.13s; }
.dt-file:hover .dt-file-dl { color: var(--green); background: var(--green-dim); }
.dt-file-dl .ic { width: 13px; height: 13px; }

/* 整窗拖拽遮罩 */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  background: rgba(5, 9, 18, 0.55);
  backdrop-filter: blur(5px);
  pointer-events: none;
  animation: fade 0.15s var(--ease);
}
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100vw - 40px);
  height: calc(100vh - 40px);
  border: 2px dashed rgba(46, 230, 168, 0.45);
  border-radius: 18px;
  background: rgba(46, 230, 168, 0.035);
  box-shadow: inset 0 0 90px rgba(46, 230, 168, 0.06);
}
.drop-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 4px;
  border: 1px solid rgba(46, 230, 168, 0.25);
  border-radius: 18px;
  background: var(--green-dim);
  color: var(--green);
  box-shadow: 0 0 44px -8px rgba(46, 230, 168, 0.5);
}
.drop-icon .ic { width: 28px; height: 28px; }
.drop-zone b { font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }
.drop-zone span { font-size: 11.5px; color: var(--text-3); }

/* 图片查看器 */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 28px;
}
.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.9);
  backdrop-filter: blur(8px);
  animation: fade 0.18s var(--ease);
}
.viewer-figure {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  animation: pop 0.18s var(--ease);
}
.viewer-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100vw - 56px);
}
#viewer-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  border: 1px solid rgba(148, 162, 190, 0.2);
  border-radius: 12px;
  background: #0B1020;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
  object-fit: contain;
}
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(920px, calc(100vw - 56px));
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 23, 41, 0.94);
  box-shadow: var(--shadow-2);
}
.viewer-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.viewer-meta b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-meta span { font-size: 10px; color: var(--text-3); }
.viewer-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.viewer-actions .btn { height: 30px; font-size: 11px; text-decoration: none; }
body.viewer-open { overflow: hidden; }

/* ══════════════════════════════════════════════════════════════
   P2P 直传状态 / 传输方式角标
   ══════════════════════════════════════════════════════════════ */
.msg-status.is-p2p { color: #7BF0C6; }
.msg-status.is-p2p .ic { filter: drop-shadow(0 0 5px rgba(46, 230, 168, 0.45)); }
.msg-status.is-warn { color: var(--amber); }

.file-via,
.image-via {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.file-via { height: 15px; padding: 0 5px; font-size: 8.5px; margin-left: 2px; }
.file-via .ic { width: 9px; height: 9px; }
.file-via.is-p2p { color: #7BF0C6; background: rgba(46, 230, 168, 0.1); border-color: rgba(46, 230, 168, 0.22); }
.file-via.is-server { color: var(--text-3); background: rgba(148, 162, 190, 0.07); border-color: rgba(148, 162, 190, 0.15); }
.image-via {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  height: 18px;
  padding: 0 7px;
  font-size: 9px;
  backdrop-filter: blur(6px);
}
.image-via .ic { width: 10px; height: 10px; }
.image-via.is-p2p { color: #7BF0C6; background: rgba(6, 25, 19, 0.72); border-color: rgba(46, 230, 168, 0.32); }
.image-via.is-server { color: var(--text-2); background: rgba(7, 12, 24, 0.62); border-color: rgba(148, 162, 190, 0.22); }

.upload-block.is-p2p .upl-fill {
  background: linear-gradient(90deg, #2EE6A8, #5AC8FF);
  box-shadow: 0 0 8px rgba(90, 200, 255, 0.45);
}
.upload-block.is-p2p .upl-pct { color: #7BF0C6; }
.upload-block.is-fallback .upl-fill {
  background: linear-gradient(90deg, var(--amber), #FF9A5A);
  box-shadow: 0 0 8px rgba(255, 180, 84, 0.35);
}
.upload-block.is-fallback .upl-pct { color: var(--amber); }
.upl-speed { font-size: 9px; font-weight: 500; color: #7BF0C6; font-variant-numeric: tabular-nums; }
.upl-count { color: #7BF0C6; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.upload-caption {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  font-size: 8.5px;
  line-height: 1.5;
  color: var(--text-3);
  min-width: 0;
}
.upload-caption .ic { width: 10px; height: 10px; flex: none; }
.upload-caption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-caption.is-p2p { color: rgba(123, 240, 198, 0.72); }
.upload-caption.is-warn { color: var(--amber); }

.msg-file.is-p2p { border-color: rgba(46, 230, 168, 0.22); }
.msg-file.is-loading { background: rgba(18, 28, 51, 0.55); }
.msg-file.is-missing { border-style: dashed; border-color: rgba(148, 162, 190, 0.3); background: rgba(18, 28, 51, 0.4); }
.msg-file-missing-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 5px;
  font-size: 8.5px;
  line-height: 1.5;
  color: var(--text-3);
}
.msg-file-missing-note b { font-weight: 500; color: var(--amber); }
.msg-image.is-p2p { border-color: rgba(46, 230, 168, 0.22); }

/* ══════════════════════════════════════════════════════════════
   响应式
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1240px) {
  :root { --conv-w: 260px; --detail-w: 286px; }
  .login-main { gap: 40px; padding: 92px 48px 52px; }
  .hero-points { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  :root { --conv-w: 248px; --detail-w: 272px; --rail-w: 58px; }
  .login-main { grid-template-columns: 1fr; max-width: 560px; padding: 104px 40px 56px; }
  .login-hero { display: none; }
  .login-top-meta { display: none; }
  .login-side::before { inset: -40px -30px; }
  .ch-actions .pill { display: none; }
}
@media (max-width: 980px) {
  :root { --conv-w: 240px; --detail-w: 260px; }
  .msg-main { max-width: 82%; }
  .ch-title-row h1 { max-width: 220px; }
}
@media (max-height: 780px) {
  .login-main { padding-top: 82px; padding-bottom: 36px; }
  .login-hero h1 { font-size: clamp(32px, 3.4vw, 46px); }
  .hero-points { margin-top: 26px; }
  .hero-signal { display: none; }
  .hero-lead { margin-top: 18px; }
  .login-card { padding: 24px; }
  .login-legal { margin-top: 14px; }
}

/* 降低动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   Markdown 渲染（消息气泡 + 输入预览共用）
   ══════════════════════════════════════════════════════════════ */
.msg-md { white-space: normal; }
.md-p { margin: 0 0 7px; }
.md-p:last-child { margin-bottom: 0; }
.msg-md > :first-child { margin-top: 0; }
.msg-md > :last-child { margin-bottom: 0; }
.md-h1, .md-h2, .md-h3, .md-h4, .md-h5, .md-h6 {
  margin: 10px 0 6px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: 0.005em;
  color: var(--text);
}
.md-h1 { font-size: 18px; }
.md-h2 { font-size: 16px; }
.md-h3 { font-size: 14.5px; }
.md-h4 { font-size: 13.5px; }
.md-h5, .md-h6 { font-size: 13px; color: var(--text-2); }
.msg-row.is-mine .msg-bubble .md-h1,
.msg-row.is-mine .msg-bubble .md-h2,
.msg-row.is-mine .msg-bubble .md-h3,
.msg-row.is-mine .msg-bubble .md-h4,
.msg-row.is-mine .msg-bubble .md-h5,
.msg-row.is-mine .msg-bubble .md-h6 { color: #062E22; }
.md-list { margin: 4px 0 8px; padding-left: 19px; }
.md-list li { margin: 2px 0; }
.md-list li::marker { color: rgba(46, 230, 168, 0.75); }
.msg-row.is-mine .msg-bubble .md-list li::marker { color: rgba(6, 46, 34, 0.65); }
.md-quote {
  margin: 6px 0;
  padding: 5px 10px;
  border-left: 3px solid rgba(46, 230, 168, 0.6);
  border-radius: 0 6px 6px 0;
  background: rgba(46, 230, 168, 0.055);
  color: var(--text-2);
}
.msg-row.is-mine .msg-bubble .md-quote {
  border-left-color: rgba(6, 46, 34, 0.55);
  background: rgba(6, 46, 34, 0.08);
  color: rgba(6, 46, 34, 0.86);
}
.md-hr { margin: 10px 0; border: 0; border-top: 1px solid var(--line); }
.md-code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(129, 160, 220, 0.14);
  color: #B9F5DF;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, "Microsoft YaHei UI", monospace;
  word-break: break-word;
}
.msg-row.is-mine .msg-bubble .md-code { background: rgba(6, 46, 34, 0.12); color: #0B4A37; }
.md-pre {
  position: relative;
  margin: 7px 0;
  padding: 10px 12px;
  border: 1px solid rgba(46, 230, 168, 0.16);
  border-radius: 8px;
  background: var(--bg-deep);
  overflow-x: auto;
  max-width: 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}
.md-pre code.md-codeblock {
  display: block;
  min-width: max-content;
  color: #D7E4FF;
  font: 11.5px/1.65 ui-monospace, SFMono-Regular, Consolas, "Microsoft YaHei UI", monospace;
  white-space: pre;
  tab-size: 2;
}
.md-pre .md-copy {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(10, 17, 32, 0.85);
  color: var(--text-2);
  opacity: 0;
  transition: opacity 0.13s, background 0.13s, color 0.13s;
}
.md-pre .md-copy .ic { width: 12px; height: 12px; }
.md-pre:hover .md-copy { opacity: 1; }
.md-pre .md-copy:hover { background: rgba(46, 230, 168, 0.14); color: var(--green); border-color: rgba(46, 230, 168, 0.35); }
.md-table {
  margin: 7px 0;
  border-collapse: collapse;
  max-width: 100%;
  font-size: 12px;
}
.md-table th, .md-table td {
  padding: 4px 9px;
  border: 1px solid rgba(120, 150, 210, 0.22);
  text-align: left;
  vertical-align: top;
}
.md-table th { background: rgba(129, 160, 220, 0.1); color: var(--text); font-weight: 600; }
.msg-row.is-mine .msg-bubble .md-table th,
.msg-row.is-mine .msg-bubble .md-table td { border-color: rgba(6, 46, 34, 0.22); }
.msg-row.is-mine .msg-bubble .md-table th { background: rgba(6, 46, 34, 0.09); color: #062E22; }
.msg-bubble a { word-break: break-all; }

/* Markdown 输入预览 */
.md-preview {
  margin: 0 14px;
  padding: 7px 0 6px;
  border-top: 1px dashed rgba(120, 150, 210, 0.22);
  max-height: 196px;
  overflow-y: auto;
}
.md-preview[hidden] { display: none !important; }
.md-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.md-preview-hint { opacity: 0.75; letter-spacing: 0.02em; }
.md-preview-body { min-height: 20px; font-size: 12.5px; line-height: 1.65; color: var(--text-2); }
.md-preview-body:empty::before {
  content: "输入 Markdown 后在此实时预览（支持标题 / 粗体 / 代码块 / 表格 / 列表 / 引用 / 链接）";
  color: var(--text-3);
  font-size: 10.5px;
}
.md-preview-body .msg-md { font-size: 12.5px; }
.md-toggle {
  width: 30px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-3);
}
.md-toggle.is-on {
  color: var(--green);
  background: rgba(46, 230, 168, 0.1);
  box-shadow: inset 0 0 0 1px rgba(46, 230, 168, 0.32);
}

/* 会话列表草稿标记 */
.conv-preview.is-draft { display: flex; align-items: center; gap: 5px; }
.conv-draft-tag {
  flex: none;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--amber-dim);
  color: var(--amber);
  font-size: 9px;
  font-weight: 600;
  line-height: 14px;
  letter-spacing: 0.02em;
}
.conv-draft-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

/* 快捷键帮助面板 */
.help-panel { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; }
.help-panel[hidden] { display: none !important; }
.help-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 16, 0.66); backdrop-filter: blur(7px); }
.help-card {
  position: relative;
  width: min(560px, calc(100vw - 48px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: 18px 20px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}
.help-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.help-eyebrow { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--green); opacity: 0.85; }
.help-head h3 { margin-top: 3px; font-size: 16px; font-weight: 650; letter-spacing: 0.01em; }
.help-body { display: grid; grid-template-columns: 1fr; gap: 4px; }
.help-group { margin-bottom: 14px; }
.help-group h4 {
  margin-bottom: 6px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  opacity: 0.9;
}
.help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  font-size: 12px;
  color: var(--text-2);
}
.help-keys { display: flex; gap: 5px; }
.help-row kbd, .help-keys kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text);
  font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: nowrap;
}
.help-note { margin-top: 8px; font-size: 10px; line-height: 1.6; color: var(--text-3); }
.help-foot { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 10.5px; color: var(--text-3); }
.help-foot kbd {
  display: inline-flex;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  font: 9.5px/1.4 ui-monospace, monospace;
}

/* ══════════════════════════════════════════════════════════════
   离线发件箱状态
   ══════════════════════════════════════════════════════════════ */
.msg-status.is-outbox { color: var(--amber); }
.msg-status.is-outbox .ic { animation: pulse 1.8s ease-in-out infinite; }
.msg-status.is-muted { color: var(--text-3); cursor: pointer; }
.msg-status.is-muted:hover { color: var(--text-2); text-decoration: underline; }
.msg-status-actions { display: inline-flex; align-items: center; gap: 8px; }
.upl-outbox { font-size: 9px; font-weight: 600; color: var(--amber); letter-spacing: 0.02em; }
.upload-caption.is-outbox { color: var(--amber); }
.upload-block.is-outbox .upl-fill { background: linear-gradient(90deg, rgba(255, 180, 84, 0.75), rgba(255, 180, 84, 0.35)); }
.upload-block.is-outbox .upl-pct { color: var(--amber); }
.image-upload-mask .upl-outbox { font-size: 9px; }
.set-actions { flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════════════
   文件管理页 + 下载续传 UI + 秒传角标
   ══════════════════════════════════════════════════════════════ */
.file-via.is-instant,
.image-via.is-instant {
  color: #F4C97A;
  background: rgba(244, 201, 122, 0.12);
  box-shadow: inset 0 0 0 1px rgba(244, 201, 122, 0.28);
}
.file-dl-state {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  font-size: 9.5px;
  color: var(--amber);
  letter-spacing: 0.02em;
}
.file-dl-state .ic { width: 12px; height: 12px; }
.msg-file { flex-wrap: wrap; }
.msg-file .msg-file-main { min-width: 0; }
.msg-file .file-dl-state { flex-basis: 100%; padding-left: 45px; }
.files-page {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 22px;
  background: var(--panel);
}
.files-page[hidden] { display: none !important; }
.files-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 2px 12px; flex: none; }
.files-head h2 { font-size: 18px; font-weight: 650; letter-spacing: 0.01em; }
.files-head p { margin-top: 3px; font-size: 11px; color: var(--text-3); }
.files-toolbar { display: flex; align-items: center; gap: 12px; flex: none; padding-bottom: 12px; }
.files-filters { display: flex; align-items: center; gap: 6px; }
.files-filters .chip { font-size: 11px; }
.files-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  width: 250px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.files-search .ic { width: 13px; height: 13px; color: var(--text-3); }
.files-search input { flex: 1; min-width: 0; font-size: 11.5px; color: var(--text); }
.files-search input::placeholder { color: var(--text-3); }
.files-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 2px 12px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s;
}
.file-row:hover { background: rgba(255, 255, 255, 0.03); border-color: rgba(120, 150, 210, 0.16); }
.file-row + .file-row { margin-top: 2px; }
.file-row-ic {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(129, 160, 220, 0.1);
  color: var(--text-2);
}
.file-row-ic .ic { width: 17px; height: 17px; }
.file-row-main { flex: 1; min-width: 0; }
.file-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.file-row-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 10px;
  color: var(--text-3);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.file-row-conv { color: var(--text-2); }
.file-row-actions { display: flex; align-items: center; gap: 4px; flex: none; opacity: 0; transition: opacity 0.13s; }
.file-row:hover .file-row-actions { opacity: 1; }
.files-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 10.5px;
  color: var(--text-3);
}
.files-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  min-height: 240px;
  color: var(--text-3);
  text-align: center;
  font-size: 11.5px;
}
.files-empty b { font-size: 13px; color: var(--text-2); font-weight: 600; }
.files-empty-ic {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(46, 230, 168, 0.07);
  color: var(--green);
  margin-bottom: 6px;
}
.files-empty-ic .ic { width: 24px; height: 24px; }

/* ══════════════════════════════════════════════════════════════
   内容中心 / 搜索 / 标签 / 统一预览器（第 6 项）
   ══════════════════════════════════════════════════════════════ */
.content-page { padding-top: 0; }
.content-head { padding: 18px 2px 10px; }
.content-head-actions { display: flex; align-items: center; gap: 8px; }
.content-search-row { display: flex; align-items: center; gap: 6px; flex: none; }
.content-search { width: 100%; max-width: 520px; margin: 0 0 2px; }
.content-page .content-search-row .icon-btn { flex: none; }
.content-history {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 2px 2px;
  font-size: 10.5px;
  color: var(--text-3);
}
.content-history-label { margin-right: 2px; }
.content-history-chip {
  padding: 2px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 10.5px;
  cursor: pointer;
}
.content-history-chip:hover { border-color: rgba(46, 230, 168, 0.35); color: var(--text); }
.content-history-clear { margin-left: auto; font-size: 10px; color: var(--text-3); }
.content-tabs { display: flex; align-items: center; gap: 6px; padding: 8px 2px 6px; flex: none; }
.content-tabs .chip { font-size: 11px; }
.content-filters { display: flex; align-items: center; gap: 8px; padding: 2px 2px 8px; flex: none; flex-wrap: wrap; }
.content-select {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 10.5px;
  outline: none;
}
.content-tag-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 4px 0 9px;
  border-radius: 7px;
  background: rgba(46, 230, 168, 0.08);
  color: var(--green);
  font-size: 10.5px;
}
.content-tag-filter .icon-btn { width: 22px; height: 22px; }
.content-tag-filter .icon-btn .ic { width: 12px; height: 12px; }
.content-status { margin-left: auto; font-size: 10px; color: var(--text-3); }
.content-tag-cloud { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 4px 2px 10px; flex: none; }
.tag-cloud-label { font-size: 10px; color: var(--text-3); letter-spacing: 0.06em; }
.tag-cloud-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 10.5px;
  cursor: pointer;
}
.tag-cloud-item .ic { width: 11px; height: 11px; }
.tag-cloud-item em { color: var(--text-3); font-style: normal; font-size: 9px; }
.tag-cloud-item:hover, .tag-cloud-item.is-active { border-color: rgba(46, 230, 168, 0.45); color: var(--green); }
.tag-cloud-item.is-fav { color: var(--amber); }
.tag-cloud-item.is-clear { color: var(--text-3); }
.content-list { padding-top: 0; }
.content-row-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content-mark { background: rgba(46, 230, 168, 0.18); color: var(--green); border-radius: 2px; padding: 0 1px; }
.content-tags { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.content-tags.is-small .content-tag { font-size: 8.5px; padding: 0 4px; }
.content-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(46, 230, 168, 0.1);
  color: var(--green);
  font-size: 9px;
  line-height: 15px;
}
.content-tag .ic { width: 10px; height: 10px; }
.content-tag.is-fav { background: rgba(244, 201, 122, 0.12); color: #F4C97A; }
.content-loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 46px; color: var(--text-3); font-size: 11.5px; }

/* ── 文件仓库 / 收藏夹：两种完全不同的内容视图 ───────────────── */
.content-head-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.content-page-icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--green);
  background: linear-gradient(145deg, rgba(46, 230, 168, .18), rgba(46, 230, 168, .04));
  border: 1px solid rgba(46, 230, 168, .25);
}
.content-page-icon .ic { width: 20px; height: 20px; }
.files-page.is-fav-mode .content-page-icon {
  color: #C4B5FD;
  background: linear-gradient(145deg, rgba(124, 92, 255, .28), rgba(244, 190, 92, .08));
  border-color: rgba(124, 92, 255, .38);
  box-shadow: 0 0 22px rgba(124, 92, 255, .16);
}
.files-page.is-fav-mode {
  background:
    radial-gradient(720px 360px at 78% -12%, rgba(124, 92, 255, .13), transparent 70%),
    radial-gradient(520px 300px at 8% 8%, rgba(244, 190, 92, .045), transparent 72%),
    var(--panel);
}
.files-page.is-fav-mode .content-head { border-bottom: 1px solid rgba(124, 92, 255, .14); }
.files-page.is-files-mode .content-head { border-bottom: 1px solid rgba(46, 230, 168, .08); }

.content-overview[hidden],
.content-fav-hero[hidden],
#content-tabs[hidden],
#content-filters[hidden],
#files-foot[hidden] { display: none !important; }

/* 文件仓库概览条 */
.content-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: none;
  margin: 2px 2px 10px;
  padding: 12px 14px;
  border: 1px solid rgba(46, 230, 168, .15);
  border-radius: 14px;
  background: linear-gradient(105deg, rgba(46, 230, 168, .075), rgba(19, 34, 50, .55) 55%, rgba(46, 230, 168, .025));
}
.file-overview-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-overview-ic {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--green);
  background: rgba(46, 230, 168, .10);
  border: 1px solid rgba(46, 230, 168, .2);
}
.file-overview-ic .ic { width: 17px; height: 17px; }
.file-overview-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-overview-copy b { font-size: 12px; color: var(--text); }
.file-overview-copy span { font-size: 10px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-overview-stats { display: flex; align-items: center; gap: 18px; flex: none; }
.file-overview-stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.file-overview-stat b { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.file-overview-stat span { font-size: 9px; color: var(--text-3); }

/* 收藏夹：hero + 卡片墙 */
.content-fav-hero { flex: none; margin: 2px 2px 10px; }
.fav-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 126px;
  padding: 20px 24px;
  border: 1px solid rgba(124, 92, 255, .32);
  border-radius: 18px;
  background:
    radial-gradient(420px 220px at 88% 12%, rgba(244, 190, 92, .16), transparent 66%),
    radial-gradient(560px 260px at 4% 0%, rgba(124, 92, 255, .28), transparent 68%),
    linear-gradient(125deg, rgba(31, 20, 54, .92), rgba(13, 25, 40, .95));
  box-shadow: 0 18px 45px -30px rgba(124, 92, 255, .65);
}
.fav-hero-glow {
  position: absolute;
  right: 110px;
  top: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 181, 253, .20), transparent 68%);
  pointer-events: none;
}
.fav-hero-copy { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fav-kicker { font-size: 9px; letter-spacing: .12em; color: #C4B5FD; font-family: var(--mono); }
.fav-hero h3 { font-size: 24px; font-weight: 650; letter-spacing: .01em; color: #F5F0FF; }
.fav-hero p { max-width: 460px; font-size: 10.5px; line-height: 1.55; color: rgba(226, 216, 255, .58); }
.fav-browse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: 4px;
  height: 27px;
  padding: 0 10px;
  border: 1px solid rgba(196, 181, 253, .28);
  border-radius: 8px;
  background: rgba(124, 92, 255, .12);
  color: #DCD2FF;
  font-size: 10px;
  cursor: pointer;
  transition: .15s;
}
.fav-browse:hover { border-color: rgba(244, 190, 92, .45); color: #FFE4AE; background: rgba(244, 190, 92, .08); }
.fav-browse .ic { width: 12px; height: 12px; }
.fav-hero-side { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; flex: none; }
.fav-hero-count { display: flex; flex-direction: column; align-items: flex-end; }
.fav-hero-count b { font-size: 38px; line-height: 1; color: #F4C97A; font-weight: 650; font-variant-numeric: tabular-nums; }
.fav-hero-count span { margin-top: 4px; font-size: 9px; color: rgba(226, 216, 255, .5); }
.fav-hero-star {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #F4C97A;
  background: rgba(244, 190, 92, .1);
  border: 1px solid rgba(244, 190, 92, .28);
  transform: rotate(-8deg);
}
.fav-hero-star .ic { width: 26px; height: 26px; }

.files-page.is-fav-mode .content-search-row { margin-top: 2px; }
.files-page.is-fav-mode .content-search {
  border-color: rgba(124, 92, 255, .22);
  background: rgba(20, 25, 45, .72);
}
.files-page.is-fav-mode .content-search:focus-within { border-color: rgba(196, 181, 253, .5); }

.fav-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 2px 2px 14px; }
.fav-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  padding: 13px 14px 11px;
  border: 1px solid rgba(124, 92, 255, .16);
  border-left: 2px solid rgba(196, 181, 253, .55);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(31, 25, 48, .72), rgba(15, 25, 39, .82));
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.fav-card:hover { transform: translateY(-1px); border-color: rgba(196, 181, 253, .4); background: linear-gradient(135deg, rgba(40, 31, 62, .8), rgba(17, 29, 45, .9)); }
.fav-card.tone-1 { border-left-color: rgba(244, 190, 92, .6); }
.fav-card.tone-2 { border-left-color: rgba(46, 230, 168, .5); }
.fav-card.tone-3 { border-left-color: rgba(130, 170, 255, .6); }
.fav-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fav-card-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.fav-card-who b { font-size: 11.5px; color: var(--text); font-weight: 600; }
.fav-card-who span { font-size: 9px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-card-mark {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #F4C97A;
  background: rgba(244, 190, 92, .10);
}
.fav-card-mark .ic { width: 13px; height: 13px; }
.fav-quote {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: rgba(238, 232, 255, .88);
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.fav-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.fav-card-actions { display: flex; align-items: center; gap: 2px; flex: none; opacity: 0; transition: opacity .15s; }
.fav-card:hover .fav-card-actions { opacity: 1; }
.fav-card-tag-hint { font-size: 8.5px; color: #F4C97A; opacity: .7; }
.files-empty.is-fav-empty .files-empty-ic { color: #F4C97A; background: rgba(244, 190, 92, .08); }
.files-page.is-fav-mode .content-history-chip:hover { border-color: rgba(196, 181, 253, .38); }
.files-page.is-fav-mode .content-mark { background: rgba(196, 181, 253, .18); color: #DCD2FF; }

@media (max-width: 760px), (pointer: coarse) and (max-height: 520px) {
  .content-head-main { gap: 9px; }
  .content-page-icon { width: 34px; height: 34px; border-radius: 11px; }
  .content-page-icon .ic { width: 17px; height: 17px; }
  .files-head h2 { font-size: 17px; }
  .content-overview { align-items: flex-start; flex-direction: column; gap: 9px; padding: 11px 12px; }
  .file-overview-stats { width: 100%; justify-content: space-between; gap: 10px; }
  .file-overview-stat { align-items: flex-start; }
  .fav-hero { min-height: 0; padding: 17px 16px; border-radius: 15px; align-items: flex-start; }
  .fav-hero h3 { font-size: 20px; }
  .fav-hero-side { gap: 8px; flex-direction: column-reverse; align-items: flex-end; }
  .fav-hero-count b { font-size: 30px; }
  .fav-hero-star { width: 40px; height: 40px; border-radius: 12px; }
  .fav-hero-star .ic { width: 20px; height: 20px; }
  .fav-grid { grid-template-columns: 1fr; }
  .fav-browse { display: none; }
}
.content-loading i { width: 14px; height: 14px; border: 2px solid rgba(46, 230, 168, 0.25); border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* 消息标签 / 悬浮工具条 */
.msg-row { position: relative; }
.msg-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 5px; padding-left: 2px; }
.msg-highlight { animation: msgHighlight 1.8s ease-out; }
@keyframes msgHighlight {
  0% { background: rgba(46, 230, 168, 0.18); box-shadow: 0 0 0 1px rgba(46, 230, 168, 0.4); }
  100% { background: transparent; box-shadow: none; }
}

/* 标签浮层 */
.tag-popover {
  position: fixed;
  z-index: 180;
  width: 264px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.tag-popover[hidden] { display: none !important; }
.tag-popover-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.tag-popover-head .icon-btn { width: 22px; height: 22px; }
.tag-popover-head .icon-btn .ic { width: 12px; height: 12px; }
.tag-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 10.5px;
  cursor: pointer;
}
.tag-option .ic { width: 11px; height: 11px; }
.tag-option:hover { border-color: rgba(46, 230, 168, 0.4); color: var(--text); }
.tag-option.is-on { background: rgba(46, 230, 168, 0.12); border-color: rgba(46, 230, 168, 0.5); color: var(--green); }
.tag-option.is-fav.is-on { color: #F4C97A; border-color: rgba(244, 201, 122, 0.5); background: rgba(244, 201, 122, 0.1); }
.tag-custom { display: flex; gap: 6px; margin-top: 9px; }
.tag-custom input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11px;
}
.tag-custom .btn { height: 28px; padding: 0 10px; font-size: 10.5px; }
.tag-popover-hint { margin-top: 8px; font-size: 9.5px; line-height: 1.5; color: var(--text-3); }

/* 统一预览器 */
.previewer { position: fixed; inset: 0; z-index: 190; display: grid; place-items: center; }
.previewer[hidden] { display: none !important; }
.previewer-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 16, 0.74); backdrop-filter: blur(8px); }
.previewer-card {
  position: relative;
  width: min(1080px, calc(100vw - 64px));
  max-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}
.previewer-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); flex: none; }
.previewer-title-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.previewer-title-wrap b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.previewer-title-wrap span { font-size: 10px; color: var(--text-3); }
.previewer-nav { display: flex; align-items: center; gap: 2px; flex: none; }
.previewer-count { min-width: 42px; text-align: center; font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.previewer-body { flex: 1; min-height: 220px; max-height: 62vh; overflow: auto; padding: 14px 18px; background: #080D18; }
.previewer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; border-top: 1px solid var(--line-soft); flex: none; font-size: 10px; color: var(--text-3); }
.previewer-hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-image-wrap { display: grid; place-items: center; min-height: 200px; }
.preview-image { max-width: 100%; max-height: 58vh; border-radius: 8px; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.8); }
.preview-pdf { width: 100%; height: 58vh; border: 0; border-radius: 6px; background: #fff; }
.preview-media { display: grid; place-items: center; padding: 26px 10px; }
.preview-media audio { width: min(520px, 100%); }
.preview-media video { max-width: 100%; border-radius: 8px; background: #000; }
.preview-code, .preview-text {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(46, 230, 168, 0.16);
  border-radius: 9px;
  background: var(--bg-deep);
  color: #D7E4FF;
  font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, "Microsoft YaHei UI", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}
.preview-code { white-space: pre; overflow-x: auto; }
.preview-truncated { margin-top: 8px; font-size: 10px; color: var(--amber); }
.preview-loading { padding: 36px; text-align: center; color: var(--text-3); font-size: 11.5px; }
.preview-missing { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 56px 20px; text-align: center; color: var(--text-3); font-size: 11.5px; }
.preview-missing .ic { width: 30px; height: 30px; color: var(--amber); }
.preview-missing b { color: var(--text-2); font-size: 13px; }
.preview-other { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 60px 20px; text-align: center; color: var(--text-3); font-size: 11.5px; }
.preview-other .ic { width: 34px; height: 34px; color: var(--text-3); }
.preview-other b { color: var(--text-2); font-size: 13px; }
.previewer-card .md-p, .previewer-card .md-h1, .previewer-card .md-h2, .previewer-card .md-h3 { color: var(--text); }
.dt-export-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-export-actions .btn { font-size: 10.5px; padding: 5px 9px; }
.previewer-body.is-pdf { overflow: hidden; padding: 0; background: #fff; }
.previewer-body.is-pdf .preview-pdf { height: 62vh; width: 100%; border: 0; display: block; }
.previewer-card.is-pdf { overflow: visible; }
.previewer-card.is-pdf .previewer-body { border-radius: 0 0 14px 14px; }
.previewer-card.is-pdf .preview-pdf { border-radius: 0; }

/* ══════════════════════════════════════════════════════════════
   多端漫游：登录三入口 / 账号安全 / 设备管理 / 漫游遮罩
   ══════════════════════════════════════════════════════════════ */
.login {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(420px, 0.96fr);
  align-items: center;
  gap: 48px;
  width: 100%;
  max-width: 1330px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 96px 64px 56px;
  overflow: hidden;
}
.login-art { min-width: 0; }
.login-art-inner { max-width: 560px; }
.login-logo { width: 54px; height: 54px; filter: drop-shadow(0 0 26px rgba(46, 230, 168, 0.45)); }
.login-brand { margin-top: 18px; font-size: 15px; font-weight: 600; letter-spacing: 0.06em; }
.login-brand span { margin-left: 8px; font-size: 9px; font-weight: 400; color: var(--text-3); letter-spacing: 0.22em; text-transform: uppercase; }
.login-art h1 {
  margin-top: 36px;
  font-size: clamp(34px, 3.6vw, 50px);
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}
.login-art > .login-art-inner > p { margin-top: 18px; font-size: 13px; color: var(--text-3); letter-spacing: 0.02em; }
.login-points { margin-top: 34px; display: flex; flex-direction: column; gap: 16px; list-style: none; }
.login-points li { display: flex; align-items: flex-start; gap: 11px; font-size: 12px; line-height: 1.55; color: var(--text-2); }
.login-points .ic { width: 16px; height: 16px; flex: none; color: var(--green); margin-top: 1px; }
.login-side { justify-self: center; width: 100%; max-width: 430px; }
.login-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-bottom: 20px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--panel-2);
}
.login-mode {
  height: 32px;
  border-radius: 7px;
  color: var(--text-3);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.login-mode:hover { color: var(--text-2); }
.login-mode.is-active { background: rgba(46, 230, 168, 0.1); color: var(--green); box-shadow: inset 0 0 0 1px rgba(46, 230, 168, 0.22); }
.login-mode:disabled { opacity: 0.5; cursor: default; }
.login-device {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 14px;
  font-size: 10px;
  color: var(--text-3);
}
.login-device .ic { width: 12px; height: 12px; }
.login-device b { font-weight: 500; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.set-section {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(7, 12, 24, 0.28);
}
.set-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.set-section-head h4 { font-size: 11.5px; font-weight: 600; color: var(--text-2); letter-spacing: 0.02em; }
.set-section .set-row { border-bottom: 0; padding: 6px 0; }
.set-section .btn-mini { margin-left: auto; }
.btn-mini { height: 26px; padding: 0 9px !important; font-size: 10px !important; }
.set-password-form { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; padding-top: 9px; border-top: 1px dashed var(--line-soft); }
.set-password-form[hidden] { display: none !important; }
.set-password-form input {
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11px;
  outline: none;
}
.set-password-form input:focus { border-color: rgba(46, 230, 168, 0.5); box-shadow: var(--ring-green); }
.set-password-actions { display: flex; gap: 6px; }
.device-list { display: flex; flex-direction: column; gap: 6px; }
.device-empty { padding: 12px 2px; font-size: 10.5px; color: var(--text-3); }
.device-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(10, 17, 32, 0.55);
}
.device-item.is-current { border-color: rgba(46, 230, 168, 0.24); background: rgba(46, 230, 168, 0.045); }
.device-ic { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px; background: rgba(46, 230, 168, 0.08); color: var(--green); }
.device-ic .ic { width: 13px; height: 13px; }
.device-main { flex: 1; min-width: 0; }
.device-name { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; color: var(--text); overflow: hidden; }
.device-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-current-tag { padding: 0 5px; font-size: 8px; line-height: 14px; flex: none; }
.device-meta { margin-top: 2px; font-size: 9px; color: var(--text-3); }
.device-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.device-actions .btn { padding: 0 6px; font-size: 9.5px; height: 24px; }
.btn-danger-ghost { color: #FF9AA6 !important; }
.device-rename-input {
  width: 100%;
  height: 27px;
  padding: 0 7px;
  border: 1px solid rgba(46, 230, 168, 0.45);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11px;
  outline: none;
}

/* 新设备漫游 */
.roaming {
  position: fixed;
  inset: 0;
  z-index: 170;
  display: grid;
  place-items: center;
  background: rgba(6, 10, 20, 0.82);
  backdrop-filter: blur(10px);
}
.roaming[hidden] { display: none !important; }
.roaming-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(360px, 86vw);
  padding: 30px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(19, 30, 54, 0.96), rgba(13, 20, 37, 0.98));
  box-shadow: var(--shadow-3);
  text-align: center;
}
.roaming-card b { font-size: 14px; font-weight: 600; color: var(--text); }
.roaming-card p { font-size: 11px; color: var(--text-3); line-height: 1.6; }
.roaming-spinner {
  width: 30px;
  height: 30px;
  margin-bottom: 4px;
  border: 2px solid rgba(46, 230, 168, 0.18);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; gap: 26px; padding: 80px 34px 44px; }
  .login-art { display: none; }
  .login-side { max-width: 430px; }
}

/* ══════════════════════════════════════════════════════════════
   隐私与安全 / 端到端加密
   ══════════════════════════════════════════════════════════════ */
.ch-lock {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 5px;
  border: 1px solid rgba(46, 230, 168, 0.28);
  background: rgba(46, 230, 168, 0.08);
  color: var(--green);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.msg-bubble.is-e2ee { border-color: rgba(46, 230, 168, 0.18); }
.msg-e2ee-head {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px dashed rgba(46, 230, 168, 0.14);
  font-size: 9px;
  color: rgba(46, 230, 168, 0.82);
  letter-spacing: 0.02em;
}
.msg-e2ee-locked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 180px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.5;
}
.msg-e2ee-locked b { color: var(--text-2); font-size: 11.5px; }
.msg-e2ee-locked .btn { margin-top: 4px; height: 24px; padding: 0 8px; font-size: 9.5px; }
.set-hint { margin: 4px 0 2px; font-size: 9.5px; line-height: 1.55; color: var(--text-3); }
.set-actions-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 8px; }
.set-actions-inline .linklike { margin-left: auto; font-size: 9.5px; color: var(--text-3); }
.e2ee-fp { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10.5px; letter-spacing: 0.04em; color: var(--green); }
.e2ee-tofu {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 6px 0;
  padding: 7px 9px;
  border: 1px solid rgba(244, 201, 122, 0.28);
  border-radius: 7px;
  background: rgba(244, 201, 122, 0.07);
  color: #F4C97A;
  font-size: 9.5px;
  line-height: 1.5;
}
.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.pref-row:last-of-type { border-bottom: 0; }
.pref-row > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pref-row b { font-size: 11px; font-weight: 500; color: var(--text); }
.pref-row em { font-style: normal; font-size: 9px; color: var(--text-3); line-height: 1.4; }
/* AI 模型来源 / 云端配置 */
.ai-select,
.ai-input {
  width: 230px;
  max-width: 58%;
  height: 30px;
  flex: none;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--ui);
  font-size: 11px;
  padding: 0 8px;
  outline: none;
}
.ai-input { width: 300px; text-align: left; }
.ai-select:focus,
.ai-input:focus { border-color: rgba(46, 230, 168, 0.55); box-shadow: 0 0 0 2px rgba(46, 230, 168, 0.08); }
.ai-cloud-config { border-top: 1px solid rgba(34, 48, 77, 0.45); margin-top: 2px; padding-top: 2px; }
.ai-cloud-config .set-hint { margin: 6px 2px 4px; }
@media (max-width: 760px), (pointer: coarse) and (max-height: 520px) {
  .ai-source-row,
  .ai-cloud-config .set-row { flex-wrap: wrap; gap: 7px; }
  .ai-source-row .set-key,
  .ai-cloud-config .set-key { flex: 1 0 100%; }
  .ai-select,
  .ai-input { width: 100%; max-width: 100%; height: 36px; font-size: 12px; }
}
.switch-input {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 19px;
  flex: none;
  border-radius: 20px;
  background: rgba(148, 162, 190, 0.18);
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}
.switch-input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform 0.16s, background 0.16s;
}
.switch-input:checked { background: rgba(46, 230, 168, 0.28); border-color: rgba(46, 230, 168, 0.5); }
.switch-input:checked::after { transform: translateX(15px); background: var(--green); }
.e2ee-form { display: flex; flex-direction: column; gap: 4px; }
.e2ee-form .field { margin-bottom: 8px; }
.e2ee-modal-actions { display: flex; gap: 8px; margin-top: 6px; }
.e2ee-modal-actions .btn { flex: 1; }
.modal-e2ee { max-width: 440px; }

/* ══════════════════════════════════════════════════════════════
   主题 / 插件 / 命令面板
   ══════════════════════════════════════════════════════════════ */
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
  text-align: left;
  cursor: pointer;
  transition: border-color .14s, background .14s;
}
.theme-card:hover { border-color: var(--line-strong); }
.theme-card.is-active { border-color: rgba(46, 230, 168, .55); background: rgba(46, 230, 168, .07); }
.theme-preview { display: flex; gap: 2px; height: 28px; border-radius: 5px; overflow: hidden; border: 1px solid var(--line-soft); }
.theme-preview i { flex: 1; display: block; }
.theme-card b { font-size: 10.5px; font-weight: 600; color: var(--text); }
.theme-card span { font-size: 8.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-accent-row { display: flex; align-items: center; gap: 8px; margin: 8px 0 6px; }
.theme-accent { width: 30px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: transparent; cursor: pointer; }
.custom-theme-json {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font: 10.5px/1.6 var(--mono);
  outline: none;
}
.custom-theme-json:focus { border-color: rgba(46, 230, 168, .5); box-shadow: var(--ring-green); }
.set-section-actions { display: flex; align-items: center; gap: 10px; }
.plugin-list { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.plugin-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(10, 17, 32, .35);
}
.plugin-item.is-error { border-color: rgba(255, 122, 138, .35); background: rgba(255, 122, 138, .05); }
.plugin-main { flex: 1; min-width: 0; }
.plugin-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.plugin-name { font-size: 11.5px; font-weight: 600; color: var(--text); }
.plugin-version { font-size: 8.5px; color: var(--text-3); }
.plugin-status { padding: 0 5px; border-radius: 4px; font-size: 8.5px; line-height: 15px; background: var(--panel-3); color: var(--text-3); }
.plugin-status.is-ready { color: var(--green); background: var(--green-dim); }
.plugin-status.is-error, .plugin-status.is-permission-denied { color: var(--red); background: var(--red-dim); }
.plugin-status.is-loading { color: var(--amber); background: var(--amber-dim); }
.plugin-desc { margin: 4px 0 0; font-size: 9.5px; line-height: 1.5; color: var(--text-3); }
.plugin-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 5px; font-size: 8.5px; color: var(--text-3); }
.plugin-perm { padding: 0 5px; border-radius: 4px; background: var(--panel-3); color: var(--text-2); font-size: 8px; }
.plugin-error { margin: 5px 0 0; font-size: 9px; color: var(--red); line-height: 1.5; }
.plugin-actions { display: flex; flex-direction: column; gap: 4px; flex: none; }
.plugin-actions .btn { height: 24px; padding: 0 7px; font-size: 9.5px; }
.plugin-empty { display: flex; flex-direction: column; gap: 3px; padding: 14px 6px; color: var(--text-3); font-size: 10px; }
.plugin-empty b { color: var(--text-2); font-size: 11px; }
.plugin-segments { line-height: 1.65; }
.plugin-mark { border-radius: 3px; padding: 0 2px; }
.plugin-mark.mark-highlight { background: rgba(46, 230, 168, .18); color: var(--green); }
.plugin-mark.mark-warning { background: rgba(255, 180, 84, .2); color: var(--amber); }
.plugin-mark.mark-danger { background: rgba(255, 122, 138, .18); color: var(--red); }
.plugin-mark.mark-amber { background: rgba(255, 180, 84, .18); color: var(--amber); }
.plugin-mark.mark-green { background: rgba(46, 230, 168, .14); color: var(--green); }

/* 命令面板 */
.command-palette { position: fixed; inset: 0; z-index: 210; display: grid; place-items: start center; padding-top: 12vh; }
.command-palette[hidden] { display: none !important; }
.cp-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 16, .62); backdrop-filter: blur(6px); }
.cp-card {
  position: relative;
  width: min(580px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.cp-input-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.cp-input-row .ic { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.cp-input-row input { flex: 1; min-width: 0; font-size: 13px; color: var(--text); }
.cp-input-row input::placeholder { color: var(--text-3); }
.cp-input-row kbd { padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--text-3); font-size: 8.5px; }
.cp-list { max-height: min(46vh, 360px); overflow-y: auto; padding: 5px; }
.cp-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; text-align: left; }
.cp-item:hover, .cp-item.is-active { background: rgba(46, 230, 168, .1); }
.cp-item-title { font-size: 11.5px; color: var(--text); }
.cp-item-hint { font-size: 8.5px; color: var(--text-3); flex: none; }
.cp-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 10.5px; }
.cp-foot { padding: 6px 12px; border-top: 1px solid var(--line-soft); color: var(--text-3); font-size: 8.5px; }

/* ══════════════════════════════════════════════════════════════
   浅色主题关键硬编码颜色兜底（逐屏审计）
   ══════════════════════════════════════════════════════════════ */
html[data-theme="light"] body { background: var(--bg); }
html[data-theme="light"] .login {
  background:
    radial-gradient(720px 520px at 12% 18%, rgba(10, 143, 106, .08), transparent 62%),
    radial-gradient(760px 560px at 88% 4%, rgba(53, 105, 212, .07), transparent 60%),
    linear-gradient(180deg, #FBFCFE 0%, #F4F6FA 58%, #EEF1F7 100%);
}
html[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, .88);
  border-color: rgba(148, 162, 190, .24);
  box-shadow: 0 24px 70px -28px rgba(31, 45, 70, .28), inset 0 1px 0 rgba(255, 255, 255, .8);
}
html[data-theme="light"] .login-side::before { background: radial-gradient(closest-side, rgba(10, 143, 106, .07), transparent 72%); }
html[data-theme="light"] .titlebar { background: rgba(255, 255, 255, .82); border-bottom-color: var(--line-soft); }
html[data-theme="light"] .win-controls .win-btn:hover { background: rgba(31, 45, 70, .08); }
html[data-theme="light"] .modal { background: linear-gradient(180deg, #FFFFFF, #FAFBFD); border-color: var(--line); }
html[data-theme="light"] .settings-profile { background: var(--panel-2); }
html[data-theme="light"] .set-section { background: rgba(244, 246, 250, .65); }
html[data-theme="light"] .plugin-item, html[data-theme="light"] .device-item { background: var(--panel-2); }
html[data-theme="light"] .files-page, html[data-theme="light"] .content-page { background: var(--panel); }
html[data-theme="light"] .msg-bubble { background: #FFFFFF; border-color: var(--line); }
html[data-theme="light"] .msg-row.is-theirs .msg-bubble { background: #FFFFFF; }
html[data-theme="light"] .msg-row.is-mine .msg-bubble { background: linear-gradient(145deg, rgba(10, 143, 106, .13), rgba(10, 143, 106, .06)); border-color: rgba(10, 143, 106, .2); }
html[data-theme="light"] .msg-bubble .msg-md code { background: rgba(31, 45, 70, .06); }
html[data-theme="light"] .msg-bubble .md-pre { background: #F2F5FA; }
html[data-theme="light"] .composer-box { background: var(--panel); }
html[data-theme="light"] .composer-toolbar { background: transparent; }
html[data-theme="light"] .previewer-card { background: var(--panel); }
html[data-theme="light"] .previewer-body { background: #F7F9FC; }
html[data-theme="light"] .previewer-body .preview-code, html[data-theme="light"] .previewer-body .preview-text { background: #FFFFFF; color: #1B2537; border-color: var(--line); }
html[data-theme="light"] .tag-popover, html[data-theme="light"] .cp-card { background: #FFFFFF; }
html[data-theme="light"] .cp-backdrop { background: rgba(31, 45, 70, .28); }
html[data-theme="light"] .menu { background: #FFFFFF; border-color: var(--line); }
html[data-theme="light"] .theme-card { background: var(--panel-2); }
html[data-theme="light"] .custom-theme-json { background: #FFFFFF; }
html[data-theme="light"] .toast { background: #FFFFFF; color: var(--text); border-color: var(--line); }
html[data-theme="light"] .search-box, html[data-theme="light"] .conv-search, html[data-theme="light"] .files-search { background: var(--panel-2); }
html[data-theme="light"] .titlebar, html[data-theme="light"] .tabs-bar { background: rgba(255, 255, 255, .86); }
html[data-theme="light"] .rail { background: var(--panel); }
html[data-theme="light"] .detail-pane { background: var(--panel); }
html[data-theme="light"] .login-winctl .win-btn { color: var(--text-2); }
html[data-theme="light"] .login-mode.is-active { background: rgba(10, 143, 106, .1); color: #057A58; }
html[data-theme="light"] .btn-primary { color: #FFFFFF; }
html[data-theme="light"] .msg-highlight { background: rgba(10, 143, 106, .12) !important; }


/* 浅色 / 自定义主题补充：输入框和登录方式 tab */
html[data-theme="light"] .field input,
html[data-theme="light"] .custom-theme-json,
html[data-theme="light"] .search-box input {
  background: #FFFFFF;
  color: var(--text);
}
html[data-theme="light"] .login-modes { background: #F1F4F9; }
html[data-theme="light"] .login-mode { color: var(--text-3); }
html[data-theme="light"] .composer-box { background: #FFFFFF; }
html[data-theme="light"] .chat-head { background: linear-gradient(180deg, #FFFFFF, rgba(255,255,255,.68)); }
html[data-theme="light"] .titlebar, html[data-theme="light"] .tabs-bar { background: #FFFFFF; }
html[data-theme="light"] .rail { background: var(--panel-2); }
html[data-theme="light"] .detail-pane { background: #FFFFFF; }
html[data-theme="light"] .dt-card { background: #F4F6FA; border-color: var(--line-soft); }
html[data-theme="light"] .set-section .set-row { border-color: var(--line-soft); }

.modal-settings { overflow-y: auto; overscroll-behavior: contain; }
.toast { background: var(--panel-2); color: var(--text); border-color: var(--line); }
html[data-theme="light"] .login-modes { background: #F1F4F9 !important; border-color: #DCE3EE; }
html[data-theme="light"] .login-mode { background: transparent; color: #55647D !important; }
html[data-theme="light"] .login-mode.is-active { background: rgba(10,143,106,.12) !important; color: #057A58 !important; }

/* P2P 离线补传 */
.msg-file-missing-note { display: flex; flex-direction: column; gap: 4px; }
.msg-file-missing-note .btn-mini { align-self: flex-start; margin-top: 2px; }
.msg-file.is-missing.is-no-holder { border-color: rgba(255, 180, 84, .35); }
.file-catchup-state {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 9px;
  color: var(--green);
}
.file-catchup-state .ic { width: 11px; height: 11px; }

/* ══════════════════════════════════════════════════════════════
   主题对比度收尾：组件统一走 CSS 变量（dark / light / custom / 插件主题）
   ══════════════════════════════════════════════════════════════ */
:focus-visible { outline-color: var(--green); }
::selection { background: var(--green-dim); color: var(--text); }

/* 悬停底色：深色主题是极淡白，浅色主题要改为实色 panel-3，避免“看不出来/灰脏” */
.icon-btn:hover,
.win-btn:hover,
.tab:hover,
.tab-close:hover,
.tab.is-menu-open,
.rail-btn:hover,
.conv-item:hover,
.menu-item:hover,
.dt-member:hover,
.user-row:hover,
.file-row:hover,
.dt-file:hover {
  background: var(--panel-3);
  color: var(--text);
}
.menu-item:hover .ic { color: var(--text-2); }

/* 弹窗、菜单、tooltip、浮层 */
.modal-search { background: var(--panel-2); }
.set-section { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.help-row { border-bottom-color: var(--line-soft); }
.toast { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.menu, .tag-popover, .cp-card, .help-card, .viewer-bar { background: var(--panel-2); }
.viewer-bar { border-color: var(--line); }
#viewer-img { background: var(--bg); }
.msg-image { background: var(--panel-3); border-color: var(--line); }

/* 预览器：PDF 外框、文本/代码底与文字、图片查看器底 */
.previewer-body { background: var(--bg-deep); }
.previewer-card { background: var(--panel); }
.preview-code, .preview-text, .md-pre code.md-codeblock { color: var(--text); }
.preview-code, .preview-text { border-color: var(--green-line); background: var(--bg-deep); }
.md-pre { border-color: var(--green-line); background: var(--bg-deep); }
.previewer-card .md-p, .previewer-card .md-h1, .previewer-card .md-h2,
.previewer-card .md-h3, .previewer-card .md-h4 { color: var(--text); }
.md-quote { color: var(--text-2); border-left-color: var(--green-line); }
.md-code { background: var(--green-dim); color: var(--green); }

/* 标签 chips / 收藏金色 / 上传进度 / P2P 文字 */
.tag-option.is-fav { color: var(--amber); }
.tag-option.is-fav.is-on { color: var(--amber); background: var(--amber-dim); border-color: var(--amber); }
.msg-status.is-p2p, .file-via.is-p2p, .upl-speed, .upl-count,
.upload-block.is-p2p .upl-pct { color: var(--green-deep); }
.image-via.is-p2p { color: var(--green); }
.upload-block.is-p2p .upl-fill { background: linear-gradient(90deg, var(--green), var(--green-deep)); }

/* 登录页错误/提示 */
.login-error { color: var(--red); }
.login-error.is-ok { color: var(--green); }
.login-error.is-info { color: var(--text-2); }

/* 滚动条：用当前主题的文字色混合，浅色主题仍可见 */
* { scrollbar-color: color-mix(in srgb, var(--text-3) 38%, transparent) transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-3) 34%, transparent); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-2) 48%, transparent); background-clip: padding-box; }

/* 按钮/输入禁用态：大色块改成 panel 混合，避免浅底白字 */
.btn:disabled { opacity: 0.55; filter: none; }
input:disabled, textarea:disabled, select:disabled { color: var(--text-3); background: var(--panel-3); }

/* 浅色主题（含自定义浅色/插件浅色）专项兜底 */
html[style*="color-scheme: light"] .modal-backdrop,
html[style*="color-scheme: light"] .previewer-backdrop,
html[style*="color-scheme: light"] .cp-backdrop { background: rgba(31, 45, 70, 0.32); }
html[style*="color-scheme: light"] .titlebar,
html[style*="color-scheme: light"] .tabs-bar { background: var(--panel-2); }
html[style*="color-scheme: light"] .chat-head { background: var(--panel); }
html[style*="color-scheme: light"] .composer-box { background: var(--panel); }
html[style*="color-scheme: light"] .detail-pane { background: var(--panel); }
html[style*="color-scheme: light"] .rail { background: var(--panel-2); }
html[style*="color-scheme: light"] .set-section { background: var(--panel-2); }
html[style*="color-scheme: light"] .plugin-item,
html[style*="color-scheme: light"] .device-item,
html[style*="color-scheme: light"] .dt-card { background: var(--panel-2); }
html[style*="color-scheme: light"] .toast { background: var(--panel); color: var(--text); }
html[style*="color-scheme: light"] .menu,
html[style*="color-scheme: light"] .tag-popover,
html[style*="color-scheme: light"] .cp-card { background: var(--panel); }
html[style*="color-scheme: light"] .previewer-body { background: var(--bg-deep); }
html[style*="color-scheme: light"] .preview-code,
html[style*="color-scheme: light"] .preview-text,
html[style*="color-scheme: light"] .md-pre code.md-codeblock { color: var(--text); background: var(--panel-2); }
html[style*="color-scheme: light"] .login-card { background: var(--panel); }
html[style*="color-scheme: light"] .login-modes { background: var(--panel-3); }
html[style*="color-scheme: light"] .login-mode { color: var(--text-2); }
html[style*="color-scheme: light"] .login-error.is-info { color: var(--text-2); }
html[style*="color-scheme: light"] .msg-time,
html[style*="color-scheme: light"] .msg-status { color: var(--text-3); }
html[style*="color-scheme: light"] .msg-status.is-read { color: var(--green); }
html[style*="color-scheme: light"] .image-via.is-server { color: var(--text-2); background: rgba(255,255,255,.78); }
html[style*="color-scheme: light"] .image-via.is-p2p { color: var(--green-deep); background: rgba(255,255,255,.86); }
html[style*="color-scheme: light"] .set-section-head h4 { color: var(--text-2); }
html[style*="color-scheme: light"] .modal { background: var(--panel); border-color: var(--line); }
html[style*="color-scheme: light"] .custom-theme-json,
html[style*="color-scheme: light"] .field input { background: var(--panel-2); }

/* E2EE 弹窗 / 设置资料卡对比度兜底 */
.modal { color: var(--text); }
.modal .modal-head h3 { color: var(--text); }
.modal .modal-head p { color: var(--text-3); }
.modal .field label,
.modal .set-key { color: var(--text-3); }
.modal .field input { color: var(--text); background: var(--panel-2); }
.modal .field input::placeholder { color: var(--text-3); }
.modal-e2ee { color: var(--text); }
.modal-e2ee #e2ee-modal-title { color: var(--text); }
html[data-theme="light"] .settings-profile,
html[style*="color-scheme: light"] .settings-profile { background: var(--panel-2) !important; }

/* 消息列表窗口化 / 历史分页 */
.msg-list-spacer { flex: none; width: 100%; pointer-events: none; }
.msg-history-loader {
  flex: none;
  align-self: center;
  margin: 0 auto 10px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 10.5px;
  cursor: pointer;
  transition: border-color .14s, color .14s, background .14s;
}
.msg-history-loader:hover { border-color: var(--green-line); color: var(--green); }
.msg-history-loader:disabled { opacity: .6; cursor: default; }
.msg-history-loader[hidden] { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   AI 原生：顶栏入口 / 输入框辅助 / 右侧抽屉 / 设置
   ══════════════════════════════════════════════════════════════ */
.tb-ai {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 10.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .14s, color .14s, background .14s;
}
.tb-ai .ic { width: 13px; height: 13px; color: var(--green); }
.tb-ai:hover { border-color: var(--green-line); color: var(--green); background: var(--green-dim); }
.ai-icon-btn { color: var(--green); }
.ai-icon-btn:hover { background: var(--green-dim); color: var(--green); }
.ai-assist { display: inline-flex; align-items: center; gap: 3px; }
.ai-tool { width: auto; min-width: 52px; padding: 0 7px; font-size: 9.5px; color: var(--green); border: 1px solid var(--green-line); background: var(--green-dim); }
.ai-tool:hover { background: var(--green-line); color: var(--green); }

.ai-backdrop {
  position: fixed;
  inset: 0;
  z-index: 205;
  background: rgba(4, 8, 16, 0.42);
  backdrop-filter: blur(2px);
}
.ai-backdrop[hidden] { display: none !important; }
.ai-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 206;
  width: min(400px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 50px -24px rgba(0, 0, 0, .55);
  transition: transform .18s var(--ease);
}
.ai-panel[hidden] { display: none !important; }
.ai-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 13px 10px 16px; border-bottom: 1px solid var(--line-soft); }
.ai-head-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ai-mark { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; color: var(--green); background: var(--green-dim); border: 1px solid var(--green-line); }
.ai-mark .ic { width: 16px; height: 16px; }
.ai-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ai-head-text b { font-size: 13px; }
.ai-head-text span { font-size: 9.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-tabs { flex: none; display: flex; align-items: center; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.ai-tab { flex: none; height: 26px; padding: 0 8px; border-radius: 6px; color: var(--text-3); font-size: 10px; white-space: nowrap; cursor: pointer; }
.ai-tab:hover { color: var(--text-2); background: var(--panel-2); }
.ai-tab.is-active { color: var(--green); background: var(--green-dim); }
.ai-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }
.ai-empty { display: flex; flex-direction: column; gap: 5px; padding: 22px 8px; color: var(--text-3); font-size: 11px; line-height: 1.6; }
.ai-empty b { color: var(--text-2); font-size: 12px; }
.ai-empty.ai-error b { color: var(--red); }
.ai-empty .btn { align-self: flex-start; margin-top: 5px; }
.ai-loading { display: flex; flex-direction: column; gap: 10px; padding: 14px 6px; color: var(--text-3); font-size: 10.5px; }
.ai-skeleton { display: flex; flex-direction: column; gap: 7px; }
.ai-skeleton i { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.ai-skeleton i:nth-child(2) { width: 82%; }
.ai-skeleton i:nth-child(3) { width: 64%; }
.ai-result { display: flex; flex-direction: column; gap: 8px; }
.ai-result-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ai-source { height: 17px; padding: 0 6px; border-radius: 4px; font-size: 8.5px; line-height: 17px; font-weight: 600; }
.ai-source.is-model { color: var(--green); background: var(--green-dim); }
.ai-source.is-local { color: var(--amber); background: var(--amber-dim); }
.ai-model-name { color: var(--text-3); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-latency { color: var(--text-3); font-size: 8.5px; }
.ai-copy { margin-left: auto; color: var(--text-3); font-size: 9px; }
.ai-bullets { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0 0 0 14px; color: var(--text); font-size: 11.5px; line-height: 1.65; }
.ai-bullets li::marker { color: var(--green); }
.ai-todos li::marker { color: var(--amber); }
.ai-section { display: flex; flex-direction: column; gap: 5px; }
.ai-section b { font-size: 10px; color: var(--text-3); letter-spacing: .04em; }
.ai-reply-card { padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-2); }
.ai-reply-card p { margin: 0; font-size: 11.5px; line-height: 1.6; color: var(--text); }
.ai-reply-actions { display: flex; gap: 5px; margin-top: 7px; }
.ai-answer { white-space: pre-wrap; color: var(--text); font-size: 12px; line-height: 1.7; }
.ai-citation { color: var(--text-3); font-size: 9px; }
.ai-citation-list { padding-left: 15px; color: var(--text-2); font-size: 10.5px; }
.ai-text-result { white-space: pre-wrap; padding: 10px; border: 1px solid var(--green-line); border-radius: 8px; background: var(--bg-deep); color: var(--text); font-size: 11.5px; line-height: 1.7; }
.ai-note { color: var(--text-3); font-size: 9px; line-height: 1.5; }
.ai-stream { display: flex; flex-direction: column; gap: 8px; }
.ai-stream-text { white-space: pre-wrap; color: var(--text); font-size: 12px; line-height: 1.7; min-height: 20px; }
.ai-stream-hint { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 9px; }
.ai-cursor { width: 5px; height: 12px; border-radius: 2px; background: var(--green); animation: aiCursor 1s steps(2) infinite; }
@keyframes aiCursor { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .15; } }
.ai-global-card { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-2); text-align: left; cursor: pointer; }
.ai-global-card:hover { border-color: var(--green-line); background: var(--green-dim); }
.ai-global-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-global-head b { color: var(--text); font-size: 11px; }
.ai-global-head em { color: var(--text-3); font-size: 8.5px; font-style: normal; }
.ai-global-text { color: var(--text-2); font-size: 10px; line-height: 1.5; }
.ai-qa-row { flex: none; display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line-soft); }
.ai-qa-row[hidden] { display: none !important; }
.ai-qa-row input { flex: 1; min-width: 0; height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: var(--text); font-size: 11px; outline: none; }
.ai-qa-row input:focus { border-color: var(--green-line); box-shadow: var(--ring-green); }
.ai-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line-soft); color: var(--text-3); font-size: 8.5px; }
html[style*="color-scheme: light"] .ai-panel { background: var(--panel); }
html[style*="color-scheme: light"] .ai-backdrop { background: rgba(31, 45, 70, .24); }
@media (max-width: 900px) {
  .tb-ai span, .tb-ai { font-size: 9px; padding: 0 6px; }
  .ai-panel { width: min(380px, 100vw); }
}
.ai-bullets { list-style: disc; list-style-position: outside; }
.ai-todos { list-style: decimal; }

/* ══════════════════════════════════════════════════════════════
   第 13 项：1:1 通话 / 大群成员 / @提及 / 会话待办
   ══════════════════════════════════════════════════════════════ */
.call-icon-btn, .todo-icon-btn { position: relative; }
.todo-icon-btn .todo-count {
  position: absolute; top: -4px; right: -4px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 8px; background: var(--red); color: #fff; font-size: 8.5px; line-height: 15px;
  text-align: center; border: 1px solid var(--panel); pointer-events: none;
}
.call-icon-btn:hover, .todo-icon-btn:hover { color: var(--green); }

.call-incoming {
  position: fixed; inset: 0; z-index: 240; display: grid; place-items: center;
  background: rgba(4, 8, 16, .58); backdrop-filter: blur(8px);
}
.call-incoming[hidden] { display: none !important; }
.call-incoming-card {
  width: min(330px, calc(100vw - 32px)); padding: 26px 24px 22px; border-radius: 20px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line);
  box-shadow: 0 24px 70px -28px rgba(0,0,0,.7); display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.call-incoming-avatar { margin-bottom: 4px; border-radius: 50%; box-shadow: 0 0 0 5px var(--green-dim), 0 0 26px -6px var(--green); animation: call-pulse 1.8s ease-in-out infinite; }
.call-incoming-card b { font-size: 17px; color: var(--text); }
.call-incoming-type { font-size: 10px; color: var(--green); background: var(--green-dim); border-radius: 5px; padding: 2px 8px; }
.call-incoming-hint { margin: 2px 0 12px; font-size: 11px; color: var(--text-3); }
.call-incoming-actions { display: flex; gap: 20px; }
.call-action { width: 58px; height: 58px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff; cursor: pointer; border: 1px solid transparent; }
.call-action .ic { width: 20px; height: 20px; }
.call-action span { font-size: 8.5px; }
.call-action-reject { background: #e5484d; }
.call-action-accept { background: var(--green); color: #061a13; box-shadow: 0 0 22px -6px var(--green); animation: call-pulse 2s ease-in-out infinite; }
.call-action:hover { filter: brightness(1.08); }
@keyframes call-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

.call-overlay { position: fixed; inset: 0; z-index: 230; background: #05080f; }
.call-overlay[hidden] { display: none !important; }
.call-stage { position: relative; width: 100%; height: 100%; overflow: hidden; background: radial-gradient(circle at 50% 35%, #122238, #05080f 68%); }
.call-stage video { width: 100%; height: 100%; object-fit: cover; background: #05080f; }
#call-remote-video.is-hidden { visibility: hidden; }
.call-remote-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: var(--text-2); pointer-events: none; }
.call-remote-placeholder.is-hidden { display: none; }
.call-remote-avatar { border-radius: 50%; box-shadow: 0 0 0 6px rgba(46, 230, 168, .08), 0 0 60px -18px var(--green); }
.call-remote-placeholder b { font-size: 20px; color: var(--text); }
.call-remote-placeholder span { font-size: 11px; color: var(--text-3); }
.call-topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 24px; background: linear-gradient(rgba(3,6,12,.65), transparent); color: #fff; pointer-events: none; }
.call-topbar-main { display: flex; flex-direction: column; gap: 3px; }
.call-topbar-main b { font-size: 14px; }
.call-topbar-main span { font-size: 10px; color: var(--text-3); }
.call-timer { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--text-2); }
.call-local { position: absolute; right: 22px; top: 82px; width: 190px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.14); background: #060c16; box-shadow: 0 12px 40px -16px rgba(0,0,0,.8); transition: width .2s, transform .2s; }
.call-local.is-hidden { display: none; }
.call-local.is-sharing { width: 260px; border-color: var(--green-line); }
.call-local video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.call-local-label { position: absolute; left: 6px; bottom: 5px; padding: 1px 5px; border-radius: 3px; background: rgba(0,0,0,.5); color: #fff; font-size: 8px; }
.call-notice { position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); max-width: min(520px, calc(100vw - 40px)); padding: 7px 12px; border-radius: 7px; background: rgba(255, 184, 77, .16); border: 1px solid rgba(255, 184, 77, .4); color: #ffdc9a; font-size: 10.5px; text-align: center; }
.call-controls { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 16px; background: rgba(8, 14, 24, .78); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(12px); }
.call-control { width: 62px; height: 48px; border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-2); background: transparent; cursor: pointer; }
.call-control .ic { width: 18px; height: 18px; }
.call-control span { font-size: 8px; }
.call-control:hover { background: rgba(255,255,255,.07); color: #fff; }
.call-control.is-active { color: var(--amber); background: rgba(255,184,77,.12); }
.call-control:disabled { opacity: .35; cursor: default; }
.call-control-hangup { color: #fff; background: #e5484d; width: 70px; }
.call-control-hangup:hover { background: #f05a5f; }
html[style*="color-scheme: light"] .call-overlay { background: #0b1220; }
@media (max-width: 720px) {
  .call-control { width: 52px; }
  .call-local { width: 128px; top: 74px; right: 12px; }
  .call-controls { gap: 4px; padding: 7px; }
}

/* 待办抽屉 */
.todo-backdrop { position: fixed; inset: 0; z-index: 207; background: rgba(4, 8, 16, .36); backdrop-filter: blur(2px); }
.todo-backdrop[hidden] { display: none !important; }
.todo-drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 208; width: min(380px, 100vw); display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -18px 0 50px -24px rgba(0,0,0,.55); }
.todo-drawer[hidden] { display: none !important; }
.todo-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 13px 10px 16px; border-bottom: 1px solid var(--line-soft); }
.todo-head-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.todo-mark { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; color: var(--green); background: var(--green-dim); border: 1px solid var(--green-line); }
.todo-mark .ic { width: 16px; height: 16px; }
.todo-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.todo-head-text b { font-size: 13px; }
.todo-head-text span { font-size: 9.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-add-form { flex: none; display: flex; flex-direction: column; gap: 7px; padding: 10px 13px; border-bottom: 1px solid var(--line-soft); }
.todo-add-form > input { height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: var(--text); font-size: 11.5px; outline: none; }
.todo-add-form > input:focus { border-color: var(--green-line); box-shadow: var(--ring-green); }
.todo-add-row { display: flex; align-items: flex-end; gap: 6px; }
.todo-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 8.5px; color: var(--text-3); }
.todo-field input, .todo-field select { height: 27px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text-2); font-size: 9.5px; padding: 0 5px; outline: none; min-width: 0; }
.todo-field input { width: 148px; }
.todo-field select { width: 100px; }
.todo-filters { flex: none; display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.todo-filter { height: 24px; padding: 0 8px; border-radius: 6px; font-size: 9.5px; color: var(--text-3); cursor: pointer; }
.todo-filter:hover { color: var(--text-2); background: var(--panel-2); }
.todo-filter.is-active { color: var(--green); background: var(--green-dim); }
.todo-summary { margin-left: auto; color: var(--text-3); font-size: 8.5px; }
.todo-list { flex: 1; min-height: 0; overflow-y: auto; padding: 9px 11px; display: flex; flex-direction: column; gap: 6px; }
.todo-empty { display: flex; flex-direction: column; gap: 5px; padding: 24px 10px; color: var(--text-3); font-size: 10.5px; line-height: 1.6; }
.todo-empty b { color: var(--text-2); font-size: 12px; }
.todo-item { display: flex; align-items: flex-start; gap: 8px; padding: 9px 9px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-2); transition: border-color .14s; }
.todo-item:hover { border-color: var(--line); }
.todo-item.is-done { opacity: .6; }
.todo-item.is-overdue { border-color: rgba(229,72,77,.4); background: linear-gradient(90deg, rgba(229,72,77,.07), var(--panel-2)); }
.todo-item.is-today { border-color: rgba(255,184,77,.32); }
.todo-check { width: 15px; height: 15px; margin-top: 2px; accent-color: var(--green); cursor: pointer; flex: none; }
.todo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.todo-text { font-size: 11.5px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.todo-item.is-done .todo-text { text-decoration: line-through; color: var(--text-3); }
.todo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 8.5px; color: var(--text-3); }
.todo-due.is-overdue { color: #ff8a8d; }
.todo-due.is-today { color: var(--amber); }
.todo-due.is-soon { color: var(--green); }
.todo-assignee { color: var(--text-2); }
.todo-pending { color: var(--amber); }
.todo-actions { display: flex; gap: 1px; flex: none; opacity: .4; transition: opacity .14s; }
.todo-item:hover .todo-actions { opacity: 1; }
.todo-icon { width: 22px; height: 22px; }
.todo-icon .ic { width: 13px; height: 13px; }
.todo-source { font-size: 8.5px; color: var(--green); }
.todo-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line-soft); color: var(--text-3); font-size: 8.5px; }
.todo-edit { flex-direction: column; align-items: stretch; }
.todo-edit-fields { display: flex; flex-direction: column; gap: 5px; }
.todo-edit-text, .todo-edit-due, .todo-edit-assignee { height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font-size: 10px; padding: 0 7px; outline: none; }
.todo-edit-row { display: flex; gap: 5px; }
.todo-edit-row input { flex: 1; min-width: 0; }
.todo-edit-row select { width: 110px; }
.todo-edit .todo-actions { opacity: 1; align-self: flex-end; }
html[style*="color-scheme: light"] .todo-backdrop { background: rgba(31,45,70,.18); }

/* 大群成员 */
.dt-group-actions { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 0 2px; }
.dt-group-rename { display: flex; gap: 5px; align-items: center; padding: 8px 0; }
.group-rename-input { flex: 1; min-width: 0; height: 28px; border: 1px solid var(--green-line); border-radius: 6px; background: var(--panel-2); color: var(--text); font-size: 10.5px; padding: 0 7px; outline: none; }
.dt-add-member { font-size: 9px; color: var(--green); margin-left: auto; }
.group-search-row { display: flex; gap: 5px; margin: 7px 0 5px; }
.group-search-box { flex: 1; display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); }
.group-search-box .ic { width: 12px; height: 12px; color: var(--text-3); flex: none; }
.group-search-box input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: 10px; }
.dt-member-page { max-height: none; }
.dt-remove-member { width: 20px; height: 20px; margin-left: auto; color: var(--text-3); }
.dt-remove-member:hover { color: var(--red); }
.dt-page-row { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 0 2px; }
.dt-page-label { color: var(--text-3); font-size: 8.5px; font-variant-numeric: tabular-nums; }

/* @ 提及 */
.mention-popover { position: fixed; z-index: 260; max-height: 220px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); box-shadow: 0 16px 40px -16px rgba(0,0,0,.6); }
.mention-popover[hidden] { display: none !important; }
.mention-row { display: flex; align-items: center; gap: 7px; padding: 5px 6px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-size: 10.5px; }
.mention-row:hover, .mention-row.is-active { background: var(--green-dim); color: var(--text); }
.mention-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-online { color: var(--green); font-size: 8px; }
.msg-mention.is-me { color: #fff; background: var(--red); border-radius: 3px; padding: 0 3px; font-weight: 600; }
.conv-at-badge { position: absolute; right: 8px; top: 24px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 9px; line-height: 16px; text-align: center; font-weight: 700; z-index: 2; box-shadow: 0 0 0 2px var(--panel); }

.ai-import-todo { margin-top: 6px; align-self: flex-start; }
.call-local.is-sharing video { transform: none; }
.tag-todo-action { display: flex; align-items: center; gap: 6px; width: 100%; margin: 7px 0 0; padding: 7px 9px; border-radius: 6px; border: 1px solid var(--line-soft); color: var(--green); background: var(--green-dim); font-size: 10.5px; cursor: pointer; }
.tag-todo-action .ic { width: 13px; height: 13px; }
.tag-todo-action[hidden] { display: none; }
.dt-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dt-role { display: inline-flex; align-items: center; height: 16px; padding: 0 6px; border-radius: 4px; font-size: 8.5px; font-weight: 600; letter-spacing: .02em; }
.dt-role.is-owner { color: var(--amber); background: var(--amber-dim); border: 1px solid rgba(255, 184, 77, .28); }
.dt-role.is-member { color: var(--text-3); background: var(--panel-2); border: 1px solid var(--line-soft); }

/* 通话画质档位 / 实时质量 */
.call-net{position:absolute;right:18px;top:58px;z-index:5;padding:4px 9px;border-radius:999px;
  background:rgba(8,14,26,.72);border:1px solid rgba(120,150,190,.22);color:#a9bbd6;
  font-size:11px;letter-spacing:.2px;pointer-events:none}
@media (max-width:720px){.call-net{right:10px;top:52px;font-size:10px}}

/* ── 移动端（Android App / 手机浏览器） ─────────────────────── */
.ch-back{display:none}
@media (max-width: 760px), (pointer: coarse) and (max-height: 520px){
  .titlebar,#tabs-bar{display:none!important}
  .app-body{flex-direction:column;padding-bottom:calc(58px + env(safe-area-inset-bottom))}
  .rail{
    position:fixed;left:0;right:0;bottom:0;z-index:70;width:100%;
    height:calc(58px + env(safe-area-inset-bottom));flex-direction:row;align-items:center;
    justify-content:space-around;padding:0 6px env(safe-area-inset-bottom);
    background:rgba(13,20,34,.97);border-top:1px solid var(--line);backdrop-filter:blur(16px)
  }
  .rail-top,.rail-bottom{display:flex;flex-direction:row;align-items:center;gap:2px;margin:0}
  .rail-btn{width:46px;height:46px;border-radius:13px}
  .rail-avatar{width:40px;height:40px}
  .conv-pane{width:100%!important;min-width:0!important;flex:1;border-right:none}
  .conv-resizer,#btn-collapse-conv{display:none!important}
  .detail-pane{display:none!important}
  /* 底部导航：激活指示条改到图标下方（桌面版是左侧竖条） */
  .rail-btn.is-active::before{
    left:50%;top:auto;bottom:3px;width:16px;height:3px;transform:translateX(-50%);
    border-radius:3px;box-shadow:none;
  }
  /* 文件/内容中心：手机端全屏布局 */
  .files-page{padding:0 14px}
  .files-toolbar{flex-wrap:wrap;gap:8px}
  .files-search{width:auto;flex:1;min-width:120px}
  .files-head{padding-top:14px}
  .files-head h2{font-size:17px}
  .files-head p{font-size:10.5px}
  .chat-pane{display:none}
  .app.is-mobile-chat .conv-pane{display:none}
  .app.is-mobile-chat .chat-pane{
    display:flex;position:fixed;left:0;right:0;top:0;
    bottom:calc(58px + env(safe-area-inset-bottom));z-index:60;background:var(--panel)
  }
  .ch-back{display:inline-flex!important;margin-right:2px;width:38px;height:38px}
  .ch-id{flex:1;min-width:0}
  .ch-text{min-width:0}
  .ch-title-row h1{max-width:none;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1}
  #ch-kind{display:none!important}
  #more-menu [data-menu="toggle-detail"]{display:none!important}
  .ch-actions{gap:1px}
  .ch-actions .pill,#btn-chat-summary,#btn-detail,#btn-todo{display:none!important}
  .ch-actions .icon-btn{width:38px;height:38px;border-radius:10px}
  .ch-actions .icon-btn .ic{width:18px;height:18px}
  #btn-ai-mobile{display:inline-flex;width:40px;height:40px;border-radius:11px}
  #btn-ai-close{width:40px;height:40px}
  .composer .tool-btn{width:34px;height:34px;border-radius:10px}
  .composer .tool-btn .ic{width:17px;height:17px}
  .ch-avatar{width:34px;height:34px;border-radius:10px}
  .chat-head{padding:9px 10px}
  .ch-sub{font-size:10.5px}
  .msg-main{max-width:88%}
  .msg-bubble{font-size:15px;line-height:1.5}
  .composer{padding:6px 10px calc(10px + env(safe-area-inset-bottom))}
  .composer-box{padding:6px 8px;border-radius:16px}
  .composer-hint{display:none}
  #search-kbd{display:none!important}
  .send-btn,.composer-box .send{width:40px;height:40px;border-radius:12px}
  .pane-head{padding:10px 12px 6px}
  .conv-item{padding:10px 8px;border-radius:12px}
  .conv-name{font-size:15px}
  .conv-preview{font-size:12px}
  .chat-empty{padding:44px 20px}
  .msg-day{margin:10px 0 6px}
  .toast{left:12px;right:12px;transform:none;bottom:calc(70px + env(safe-area-inset-bottom))}
  .ai-panel{width:100vw!important;right:0!important}
  .todo-drawer{width:100vw}
}
@media (max-width: 380px){
  .ch-title-row h1{max-width:44vw;font-size:15.5px}
  .rail-btn{width:42px;height:42px}
}

/* 前端静态资源更新提示条（PC / 手机通用） */
.client-refresh-bar{position:fixed;left:50%;top:calc(52px + env(safe-area-inset-top));transform:translateX(-50%);z-index:11900;display:flex;width:max-content;align-items:center;gap:10px;padding:8px 10px 8px 12px;border-radius:14px;background:rgba(12,20,34,.97);border:1px solid rgba(46,230,168,.42);box-shadow:0 12px 34px rgba(0,0,0,.45);backdrop-filter:blur(12px);color:#e8f6f2;font-size:13px;max-width:calc(100vw - 24px)}
.client-refresh-bar[hidden]{display:none}
.crb-dot{width:8px;height:8px;border-radius:50%;background:#2ee6a8;box-shadow:0 0 10px rgba(46,230,168,.9);flex:none}
.crb-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;color:#e8f6f2}
.crb-btn{flex:none;border:0;border-radius:9px;padding:5px 10px;background:#2ee6a8;color:#062018;font-weight:600;font-size:12.5px;cursor:pointer}
.crb-btn:active{transform:scale(.97)}
.crb-close{flex:none;border:0;background:transparent;color:#9fb3ad;font-size:18px;line-height:1;cursor:pointer;padding:0 2px}
@media (max-width: 760px), (pointer: coarse) and (max-height: 520px) {
  .client-refresh-bar{top:auto;bottom:calc(176px + env(safe-area-inset-bottom));font-size:12.5px}
}

/* App 在线更新提示条（安卓壳） */
.update-bar{position:fixed;left:50%;top:calc(10px + env(safe-area-inset-top));transform:translateX(-50%);z-index:12000;display:flex;align-items:center;gap:10px;padding:8px 10px 8px 12px;border-radius:14px;background:rgba(12,20,34,.96);border:1px solid rgba(46,230,168,.38);box-shadow:0 12px 34px rgba(0,0,0,.42);backdrop-filter:blur(10px);color:#e8f6f2;font-size:13px;max-width:calc(100vw - 24px)}
.update-bar[hidden]{display:none}
.ub-dot{width:8px;height:8px;border-radius:50%;background:#2ee6a8;box-shadow:0 0 10px rgba(46,230,168,.9);flex:none}
.ub-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.ub-btn{flex:none;border:0;border-radius:9px;padding:5px 10px;background:#2ee6a8;color:#062018;font-weight:600;font-size:12.5px;cursor:pointer}
.ub-btn:active{transform:scale(.97)}
.ub-close{flex:none;border:0;background:transparent;color:#9fb3ad;font-size:18px;line-height:1;cursor:pointer;padding:0 2px}

/* 手机端 AI 入口：桌面用顶栏按钮，手机在会话列表头部显示 */
#btn-ai-mobile { display: none; }
@media (max-width: 760px), (pointer: coarse) and (max-height: 520px) {
  #btn-ai-mobile { display: inline-flex; }
}
@media (hover: none), (max-width: 760px) {
  .rail-btn::after,
  .rail-avatar[data-tip]::after,
  .icon-btn[data-tip]::after { display: none !important; }
}

/* 通讯录页 */
.contacts-page{padding:0 14px}
.contacts-list{flex:1;min-height:0;overflow-y:auto;padding:4px 0 16px;display:flex;flex-direction:column;gap:2px}
.contact-item{display:flex;align-items:center;gap:12px;width:100%;padding:10px 8px;border:0;border-radius:12px;background:transparent;color:var(--text);text-align:left;cursor:pointer}
.contact-item:hover{background:rgba(255,255,255,0.045)}
.contact-item .av{flex:none}
.contact-info{flex:1;min-width:0}
.contact-name{font-size:15px;font-weight:560;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.contact-sub{font-size:11px;color:var(--text-3);margin-top:2px}
.contact-online{margin-left:auto;width:8px;height:8px;border-radius:50%;background:var(--line);flex:none}
.contact-online.is-on{background:var(--green);box-shadow:0 0 8px rgba(46,230,168,0.7)}
.contacts-empty{padding:48px 0;text-align:center;color:var(--text-3);font-size:12.5px}
.rail-mine-label{display:none}

/* 手机底部导航：文字标签 + 精简入口（隐藏占位收藏与重复设置齿轮） */
@media (max-width: 760px), (pointer: coarse) and (max-height: 520px) {
  #rail-settings{display:none!important}
  .rail-btn{
    width:auto;min-width:58px;height:52px;display:flex;flex-direction:column;
    align-items:center;justify-content:center;gap:2px;border-radius:12px
  }
  .rail-btn .ic{width:20px;height:20px}
  .rail-btn::after{
    display:block!important;content:attr(data-tip);position:static;transform:none;opacity:1;
    background:none;border:0;box-shadow:none;padding:0;font-size:9.5px;line-height:1;
    color:currentColor;white-space:nowrap
  }
  .rail-btn.is-active::before{bottom:2px;width:14px;height:2px}
  .rail-avatar{width:30px;height:30px}
  .rail-bottom{flex-direction:column;justify-content:center;gap:2px;margin:0;height:auto}
  .rail-mine-label{display:block;font-size:9.5px;line-height:1;color:var(--text-3);white-space:nowrap}
}

/* 手机端常驻连接状态 + 设置页移动化 */
.mobile-conn{display:none}
@media (max-width: 760px), (pointer: coarse) and (max-height: 520px) {
  #btn-ai-mobile{display:inline-flex;align-items:center;gap:4px;width:auto;height:34px;padding:0 10px;border-radius:10px}
  .ai-mobile-text{font-size:10.5px;font-weight:600;letter-spacing:.02em;line-height:1}
  .msg-menu{position:fixed!important;z-index:400;width:190px;padding:5px;border:1px solid var(--line);border-radius:10px;background:var(--panel-2);box-shadow:var(--shadow-3);animation:pop .14s var(--ease)}
  .msg-menu .menu-item{height:38px;font-size:12.5px}
  /* 长按弹出自定义菜单时，避免系统文本选择手柄与菜单重叠 */
  .msg-row, .msg-bubble{-webkit-user-select:none;user-select:none}
  .mobile-conn{
    display:inline-flex;align-items:center;gap:4px;margin-left:8px;padding:2px 7px;
    border-radius:999px;font-size:9.5px;line-height:1.2;font-weight:500;vertical-align:middle;
    color:var(--text-3);background:rgba(255,255,255,0.05)
  }
  .mobile-conn .dot{width:6px;height:6px;border-radius:50%;background:currentColor;flex:none}
  .mobile-conn.is-online{color:var(--green)}
  .mobile-conn.is-reconnecting,.mobile-conn.is-connecting{color:#f0b855}
  .mobile-conn.is-offline{color:#f2777a}

  .modal-settings{
    width:100vw;max-width:100vw;height:100vh;max-height:100vh;
    border-radius:0;border:0
  }
  .modal-settings .modal-head{padding:16px 18px 12px}
  .modal-settings .modal-head .icon-btn{width:40px;height:40px}
  .modal-settings .settings-profile{margin:4px 16px 14px;padding:14px}
  .modal-settings .set-rows{margin:0 16px}
  .modal-settings .set-row{padding:13px 2px;min-height:49px}
  .modal-settings .set-actions .btn,
  .modal-settings .btn-mini{min-height:38px;padding:0 14px}
  .modal-settings .switch-input{width:44px;height:24px}
  .modal-settings .switch-input::after{width:18px;height:18px;top:2px;left:2px}
  .modal-settings .switch-input:checked::after{transform:translateX(19px)}

  /* 手机端辅助字号统一下限，提升小屏可读性 */
  .ch-sub, .files-head p, .contact-sub, .foot-online, .files-cache-info{font-size:11px}
  .settings-profile-text span, .msg-meta, .msg-sender, .msg-time, .msg-day,
  .ai-head-text span, .ai-foot, .modal-note, .pref-row em, .conv-section,
  .conv-section-count, .msg-file-meta{font-size:10.5px}
  .count-pill{font-size:10px}
  .rail-btn::after, .rail-mine-label, .mobile-conn{font-size:10.5px}
  #foot-online{font-size:11px}
}
