/* DeepSeek 归档 · 界面样式
   参考 Apple 的材质、层级与弹簧动效规范，纯 CSS，无外部资源。 */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Cascadia Mono", monospace;

  --bg: #edeff5;
  --bg-deep: #e6e9f2;
  --panel: rgba(255, 255, 255, 0.66);
  --panel-strong: rgba(255, 255, 255, 0.86);
  --card: #ffffff;
  --card-soft: #f6f7fb;
  --code-bg: #f4f5f9;
  --text: #15161a;
  --text-2: #5b5f68;
  --text-3: #8a8f99;
  --line: rgba(18, 20, 30, 0.075);
  --line-2: rgba(18, 20, 30, 0.14);
  --accent: #4d6bfe;
  --accent-ink: #2f3c9e;
  --accent-soft: rgba(77, 107, 254, 0.09);
  --bubble: #e5e9ff;
  --bubble-edge: rgba(77, 107, 254, 0.12);
  --warn-bg: rgba(255, 159, 10, 0.12);
  --warn-ink: #96560a;

  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.04), 0 8px 22px rgba(20, 24, 40, 0.045);
  --shadow-md: 0 14px 42px rgba(20, 24, 40, 0.10), 0 2px 8px rgba(20, 24, 40, 0.04);
  --shadow-lg: 0 34px 100px rgba(16, 20, 36, 0.22);

  --sidebar-w: 316px;
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e12;
    --bg-deep: #08090c;
    --panel: rgba(24, 25, 31, 0.68);
    --panel-strong: rgba(26, 27, 33, 0.9);
    --card: #18191f;
    --card-soft: #1f2028;
    --code-bg: #121319;
    --text: #f2f3f6;
    --text-2: #a9adb7;
    --text-3: #8b909c;
    --line: rgba(255, 255, 255, 0.075);
    --line-2: rgba(255, 255, 255, 0.14);
    --accent: #8296ff;
    --accent-ink: #c3ccff;
    --accent-soft: rgba(130, 150, 255, 0.12);
    --bubble: #242c4d;
    --bubble-edge: rgba(130, 150, 255, 0.18);
    --warn-bg: rgba(255, 175, 60, 0.14);
    --warn-ink: #f3c073;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 26px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.42);
    --shadow-lg: 0 40px 110px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(920px 520px at 6% -10%, rgba(116, 137, 255, 0.20), transparent 62%),
    radial-gradient(820px 460px at 100% 4%, rgba(183, 158, 255, 0.16), transparent 60%),
    radial-gradient(700px 700px at 50% 115%, rgba(120, 200, 255, 0.10), transparent 60%),
    var(--bg);
  overflow: hidden;
}

::selection { background: rgba(77, 107, 254, 0.22); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-block;
  vertical-align: -3px;
  pointer-events: none;
}

h1, h2, h3, h4, p { margin: 0; }

button { font: inherit; color: inherit; }

button, a, input, select { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-3) 30%, transparent);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-3) 55%, transparent); background-clip: content-box; }

/* ---------------------------------------------------------------- 布局 */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(42px) saturate(180%);
  -webkit-backdrop-filter: blur(42px) saturate(180%);
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  border: 0;
  padding: 0;
  background: rgba(10, 12, 20, 0.32);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.app.is-menu .sidebar-scrim { opacity: 1; pointer-events: auto; }

.main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* ---------------------------------------------------------------- 侧栏 */

