/* ============================================================
   研究报告库 · 正式界面样式
   由定稿样稿（design-preview/mockup.css，提交 5e97a9d）迁移而来。
   ============================================================ */

:root {
  /* 底色与表面 */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --line: #e6e8ec;
  --line-2: #d5d9df;

  /* 文字 */
  --ink: #171a20;
  --ink-2: #4b5563;
  --ink-3: #8a93a2;

  /* 主色 */
  --accent: #1f5cc4;
  --accent-ink: #17469a;
  --accent-tint: #eaf1fd;

  /* 状态色：已核验 / 未核验 / 已确认 */
  --ok: #178a4c;
  --ok-tint: #e7f6ed;
  --warn: #a8600c;
  --warn-tint: #fdf3e2;
  --warn-line: #f1d7a9;
  --conf: #55657e;
  --conf-tint: #edf1f6;

  /* 事实 / 观点 标记 */
  --fact: #0f766e;
  --fact-tint: #e4f4f1;
  --opin: #6d3fd6;
  --opin-tint: #f2ecfd;

  --shadow-sm: 0 1px 2px rgba(20, 30, 50, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 30, 50, 0.1);

  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "MiSans",
    "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --side-w: 264px;
  --rail-w: 44px;
}

/* ---------- 基础 ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.lock {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

svg {
  display: block;
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- 外壳：手机优先 ---------- */

.app {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  width: min(84vw, 320px);
  background: var(--surface);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow-md);
}

.sidebar.open {
  transform: none;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 20, 30, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.scrim.show {
  opacity: 1;
  pointer-events: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink);
}

.icon-btn:active {
  background: var(--surface-2);
}

.topbar-title {
  font-size: 15px;
  font-weight: 650;
}

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 15;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(31, 92, 196, 0.36);
}

.agent-rail {
  display: none;
}

/* 电脑端：左导航 / 中内容 / 右 Agent 窄边 */
@media (min-width: 1024px) {
  .app {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr) var(--rail-w);
    grid-template-rows: 100vh; /* 内容比窗口高时，行高也不变，各栏在各自内部滚动 */
    height: 100vh;
    overflow: hidden;
  }

  .sidebar {
    position: relative;
    inset: auto;
    transform: none;
    width: auto;
    background: var(--bg);
    box-shadow: none;
    border-right: 1px solid var(--line);
  }

  /* 只有中间内容区滚动，左右两栏固定不动 */
  .main {
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c5cad3 transparent;
    scrollbar-gutter: stable; /* 内容长短变化时滚动条时有时无，给内容留出固定位置，免得左右跳 */
  }

  .scrim,
  .topbar,
  .fab {
    display: none;
  }

  .agent-rail {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    height: 100vh;
    padding-top: 18px;
    border-left: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink-3);
    transition: color 0.15s, background 0.15s;
  }

  .agent-rail:hover {
    color: var(--accent);
    background: var(--accent-tint);
  }

  .rail-label {
    writing-mode: vertical-rl;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.22em;
  }
}

/* ---------- 全文搜索 ---------- */

/* 电脑上，搜索框在左栏站名的下面；手机上的入口是顶栏的搜索按钮 */
.side-search {
  display: none;
}

.topbar .tb-search {
  margin-left: auto;
}

.search-bar {
  position: relative;
  margin-bottom: 12px;
}

.search-bar .lens {
  position: absolute;
  left: 14px;
  top: calc(50% - 9px);
  color: var(--ink-3);
  pointer-events: none;
}

.search-bar input {
  width: 100%;
  height: 46px;
  padding: 0 46px 0 42px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* 不到 16，手机浏览器一点进输入框就会放大页面 */
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.search-bar .clear {
  position: absolute;
  right: 8px;
  top: calc(50% - 16px);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-3);
}

.search-bar .clear:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.search-hint {
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--ink-3);
}

.search-meta {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-3);
}