.sidebar-head {
  flex: none;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 4px 6px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(150deg, #7089ff 0%, #4d6bfe 52%, #384bda 100%);
  box-shadow: 0 6px 16px rgba(60, 82, 220, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand-mark .ico { width: 22px; height: 22px; }

.brand-copy { min-width: 0; flex: 1; }
.brand-copy h1 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.brand-copy p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.16s ease, transform 0.1s ease;
}
.icon-btn:hover { background: rgba(120, 128, 150, 0.12); }
.icon-btn:active { transform: scale(0.94); }

.open-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.open-btn:hover { background: color-mix(in srgb, var(--card) 88%, var(--accent) 4%); }
.open-btn:active { transform: scale(0.985); }
.open-btn .ico { width: 17px; height: 17px; color: var(--accent); }
.open-btn span:first-of-type { flex: 1; text-align: left; }
.open-hint {
  font-size: 10.5px;
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  letter-spacing: 0.03em;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.16s ease;
}
.nav-row:hover:not(:disabled) { background: rgba(120, 128, 150, 0.10); }
.nav-row:disabled { opacity: 0.45; cursor: default; }
.nav-row.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-ico { display: grid; place-items: center; width: 18px; }
.nav-ico .ico { width: 16px; height: 16px; }
.nav-label { flex: 1; text-align: left; }
.nav-count {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
  border-radius: 10px;
  background: rgba(120, 128, 150, 0.10);
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.search-box:focus-within {
  background: var(--card);
  border-color: color-mix(in srgb, var(--accent) 36%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-ico {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--text-3);
}
.search-box input {
  width: 100%;
  height: 100%;
  padding: 0 56px 0 32px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box kbd {
  position: absolute;
  right: 8px;
  font-family: var(--font);
  font-size: 10px;
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
}
.search-clear {
  position: absolute;
  right: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.search-clear:hover { background: rgba(120, 128, 150, 0.14); }
.search-clear .ico { width: 14px; height: 14px; }

.filter-row { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  height: 25px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 99px;
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.1s ease;
}
.chip:hover { background: rgba(120, 128, 150, 0.10); }
.chip:active { transform: scale(0.96); }
.chip.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 18%, transparent);
}

.list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 0;
  min-height: 26px;
}
.list-bar > span { font-size: 11px; color: var(--text-3); letter-spacing: 0.01em; }
.list-bar.is-searching .sort-wrap { display: none; }

.sort-wrap { position: relative; display: flex; align-items: center; }
.sort-wrap select {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 11px;
  padding: 3px 16px 3px 4px;
  cursor: pointer;
  outline: none;
  font-family: var(--font);
}
.select-chev {
  position: absolute;
  right: 0;
  width: 11px;
  height: 11px;
  color: var(--text-3);
  pointer-events: none;
}

.session-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 8px 18px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.list-empty {
  padding: 42px 16px;
  text-align: center;
  color: var(--text-3);
}
.list-empty-mark {
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: rgba(120, 128, 150, 0.10);
}
.list-empty p { font-size: 12px; line-height: 1.6; }

.session {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 11px;
  padding: 9px 10px;
  margin-bottom: 1px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.14s ease, transform 0.1s ease;
}
.session:hover { background: rgba(120, 128, 150, 0.09); }
.session:active { transform: scale(0.988); }
.session.is-active { background: var(--accent-soft); }
.session.is-active .session-title { color: var(--accent-ink); }

.session-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-title span { overflow: hidden; text-overflow: ellipsis; }
.session-title .ico { width: 12px; height: 12px; color: var(--accent); opacity: 0.75; }

.session-snippet {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-2);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.session-snippet mark, .session-title mark {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.session-meta .sep { width: 2px; height: 2px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.session-meta .ico { width: 11px; height: 11px; }
.session-meta .m-flag { display: inline-flex; align-items: center; gap: 2px; }

.sidebar-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px 12px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--text-3);
}
.lock-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.14);
}
.text-btn {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 10.5px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.text-btn:hover { color: var(--text); background: rgba(120, 128, 150, 0.12); }

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  position: relative;
  z-index: 6;
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  height: 62px;
  padding: 0 24px;
  background: linear-gradient(to bottom, var(--bg) 42%, color-mix(in srgb, var(--bg) 55%, transparent) 78%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.topbar-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  color: var(--text);
}
.menu-btn { display: none; }

.segmented {
  position: relative;
  display: flex;
  align-items: center;
  padding: 3px;
  border-radius: 11px;
  background: rgba(120, 128, 150, 0.13);
  border: 1px solid var(--line);
  justify-self: center;
}
.segmented button {
  position: relative;
  z-index: 1;
  height: 26px;
  padding: 0 13px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.18s ease;
}
.segmented button.is-active { color: var(--text); font-weight: 600; }
.seg-pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: 0;
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(20, 24, 40, 0.10), 0 3px 8px rgba(20, 24, 40, 0.06);
  will-change: transform, width;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-self: end;
  min-width: 0;
}
.top-actions-note {
  font-size: 11.5px;
  max-width: 300px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.1s ease, box-shadow 0.16s ease;
}
.btn:hover { background: color-mix(in srgb, var(--card) 90%, var(--accent) 5%); }
.btn:active { transform: scale(0.96); }
.btn .ico { width: 14px; height: 14px; color: var(--text-2); }
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent);
}
.btn.primary .ico { color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 90%, #000 10%); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: rgba(120, 128, 150, 0.10); color: var(--text); }
.btn.icon-only { width: 30px; padding: 0; justify-content: center; }

.scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 30px 90px;
  overscroll-behavior: contain;
}

.view { max-width: 1080px; margin: 0 auto; }
.view > .thread, .view > .chat-shell { max-width: 860px; margin: 0 auto; }

.to-bottom {
  position: absolute;
  right: 26px;
  bottom: 24px;
  z-index: 7;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-2);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.14s ease;
}
.to-bottom .ico { width: 17px; height: 17px; transform: rotate(180deg); }
.to-bottom:active { transform: scale(0.93); }

/* ---------------------------------------------------------------- 欢迎页 */

.welcome {
  min-height: calc(100dvh - 170px);
  display: grid;
  place-items: center;
  padding: 24px 0 40px;
}
.welcome-inner {
  width: min(620px, 100%);
  text-align: center;
}
.welcome-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 22px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(150deg, #7d92ff, #4d6bfe 55%, #3446ce);
  box-shadow: 0 18px 40px rgba(57, 78, 210, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.welcome-mark .ico { width: 34px; height: 34px; }
.welcome h2 {
  font-size: clamp(30px, 4.4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 680;
}
.welcome-sub {
  margin: 14px auto 0;
  max-width: 460px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-2);
}
.welcome-sub strong { color: var(--text); font-weight: 600; }

.dropzone {
  margin-top: 28px;
  padding: 26px 22px;
  border: 1.5px dashed var(--line-2);
  border-radius: 18px;
  background: color-mix(in srgb, var(--card) 40%, transparent);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.16s ease;
}
.dropzone:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dropzone p { font-size: 12.5px; color: var(--text-3); margin-top: 10px; }
.dz-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.load-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}
.load-error .ico { width: 14px; height: 14px; margin-top: 1px; flex: none; }

.welcome-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 30px;
  text-align: left;
}
.point {
  padding: 13px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 55%, transparent);
  border: 1px solid var(--line);
}
.point .ico { width: 16px; height: 16px; color: var(--accent); }
.point strong { display: block; font-size: 12.5px; margin-top: 8px; font-weight: 600; }
.point span { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }

/* ---------------------------------------------------------------- 概览 */

.overview { padding-bottom: 20px; }

.hero { padding: 20px 4px 4px; }
.hero-kicker {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}
.hero h2 {
  margin-top: 10px;
  font-size: clamp(30px, 4.2vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.038em;
  font-weight: 680;
  max-width: 720px;
}
.hero-sub {
  margin-top: 14px;
  max-width: 660px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-2);
}
.hero-sub strong { color: var(--text); font-weight: 600; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 55%, transparent);
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.meta-pill .ico { width: 12px; height: 12px; color: var(--text-3); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 12px;
}
.stat {
  padding: 15px 17px 14px;
  border-radius: 17px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.01em;
}
.stat-label .ico { width: 13px; height: 13px; }
.stat-value {
  margin-top: 7px;
  font-size: 29px;
  line-height: 1.1;
  font-weight: 660;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0;
  margin-left: 3px;
}
.stat-foot { margin-top: 5px; font-size: 11px; color: var(--text-3); }

.card {
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h3 {
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -0.012em;
}
.card-sub { font-size: 11.5px; color: var(--text-3); }
.card-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11.5px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 5px;
}
.card-link:hover { background: var(--accent-soft); }