.search-meta b {
  color: var(--ink-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.fchip {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
}

.fchip b {
  margin-left: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.fchip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.results {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.result + .result {
  border-top: 1px solid var(--line);
}

.result a {
  display: block;
  padding: 14px 16px;
}

.result a:hover {
  background: #fafbfc;
}

.result-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
}

.result a:hover .result-title {
  color: var(--accent-ink);
}

.result-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.result-sub .hits {
  color: var(--accent-ink);
  font-weight: 600;
}

.snippets {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.snippets li {
  padding-left: 10px;
  border-left: 2px solid var(--line);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
}

/* 命中处的底色。报告里有青色的“事实”、紫色的“观点”，用黄色不会混淆 */
mark.hl-term {
  padding: 0 1px;
  border-radius: 2px;
  background: #ffe58f;
  color: inherit;
}

mark.hl-term.cur {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* 从搜索结果点进报告之后：一条可以来回跳的小工具条，滚动时停在顶上 */
.findbar {
  position: sticky;
  top: 52px; /* 手机上贴在顶栏下面 */
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 14px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.findbar > svg {
  flex: none;
  color: var(--ink-3);
}

.findbar .q {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.findbar .q b {
  color: var(--ink);
}

.findbar .pos {
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

.findbar button {
  flex: none;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--ink-2);
  font-size: 13px;
}

.findbar button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.findbar button.close {
  width: 30px;
  padding: 0;
  display: grid;
  place-items: center;
}

.findbar button .lbl {
  display: none; /* 手机上地方不够，按钮只留箭头 */
}

.findbar .flip {
  transform: rotate(180deg);
}

@media (min-width: 1024px) {
  .side-search {
    display: block;
    position: relative;
    margin: 2px 12px 4px;
  }

  .side-search svg {
    position: absolute;
    left: 10px;
    top: calc(50% - 8px);
    color: var(--ink-3);
    pointer-events: none;
  }

  .side-search input {
    width: 100%;
    height: 36px;
    padding: 0 10px 0 34px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13.5px;
  }

  .side-search input::placeholder {
    color: var(--ink-3);
  }

  .side-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-tint);
  }

  .findbar {
    top: 0;
  }

  .findbar button .lbl {
    display: inline;
  }
}

@media (max-width: 1023.98px) {
  /* 手机上筛选按钮排成一行，放不下就左右滑动，不占第二行 */
  .search-filters {
    flex-wrap: nowrap;
    margin-right: -16px;
    padding-right: 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .search-filters::-webkit-scrollbar {
    display: none;
  }

  .fchip {
    flex: none;
  }
}

/* ---------- AI 助手（试点）：电脑是右栏，手机是从底部升起的面板 ---------- */

.agent {
  display: none;
}

.agent-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
}

.agent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 8px 12px 16px;
  border-bottom: 1px solid var(--line);
}

.agent-heading {
  min-width: 0;
}

.agent-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 650;
  color: var(--accent-ink);
}

.agent-sub {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
}

.agent-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.agent-intro {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
}

.agent-intro p {
  margin: 0;
}

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

.agent-intro b {
  color: var(--ink);
  font-weight: 600;
}

.agent-suggest {
  display: grid;
  gap: 8px;
}

.suggest {
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent-ink);
  font-size: 13.5px;
  line-height: 1.45;
  text-align: left;
}

.suggest:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.suggest:disabled {
  color: var(--ink-3);
}

.agent-msg.user {
  display: flex;
  justify-content: flex-end;
}

.agent-msg.user .bubble {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 14px 14px 4px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  line-height: 1.55;
}

.agent-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.agent-answer {
  white-space: pre-wrap;
  color: var(--ink);
}

.agent-card.miss .agent-answer {
  color: var(--ink-2);
}

.agent-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}

.agent-quotes {
  margin-top: 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
}

.agent-quotes .agent-label {
  margin-bottom: 2px;
}

.agent-quotes p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-2);
  white-space: pre-wrap;
}

.agent-src {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.agent-src .agent-label {
  margin-right: 2px;
}

.src-chip {
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-ink);
  font-size: 12.5px;
  line-height: 1.4;
  text-align: left;
}

.src-chip:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.agent-fine {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-3);
}

.agent-tag {
  color: var(--ink-2);
}

.agent-card.waiting,
.agent-card.error {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.agent-card.error {
  color: var(--warn);
  background: var(--warn-tint);
  border-color: var(--warn-line);
}

.dots {
  display: inline-flex;
  gap: 3px;
}

.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: agent-dot 1.2s infinite ease-in-out;
}

.dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes agent-dot {
  0%,
  60%,
  100% {
    opacity: 0.25;
    transform: none;
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.agent-composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.agent-composer input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.agent-composer input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.agent-composer input:disabled {
  background: var(--surface-2);
  color: var(--ink-3);
}

.send {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
}

.send:disabled {
  background: var(--line-2);
  cursor: default;
}

.agent-foot {
  padding: 8px 14px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-2);
}

.agent-scrim {
  display: none;
}

@media (min-width: 1024px) {
  .app.agent-open {
    grid-template-columns: var(--side-w) minmax(0, 1fr) 380px;
  }

  .agent {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
  }

  .agent:not(.open) {
    border-left: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink-3);
  }

  .agent-panel {
    height: 100%;
    border-left: 1px solid var(--line);
  }

  .agent-strip {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-top: 18px;
    color: inherit;
    transition: color 0.15s, background 0.15s;
  }

  .agent-strip:hover {
    color: var(--accent);
    background: var(--accent-tint);
  }
}

@media (max-width: 1023.98px) {
  .agent {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    height: min(82vh, 680px);
    pointer-events: none; /* 收起时是一块透明的空白，不能挡住下面的报告 */
  }

  .agent.open {
    pointer-events: auto;
  }

  .agent-panel {
    height: 100%;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .agent-strip {
    display: none;
  }

  .agent-foot {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  /* 字号不到 16 时，手机浏览器一点进输入框就会把页面放大 */
  .agent-composer input {
    font-size: 16px;
  }

  .agent-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgba(15, 20, 30, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  .agent-scrim.show {
    opacity: 1;
    pointer-events: auto;
  }
}

/* 手机面板升起、落下的过渡 */
.sheet-enter-from,
.sheet-leave-to {
  transform: translateY(105%);
}

.sheet-enter-active,
.sheet-leave-active {
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- 侧栏内容 ---------- */

.side-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px 18px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #2f74e6, #1847a6);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.topbar .brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
}

.brand-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: #c5cad3 transparent;
}

.nav-group {
  margin-top: 12px;
}

.nav-group:first-child {
  margin-top: 2px;
}

.nav-group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 12px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.nav-item,
.nav-sub {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 10px 0 12px;
  border-radius: 7px;
  color: var(--ink-2);
  font-size: 13.5px;
  text-align: left;
}

.nav-item:hover,
.nav-sub:hover {
  background: #eceef2;
  color: var(--ink);
}

.nav-item.active {
  background: var(--accent-tint);
  color: var(--accent-ink);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-lead {
  width: 16px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
}

.nav-item.active .nav-lead {
  color: var(--accent);
}

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

.nav-date {
  flex: none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}

.nav-item.active .nav-date {
  color: var(--accent);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
}

.dot.ok {
  background: #22a35c;
}

.dot.warn {
  background: #e79a1f;
}

.dot.conf {
  background: #8090a8;
}

.nav-sub {
  height: 30px;
  font-size: 13px;
}

.nav-sub .chev {
  color: var(--ink-3);
  transition: transform 0.18s;
}

.nav-sub.open .chev {
  transform: rotate(90deg);
}

.nav-sub .cnt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}

.nav-sub-list.nested .nav-item {
  padding-left: 40px;
}

.nav-note {
  display: block;
  padding: 2px 12px 2px 36px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.side-foot {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) 18px;
  border-top: 1px solid var(--line);
}

.side-foot p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

.side-foot p + p {
  margin-top: 2px;
}

/* ---------- 内容区 ---------- */

.main {
  min-width: 0;
  background: var(--surface);
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.wrap.wide {
  max-width: 1000px;
}

@media (min-width: 1024px) {
  .wrap {
    padding: 40px 48px 80px;
  }
}

/* 通用小件 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.lg {
  height: 26px;
  padding: 0 10px;
  font-size: 13px;
}

.badge.ok {
  background: var(--ok-tint);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-tint);
  color: var(--warn);
}

.badge.conf {
  background: var(--conf-tint);
  color: var(--conf);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f8fa;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.65;
}

.notice svg {
  margin-top: 2px;
  color: var(--ink-3);
}

.notice b {
  color: var(--ink);
  font-weight: 600;
}

.notice.warn {
  background: var(--warn-tint);
  border-color: var(--warn-line);
  color: #74460b;
}

.notice.warn svg {
  color: var(--warn);
}

/* ---------- 首页 ---------- */

.home-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
}

.page-title {
  margin: 4px 0 6px;
  font-size: 26px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.lead {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.stats {
  display: flex;
}

.stat {
  flex: 1;
  padding: 0 14px;
  border-left: 1px solid var(--line);
}

.stat:first-child {
  padding-left: 0;
  border-left: 0;
}

.stat b {
  display: block;
  font-size: 21px;
  line-height: 1.25;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: 12px;
  color: var(--ink-3);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

.legend i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  vertical-align: 1px;
}

.series {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.series-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon name badge"
    "icon latest date";
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  transition: background 0.15s;
}

.series-row:first-child {
  border-top: 0;
}

.series-row:hover {
  background: #fafbfc;
}

.s-icon {
  grid-area: icon;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}

.series-row:hover .s-icon {
  background: var(--accent-tint);
  color: var(--accent);
}

.s-name {
  grid-area: name;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

.s-badge {
  grid-area: badge;
  justify-self: end;
}

.s-latest {
  grid-area: latest;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--ink-2);
}

.s-latest b {
  color: var(--ink);
  font-weight: 600;
}

.s-more {
  margin-left: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

.s-date {
  grid-area: date;
  justify-self: end;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
}

@media (min-width: 1024px) {
  .home-head {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 24px;
  }

  .page-title {
    font-size: 28px;
  }

  .lead {
    font-size: 15px;
  }

  .stats {
    flex: none;
    gap: 0;
  }

  .stat {
    min-width: 96px;
  }

  .section-head {
    margin: 32px 0 12px;
  }

  .series-row {
    grid-template-columns: 36px 116px minmax(0, 1fr) auto 56px 14px;
    grid-template-areas: "icon name latest badge date chev";
    padding: 14px 18px 14px 16px;
  }

  .s-latest {
    font-size: 14px;
  }
}

.s-chev {
  grid-area: chev;
  color: var(--ink-3);
}

/* ---------- 报告页 ---------- */

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--ink-3);
}

.crumbs a:hover {
  color: var(--accent);
}

.crumbs .sep {
  color: var(--line-2);
}

.report-title {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  text-wrap: balance; /* 需要折行时让两行长短接近 */
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--ink-2);
}

.meta-row .badge.lg {
  margin-right: 2px;
}

.mi {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mi svg {
  color: var(--ink-3);
}

.report-head .notice {
  margin-bottom: 16px;
}

.report-head .notice + .notice {
  margin-top: -8px;
}

.metacard {
  margin: 0 0 26px;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

.metacard dl {
  margin: 0;
}

.mrow {
  display: grid;
  grid-template-columns: 4.8em minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  line-height: 1.7;
}

.mrow:first-child {
  border-top: 0;
}

.mrow dt {
  color: var(--ink-3);
  font-weight: 500;
}

.mrow dd {
  margin: 0;
  color: var(--ink-2);
}

.mrow dd strong,
.doc strong {
  color: var(--ink);
  font-weight: 650;
}

@media (min-width: 1024px) {
  .crumbs {
    margin-bottom: 14px;
  }

  .report-title {
    margin-bottom: 16px;
    font-size: 28px;
    line-height: 1.4;
  }

  .meta-row {
    margin-bottom: 18px;
    font-size: 13.5px;
  }

  .report-head .notice {
    margin-bottom: 18px;
  }

  .report-head .notice + .notice {
    margin-top: -10px;
  }

  .metacard {
    margin-bottom: 30px;
    padding: 6px 16px;
  }

  .mrow {
    grid-template-columns: 5.4em minmax(0, 1fr);
    gap: 14px;
    font-size: 13.5px;
  }
}

/* ---------- 正文 ---------- */

.doc {
  font-size: 16px;
  line-height: 1.82;
  color: #22262d;
}

.doc strong {
  font-weight: 650;
}

.doc p {
  margin: 14px 0;
}

.doc h2 {
  margin: 40px 0 14px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  font-size: 19px;
  line-height: 1.5;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.doc h3 {
  margin: 28px 0 10px;
  font-size: 16.5px;
  font-weight: 650;
  color: var(--ink);
}

.doc h4 {
  margin: 22px 0 8px;
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
}

.doc ol,
.doc ul {
  margin: 14px 0;
  padding-left: 1.5em;
}

.doc li {
  margin: 8px 0;
  padding-left: 4px;
}

.doc li::marker {
  color: var(--ink-3);
  font-weight: 600;
}

.doc li > p {
  margin: 6px 0;
}

/* 从 AI 助手的出处跳过来时，章节标题和开头的信息卡闪一下 */
.doc .hl {
  border-radius: 6px;
  animation: heading-flash 1.8s ease-out;
}

.metacard.hl {
  animation: card-flash 1.8s ease-out;
}

@keyframes card-flash {
  0% {
    border-color: var(--accent);
    box-shadow: 0 0 0 6px var(--accent-tint);
  }
  100% {
    box-shadow: 0 0 0 6px transparent;
  }
}

@keyframes heading-flash {
  0% {
    background: var(--accent-tint);
    box-shadow: 0 0 0 8px var(--accent-tint);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 8px transparent;
  }
}

.doc blockquote {
  margin: 18px 0;
  padding: 10px 16px;
  border-left: 3px solid #b9cdf0;
  border-radius: 0 10px 10px 0;
  background: #f7f9fc;
  color: var(--ink-2);
}

.doc blockquote p {
  margin: 4px 0;
}

/* 代码块：内容太长时在自己内部左右滚动，不把页面撑宽。手机上有的代码块一行有几百个字符 */
.doc pre {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.doc code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: #33415c;
  font-family: var(--mono);
  font-size: 0.84em;
  overflow-wrap: anywhere;
}

.doc a {
  color: var(--accent);
  border-bottom: 1px solid #c5d5f3;
}

.doc a:hover {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
}

.doc hr {
  margin: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* 事实 / 观点 标记：文字原样保留，只加颜色 */

.mk {
  display: inline-block;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  white-space: nowrap;
  vertical-align: 1px;
}

.mk-fact {
  background: var(--fact-tint);
  color: var(--fact);
}

.mk-opin {
  background: var(--opin-tint);
  color: var(--opin);
}

/* 带长说明的标记：只给"事实 / 观点"两个字着色 */
.k-fact {
  color: var(--fact);
  font-weight: 700;
}

.k-opin {
  color: var(--opin);
  font-weight: 700;
}

/* 标题里的日期、代码不在中间断行 */
.nb {
  white-space: nowrap;
}

/* 表格：外框负责圆角，内层负责横向滚动 */

.tw {
  position: relative;
  margin: 18px 0 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.tw::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 40px;
  background: linear-gradient(to left, #fff, rgba(255, 255, 255, 0));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.tw.more::after {
  opacity: 1;
}

.tw-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c5cad3 transparent;
}

.doc table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.6;
}

.doc th {
  padding: 8px 11px;
  border-bottom: 1px solid var(--line-2);
  background: #f4f6f9;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}

.doc td {
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere; /* 很长的英文接口名等允许断开，避免把表格撑宽 */
}

.doc tbody tr:last-child td {
  border-bottom: 0;
}

.doc tbody tr {
  background: #fff;
}

.doc tbody tr:nth-child(even) {
  background: #fafbfc;
}

/* 首列固定：横向滑动时始终看得到行名 */
.tw-scroll th:first-child,
.tw-scroll td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
}

.tw-scroll th:first-child {
  background: #f4f6f9;
}

.doc td.rowh {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.doc .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.doc td.nw {
  white-space: nowrap;
}

.doc td.rowh {
  overflow-wrap: normal;
}

@media (min-width: 1024px) {
  .doc h2 {
    margin: 44px 0 14px;
    font-size: 20px;
  }

  .doc table {
    font-size: 14px;
  }

  .doc th,
  .doc td {
    padding: 9px 14px;
  }

  .doc th {
    font-size: 13px;
  }
}

/* 文末风险提示：原样显示，加一个收尾框 */

/* ---------- 状态提示（加载中、出错、找不到） ---------- */

.state-box {
  margin: 24px 0;
  padding: 28px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

.state-box a {
  color: var(--accent);
}

/* 报告里指向站外文件（不在展示范围）的链接：保留文字，不可点 */
.doc .dead {
  border-bottom: 1px dashed var(--line-2);
  cursor: help;
}

/* 品牌名可以点击回首页 */
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
}

/* 手机上导航是抽屉，条目加高，方便点按 */
@media (max-width: 1023.98px) {
  .sidebar .nav-item,
  .sidebar .nav-sub {
    height: 44px;
  }
}

.risk {
  position: relative;
  margin: 36px 0 8px;
  padding: 18px 18px 18px 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
}

.risk > svg {
  position: absolute;
  left: 20px;
  top: 21px;
  color: var(--ink-3);
}

.risk .doc,
.risk .doc > :first-child,
.risk h2 {
  margin: 0;
}

.risk h2 {
  padding: 0;
  border: 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}

.risk p {
  margin: 4px 0 0;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

.site-foot {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink-3);
}

.site-foot b {
  color: var(--ink-2);
  font-weight: 600;
}

@media (min-width: 1024px) {
  .site-foot {
    margin-top: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }

  .doc .hl {
    background: var(--accent-tint);
  }

  .metacard.hl {
    border-color: var(--accent);
    box-shadow: 0 0 0 6px var(--accent-tint);
  }
}

/* ---------- 账号管理：登录页、侧栏里的用户、管理后台 ---------- */

.boot {
  padding: 24px 16px;
  color: var(--ink-3);
}

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.login-card .brand-mark {
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  border-radius: 12px;
  font-size: 20px;
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.login-lead {
  margin: 6px 0 20px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-3);
}

.login-note,
.login-error {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.6;
}

.login-note {
  background: var(--accent-tint);
  color: var(--accent-ink);
}

.login-error {
  background: var(--warn-tint);
  color: var(--warn);
}

.field {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.field input {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 6px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  font-size: 16px; /* 不到 16，手机浏览器一点进输入框就会放大页面 */
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.btn {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
}

.btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-ink);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.login-submit {
  width: 100%;
  height: 46px;
  margin-top: 6px;
}

.login-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

/* 侧栏底部：当前的用户和“退出”。手机上在抽屉里 */
.side-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px 0 18px;
  font-size: 13px;
}

.side-user b {
  font-weight: 600;
}

.side-user .role {
  margin-left: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

.side-logout {
  flex: none;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--ink-2);
  font-size: 13px;
}

.side-logout:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* 手机上“退出”在抽屉里，点按的区域放大到不小于 44，这一行跟着变高 */
@media (max-width: 1023.98px) {
  .side-logout {
    min-width: 64px;
    height: 44px;
  }

  .side-user {
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

/* 管理后台 */
.admin-card {
  margin-top: 18px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 650;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form .check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
}

.admin-form .btn {
  justify-self: start;
}

.user-list,
.audit-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.user-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.user-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.user-row:last-child {
  padding-bottom: 0;
}

.user-main {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.badge.plain {
  background: var(--surface-2);
  color: var(--ink-2);
}

.user-state {
  font-size: 12.5px;
  color: var(--ink-3);
}

.user-state.warn {
  color: var(--warn);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-actions button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
}

.user-actions button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.user-actions button.danger {
  color: var(--warn);
}

.user-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}

.reset-form {
  flex-basis: 100%;
  display: flex;
  gap: 8px;
}

.reset-form input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.admin-empty {
  margin: 0;
  font-size: 14px;
  color: var(--ink-3);
}

.audit-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
}

.audit-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.audit-list time {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
}

.audit-list b {
  font-weight: 600;
  color: var(--ink);
}

.muted {
  color: var(--ink-3);
}

@media (min-width: 1024px) {
  .admin-card {
    padding: 20px 22px;
  }

  .admin-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .admin-form .check,
  .admin-form .btn {
    grid-column: span 1;
  }
}