.duo {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.section-gap { margin-top: 12px; }

/* 月份柱状 */
.chart { position: relative; }
.chart-plot {
  position: relative;
  height: 154px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding-top: 8px;
  background-image: linear-gradient(to top, var(--line) 1px, transparent 1px);
  background-size: 100% 25%;
  background-position: 0 100%;
}
.mcol {
  position: relative;
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}
.mbar {
  width: 100%;
  max-width: 26px;
  height: calc(var(--v) * 1%);
  min-height: 2px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(to top, color-mix(in srgb, var(--accent) 72%, #ffffff 10%), color-mix(in srgb, var(--accent) 38%, #ffffff 30%));
  transition: transform 0.18s var(--ease), filter 0.18s ease;
  transform-origin: bottom center;
}
.mcol:hover .mbar { filter: saturate(1.2) brightness(1.03); transform: scaleY(1.015); }
.mcol.is-zero .mbar { background: var(--line-2); }
.mcol .tip {
  position: absolute;
  bottom: calc(var(--v) * 1% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 10.5px;
  line-height: 1.2;
  padding: 4px 7px;
  border-radius: 6px;
  white-space: nowrap;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 3;
}
.mcol:hover .tip { opacity: 1; transform: translate(-50%, 0); }
.chart-x {
  display: flex;
  gap: 3px;
  margin-top: 7px;
}
.chart-x span {
  flex: 1 1 0;
  text-align: center;
  font-size: 9.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}

.hour-chart { height: 96px; }
.hour-chart .mbar { max-width: 14px; border-radius: 3px 3px 1px 1px; }
.chart-note { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-3); margin-top: 6px; }

/* 账户 */
.kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--text-3); flex: none; }
.kv strong {
  font-weight: 500;
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-top { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.profile-avatar {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(150deg, #6f86ff, #4459dd);
  text-transform: uppercase;
}
.profile-name { font-size: 13.5px; font-weight: 600; }
.profile-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* 最近对话 */
.recent { display: flex; flex-direction: column; gap: 2px; }
.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
}
.recent-row:hover { background: var(--card-soft); }
.recent-date {
  flex: none;
  width: 52px;
  font-size: 10.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.recent-title {
  flex: 1;
  min-width: 0;
  font-size: 12.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-meta { flex: none; font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.recent-row .ico { width: 13px; height: 13px; color: var(--text-3); opacity: 0; transition: opacity 0.14s ease; }
.recent-row:hover .ico { opacity: 1; }

/* 附件条 */
.strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}
.strip-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card-soft);
  cursor: zoom-in;
  padding: 0;
}
.strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s var(--ease); }
.strip-item:hover img { transform: scale(1.05); }
.strip-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 10, 18, 0.28), transparent 55%);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.strip-item:hover::after { opacity: 1; }
.strip-more {
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px dashed var(--line-2);
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  cursor: pointer;
}
.strip-more:hover { background: var(--accent-soft); color: var(--accent-ink); }

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.6;
}
.privacy-note .ico { width: 14px; height: 14px; color: #34c759; flex: none; }

/* ---------------------------------------------------------------- 对话 */

.chat-shell { padding-top: 6px; }

.chat-head { padding: 10px 2px 16px; border-bottom: 1px solid var(--line); }
.chat-title {
  font-size: clamp(21px, 2.6vw, 27px);
  line-height: 1.24;
  letter-spacing: -0.028em;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.chat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.chat-meta .dot { width: 2px; height: 2px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.chat-meta .ico { width: 12px; height: 12px; }

.thread { padding: 8px 0 30px; }

.day-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 4px;
  color: var(--text-3);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.day-divider::before, .day-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line), transparent);
}

.msg { position: relative; margin-top: 18px; }
.msg-flash {
  position: relative;
  border-radius: 16px;
  animation: flashFade 2.4s ease forwards;
}
@keyframes flashFade {
  0%, 40% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 7px var(--accent-soft); }
  100% { box-shadow: 0 0 0 2px transparent, 0 0 0 7px transparent; }
}

.msg-user { display: flex; justify-content: flex-end; }
.msg-user .msg-stack {
  max-width: min(80%, 620px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}
.bubble {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 19px 19px 5px 19px;
  background: var(--bubble);
  border: 1px solid var(--bubble-edge);
  font-size: 14.6px;
  line-height: 1.68;
  overflow-wrap: anywhere;
}
.bubble .prose { font-size: 14.6px; }
.msg-time {
  font-size: 10.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.18s ease;
  padding: 0 4px;
}
.msg:hover .msg-time, .msg-user:hover .msg-time { opacity: 1; }
@media (hover: none) { .msg-time { opacity: 0.75; } }

.msg-ai { display: flex; gap: 11px; align-items: flex-start; }
.avatar {
  width: 27px;
  height: 27px;
  flex: none;
  margin-top: 1px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(150deg, #7d92ff, #4d6bfe 60%, #3c50d8);
  box-shadow: 0 3px 9px rgba(55, 76, 200, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.ai-main { flex: 1; min-width: 0; }
.ai-head {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 27px;
  margin-bottom: 2px;
}
.ai-name { font-size: 12px; font-weight: 620; letter-spacing: -0.005em; }
.ai-head .msg-time { opacity: 0; }
.msg-ai:hover .ai-head .msg-time { opacity: 1; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 500;
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.status-badge .ico { width: 10px; height: 10px; }

.prose {
  font-size: 14.6px;
  line-height: 1.74;
  color: var(--text);
  overflow-wrap: anywhere;
}
.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }
.prose p { margin: 0.6em 0; }
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  margin: 1.15em 0 0.45em;
  line-height: 1.4;
  letter-spacing: -0.015em;
  font-weight: 640;
}
.prose h2 { font-size: 20px; }
.prose h3 { font-size: 18px; }
.prose h4 { font-size: 16px; }
.prose h5 { font-size: 14.8px; }
.prose h6 { font-size: 14px; color: var(--text-2); }
.prose ul, .prose ol { margin: 0.55em 0; padding-left: 1.4em; }
.prose li { margin: 0.22em 0; }
.prose li > ul, .prose li > ol { margin: 0.18em 0; }
.prose li::marker { color: var(--text-3); }
.prose strong { font-weight: 650; }
.prose em { font-style: italic; }
.prose del { color: var(--text-3); }
.prose blockquote {
  margin: 0.7em 0;
  padding: 0.1em 0 0.1em 12px;
  border-left: 2px solid var(--line-2);
  color: var(--text-2);
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.3em 0; }
.prose a.md-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.prose a.md-link:hover { border-bottom-color: var(--accent); background: var(--accent-soft); }

.inline-code {
  font-family: var(--mono);
  font-size: 0.87em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  padding: 0.08em 0.34em;
  border-radius: 5px;
}

.code-block {
  margin: 0.85em 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--code-bg);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
}
.code-lang {
  font-size: 10.5px;
  color: var(--text-3);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.code-copy {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.code-copy:hover { background: rgba(120, 128, 150, 0.12); color: var(--text); }
.code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.6px;
  line-height: 1.62;
  color: var(--text);
  tab-size: 2;
}
.code-block pre code { font-family: inherit; }

.table-wrap {
  margin: 0.85em 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.55; }
.table-wrap th, .table-wrap td {
  padding: 7px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table-wrap th {
  background: var(--card-soft);
  font-weight: 600;
  font-size: 12.2px;
  white-space: nowrap;
}
.table-wrap tr:last-child td { border-bottom: 0; }

.math {
  font-family: "Cambria Math", "Latin Modern Math", Georgia, "Times New Roman", serif;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 4px;
  padding: 0.04em 0.26em;
  font-size: 0.98em;
  white-space: nowrap;
}
.math-block {
  display: block;
  margin: 0.55em 0;
  padding: 0.5em 0.75em;
  text-align: center;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* 思考 */
.think { margin: 3px 0 9px; }
.think-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 25px;
  padding: 0 9px 0 7px;
  border: 0;
  border-radius: 99px;
  background: rgba(120, 128, 150, 0.09);
  color: var(--text-2);
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.think-toggle:hover { background: rgba(120, 128, 150, 0.15); }
.think-toggle .ico { width: 12px; height: 12px; color: var(--accent); }
.think-toggle .chev { width: 12px; height: 12px; color: var(--text-3); transition: transform 0.28s var(--ease); }
.think.open .think-toggle .chev { transform: rotate(180deg); }
.think-time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.think-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s var(--ease);
}
.think.open .think-body { grid-template-rows: 1fr; }
.think-clip { overflow: hidden; }
.think-text {
  margin-top: 8px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--line-2);
  color: var(--text-2);
  font-size: 13.2px;
  line-height: 1.68;
}
.think-text .prose { font-size: 13.2px; color: var(--text-2); }

/* 工具卡片 */
.tool {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card-soft);
  overflow: hidden;
}
.tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s ease;
}
.tool-head:hover { background: rgba(120, 128, 150, 0.06); }
.tool-ico {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.tool-ico .ico { width: 13px; height: 13px; }
.tool-text { flex: 1; min-width: 0; }
.tool-title {
  display: block;
  font-size: 12.2px;
  font-weight: 550;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tool-sub {
  display: block;
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tool-chev { color: var(--text-3); transition: transform 0.26s var(--ease); width: 13px; height: 13px; }
.tool.open .tool-chev { transform: rotate(180deg); }
.tool-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.36s var(--ease); }
.tool.open .tool-body { grid-template-rows: 1fr; }
.tool-clip { overflow: hidden; }
.tool-inner { padding: 0 11px 10px; }

.tool-chips { display: flex; flex-wrap: wrap; gap: 5px; padding-bottom: 7px; }
.tool-chip {
  font-size: 10.5px;
  padding: 3px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent);
}
.result {
  display: block;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.result:first-of-type { border-top: 0; }
.result-title { font-size: 12.4px; font-weight: 550; line-height: 1.45; }
.result:hover .result-title { color: var(--accent); }
.result-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--text-3);
}
.result-site {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: var(--line);
  font-size: 8px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
}
.result-snippet {
  margin-top: 3px;
  font-size: 11.6px;
  line-height: 1.55;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-more {
  margin-top: 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 10.8px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 5px;
}
.tool-more:hover { background: var(--accent-soft); }

.tool-note { font-size: 11.8px; color: var(--text-2); line-height: 1.6; }
.tool-note + .tool-note { margin-top: 4px; }

/* 附件 */
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}
.attachments.ai-side { justify-content: flex-start; }
.att img, .strip-item img, .file-card img { opacity: 0; }
.att img.loaded, .strip-item img.loaded, .file-card img.loaded { opacity: 1; }
.strip-item img { transition: opacity 0.32s ease, transform 0.4s var(--ease); }
.file-card img { transition: opacity 0.32s ease; }

.att {
  position: relative;
  padding: 0;
  width: 108px;
  height: 108px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  background: var(--card-soft);
  cursor: zoom-in;
  transition: transform 0.16s var(--ease), box-shadow 0.2s ease;
}
.att:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.att:active { transform: scale(0.98); }
.att img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-missing {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  color: var(--text-3);
  text-align: center;
}
.att-missing .ico { width: 20px; height: 20px; }
.att-missing span { font-size: 9.5px; line-height: 1.4; }
.att-tag {
  position: absolute;
  left: 5px;
  bottom: 5px;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(12, 14, 22, 0.62);
  color: #fff;
  backdrop-filter: blur(6px);
  letter-spacing: 0.01em;
}

/* 杂项提示 */
.risk-note, .tip-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
  font-size: 10.8px;
  line-height: 1.55;
  color: var(--text-3);
}
.risk-note .ico, .tip-note .ico { width: 12px; height: 12px; margin-top: 1px; flex: none; }
.tip-note {
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 11.4px;
}

.extra-branch {
  margin-top: 26px;
  padding-top: 4px;
  border-top: 1px dashed var(--line-2);
}
.extra-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font-size: 11.5px;
  height: 28px;
  padding: 0 11px;
  border-radius: 99px;
  cursor: pointer;
}
.extra-toggle:hover { background: var(--card-soft); }
.extra-toggle .ico { width: 13px; height: 13px; }
.extra-note { margin: 10px 0 0; font-size: 11px; color: var(--text-3); }

/* ---------------------------------------------------------------- 附件页 */

.files-view { padding-top: 12px; }
.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.view-head h2 {
  font-size: 24px;
  letter-spacing: -0.028em;
  font-weight: 650;
  line-height: 1.2;
}
.view-head p { font-size: 12px; color: var(--text-3); margin-top: 5px; }

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 12px;
}
.file-card {
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  background: var(--card-soft);
  aspect-ratio: 1 / 1;
  cursor: zoom-in;
  transition: transform 0.18s var(--ease), box-shadow 0.22s ease;
}
.file-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.file-card:active { transform: scale(0.99); }
.file-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-card .fc-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 10, 18, 0.62), rgba(8, 10, 18, 0) 52%);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.file-card:hover .fc-shade { opacity: 1; }
.fc-cap {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 9px;
  text-align: left;
  color: #fff;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.24s var(--ease);
}
.file-card:hover .fc-cap { opacity: 1; transform: none; }
.fc-name {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}
.fc-meta { font-size: 9.5px; opacity: 0.72; margin-top: 1px; }
.file-missing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 100%;
  padding: 16px;
  color: var(--text-3);
  text-align: center;
}
.file-missing .ico { width: 24px; height: 24px; }
.file-missing span { font-size: 10.5px; line-height: 1.45; }
.files-note {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 55%, transparent);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ---------------------------------------------------------------- 分析页 */

.stats-view { padding-top: 6px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.span-2 { grid-column: 1 / -1; }

.comp-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 11.8px;
}
.comp-name { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comp-track { display: block; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.comp-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(to right, color-mix(in srgb, var(--accent) 60%, #9fb0ff), var(--accent));
  width: calc(var(--v) * 1%);
  min-width: 2px;
}
.comp-num {
  text-align: right;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  font-size: 10.8px;
}

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 148px; height: 148px; flex: none; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 13; stroke-linecap: butt; }
.donut-center { position: relative; }
.donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-label strong { font-size: 21px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.donut-label span { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.legend { display: flex; flex-direction: column; gap: 7px; min-width: 130px; flex: 1; }
.legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-2);
}
.legend-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.legend-row b { margin-left: auto; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }

.rank { display: flex; flex-direction: column; gap: 1px; }
.rank-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  border-radius: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 11.8px;
}
.rank-row:hover { background: var(--card-soft); }
.rank-idx { font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; }
.rank-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-val { text-align: right; color: var(--text-3); font-size: 10.8px; font-variant-numeric: tabular-nums; }

.big-number-row { display: flex; gap: 24px; flex-wrap: wrap; }
.big-stat strong {
  display: block;
  font-size: 25px;
  letter-spacing: -0.03em;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.big-stat span { font-size: 10.5px; color: var(--text-3); }

/* ---------------------------------------------------------------- 灯箱 */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.lb-scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 11, 18, 0.78);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.lightbox.is-open .lb-scrim { opacity: 1; }
.lb-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 94vw;
  max-height: 86vh;
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.24s ease, transform 0.34s var(--ease);
  will-change: transform, opacity;
  cursor: grab;
}
.lightbox.is-open .lb-stage { opacity: 1; transform: scale(1); }
.lb-stage.dragging { cursor: grabbing; transition: none; }
.lb-stage img {
  max-width: 92vw;
  max-height: 84vh;
  border-radius: 10px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}
.lb-missing {
  width: 320px;
  max-width: 80vw;
  padding: 40px 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.76);
  text-align: center;
}
.lb-missing .ico { width: 30px; height: 30px; opacity: 0.7; }
.lb-missing p { font-size: 12.5px; margin-top: 10px; }

.lb-bar {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lb-count {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
  font-variant-numeric: tabular-nums;
  margin-right: 2px;
}
.lb-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: #fff;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.12s ease;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.18); }
.lb-btn:active { transform: scale(0.92); }
.lb-btn .ico { width: 16px; height: 16px; }

.lb-cap {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 3;
  max-width: 80vw;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11.5px;
  line-height: 1.5;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.lb-cap strong { display: block; font-weight: 500; font-size: 12px; color: #fff; }
.lb-cap span { display: block; color: rgba(255, 255, 255, 0.5); font-size: 10px; margin-top: 2px; }

.lb-nav {
  position: fixed;
  top: 50%;
  z-index: 3;
  width: 40px;
  height: 40px;
  margin-top: -20px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
  transition: background 0.16s ease, opacity 0.16s ease;
}
.lb-nav:hover { background: rgba(255, 255, 255, 0.18); }
.lb-nav.prev { left: 18px; transform: rotate(180deg); }
.lb-nav.next { right: 18px; }
.lb-nav[disabled] { opacity: 0.25; pointer-events: none; }

/* ---------------------------------------------------------------- 抽屉 */

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 95;
}
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 11, 18, 0.3);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sheet-layer.is-open .sheet-scrim { opacity: 1; }
.sheet {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 10px;
  width: min(400px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: var(--panel-strong);
  backdrop-filter: blur(50px) saturate(180%);
  -webkit-backdrop-filter: blur(50px) saturate(180%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(calc(100% + 24px));
  transition: transform 0.42s var(--ease);
  will-change: transform;
  overflow: hidden;
}
.sheet-layer.is-open .sheet { transform: translateX(0); }
.sheet.dragging { transition: none; }
.sheet-grip {
  position: absolute;
  left: 7px;
  top: 50%;
  width: 3px;
  height: 46px;
  margin-top: -23px;
  border-radius: 99px;
  background: var(--line-2);
  opacity: 0.7;
}
.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 20px 10px;
}
.sheet-head h2 { font-size: 17px; letter-spacing: -0.02em; font-weight: 640; }
.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 20px 24px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
}
.sheet-body h3 {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 18px 0 6px;
}
.sheet-body p { margin: 8px 0; }
.sheet-body .kv { font-size: 12.5px; }
.sheet-note {
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-2);
}
.sheet-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.sheet-actions .btn { height: 32px; font-size: 12px; }
.sheet-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 7px;
  word-break: break-all;
  user-select: all;
}
.kbd-list { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }
.kbd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.kbd-row span { color: var(--text-2); }
kbd.key {
  font-family: var(--font);
  font-size: 10.5px;
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 6px;
}

/* ---------------------------------------------------------------- 加载 / 拖拽 */

.loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.loading-card {
  width: min(360px, 86vw);
  padding: 28px 26px 24px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0%, color-mix(in srgb, var(--accent) 25%, transparent) 40%, var(--accent) 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.loading-sub { margin-top: 5px; font-size: 11.5px; color: var(--text-3); }
.progress { margin-top: 16px; display: flex; align-items: center; gap: 9px; }
.progress-track { flex: 1; height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(to right, color-mix(in srgb, var(--accent) 55%, #a9b8ff), var(--accent));
  transition: width 0.18s linear;
}
.progress-text { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.drop-card {
  width: min(440px, 88vw);
  padding: 38px 24px;
  border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 24px;
  background: var(--panel-strong);
  text-align: center;
  box-shadow: var(--shadow-md);
}
.drop-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(150deg, #7d92ff, #4d6bfe);
}
.drop-icon .ico { width: 27px; height: 27px; }
.drop-card strong { display: block; font-size: 16px; letter-spacing: -0.01em; }
.drop-card span { display: block; margin-top: 6px; font-size: 11.5px; color: var(--text-3); }

/* ---------------------------------------------------------------- Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 120;
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  padding: 9px 15px;
  border-radius: 99px;
  background: rgba(28, 29, 36, 0.94);
  color: #f6f7fb;
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 12px;
  box-shadow: var(--shadow-md);
  transition: opacity 0.24s ease, transform 0.34s var(--ease);
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1180px) {
  .strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 1040px) {
  :root { --sidebar-w: 288px; }
  .duo { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scroller { padding-left: 22px; padding-right: 22px; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 340px);
    z-index: 60;
    transform: translateX(-102%);
    /* 收起时不能留阴影：fixed 定位不受父级 overflow 裁剪，
       shadow-lg 是 100px 模糊，会整条漏到屏幕左缘变成一道黑渐变 */
    transition: transform 0.38s var(--ease), box-shadow 0.3s ease;
    border-radius: 0 18px 18px 0;
    box-shadow: none;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .menu-btn { display: grid; }
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    min-height: 96px;
    padding: 8px 14px 10px;
    row-gap: 6px;
  }
  .topbar-left { grid-row: 1; grid-column: 1; }
  .topbar-actions { grid-row: 1; grid-column: 2; }
  .segmented { grid-row: 2; grid-column: 1 / -1; justify-self: center; }
  .scroller { padding: 0 16px 76px; }
  .welcome { min-height: calc(100dvh - 200px); }
  .load-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}
.load-error .ico { width: 14px; height: 14px; margin-top: 1px; flex: none; }

.welcome-points { grid-template-columns: 1fr; }
  .strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: 1fr; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; }
  .msg-user .msg-stack { max-width: 90%; }
  .att { width: 92px; height: 92px; }
  .lb-nav { display: none; }
  .sheet { top: 8px; right: 8px; bottom: 8px; }
  .to-bottom { right: 16px; bottom: 16px; }
  .topbar-title { font-size: 13px; }
  .hero { padding-top: 8px; }
}

@media (max-width: 560px) {
  .chart-x span { overflow: visible; font-size: 9px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px 13px; }
  .stat-value { font-size: 24px; }
  .card { padding: 15px; }
  .chat-title { font-size: 20px; }
  .msg-ai { gap: 8px; }
  .avatar { width: 24px; height: 24px; border-radius: 8px; font-size: 8.5px; }
  .bubble { font-size: 14.2px; }
  .prose { font-size: 14.2px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { width: 30px; padding: 0; justify-content: center; }
}

/* ---------------------------------------------------------------- 减弱动效 / 通透 */

@media (hover: none) {
  .fc-shade { opacity: 1; }
  .fc-cap { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .mbar, .mcol:hover .mbar { transform: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .sidebar, .sheet, .loading, .to-bottom {
    background: var(--card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .lb-scrim { background: rgba(9, 11, 18, 0.94); backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(0, 0, 0, 0.22); --line-2: rgba(0, 0, 0, 0.38); --text-2: #3a3d45; --text-3: #555962; }
  .card, .stat, .tool, .bubble { border-color: var(--line-2); }
}
