/* ============ 主题变量 ============ */
:root {
  --bg: #f6f7f9;
  --bg-soft: #eef0f4;
  --panel: #ffffff;
  --panel-2: #fbfbfd;
  --border: #e4e7ec;
  --border-strong: #d3d8e0;
  --text: #16191f;
  --text-2: #454b57;
  --muted: #7a808c;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0ff;
  --ok: #17864a;
  --ok-soft: #e6f6ec;
  --err: #c22f3d;
  --err-soft: #fdecee;
  --mark: #fff3b8;
  --mark-ink: #4a3a00;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 12px;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
}

html[data-theme="dark"] {
  --bg: #0e1116;
  --bg-soft: #131820;
  --panel: #161b23;
  --panel-2: #1a202a;
  --border: #262d39;
  --border-strong: #333c4b;
  --text: #e7eaf0;
  --text-2: #b3bac6;
  --muted: #7d8797;
  --accent: #6d9cff;
  --accent-ink: #0b1220;
  --accent-soft: #1d2a44;
  --ok: #52c98a;
  --ok-soft: #16301f;
  --err: #ff7b88;
  --err-soft: #341a1e;
  --mark: #4a3d10;
  --mark-ink: #ffe9a3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #0e1116;
    --bg-soft: #131820;
    --panel: #161b23;
    --panel-2: #1a202a;
    --border: #262d39;
    --border-strong: #333c4b;
    --text: #e7eaf0;
    --text-2: #b3bac6;
    --muted: #7d8797;
    --accent: #6d9cff;
    --accent-ink: #0b1220;
    --accent-soft: #1d2a44;
    --ok: #52c98a;
    --ok-soft: #16301f;
    --err: #ff7b88;
    --err-soft: #341a1e;
    --mark: #4a3d10;
    --mark-ink: #ffe9a3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .92em; background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; }
pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; overflow: auto; }
pre code { background: none; padding: 0; font-size: 13px; line-height: 1.6; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 22px 0; }

/* ============ 布局 ============ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px;
  flex: 0 0 256px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; padding: 4px 8px 8px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff; font-weight: 700; font-size: 15px;
  flex: 0 0 30px; overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--panel); }
.brand-text { font-size: 15.5px; letter-spacing: .2px; }

.side-search input {
  width: 100%; padding: 8px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
  font-size: 13.5px; outline: none;
}
.side-search input:focus { border-color: var(--accent); background: var(--panel); }

/* 左栏两块列表（我的分组 / 对话）并列：各按内容自然高度，整栏滚动，底部导航贴底 */
.side-section { flex: 0 0 auto; }
.side-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 6px 10px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; color: var(--text-2);
  font-size: 14px; background: none; border: none; width: 100%;
  text-align: left; cursor: pointer; font-family: inherit;
}
.side-item:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.side-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-item-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; flex: 0 0 6px; }
.side-item .ico { width: 18px; display: inline-block; text-align: center; opacity: .8; font-size: 13px; }
.side-empty { color: var(--muted); font-size: 13px; padding: 6px 10px; }
.side-nav .side-title + .side-title,
.side-nav .side-item + .side-title { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 12px; }
.side-title { display: flex; align-items: center; gap: 6px; }
.side-count {
  font-size: 10.5px; letter-spacing: 0; padding: 0 5px; border-radius: 99px;
  background: var(--bg-soft); color: var(--muted); line-height: 16px;
}
.side-item .dot.user { background: var(--accent); opacity: .75; }

/* ============ 侧栏分组的「⋯」重命名（2.6.5） ============
 * 名字就在侧栏里改，不再需要滚到页面底部的「分组设置」卡片。
 * 「⋯」平时隐藏（opacity 0 而不是 display:none——后者会让 hover 判定抖动），
 * 鼠标移到这一行或键盘聚焦时出现；触屏没有 hover，靠 :focus-within 兜底。
 */
.side-group-row { position: relative; display: flex; align-items: center; gap: 2px; min-width: 0; }
.side-group-row .side-item { flex: 1 1 auto; min-width: 0; }
.side-group-more {
  flex: 0 0 22px; width: 22px; height: 22px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1;
  opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
.side-group-row:hover .side-group-more,
.side-group-row:focus-within .side-group-more,
.side-group-more[aria-expanded="true"] { opacity: 1; }
.side-group-more:hover { background: var(--bg-soft); color: var(--text); }
.side-group-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; opacity: 1; }
/* 就地编辑：输入框直接顶替这一行，前缀「昵称 ·」保持可见 */
.side-group-edit {
  display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0;
  padding: 2px 4px; border: 1px solid var(--accent); border-radius: 8px; background: var(--panel);
}
.side-group-edit .side-group-prefix {
  font-size: 13px; color: var(--muted); white-space: nowrap; flex: 0 0 auto;
}
.side-group-edit input {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: 13.5px;
  color: var(--text); background: transparent; border: 0; outline: none; padding: 3px 2px;
}
.side-group-err {
  font-size: 12px; color: #e05252; padding: 3px 10px 5px;
}
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.logout-form { margin: 0; }

.main { flex: 1; min-width: 0; width: 100%; padding: 0 clamp(18px, 2.2vw, 40px) 64px; }

/*
 * 阅读类页面（单条问答 / 文档 / 文件预览）统一内容栏。
 *
 * 用户报「页面中的信息严重偏左，右边空了很多」。量下来不是「没居中」：
 * 正文 .prose 有 78ch 护栏 + margin-inline:auto，在 .entry 里确实居中了。
 * 真正刺眼的是**同一页上宽度打架** —— 正文 643px（1920 屏只占 33%）、
 * 下面的「历史版本」面板满宽 1584px、面包屑贴最左，三块左边缘各在一边。
 *
 * 修法：整页收进一条阅读栏，栏内所有块同宽同左边缘，剩余空白左右均分。
 *
 * 这里踩过两个坑，都记下来免得再犯：
 *   ① 一开始用 `padding-inline: max(clamp(...), calc((100% - 1180px)/2))`
 *      想靠内边距把内容挤到中间，结果 1920 屏实测内边距 370px、内容只剩
 *      924px。原因：**padding 百分比参照的是 containing block（.shell 的
 *      1920px），不是 .main 自己的 1664px**，算出来 (1920-1180)/2 = 370
 *      全压在两侧，主体反而被挤窄。要在 flex 主轴上让 .main 自己封顶。
 *   ② 只给 `.prose` 加 margin-inline:auto 是治不好的 —— 它确实在自己的
 *      父块里居中了，但同一页上「历史版本」面板、面包屑还是满宽，三块左
 *      边缘各在一边，看着就是排版坏了。宽窄必须**整页统一**。
 *
 * 812px（减两侧 padding 后约 732px 内容）是量出来的：15.3px 字号下约
 * 68ch，正好在舒适阅读区间；再宽正文又会退回「贴左边一小条」的观感。
 */
@media (min-width: 901px) {
  .main-reading { max-width: 812px; margin-inline: auto; }
}
/* 栏内一律撑满、左边缘对齐，不再各自 max-width + margin auto */
.main-reading .entry,
.main-reading .panel,
.main-reading .crumbs,
.main-reading .entry-head,
.main-reading .entry > .prose,
.main-reading .entry > .doc-intro,
.main-reading .viewer,
.main-reading .file-head { max-width: 100%; margin-inline: 0; }
/* 文档页是「目录 + 正文」双列，天生要更宽；它有 .doc-layout 自己的上限 */
.main-doc { max-width: 1180px; margin-inline: auto; }
.main-doc .doc-layout { max-width: 100%; margin-inline: 0; }
/*
 * 文档页里 `.entry-head` 也要撑满 —— 它带着通用的 `max-width: 78ch` +
 * margin auto，在 1100px 的正文上方缩成 631px 居中的一条，标题跟正文
 * 左边缘对不上，看着像两个块拼错了。
 */
.main-doc .entry-head { max-width: 100%; margin-inline: 0; }
/* 文档页自己就是 .doc-layout（1320 上限 + 居中），别再套一层窄栏把它压小 */
.main-reading .doc-layout { max-width: 100%; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 0 6px; }
.who { color: var(--muted); font-size: 12.5px; margin-left: auto; }
a.who:hover { color: var(--text); text-decoration: none; }
.menu-btn { display: none; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; color: var(--text); cursor: pointer; }

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40; height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 0 16px 48px; }
  .menu-btn { display: inline-block; }
}

/* ============ 通用块 ============ */
.flash {
  padding: 10px 14px; border-radius: 10px; margin: 12px 0;
  font-size: 14px; border: 1px solid transparent;
}
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin: 18px 0; }
.panel-title { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 14px; font-weight: 650; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: 9px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.block { width: 100%; }
.link { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 13.5px; font-family: inherit; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--err); }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-family: inherit; }

.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }
.mono, .mono-input, .tiny.mono { font-family: var(--mono); }
.right { text-align: right; }
.c { text-align: center; }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty-hint { margin-top: 8px; font-size: 13px; }

/* ============ 首页 ============ */
.hero { padding: 56px 0 28px; text-align: center; }
.hero-title { font-size: 27px; font-weight: 680; margin: 0 0 22px; letter-spacing: -.4px; }
.big-search {
  display: flex; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow);
  max-width: 760px; margin: 0 auto;
}
.big-search input[type="search"] {
  flex: 1; border: none; outline: none; background: none; color: var(--text);
  font-size: 16px; padding: 10px 0; font-family: inherit;
}
.big-search select {
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-2);
  border-radius: 8px; padding: 7px 9px; font-size: 13.5px; font-family: inherit; outline: none;
}
.big-search.compact { max-width: 100%; margin: 0; padding: 6px 6px 6px 14px; }
.hero-meta { color: var(--muted); font-size: 13px; margin-top: 14px; }

.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.group-card {
  display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--panel-2); color: var(--text);
}
.group-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.group-name { font-weight: 640; font-size: 15px; margin-bottom: 4px; }
.group-desc { color: var(--muted); font-size: 13px; min-height: 20px; }
.group-count { color: var(--text-2); font-size: 12.5px; margin-top: 10px; }

/* 列表 */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 4px;
  border-bottom: 1px solid var(--border); color: var(--text);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { text-decoration: none; background: var(--panel-2); }
.list-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.2px; }
.list-sub { display: block; font-style: normal; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.list-time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
  background: var(--bg-soft); color: var(--text-2); white-space: nowrap; font-weight: 600;
}
.tag.qa { background: var(--accent-soft); color: var(--accent); }
.tag.doc { background: color-mix(in srgb, #8b5cf6 14%, transparent); color: #8b5cf6; }
.tag.ghost { background: none; border: 1px solid var(--border); font-weight: 400; }

/* ============ 搜索页 ============ */
.search-head { margin: 18px 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 18px; align-items: center; }
/* 分组内搜索框（2.8.1）：紧贴 chips 上方，两者视觉上一组。
   chips 自带 margin-top:12px，这里把上边距让给它，避免空出 24px。 */
.group-search { margin-top: 14px; }
.group-search + .chips { margin-top: 10px; }
.chip {
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); background: var(--panel);
}
.chip:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.scope { border-style: dashed; color: var(--accent); }

.result-meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.results { display: flex; flex-direction: column; gap: 2px; }
.result { padding: 16px 4px; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: none; }
.result-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.result-date { color: var(--muted); font-size: 12px; margin-left: auto; }
.result-title { margin: 0 0 6px; font-size: 16.5px; font-weight: 640; }
.result-title a { color: var(--text); }
.result-title a:hover { color: var(--accent); text-decoration: none; }
.result-q { color: var(--text-2); font-size: 13.5px; margin-bottom: 6px; }
.result-snippet { margin: 0; color: var(--text-2); font-size: 14px; }
mark { background: var(--mark); color: var(--mark-ink); border-radius: 3px; padding: 0 2px; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 26px 0 10px; }
.page {
  min-width: 32px; text-align: center; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 13px; color: var(--text-2);
}
.page:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.page.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.page-gap { color: var(--muted); padding: 0 2px; }

/* ============ 页头 / 面包屑 ============ */
.page-head { display: flex; align-items: flex-end; gap: 16px; padding: 26px 0 10px; flex-wrap: wrap; justify-content: space-between; }
.page-title { font-size: 22px; margin: 0; font-weight: 680; letter-spacing: -.3px; }
.page-desc { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; max-width: 62ch; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.crumbs { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); padding: 18px 0 0; }
.crumb-cur { color: var(--text-2); }

/* ============ 条目 / 文档 ============ */
.entry { padding: 8px 0 16px; }
.entry-head { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 20px; }
.entry-title { font-size: 24px; line-height: 1.4; margin: 10px 0 10px; font-weight: 680; letter-spacing: -.3px; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 12.5px; align-items: center; }
.entry-meta .link { margin-left: auto; }

.prose { font-size: 15.3px; color: var(--text); line-height: 1.78; max-width: 78ch; }
/*
 * 阅读页（单条问答 / 文档）把内容块居中。
 *
 * 原来 `.prose` 只有 max-width，没有 margin auto —— 于是宽屏上正文贴左边、
 * 右边留白，视觉重心严重偏左（用户报「信息严重偏左，右边空了很多」）。
 * 给阅读容器的直接子块加上居中，护栏宽度不变、观感正常。
 * 只作用于 .entry / .doc-layout，不影响表单页和表格页的满宽布局。
 */
.entry > .prose,
.entry > .doc-intro { margin-inline: auto; }
.entry-head { max-width: 78ch; margin-inline: auto; }
.doc-layout .prose { max-width: 100%; }
/*
 * 只有 1 个章节时（或没有关联问答）模板不渲染目录，但 grid 仍是两列 ——
 * 第一列 200px 空着，正文被挤到右边一小条，比「偏左」更难看。
 * 这类页面直接退回单列。
 */
.doc-layout.no-toc { grid-template-columns: minmax(0, 1fr); }
.prose p { margin: 0 0 14px; }
.prose h3, .prose h4, .prose h5, .prose h6 { margin: 24px 0 10px; font-weight: 660; line-height: 1.4; }
.prose h3 { font-size: 19px; }
.prose h4 { font-size: 17px; }
.prose ul { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose strong { font-weight: 660; }
.prose.small { font-size: 14px; }

/*
 * 文档页布局。
 *
 * 踩过的坑：`.prose` 上有 `max-width: 78ch`（约 600px）当阅读护栏，
 * 而文档列本身是 `1fr` 没有任何上限 —— 在 2K 屏上正文只占左边 1/4，
 * 右边一整片空白，看着像样式坏了（用户报「严重偏左」）。
 *
 * 修法两条一起：
 *   1. 给整个文档区一个上限并居中，宽屏下空白均分到两侧，不再全堆右边；
 *   2. 文档正文放开到列宽 —— 知识库的正文常带表格/代码，卡 600px 太窄。
 * 阅读护栏仍然保留在普通条目页（.prose 默认值），只在这里覆盖。
 */
.doc-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
}
.doc-layout .prose { max-width: 100%; }
@media (max-width: 980px) { .doc-layout { grid-template-columns: 1fr; } .doc-toc { display: none; } }
.doc-toc { position: sticky; top: 18px; display: grid; grid-template-columns: 22px 1fr; gap: 4px 4px; font-size: 13px; padding-top: 8px; }
.doc-toc .toc-title { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.doc-toc a { color: var(--text-2); padding: 2px 0; }
.doc-toc a:hover { color: var(--accent); text-decoration: none; }
.toc-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.doc-section { border-top: 1px solid var(--border); padding-top: 22px; margin-top: 26px; }
.doc-h2 { font-size: 18px; margin: 0 0 12px; font-weight: 660; line-height: 1.5; display: flex; gap: 9px; }
.doc-num {
  flex: 0 0 22px; height: 22px; border-radius: 6px; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; margin-top: 2px;
}
.doc-section-foot { margin-top: 6px; }

/* ============ 表单 ============ */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 960px; }
.form.row-form { max-width: none; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.form input[type="text"], .form input[type="password"], .form input[type="search"],
.form input[type="email"], .form input[type="number"], .form input[type="date"], .form select, .form textarea,
.entry-form input, .entry-form select, .entry-form textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 8px 11px; outline: none; width: 100%;
}
.form input:focus, .form textarea:focus, .form select:focus,
.entry-form input:focus, .entry-form textarea:focus, .entry-form select:focus { border-color: var(--accent); }
.form textarea, .entry-form textarea { resize: vertical; line-height: 1.65; }
.entry-form { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; max-width: 1180px; }
.entry-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.entry-form .panel > label + label { margin-top: 14px; }
textarea.mono-input { font-family: var(--mono) !important; font-size: 13.5px !important; }

.row-form { flex-direction: row; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.row-form label { flex: 0 0 auto; min-width: 150px; }
.row-form label.grow { flex: 1 1 220px; }
.row-form label.narrow { flex: 0 0 110px; min-width: 90px; }

.checks { display: flex; gap: 18px; align-items: center; }
.check { flex-direction: row !important; align-items: center; gap: 7px !important; font-size: 14px; color: var(--text); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* 私有分组改名：昵称前缀做成固定的「标签 + 输入框」组合 */
.name-prefix { display: flex; align-items: stretch; }
.name-prefix-tag {
  display: inline-flex; align-items: center; flex: none; max-width: 46%;
  padding: 8px 11px; font-size: 13.5px; color: var(--text-2);
  background: var(--panel-2); border: 1px solid var(--border-strong); border-right: 0;
  border-radius: 9px 0 0 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.name-prefix input[type="text"] { border-radius: 0 9px 9px 0; }
@media (max-width: 480px) {
  .name-prefix { flex-direction: column; }
  .name-prefix-tag { border-right: 1px solid var(--border-strong); border-bottom: 0; border-radius: 9px 9px 0 0; max-width: none; }
  .name-prefix input[type="text"] { border-radius: 0 0 9px 9px; }
}
.form-actions.sticky { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); padding: 12px 0; border-top: 1px solid var(--border); margin-top: 8px; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.radios { display: flex; gap: 18px; flex-wrap: wrap; }

/* 建 Key 的多选分组（2.8.2）。滚动区限高，分组多的时候不把整页推下去；
   每个选项一行、带 hover，勾选状态一眼能看出来。 */
.group-pick {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 220px; overflow-y: auto;
  padding: 8px 10px; border-radius: 9px;
  background: var(--panel-2); border: 1px solid var(--border-strong);
}
.group-pick .check {
  padding: 5px 4px; border-radius: 6px; cursor: pointer;
  font-size: 13.5px; line-height: 1.4;
}
.group-pick .check:hover { background: var(--bg-soft); }
.group-pick .check > span { display: inline-flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }

/* 列表里「另 N 个」这种内联折叠：不占一行、不撑宽表格 */
.inline-more { display: inline; }
.inline-more > summary { display: inline; cursor: pointer; list-style: none; }
.inline-more > summary::-webkit-details-marker { display: none; }
.inline-more[open] > summary { display: none; }

/* 邮件设置：Resend 与 SMTP 两组配置互斥显示。
   用 hidden 属性而不是 display:none 类，避免与 .form 的 flex 布局打架。 */
.mail-block[hidden], .mail-adv[hidden] { display: none !important; }
.mail-block {
  margin: 4px 0 14px; padding: 14px 16px; border-radius: 10px;
  background: var(--bg-soft); border: 1px solid var(--border);
}
.mail-block .hint:last-child { margin-bottom: 0; }
.mail-adv { margin: 4px 0 14px; }
.danger-zone { margin: 28px 0 40px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table .col-title { max-width: 420px; }
.table .col-title a { color: var(--text); }
.table .sub-row td { border-bottom: 1px solid var(--border); padding-top: 0; }
.col-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.edit-group { display: inline; }
.cell-input { width: 100%; min-width: 110px; padding: 4px 7px; font-size: 13.5px; }
.tiny-input { width: 62px; padding: 4px 6px; font-size: 13px; }
.reset-form { display: flex; gap: 8px; align-items: center; }
.reset-form input { padding: 4px 8px; font-size: 13px; }
.perm-table td { vertical-align: middle; }
.perm-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.on { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: var(--bg-soft); color: var(--muted); }

/* ============ API Key 页 ============ */
.newkey { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; }
.newkey-title { font-size: 13.5px; font-weight: 640; color: var(--accent); margin-bottom: 10px; }
.newkey-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.newkey-row code { background: var(--panel); padding: 8px 12px; border-radius: 8px; font-size: 13px; word-break: break-all; flex: 1; min-width: 240px; }
.newkey-hint { font-size: 12.5px; color: var(--text-2); margin-top: 8px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ============ 后台统计 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; margin: 18px 0; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; }
.stat-n { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.stat-l { color: var(--muted); font-size: 12px; margin-top: 2px; }

.kv { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--border); padding-bottom: 7px; }
.kv > div:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; text-align: right; word-break: break-all; }

.pick-list { max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.pick { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; font-size: 13.5px; }
.pick:hover { background: var(--bg-soft); }
.pick input { width: 15px; height: 15px; accent-color: var(--accent); }
.pick-q { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 登录 ============ */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-wrap { width: 100%; max-width: 380px; padding: 24px; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-title { font-weight: 680; font-size: 16px; }
.login-sub { color: var(--muted); font-size: 12.5px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.login-form input {
  font-family: inherit; font-size: 14.5px; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border-strong); border-radius: 9px; padding: 10px 12px; outline: none;
}
.login-form input:focus { border-color: var(--accent); }
.login-foot { margin-top: 16px; text-align: center; }

/* ============ 安装 ============ */
.install-body { background: var(--bg); padding: 32px 16px; }
.install-wrap { max-width: 760px; margin: 0 auto; }
.install-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 30px 32px; box-shadow: var(--shadow); }
.install-card h1 { font-size: 21px; margin: 0 0 8px; font-weight: 680; }
.install-card.wide { max-width: 760px; }
.install-form { margin-top: 18px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; font-size: 13px; }
@media (max-width: 700px) { .check-grid { grid-template-columns: 1fr; } }
.check-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }
.check-item .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.check-item.ok .dot { background: var(--ok); }
.check-item.bad .dot { background: var(--err); }
.check-item.bad { color: var(--err); }
.cred-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 14px 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.cred-box > div { display: flex; gap: 10px; }
.cred-box span { color: var(--muted); min-width: 84px; }
.install-card h2 { font-size: 14.5px; margin: 22px 0 6px; font-weight: 660; }
.install-card pre { margin: 10px 0; font-size: 12.5px; }
/* nginx 规则这类超长单行：折行显示，别让用户以为被截断 */
pre.rule-pre { white-space: pre-wrap; word-break: break-word; }
.install-note { margin: 16px 0 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); padding: 10px 14px; }
.install-note > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); }
.install-note > summary::-webkit-details-marker { color: var(--muted); }
.install-note .hint { margin-top: 8px; }

/* ============ 版本历史（问答详情页） ============ */
.hist { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel-2); }
.hist > summary { cursor: pointer; font-size: 13.5px; display: flex; gap: 8px; align-items: baseline; color: var(--text-2); }
.hist > summary::-webkit-details-marker { color: var(--muted); }
.hist[open] > summary { margin-bottom: 8px; }
.hist .prose { font-size: 14px; }

/* ============ API Key 回显 ============ */
.key-cell { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.key-text {
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 8px; word-break: break-all;
}
.key-cell[data-revealed="1"] .key-text { color: var(--text); border-color: var(--border-strong); }

/* ============ 接口地址（我的 API Key 页） ============ */
.endpoint { margin-bottom: 18px; }
.endpoint .panel-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag {
  font-size: 11.5px; font-weight: 600; letter-spacing: .2px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft, var(--bg-soft)); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.ep-row { margin-top: 14px; }
.ep-label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ep-sub { font-weight: 400; font-size: 12px; color: var(--muted); }
.ep-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--panel-2); padding: 7px 10px;
}
.ep-box code {
  flex: 1 1 auto; min-width: 0; background: none; padding: 0;
  font-size: 13.5px; color: var(--text); word-break: break-all;
}
.ep-box .btn.sm { flex: 0 0 auto; }
.btn.sm { padding: 4px 11px; font-size: 12.5px; border-radius: 7px; }
.ep-note { margin-top: 14px; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.ep-note p { margin: 0 0 6px; }
.ep-note p:last-child { margin-bottom: 0; }
.ep-check-row { margin-top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ep-check { font-size: 12.5px; }
.ep-check.ok { color: var(--ok); }
.ep-check.err { color: var(--err); }

/* 入口面板里的强提示：ChatGPT 鉴权选错会直接连不上，必须显眼 */
.ep-warn {
  margin-top: 14px; padding: 9px 12px; border-radius: 9px;
  font-size: 12.5px; line-height: 1.75; color: var(--text-2);
  background: color-mix(in srgb, #d98324 10%, transparent);
  border: 1px solid color-mix(in srgb, #d98324 30%, transparent);
  border-left: 3px solid #d98324;
}
.ep-warn b { color: var(--text); font-weight: 650; }
.ep-warn code {
  font-family: var(--mono); font-size: 11.5px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px; word-break: break-all;
}

/* ============ 注册页 ============ */
.login-hint {
  margin: 14px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--muted); text-align: center;
}
.field-hint { margin-left: 6px; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.captcha-q {
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 1px 8px; margin-left: 4px;
}
.login-foot { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }

/* ============ 邮箱验证码 ============ */
.code-row { display: flex; gap: 8px; align-items: center; }
.code-row input { flex: 1 1 auto; min-width: 0; }
.code-row .btn { flex: 0 0 auto; white-space: nowrap; }
.code-msg { font-size: 12.5px; line-height: 1.6; margin-top: 6px; color: var(--muted); }
.code-msg.ok { color: var(--ok); }
.code-msg.err { color: var(--err); }

/* ============ 设置项：勾选行 / 空空间引导 ============ */
.settings-sep { height: 1px; background: var(--border); margin: 22px 0 18px; }
label.check-line {
  display: flex; flex-direction: row; align-items: center; gap: 9px;
  font-weight: 600; cursor: pointer;
}
label.check-line input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; }

.empty-start { border-style: dashed; }
.empty-start h2 { margin: 0 0 8px; font-size: 17px; }
.empty-start ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.9; }

/* ============ 文件存储（1.7.0） ============ */
.ops { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ops form { display: inline; }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: color-mix(in srgb, var(--err) 12%, transparent); border-color: var(--err); }
.tag.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.job-line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.progress { height: 8px; border-radius: 99px; background: var(--bg-soft); border: 1px solid var(--border); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.drv-fields { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 10px; background: var(--panel-2); }

/* ============ AI 助手（1.8.0） ============ */
.ai-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.ai-wallet { display: flex; flex-wrap: wrap; gap: 18px; align-items: baseline; }
.ai-wallet b { font-size: 22px; font-variant-numeric: tabular-nums; }
.ai-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.ai-tabs button { border: 1px solid var(--border); background: var(--panel-2); color: var(--text-2); padding: 7px 14px; border-radius: 99px; cursor: pointer; font: inherit; font-size: 13px; }
.ai-tabs button:hover { border-color: var(--border-strong); color: var(--text); }
.ai-tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ai-pane { display: none; margin-top: 14px; }
.ai-pane.on { display: block; }
.ai-chat { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; padding: 4px 2px 8px; }
.ai-msg { max-width: 92%; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); white-space: pre-wrap; word-break: break-word; line-height: 1.7; font-size: 14px; }
.ai-msg.me { align-self: flex-end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.ai-msg .ai-msg-who { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ai-out { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); padding: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.75; font-size: 14px; max-height: 520px; overflow: auto; }
.ai-out:empty { display: none; }
.ai-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.ai-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--panel-2); margin-bottom: 10px; }
.ai-card-q { font-weight: 600; margin-bottom: 6px; }
.ai-card-a { color: var(--text-2); white-space: pre-wrap; line-height: 1.7; font-size: 14px; }
.ai-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.ai-row > label { flex: 1 1 220px; }
.ai-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.ai-cost { font-size: 12px; color: var(--muted); }
.ai-cost b { color: var(--accent); }
.ai-err { color: var(--err); font-size: 13px; margin-top: 8px; }

/* ============ 在线支付（1.9.0） ============ */
.ai-bar select, .table select {
  font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 6px 9px; outline: none;
}
.ai-bar select:focus, .table select:focus { border-color: var(--accent); }
.pay-note { font-size: 12px; color: var(--muted); line-height: 1.7; }

/* ============ 支付弹窗（1.9.1） ============ */
.pay-mask { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(16, 24, 40, .46); }
.pay-mask.on { display: flex; }
.pay-box { width: min(470px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.pay-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.pay-head b { font-size: 15px; }
.pay-x { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 6px; border-radius: 6px; }
.pay-x:hover { background: var(--bg-soft); color: var(--text); }
.pay-body { padding: 16px; }
.pay-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; margin-bottom: 12px; }
.pay-sum .amt { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pay-qr { width: 212px; max-width: 100%; margin: 0 auto; background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--border); }
.pay-qr svg { display: block; width: 100%; height: auto; }
.pay-box.wide { width: min(680px, 100%); }
.pay-frame { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.pay-box.wide .pay-frame { height: 470px; }
.pay-tip { font-size: 12px; color: var(--muted); line-height: 1.75; margin: 10px 0 0; }
.pay-state { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.pay-ok { text-align: center; padding: 6px 0 2px; }
.pay-ok .ico { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center; font-size: 26px; }
.pay-ok h3 { margin: 0 0 8px; font-size: 18px; }
.pay-ok p { margin: 0 0 6px; }
.pay-ok p:last-child { margin: 14px 0 0; }
.pay-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); animation: payPulse 1.2s ease-in-out infinite; }
@keyframes payPulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.redeem-shop { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 13px; }
@media (max-width: 480px) {
  .pay-frame { height: 62vh; }
  .pay-body { padding: 14px; }
}

/* ============ AI 工作台（2.0.0，2.1.0 改为整屏固定） ============ */
/* 会话列表在左侧栏里，主区只剩对话窗口，整页不滚动，只有 .agent-log 滚 */
.agent-shell {
  display: flex; flex-direction: column;
  margin: 0; flex: 1 1 auto; min-height: 0;
}
.agent-runs { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.agent-run-row { position: relative; display: flex; align-items: stretch; gap: 4px; min-width: 0; }
.agent-run {
  flex: 1 1 auto; min-width: 0; display: block; padding: 7px 9px;
  border: 1px solid var(--border); background: var(--panel);
  border-radius: 9px; color: var(--text); text-decoration: none; transition: border-color .15s, background .15s;
}
.agent-run:hover { border-color: var(--border-strong); text-decoration: none; }
.agent-run-row.on .agent-run { border-color: var(--accent); background: var(--accent-soft); }
.agent-run-t { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-run-m { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.agent-run-more {
  flex: 0 0 26px; padding: 0; border: 1px solid var(--border); background: var(--panel);
  color: var(--muted); border-radius: 9px; cursor: pointer; font-size: 16px; line-height: 1;
}
.agent-run-more:hover, .agent-run-row.on .agent-run-more { border-color: var(--accent); color: var(--text); }
.agent-run-ops {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 118px; padding: 4px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
}
.agent-run-ops button {
  border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer;
  font: inherit; font-size: 12.5px; padding: 6px 9px; border-radius: 6px;
}
.agent-run-ops button:hover { background: var(--panel-2); }
.agent-run-ops button.danger { color: #e05252; }
.agent-run-edit {
  display: block; width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--accent);
  border-radius: 6px; padding: 2px 5px; outline: none;
}

.agent-main {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; flex: 1 1 auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.agent-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.agent-title-wrap { display: flex; align-items: center; gap: 6px; flex: 1 1 160px; min-width: 0; }
.agent-title { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-model { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.agent-model select {
  font-family: inherit; font-size: 12.5px; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 5px 8px; max-width: 230px; outline: none;
}
.agent-model select:focus { border-color: var(--accent); }
.agent-del { color: var(--muted); }
.agent-del:hover { color: var(--err); border-color: var(--err); }

.agent-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.ag-msg {
  max-width: 88%; padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.75;
  background: var(--panel-2); border: 1px solid var(--border); word-break: break-word;
}
.ag-msg.me { align-self: flex-end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.ag-who { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ag-body > *:first-child { margin-top: 0; }
.ag-body > *:last-child { margin-bottom: 0; }
.ag-body p { margin: 0 0 8px; }
.ag-body h3, .ag-body h4, .ag-body h5, .ag-body h6 { margin: 12px 0 6px; font-size: 15px; font-weight: 660; }
.ag-body ul { margin: 0 0 8px; padding-left: 20px; }
.ag-body li { margin: 3px 0; }
.ag-body pre { background: var(--bg-soft); border-radius: 8px; padding: 8px 10px; overflow: auto; font-size: 12.5px; }
.ag-body code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; }

.ag-tool {
  max-width: 92%; padding: 9px 12px; border-radius: 10px; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--ok);
}
.ag-tool.fail { border-left-color: var(--err); }
.ag-tool.undone { opacity: .5; }
.ag-tool-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ag-tool-ico {
  flex: 0 0 auto; width: 17px; height: 17px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  background: var(--ok-soft); color: var(--ok); position: relative; top: 1px;
}
.ag-tool.fail .ag-tool-ico { background: var(--err-soft); color: var(--err); }
.ag-tool-name { font-weight: 650; }
.ag-tool-sum { color: var(--text-2); }
.ag-tool-det { margin-top: 6px; }
.ag-tool-det summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.ag-tool-det summary:hover { color: var(--accent); }
.ag-pre {
  margin: 6px 0 0; max-height: 230px; overflow: auto; padding: 8px 10px; border-radius: 8px;
  background: var(--bg-soft); font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all;
}
.ag-tool-bar { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; align-items: center; }
.ag-tool-bar .link-btn { color: var(--accent); font-size: 12.5px; padding: 0; }

.ag-notice { align-self: center; max-width: 94%; font-size: 12.5px; color: var(--muted); background: var(--bg-soft); padding: 5px 13px; border-radius: 99px; }
.ag-err { align-self: center; max-width: 94%; font-size: 13px; color: var(--err); background: var(--err-soft); padding: 7px 13px; border-radius: 9px; }

.ag-empty { margin: auto; padding: 10px 4px; max-width: 620px; }
.ag-empty-t { font-size: 17px; font-weight: 660; margin-bottom: 6px; }
.ag-empty-d { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.ag-chips { display: flex; flex-direction: column; gap: 8px; }
.ag-chip {
  text-align: left; font: inherit; font-size: 13px; line-height: 1.6; cursor: pointer;
  padding: 9px 12px; border-radius: 10px; color: var(--text-2);
  background: var(--panel-2); border: 1px dashed var(--border-strong);
}
.ag-chip:hover { color: var(--text); border-color: var(--accent); border-style: solid; background: var(--accent-soft); }

.agent-tip { padding: 5px 16px; border-top: 1px dashed var(--border); }
.agent-tip.on { color: var(--accent); display: flex; align-items: center; gap: 7px; }
.agent-tip.on::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: agPulse 1s ease-in-out infinite; }
@keyframes agPulse { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

.agent-form { border-top: 1px solid var(--border); padding: 10px 14px 12px; background: var(--panel); }
.agent-form textarea {
  width: 100%; box-sizing: border-box; resize: none; min-height: 58px; max-height: 190px;
  font-family: inherit; font-size: 14px; line-height: 1.7; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 9px 12px; outline: none;
}
.agent-form textarea:focus { border-color: var(--accent); }
.agent-form-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }

@media (max-width: 900px) {
  .agent-title { white-space: normal; }
  .agent-model { flex: 1 1 100%; }
  .agent-model select { max-width: 100%; flex: 1; }
  .agent-form textarea { max-width: 100%; }
  .agent-main, .agent-bar, .agent-log { min-width: 0; }
  .ag-msg, .ag-tool { max-width: 100%; }
}

/* ============ 退款申请 ============ */
.tag.warn { background: color-mix(in srgb, #d98324 15%, transparent); color: #d98324; }
.refund-req { display: inline-block; }
.refund-req > summary { list-style: none; color: var(--accent); cursor: pointer; }
.refund-req > summary::-webkit-details-marker { display: none; }
.refund-req[open] > summary { color: var(--muted); }
.refund-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; width: 210px; }
.refund-form textarea {
  font-family: inherit; font-size: 12.5px; line-height: 1.55; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 6px 8px; resize: vertical; outline: none;
}
.refund-form textarea:focus { border-color: var(--accent); }
.refund-form .btn { align-self: flex-start; }
.refund-panel .panel-title { color: #d98324; }

/* ============ 模型连通性诊断（2.0.1） ============ */
.diag-panel .panel-title { color: var(--accent); }
.diag-table td { vertical-align: top; }
.diag-step { font-weight: 650; white-space: nowrap; }
.diag-ok { color: var(--ok); }
.diag-fail { color: var(--err); }
.diag-skip { color: var(--muted); }
.diag-ms { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.diag-advice {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.7;
  background: var(--err-soft); color: var(--text); border-left: 3px solid var(--err);
}
.diag-advice.diag-good { background: var(--ok-soft); border-left-color: var(--ok); }

/* ============ 抽屉 / 折叠（2.0.4 后台收敛） ============ */
.sheet-wrap[hidden] { display: none; }
.sheet-mask {
  position: fixed; inset: 0; background: rgba(9, 12, 18, .5);
  z-index: 70; animation: sheet-fade .16s ease;
}
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 71;
  width: min(920px, 100%); display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -10px 0 36px rgba(10, 14, 22, .26);
  animation: sheet-in .2s cubic-bezier(.22, .61, .36, 1);
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.sheet-title { font-size: 15px; font-weight: 650; margin: 0; }
.sheet-sub { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.sheet-close {
  border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text-2);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1;
}
.sheet-close:hover { background: var(--bg-soft); color: var(--text); }
.sheet-body { padding: 16px 18px 28px; overflow: auto; flex: 1 1 auto; }
html.sheet-open { overflow: hidden; }
@keyframes sheet-in { from { transform: translateX(22px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }

/* 折叠块：统一 summary 长相 */
details.fold { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
details.fold + details.fold { margin-top: 10px; }
details.fold > summary {
  list-style: none; cursor: pointer; padding: 11px 14px;
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after {
  content: "展开"; margin-left: auto; font-size: 12px; font-weight: 400; color: var(--accent);
}
details.fold[open] > summary::after { content: "收起"; color: var(--muted); }
details.fold[open] > summary { border-bottom: 1px solid var(--border); }
details.fold > .fold-body { padding: 14px; }
.fold-note { font-weight: 400; color: var(--muted); font-size: 12px; }

/* 后台页头的小统计条 */
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-2); }
.mini-stats b { font-family: var(--mono); font-size: 13px; color: var(--text); }
.mini-stats .bad { color: var(--err); }

/* 对账表：数字列右对齐、异常行标红 */
.ledger-table td.num { text-align: right; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.ledger-table tr.has-issue td { background: color-mix(in srgb, var(--err) 6%, transparent); }
.issue-tag {
  display: inline-block; font-size: 11px; line-height: 1.5; padding: 1px 6px; border-radius: 6px;
  background: var(--err-soft); color: var(--err); margin: 1px 4px 1px 0; white-space: nowrap;
}
.issue-tag.soft { background: var(--bg-soft); color: var(--text-2); }

@media (max-width: 720px) {
  .sheet { width: 100%; border-left: none; }
  .sheet-body { padding: 14px 12px 24px; }
}

/* ============ 页内横向子菜单（2.1.0） ============ */
.subnav {
  display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden;
  border-bottom: 1px solid var(--border); margin: 2px 0 6px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  flex: 0 0 auto; padding: 9px 13px; font-size: 13.5px; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }

/* 左侧栏里的对话列表（AI 工作台）：与上面的「我的分组」并列，用一条分隔线区分两块 */
.side-agent {
  display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--border); padding-top: 12px;
}
.side-agent .side-title { padding: 0 10px 2px; }
.side-agent-head { display: flex; align-items: center; gap: 6px; }
.side-agent-link {
  color: var(--text-2); text-decoration: none;
  font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase;
}
.side-agent-link:hover { color: var(--accent); text-decoration: none; }
.side-agent-head .side-count { margin-left: auto; }
.side-new { margin-bottom: 2px; }
.ag-tip-run { color: var(--accent); }

/* 工作台整屏固定：页面本身不滚，只有对话记录那一列滚 */
.main.main-agent {
  height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  overflow: hidden; padding-bottom: 0;
}
.main-agent .topbar { flex: 0 0 auto; padding: 10px 0 4px; }
.main-agent .flash { flex: 0 0 auto; }
.main-agent .agent-head { flex: 0 0 auto; padding: 2px 0 10px; align-items: flex-start; }
.main-agent .agent-head .page-title { font-size: 20px; }
.main-agent .agent-head .page-desc { margin: 3px 0 0; font-size: 12.5px; }

@media (max-width: 900px) {
  .main.main-agent { padding: 0 12px; }
  .main-agent .agent-head { padding: 0 0 8px; }
  .main-agent .agent-head .page-desc { display: none; }
  .main-agent .agent-head .page-title { font-size: 17px; }
}

/* 窄屏：工作台底部说明压到两行，别占掉对话高度 */
@media (max-width: 720px) {
  #agTipScope {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.5;
  }
}

/* 后台 · GitHub 在线更新 */
.gh-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.gh-actions form { margin: 0; }
.gh-steps { margin: 8px 0 0; padding-left: 20px; font-size: 12.5px; line-height: 1.75; color: var(--muted); }
.gh-steps li { margin: 2px 0; }
.gh-src { word-break: break-all; color: var(--muted); }

/* ============ AI 计费 / 模型门禁引导卡片（2.2.5） ============ */
/* 插槽：工作台放在会话窗口顶部（常驻、不随聊天记录滚走），AI 助手放在模型选择下面 */
.ag-gate[hidden], .ai-gate[hidden] { display: none; }
.ag-gate {
  flex: 0 0 auto; padding: 9px 14px; border-bottom: 1px solid var(--border);
  background: var(--panel); max-height: 46%; overflow-y: auto;
}
.ai-gate { margin: 12px 0 2px; }

.kb-guide {
  border: 1px solid var(--border-strong); border-left: 3px solid #d98324;
  border-radius: 10px; padding: 11px 13px; background: color-mix(in srgb, #d98324 6%, var(--panel));
  font-size: 13px; line-height: 1.7; color: var(--text);
}
.kb-guide.kb-guide-call_failed, .kb-guide.kb-guide-bad_config { border-left-color: var(--err); background: var(--err-soft); }
.kb-guide.kb-guide-no_model, .kb-guide.kb-guide-no_plan { border-left-color: var(--accent); background: var(--accent-soft); }
.kb-guide-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.kb-guide-mode {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 99px;
  color: #a56215; background: color-mix(in srgb, #d98324 16%, transparent);
}
.kb-mode-custom { color: var(--accent); background: var(--accent-soft); }
html[data-theme="dark"] .kb-guide-mode { color: #f0b45c; }
html[data-theme="dark"] .kb-mode-custom { color: var(--accent); }
.kb-guide-title { font-size: 14px; font-weight: 680; }
.kb-guide-msg { margin: 7px 0 0; color: var(--text-2); }
.kb-guide-reason {
  margin: 9px 0 0; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-soft); padding: 7px 10px;
}
.kb-guide-reason-h { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.kb-guide-reason-b {
  font-size: 12px; line-height: 1.6; color: var(--text); white-space: pre-wrap;
  word-break: break-word; max-height: 130px; overflow-y: auto;
}
.kb-guide-hints { margin: 8px 0 0; padding-left: 19px; color: var(--text-2); font-size: 12.5px; }
.kb-guide-hints li { margin: 2px 0; }
.kb-guide-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.kb-guide-actions .btn { text-decoration: none; }
/* 历史里落库的引导卡片，随消息流对齐 */
.ag-guide-inline { max-width: 94%; align-self: stretch; }
@media (max-width: 720px) {
  .ag-gate { padding: 8px 10px; max-height: 52%; }
  .kb-guide-actions .btn { flex: 1 1 auto; text-align: center; }
}

/* ============ 站点身份：页脚 / 公告 / 订阅入口（2.4.0） ============ */
.site-foot {
  margin-top: 28px; padding: 16px 0 4px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); line-height: 1.7;
}
.site-foot-in { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.site-foot-copy { white-space: pre-line; }
.site-foot-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.site-foot-links a { color: var(--muted); }
.site-foot-links a:hover { color: var(--accent); }
.site-foot-dot { opacity: .5; }
.site-foot-contact { word-break: break-all; }
/* 登录 / 注册 / 找回密码这类窄卡片里，页脚居中且不要分割线 */
.login-wrap .site-foot {
  margin-top: 18px; padding: 0; border-top: none; text-align: center;
}
.login-wrap .site-foot-in { flex-direction: column; align-items: center; gap: 5px; }
.login-wrap .site-foot-links { justify-content: center; }
/* 工作台是整屏固定布局，页脚不进（本来就没空间） */
.main-agent .site-foot { display: none; }

.site-announce {
  margin-bottom: 16px; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  background: var(--accent-soft); color: var(--text); font-size: 12.5px; line-height: 1.65;
}

/* 侧栏：未订阅 → 「订阅会员」按钮；已订阅 → 「会员用户」标识（按钮自动隐藏） */
.side-foot .side-item.side-sub {
  color: #a56215; background: color-mix(in srgb, #d98324 10%, transparent); font-weight: 600;
}
.side-foot .side-item.side-sub:hover { background: color-mix(in srgb, #d98324 18%, transparent); color: #8a4f10; }
.side-foot .side-item.side-member { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.side-foot .side-item.side-member:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.side-sub-tag, .side-member-tag {
  flex: 0 0 auto; margin-left: auto; font-size: 10.5px; font-weight: 650;
  padding: 1px 6px; border-radius: 99px; line-height: 16px; white-space: nowrap;
}
.side-sub-tag { color: #a56215; background: color-mix(in srgb, #d98324 20%, transparent); }
.side-member-tag {
  color: var(--accent); background: var(--accent-soft);
  max-width: 76px; overflow: hidden; text-overflow: ellipsis;
}
html[data-theme="dark"] .side-foot .side-item.side-sub { color: #f0b45c; }
html[data-theme="dark"] .side-foot .side-item.side-sub:hover { color: #ffc978; }
html[data-theme="dark"] .side-sub-tag { color: #f0b45c; }

/* 后台「网站基础信息」里的图标预览 */
.brand-preview {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 2px 0 6px; padding: 9px 12px; border-radius: 9px;
  border: 1px dashed var(--border-strong); background: var(--bg-soft);
}
.brand-preview-img { display: inline-flex; align-items: center; }
.brand-preview-fav {
  width: 24px; height: 24px; border-radius: 5px; object-fit: contain;
  background: var(--panel); border: 1px solid var(--border);
}
.brand-preview .check-line { margin: 0 0 0 auto; }

/* ============ 感叹号提示气泡（全站通用） ============
   用法一（推荐，走 PHP 助手）：<?= tip('<p>说明</p>') ?>
   用法二（手写）：<span class="tip" tabindex="0"><span class="tip-mark">?</span>
                    <span class="tip-pop"><span class="tip-card">说明</span></span></span>
   显示：hover / 键盘聚焦 / 触屏点一下。纯 CSS，无脚本依赖。
   注意：气泡里只放「解释」，不要放用户要复制的内容（选中文字时鼠标移出会消失）。 */
.tip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft); color: var(--muted);
  font-size: 10.5px; font-weight: 700; line-height: 1;
  font-style: normal; letter-spacing: 0; text-transform: none;
  cursor: help; vertical-align: middle;
  user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.tip:hover, .tip:focus, .tip:focus-visible {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft); outline: none;
}
.tip-mark { display: block; line-height: 1; transform: translateY(.5px); }

.tip-pop {
  position: absolute; left: 0; top: 100%; z-index: 80;
  display: none;
  padding-top: 8px;                 /* 空隙用 padding 而不是偏移，保住 hover 连通 */
  width: max-content;
  max-width: min(360px, calc(100vw - 40px));
}
.tip:hover > .tip-pop,
.tip:focus > .tip-pop,
.tip:focus-visible > .tip-pop { display: block; }

/* 小箭头单独做成 .tip-pop::after：它画在卡片之上，才能盖住卡片顶边那道线；
   放在卡片内部会被 overflow:auto 裁掉。 */
.tip-pop::after {
  content: ""; position: absolute; left: 4px; top: 4px;
  width: 8px; height: 8px; transform: rotate(45deg);
  background: var(--panel); pointer-events: none;
  border-left: 1px solid var(--border-strong);
  border-top: 1px solid var(--border-strong);
}

.tip-card {
  display: block; text-align: left;
  background: var(--panel); color: var(--text-2);
  border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .16);
  padding: 10px 13px;
  font-size: 12.5px; line-height: 1.68; font-weight: 400;
  letter-spacing: 0; text-transform: none;
  white-space: normal;
  max-height: min(58vh, 400px); overflow: auto;
  overscroll-behavior: contain;
}
.tip-card p { margin: 0 0 6px; }
.tip-card p:last-child { margin-bottom: 0; }
.tip-card b, .tip-card strong { color: var(--text); font-weight: 650; }
.tip-card code {
  font-family: var(--mono); font-size: 11.5px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px; word-break: break-all;
}
.tip-card pre {
  margin: 6px 0; padding: 8px 10px; font-size: 11px; line-height: 1.5;
  border-radius: 7px; white-space: pre-wrap; word-break: break-all;
}
.tip-card pre code { background: none; border: none; padding: 0; }
.tip-card ul, .tip-card ol { margin: 4px 0 6px; padding-left: 18px; }
.tip-card li { margin: 2px 0; }
.tip-card .muted { color: var(--muted); }

/* 靠右对齐：用于表格末列、右侧面板，避免气泡冲出视口 */
.tip.tip-right .tip-pop { left: auto; right: 0; }
.tip.tip-right .tip-pop::after { left: auto; right: 4px; }
/* 向上展开：用于页面底部、表格最后一行 */
.tip.tip-up .tip-pop { top: auto; bottom: 100%; padding-top: 0; padding-bottom: 8px; }
.tip.tip-up .tip-pop::after {
  top: auto; bottom: 4px; transform: rotate(225deg);
}
/* 深色主题下阴影更沉一点，浅色背景的箭头不变 */
html[data-theme="dark"] .tip-card { box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }

/* 触屏：hover 会粘住，改由点击聚焦控制，气泡宽度随屏幕收窄 */
@media (hover: none) {
  .tip-pop { max-width: calc(100vw - 32px); }
}

/* 窄屏（手机 / 竖屏平板）：绝对定位的气泡一定会撞到右边界，
   改成贴底卡片。宽度按视口算，无论图标在哪儿都不会溢出。 */
@media (max-width: 768px) {
  .tip-pop {
    position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto;
    width: auto; max-width: none; padding: 0;
    z-index: 95;
  }
  .tip-pop::after { display: none; }        /* 位置不固定，小箭头没意义 */
  .tip-card {
    max-height: 52vh;
    box-shadow: 0 14px 44px rgba(16, 24, 40, .3);
    font-size: 13px;                         /* 手机上比桌面大半号更好读 */
  }
  html[data-theme="dark"] .tip-card { box-shadow: 0 14px 44px rgba(0, 0, 0, .6); }
}

/* 表单里的说明行（hint）右侧挂提示图标时用，保住基线对齐 */
.hint-row { display: flex; align-items: flex-start; gap: 7px; flex-wrap: wrap; }
.hint-row .tip { margin-top: 2px; }

/* 接口页里的折叠块：比默认 fold 更轻，不抢主体内容的注意力 */
.ep-fold { margin-top: 14px; background: var(--panel-2); }
.ep-fold > summary { font-size: 12.5px; padding: 9px 13px; }
.ep-fold > .fold-body { padding: 12px 14px; }
.ep-fold > .fold-body pre { margin: 6px 0; }
.ep-fold > .fold-body p { margin: 0 0 8px; }
.ep-fold > .fold-body p:last-child { margin-bottom: 0; }
.ep-fold > .fold-body .btn.sm { margin-top: 6px; }

/* <label> 里的提示图标不能撑高行高 */
.form label .tip, .check-line .tip { transform: translateY(1px); }
/* 面板标题里的提示图标与文字基线对齐（标题是小号大写字母，需要单独校） */
.panel-title .tip { width: 14px; height: 14px; font-size: 10px; vertical-align: -2px; margin-left: 2px; }
.panel-title .tag { text-transform: none; letter-spacing: 0; }
/* 段落末尾的提示图标：拉开一点距离，避免和句号挤在一起 */
.page-desc .tip, .prose .tip, .hint .tip { margin-left: 4px; }
/* 标题里的问号稍亮一档，深色主题下也看得清 */
.panel-title .tip { color: var(--text-2); border-color: var(--border-strong); }
html[data-theme="dark"] .tip { color: var(--muted); background: var(--bg-soft); }

/* 竖排表单标签里的「文字 + 提示图标」行；.lb 是 field_label() 的固定包装 */
.form label > .lb, .form label > span.lb {
  display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.form label > span.lb .field-hint { margin-left: 0; }

/* ============ 源码仓库入口（2.5.0 建立，2.6.0 收敛为右上角唯一一处） ============
   需求：「每个页面只需要在右上角预留一个即可」。
   所以不再有侧栏版、页脚版、页内多份——全站只此一个函数 github_corner_link()，
   两种定位：fixed（独立页面悬浮视口右上角）/ inline（有布局的页面放进顶栏右侧）。
   仍然没有任何显示/隐藏开关：入口必须一直可见。 */
.gh-mark { display: block; flex: 0 0 auto; }

.gh-corner {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--text-2); font-size: 12.5px; text-decoration: none;
  white-space: nowrap; flex: 0 0 auto;
  transition: color .15s, border-color .15s, background .15s;
}
.gh-corner:hover {
  color: var(--text); text-decoration: none;
  border-color: var(--border-strong); background: var(--panel);
}
.gh-corner-fixed { position: fixed; top: 16px; right: 18px; z-index: 40; }
.gh-corner-text { font-weight: 540; }

/* 顶栏里的那个：不吸顶，跟着顶栏走，右侧对齐 */
.gh-corner-inline { margin-left: auto; }
.topbar-spacer { flex: 1 1 auto; min-width: 0; }

/* 侧栏在窄屏是抽屉，入口跟着抽屉走；顶栏另给的入口见 .land-top */
@media (max-width: 860px) {
  .gh-corner-inline .gh-corner-text { display: none; }
  .gh-corner-inline { padding: 6px 8px; }
}

/* ============ 落地页（2.5.0） ============ */
.land-body { background: var(--bg); color: var(--text); }

.land-top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.land-top-in {
  max-width: 1120px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.land-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); flex: 0 0 auto; }
.land-brand:hover { text-decoration: none; }
.land-brand-text { font-weight: 660; font-size: 15px; letter-spacing: -.01em; }
.land-top-nav { display: flex; align-items: center; gap: 18px; margin-left: 8px; flex: 1 1 auto; min-width: 0; }
.land-top-nav a { color: var(--text-2); font-size: 13.5px; text-decoration: none; white-space: nowrap; }
.land-top-nav a:hover { color: var(--text); text-decoration: none; }
.land-top-act { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* 首屏 */
.land-hero { padding: 68px 24px 56px; }
.land-hero-in { max-width: 780px; margin: 0 auto; text-align: center; }
.land-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 999px; margin-bottom: 24px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text-2); font-size: 12.5px;
}
.land-h1 {
  margin: 0 0 20px; font-size: clamp(30px, 5.2vw, 48px); line-height: 1.18;
  font-weight: 700; letter-spacing: -.025em;
}
.land-h1-sub {
  font-weight: 560; color: var(--muted);
  font-size: .56em; letter-spacing: 0;
  display: inline-block; margin-top: 10px;
}
.land-lead {
  margin: 0 auto 32px; max-width: 620px;
  font-size: 16px; line-height: 1.75; color: var(--text-2);
}
.land-cta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn.lg { padding: 11px 22px; font-size: 15px; border-radius: 10px; }
.gh-cta { gap: 8px; }

.land-stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 40px;
  margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--border);
}
.land-stats > div { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.land-stats b { font-size: 24px; font-weight: 680; letter-spacing: -.02em; }
.land-stats span { font-size: 12px; color: var(--muted); }

/* 通用段落 */
.land-sec { padding: 64px 24px; }
.land-sec-alt { background: var(--bg-soft); border-block: 1px solid var(--border); }
.land-sec-in { max-width: 1120px; margin: 0 auto; }
.land-sec-head { max-width: 620px; margin-bottom: 36px; }
.land-sec-head h2 { margin: 0 0 10px; font-size: clamp(22px, 3vw, 29px); font-weight: 680; letter-spacing: -.02em; }
.land-sec-head p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.7; }

/* 能力卡片 */
.land-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.land-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: border-color .15s, transform .15s;
}
.land-card:hover { border-color: var(--border-strong); }
.land-card-ico {
  width: 36px; height: 36px; border-radius: 10px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: var(--accent-soft);
}
.land-card h3 { margin: 0 0 8px; font-size: 15.5px; font-weight: 640; letter-spacing: -.01em; }
.land-card p { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.72; }
.land-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.land-tags span {
  font-size: 11.5px; padding: 2px 8px; border-radius: 6px;
  color: var(--muted); background: var(--bg-soft); border: 1px solid var(--border);
}

/* 三步 */
.land-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 760px; }
.land-steps li {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px;
}
.land-step-n {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 680;
}
.land-steps h3 { margin: 2px 0 6px; font-size: 15px; font-weight: 640; }
.land-steps p { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.72; }
.land-steps code {
  font-family: var(--mono); font-size: 12.5px;
  padding: 1px 5px; border-radius: 5px;
  background: var(--bg-soft); border: 1px solid var(--border);
}

/* 接口三列 */
.land-api { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.land-api-col {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.land-api-h { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.land-api-h b { font-size: 14px; font-weight: 660; letter-spacing: .01em; }
.land-api-h code {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  word-break: break-all;
}
.land-api-col p { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.7; }
.land-api-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px;
}
.land-note { color: var(--muted); font-size: 12.5px; }

/* 仓库大卡片 */
.land-sec-repo { padding-top: 0; }
.land-repo {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; box-shadow: var(--shadow);
}
.land-repo-mark {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); color: var(--text); border: 1px solid var(--border);
}
.land-repo-text { flex: 1 1 320px; min-width: 0; }
.land-repo-text h2 { margin: 0 0 8px; font-size: 21px; font-weight: 680; letter-spacing: -.02em; }
.land-repo-text p { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.75; }

/* 落地页页脚比内页大一点 */
.land-body .site-foot { max-width: 1120px; margin: 0 auto; padding: 28px 24px 44px; }

@media (max-width: 860px) {
  .land-top-nav { display: none; }
  .land-top-in { gap: 12px; padding: 10px 16px; }
  .land-hero { padding: 44px 18px 40px; }
  .land-sec { padding: 44px 18px; }
  .land-stats { gap: 26px; }
  .land-repo { padding: 22px; gap: 16px; }
  .land-sec-repo { padding-top: 0; }
  .land-body .site-foot { padding: 22px 18px 36px; }
}


/* ============ 登录 / 注册合一页（2.6.0） ============
   需求：「登录窗口和注册窗口全部优化成 16 比 9 的比例，切换时不要换页面」。

   布局：一张 16:9 卡片，左边品牌栏（宽屏才有），右边表单栏。
   比例靠 aspect-ratio 保证，同时用 min/max 夹住，避免超宽屏字太大、
   矮屏卡片被压扁。窄屏（<900px）不再守 16:9 —— 手机上强行 16:9 只会
   把输入框挤成一条缝，那里改成自适应高度，可用性优先于比例。 */

.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background: var(--bg); overflow-x: hidden;
  position: relative;
}

/* ---- 背景层：两层（登录一套、注册一套），只有当前 tab 那层可见 ---- */
.auth-bg-stack {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.auth-bg-layer { position: absolute; inset: 0; }
.auth-bg-layer[hidden] { display: none; }

/* canvas 与图片都是一个「铺满」的层，一律不接鼠标事件 */
.auth-bg, .auth-bg-media, .auth-bg-frame {
  position: absolute; inset: 0;
  width: 100%; height: 100%; display: block;
  pointer-events: none; border: 0;
}
.auth-bg-media { object-fit: cover; }
.auth-bg-frame { background: transparent; }
.auth-bg-plain { background: var(--bg); }

/* 压暗遮罩：管理员可调 0~90%。默认 0，即完全不压 —— 2.5.0 的观感保持不变。
   遮罩铺在背景之上、卡片之下，所以卡片永远清晰，只是背景退后。 */
.auth-bg::after {
  content: ""; position: absolute; inset: 0;
  background: var(--bg);
  opacity: var(--auth-dim, 0);
  pointer-events: none;
}

/* ---- 16:9 卡片 ---- */
.auth-stage {
  position: relative; z-index: 1;
  width: 100%; max-width: 1080px;
  display: flex; flex-direction: column; align-items: center;
}

.auth-card {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 480px;          /* 矮屏兜底：宁可超出比例也不要挤成一条 */
  max-height: calc(100vh - 96px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* 行高必须显式 1fr(minmax(0,1fr))：默认 auto 行会按内容高度算，
     内容一多卡片就被撑出 aspect-ratio 的框，overflow:hidden 再把超出的部分切掉。 */
  grid-template-rows: minmax(0, 1fr);
  background: color-mix(in srgb, var(--panel) 95%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* 左栏：品牌叙事。宽屏才显示，窄屏让位给表单 */
.auth-aside {
  position: relative;
  padding: 40px 38px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(120% 90% at 12% 8%, var(--accent-soft) 0%, transparent 58%),
    color-mix(in srgb, var(--panel-2) 88%, transparent);
  overflow: hidden;
}
.auth-aside-in { display: flex; flex-direction: column; height: 100%; }
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand-name { font-weight: 680; font-size: 15.5px; letter-spacing: -.01em; }
.auth-brand-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.auth-aside-copy { margin-top: auto; }
.auth-aside-copy h2 {
  margin: 0 0 12px; font-size: clamp(20px, 2.1vw, 27px);
  line-height: 1.32; letter-spacing: -.02em; font-weight: 700;
}
.auth-aside-copy p { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.65; }

.auth-aside-list {
  list-style: none; margin: 24px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 9px;
}
.auth-aside-list li {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 12.8px; color: var(--text-2); line-height: 1.5;
}
.auth-dot {
  flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); margin-top: 7px;
}

/* 右栏：表单 */
.auth-main {
  display: flex; flex-direction: column;
  /* 垂直内边距收到 24/20：16:9 的卡片高度是算出来的，注册那 4 组字段离
     「刚好放得下」只差十几像素，从这里让 8px 比压字段间距更不伤可读性。 */
  padding: 24px 34px 20px; min-width: 0;
  /* grid item 默认 min-height:auto —— 内容多时会把行撑高、突破 16:9 的框，
     于是注册表单底部直接被卡片边缘裁掉（实测 691px 的内容塞进 608px 的卡片，
     「注册并进入」下面的说明和链接全丢）。必须显式归零，滚动区才真的能滚。 */
  min-height: 0;
}

/* ---- tab 切换 ---- */
.auth-tabs {
  position: relative; display: flex; gap: 4px;
  padding: 4px; margin-bottom: 20px;
  background: var(--bg-soft); border-radius: 10px;
  align-self: flex-start; flex: 0 0 auto;
}
.auth-tab {
  position: relative; z-index: 1;
  padding: 7px 20px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; font-weight: 560; cursor: pointer;
  transition: color .16s;
}
.auth-tab.on { color: var(--text); }
.auth-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* 滑块：跟着当前 tab 平移，比直接给 tab 换底色干净 */
.auth-tab-ink {
  position: absolute; top: 4px; left: 0; height: calc(100% - 8px);
  border-radius: 8px; background: var(--panel);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .10);
  transition: transform .22s cubic-bezier(.4, 0, .2, 1), width .22s cubic-bezier(.4, 0, .2, 1);
  pointer-events: none;
}

/* ---- 两个面板：叠在同一格，只有一个可见 ---- */
/* 这里三处 min-height:0 缺一不可：panes 是 flex 子项、grid 容器；pane 是 grid 行里的
   flex 容器。任何一层留着 min-height:auto，内容都会把卡片顶变形、并且让 .auth-scroll
   拿不到确切的可用高度，滚动条永远不出现。 */
.auth-panes { position: relative; flex: 1 1 auto; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); }
.auth-pane {
  grid-area: 1 / 1;
  display: none; flex-direction: column; min-height: 0; min-width: 0;
}
.auth-pane.on { display: flex; }

.auth-h1 { margin: 0 0 5px; font-size: 21px; font-weight: 690; letter-spacing: -.02em; }
.auth-lead { margin: 0 0 14px; color: var(--muted); font-size: 13px; }

/* 窄屏才出现的品牌行（左栏被隐藏后补上，别让页面少了身份） */
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 18px; }

/* 注册字段多，16:9 的高度装不下 —— 内部滚动，而不是把卡片撑变形 */
.auth-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; }
.auth-scroll::-webkit-scrollbar { width: 8px; }
.auth-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.auth-form { display: flex; flex-direction: column; gap: 12px; }

/* 注册表单：撑满面板高度，字段区滚动、按钮钉在底部。
   这样 16:9 的框再矮，「注册并进入」也永远看得见——否则用户会以为页面坏了。 */
.auth-form-fill { flex: 1 1 auto; min-height: 0; }
/* 滚动区自己成一列，字段间距由它的 gap 管：包了一层之后 .auth-form 的 gap
   只作用在「滚动区 ↔ 按钮」这一对上，字段之间会全贴着（实测就是这样）。
   gap 取 10px 而不是 12px：注册有 4 组字段，省下的 8px 正好让 1440×900 下
   整张表不用内部滚动（12px 时会差 23px，最后一行被切一半，很像坏掉了）。 */
.auth-form-fill .auth-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 9px;
  padding-right: 4px;
}
/* 滚动时留一点底部余量，最后一行不会被按在滚动区边缘上 */
.auth-form-fill .auth-scroll > *:last-child { margin-bottom: 2px; }
.auth-foot { flex: 0 0 auto; padding-top: 2px; }
.auth-foot .auth-note { margin-top: 8px; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-field {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.8px; color: var(--text-2); min-width: 0;
}
/* 标签那一行：字段名与右侧提示同一行（同名 flex 会让 <span> 变成独立的一项，
   于是「昵称」下面多出一行提示、把输入框整体往下推，跟旁边那列错位）。
   给文字包一层 flex 行，提示就贴在名字右边，行高也就一致了。 */
.auth-label {
  display: flex; align-items: baseline; gap: 6px; min-width: 0;
  line-height: 1.35; margin-bottom: -1px;
}
.auth-label > .auth-hint { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-field input {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); color: var(--text);
  font: inherit; font-size: 13.5px;
}
.auth-field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.auth-hint { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.auth-captcha-q { color: var(--accent); font-size: 14px; letter-spacing: .04em; }
.auth-submit { margin-top: 4px; }

/* 登录表单：撑满面板，把「登录」按钮推到接近底部的位置，
   与注册 tab 里那个钉底的按钮视觉对齐，切 tab 时视线不用重新找。 */
.auth-form[data-form="login"] { flex: 1 1 auto; min-height: 0; }
.auth-form[data-form="login"] .auth-submit { margin-top: auto; margin-bottom: 0; }

.auth-note {
  margin: 12px 0 0; color: var(--muted); font-size: 11.8px; line-height: 1.6;
}
.auth-links {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: auto; padding-top: 16px; flex: 0 0 auto;
}
.auth-links .link, .auth-links .link-btn { font-size: 12.8px; }

/* 卡片外页脚：只有真配了备案/版权才出现，居中排 */
.auth-stage .site-foot {
  margin-top: 16px; padding: 0; border: 0; background: none;
  text-align: center; width: 100%;
}
.auth-stage .site-foot-in { flex-direction: column; align-items: center; gap: 4px; }
.auth-stage .site-foot-links { justify-content: center; }
.auth-stage .site-foot a, .auth-stage .site-foot-copy { font-size: 12px; }

/* ---- 中等屏：守比例但收窄留白 ---- */
@media (max-width: 1080px) {
  .auth-aside { padding: 32px 28px; }
  .auth-main { padding: 24px 26px 20px; }
  .auth-aside-copy h2 { font-size: 20px; }
}

/* ---- 窄屏：放弃 16:9，改成单栏自适应 ----
   手机上把 16:9 硬套下去，输入框会被压成一条缝（16:9 在 390 宽下只有 219 高，
   而注册表单要 480 以上）。这里的取舍是明确的：比例服务于观感，可用性优先。 */
@media (max-width: 900px) {
  .auth-card {
    aspect-ratio: auto;
    grid-template-columns: 1fr;
    min-height: 0;
    max-height: none;
  }
  .auth-aside { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-main { padding: 24px 22px 20px; }
  .auth-body { padding: 16px; align-items: flex-start; padding-top: 40px; }
  /* 窄屏不分内外滚动：卡片自己按内容长高，全页滚。
     必须用同样特指度覆盖 .auth-form-fill .auth-scroll，否则手机上仍然
     会在卡片里塞一个 274px 的滚动区（内容被切成两截，很难看）。 */
  .auth-scroll,
  .auth-form-fill .auth-scroll { overflow: visible; flex: 0 0 auto; }
  .auth-form-fill { flex: 0 0 auto; }
  .auth-foot { padding-top: 12px; }
  .auth-panes { grid-area: auto; grid-template-rows: none; }
  .auth-pane { grid-area: auto; }
  .auth-h1 { font-size: 19px; }
}

@media (max-width: 520px) {
  .auth-body { padding: 12px; padding-top: 32px; }
  .auth-main { padding: 20px 16px 18px; }
  /* 两列字段在手机上并排会把字挤没，改单列 */
  .auth-row { grid-template-columns: 1fr; gap: 10px; }
  .gh-corner-fixed { top: 10px; right: 10px; padding: 5px 9px; font-size: 12px; }
  .gh-corner-fixed .gh-corner-text { display: none; }
  .auth-links { gap: 12px; }
}

/* 减少动效：背景层不显示，只留主题底色（canvas 本身也不会启动） */
@media (prefers-reduced-motion: reduce) {
  .auth-bg-layer { display: none; }
  .auth-bg-layer[data-bg-layer]:first-child { display: block; }
  .auth-bg-canvas, .auth-bg-frame { display: none; }
  .auth-bg-plain { display: block !important; background: var(--bg); }
  .auth-body { background: var(--bg); }
  .auth-tab-ink { transition: none; }
}

/* ============ 后台 · 登录外观配置页（2.6.0） ============ */
.authcfg {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; margin-bottom: 16px; background: var(--panel-2);
}
.authcfg-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.authcfg-title { margin: 0; font-size: 14.5px; font-weight: 660; }
.authcfg-cur { margin-left: auto; }

/* 类型选择：一排小卡片，选中态用边框和底色区分 */
.authcfg-types {
  display: grid; gap: 8px; margin-bottom: 14px;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}
.authcfg-type {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.authcfg-type:hover { border-color: var(--border-strong); }
.authcfg-type input { position: absolute; opacity: 0; pointer-events: none; }
.authcfg-type:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.authcfg-type:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.authcfg-type-name { font-size: 13px; font-weight: 560; color: var(--text); }
.authcfg-type-note { font-size: 11.5px; color: var(--muted); }

/* 输入区：只有当前类型那组显示 */
.authcfg-body { display: none; }
.authcfg-body.on { display: block; }

/* 预设网格 */
.authpreset-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.authpreset {
  position: relative; display: flex; flex-direction: column; gap: 5px;
  padding: 7px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.authpreset:hover { border-color: var(--border-strong); }
.authpreset input { position: absolute; opacity: 0; pointer-events: none; }
.authpreset:has(input:checked) {
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}
.authpreset:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.authpreset-thumb {
  display: block; border-radius: 7px; overflow: hidden;
  background: var(--bg-soft); line-height: 0;
}
.authpreset-canvas { display: block; width: 100%; height: auto; }
.authpreset-name { font-size: 12.5px; font-weight: 560; color: var(--text); padding: 0 2px; }
.authpreset-note { font-size: 11px; color: var(--muted); line-height: 1.45; padding: 0 2px 2px; }

.authcfg-preview {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
}
.authcfg-preview img {
  width: 132px; height: 74px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg-soft);
}

/* 压暗滑块 */
.authcfg-dim { margin-top: 14px; padding-top: 13px; border-top: 1px dashed var(--border); }
.authcfg-dim-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.authcfg-dim-row input[type="range"] { flex: 1 1 auto; min-width: 0; max-width: 320px; accent-color: var(--accent); }
.authcfg-dim-val {
  flex: 0 0 auto; font-size: 12.5px; color: var(--text-2);
  font-variant-numeric: tabular-nums; min-width: 42px;
}
.authcfg-clear { margin-top: 12px; }

/* ============ 系统 Key 页（2.7.0） ============ */
/* 领域权限：一行一块，左边名字+说明、右边两个勾选框。
   不用表格是为了在窄屏能自然折行（.perm-table 那种在手机上会横向溢出）。 */
.perm-grid { display: flex; flex-direction: column; gap: 2px; }
.perm-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 9px 12px; border-radius: 9px; background: var(--bg-soft);
  border: 1px solid var(--border);
}
.perm-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perm-name b { font-size: 13.5px; }
.perm-name .tiny { line-height: 1.45; }
@media (max-width: 560px) {
  .perm-row { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* 表单里的分组块（与 .field-group 区分：这个是带上下留白的一整块） */
.field { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }

/* 「允许明文」：勾选框本身要显眼一点，因为它改变的是泄露面 */
.check-warn { color: var(--danger, #c0392b); font-weight: 600; }
.plain-confirm { margin-top: 2px; }
.plain-confirm[hidden] { display: none !important; }

/* 表格右侧动作列：多个 form 竖着排会很高，横排更省地方 */
.row-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }

/* ============ 存储容量（2.8.0） ============ */
/*
 * 容量条刻意做成「一块独立区域」而不是塞进 .stat-grid：
 * 四个 stat 卡片是并列指标，容量是「一个比例」，混排会让人以为它们是同类数字。
 */
.cap-block {
  margin: 4px 0 20px; padding: 16px 18px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.cap-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cap-used { font-size: 22px; font-weight: 700; letter-spacing: -.4px; line-height: 1.25; }
.cap-total { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.cap-label { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.cap-pct { font-size: 20px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.cap-pct.warn { color: var(--err); }

.cap-bar {
  margin-top: 12px; height: 9px; border-radius: 99px; overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--border);
}
.cap-fill {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #5b8ff5);
  transition: width .35s ease;
}
.cap-fill.warn { background: linear-gradient(90deg, #e05252, var(--err)); }
.cap-foot {
  margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
}
.cap-foot .err { color: var(--err); font-weight: 600; }

.cap-quota {
  margin-top: 14px; padding-top: 13px; border-top: 1px dashed var(--border);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cap-quota label { font-size: 13px; color: var(--text-2); }
.cap-quota input[type="number"] {
  width: 96px; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 6px 9px; outline: none;
}
.cap-quota input[type="number"]:focus { border-color: var(--accent); }
.cap-quota .unit { font-size: 13px; color: var(--muted); }
.cap-quota-hint { font-size: 12px; color: var(--muted); margin-left: auto; }
@media (max-width: 560px) {
  .cap-quota-hint { margin-left: 0; flex-basis: 100%; }
}

/* ============ 分组文件：上传区 + 卡片网格（2.8.0） ============ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.upload-panel { margin-bottom: 20px; }
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 18px; border: 2px dashed var(--border-strong); border-radius: 12px;
  background: var(--panel-2); cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.drop-ico { font-size: 26px; color: var(--accent); line-height: 1; }
.drop-main { font-size: 14.5px; font-weight: 600; color: var(--text); }
.drop-hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.drop-exts { font-size: 11.5px; word-break: break-all; }

.upload-picked {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding: 9px 12px; border-radius: 9px;
  background: var(--bg-soft); border: 1px solid var(--border);
  font-size: 13px;
}
.upload-picked[hidden] { display: none !important; }
.upload-picked-name { font-weight: 600; word-break: break-all; }
.upload-picked-size { font-size: 12px; }
.upload-picked .btn { margin-left: auto; }

.file-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.file-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 14px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--border);
  color: inherit; transition: border-color .15s, box-shadow .15s, transform .1s;
  min-width: 0;
}
.file-card:hover {
  text-decoration: none; border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(16, 24, 40, .07);
}
.file-card-ico { font-size: 22px; line-height: 1.2; flex: none; width: 26px; text-align: center; }
.file-card-body { flex: 1; min-width: 0; }
.file-card-name {
  font-size: 14px; font-weight: 600; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-card-meta {
  margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}
.file-ext { font-family: var(--mono); font-size: 11px; text-transform: uppercase; }
.file-card-sub { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.file-card-go {
  flex: none; font-size: 12px; color: var(--accent);
  align-self: center; opacity: 0; transition: opacity .15s;
}
.file-card:hover .file-card-go { opacity: 1; }
@media (max-width: 620px) {
  .file-grid { grid-template-columns: 1fr; }
  .file-card-go { display: none; }
}

/* ============ 文件预览页（2.8.0） ============ */
.viewer { max-width: 1180px; margin-inline: auto; }
.viewer-head {
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
  justify-content: space-between; padding: 6px 0 0;
}
.viewer-title-wrap { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.viewer-title {
  font-size: 21px; font-weight: 680; letter-spacing: -.3px; margin: 0;
  line-height: 1.4; word-break: break-word;
}
.file-tag { align-self: flex-start; }
.viewer-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.viewer-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin: 10px 0 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}
.viewer-body { padding-bottom: 20px; }

/* 图片：居中、限制高度，点击可用浏览器缩放 */
.viewer-image-wrap {
  display: flex; justify-content: center; align-items: flex-start;
  padding: 8px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--border);
}
.viewer-image {
  max-width: 100%; max-height: 76vh; height: auto; border-radius: 6px;
  background: #fff; box-shadow: 0 2px 10px rgba(16, 24, 40, .1);
}

/* PDF：给足高度，短屏也别挤成一条 */
.viewer-pdf {
  width: 100%; height: min(78vh, 900px); min-height: 460px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft);
}
.viewer-tip { margin-top: 8px; font-size: 12.5px; text-align: center; }

/* 音视频 */
.viewer-media { width: 100%; border-radius: 12px; background: #000; }
.viewer-video .viewer-media { max-height: 76vh; }
.viewer-audio-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 32px 20px; border-radius: 12px;
  background: var(--bg-soft); border: 1px solid var(--border);
}
.viewer-audio-ico {
  width: 62px; height: 62px; border-radius: 50%; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.viewer-audio-wrap .viewer-media { max-width: 460px; background: transparent; }

/* 文本 / 代码 */
.viewer-textbar {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 8px;
  border-radius: 9px 9px 0 0; background: var(--bg-soft);
  border: 1px solid var(--border); border-bottom: 0;
  font-size: 12.5px; color: var(--muted);
}
.viewer-pre {
  margin: 0; padding: 16px 18px; max-height: 76vh; overflow: auto;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 0 0 10px 10px;
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  tab-size: 4; white-space: pre-wrap; word-break: break-word;
}

/* Office 渲染结果 */
.viewer-doc {
  padding: 30px 34px; border-radius: 12px; max-width: 100%;
  background: var(--panel); border: 1px solid var(--border);
  font-size: 14.6px; line-height: 1.8;
}
.viewer-doc p { margin: 0 0 12px; }
.viewer-doc .docx-h { line-height: 1.4; margin: 22px 0 10px; font-weight: 680; }
.viewer-doc h1.docx-h { font-size: 22px; }
.viewer-doc h2.docx-h { font-size: 19px; }
.viewer-doc h3.docx-h { font-size: 17px; }
.viewer-doc h4.docx-h, .viewer-doc h5.docx-h, .viewer-doc h6.docx-h { font-size: 15.5px; }
.viewer-doc .docx-gap { height: 6px; }
.viewer-doc .docx-table-wrap { overflow-x: auto; margin: 14px 0; }
.viewer-doc .docx-table {
  border-collapse: collapse; width: 100%; font-size: 13.6px;
}
.viewer-doc .docx-table th,
.viewer-doc .docx-table td {
  border: 1px solid var(--border-strong); padding: 7px 10px;
  text-align: left; vertical-align: top;
}
.viewer-doc .docx-table th { background: var(--bg-soft); font-weight: 660; }
.viewer-doc .xlsx-table td { font-variant-numeric: tabular-nums; }
.xlsx-sheet {
  margin: 22px 0 8px; font-size: 14.5px; font-weight: 660;
  padding-left: 9px; border-left: 3px solid var(--accent);
}

/* PPT：每页一张卡片 */
.pptx-slide {
  padding: 18px 20px; margin-bottom: 14px; border-radius: 11px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.pptx-num {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 8px;
}
.pptx-title { margin: 0 0 10px; font-size: 16.5px; font-weight: 680; line-height: 1.45; }
.pptx-body { margin: 0; padding-left: 20px; }
.pptx-body li { margin: 5px 0; line-height: 1.65; }

.viewer-warn {
  margin-bottom: 12px; padding: 9px 13px; border-radius: 9px;
  background: var(--mark); color: var(--mark-ink); font-size: 13px;
}
.viewer-fallback {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 52px 22px; text-align: center; border-radius: 12px;
  background: var(--bg-soft); border: 1px solid var(--border);
}
.viewer-fallback-ico { font-size: 34px; line-height: 1; }
.viewer-fallback h2 { margin: 0; font-size: 16px; font-weight: 660; }
.viewer-fallback p { margin: 0; max-width: 46ch; color: var(--text-2); font-size: 13.5px; line-height: 1.65; }

@media (max-width: 640px) {
  .viewer-doc { padding: 20px 16px; }
  .viewer-pdf { height: 68vh; min-height: 380px; }
}

/* ============ 外链视频（2.8.2） ============ */
.video-panel { margin-top: 18px; }
.video-list { display: flex; flex-direction: column; gap: 18px; }
.video-item { margin: 0; }
/* 16:9 用 padding-top 撑高，而不是写死 height：
   不同平台的 player 内部布局不同，等比容器能让它们都填满且不变形。 */
.video-frame {
  position: relative; width: 100%; padding-top: 56.25%;
  border-radius: 12px; overflow: hidden; background: #000;
  border: 1px solid var(--border);
}
.video-frame > iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
}
.video-plain {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 12px;
  background: var(--bg-soft); border: 1px dashed var(--border-strong);
}
.video-item figcaption { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; }
.video-title { font-weight: 600; color: var(--text); }

/* 编辑页里的视频清单与小表单 */
.video-mini { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 6px; }
.video-mini-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 10px; border-radius: 8px; background: var(--bg-soft);
  border: 1px solid var(--border);
}
.video-mini-title { flex: 1 1 200px; font-size: 13px; color: var(--text-2); word-break: break-all; }
.video-add { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.video-add label { flex: 1 1 260px; }

/* 面板内分隔线（分组设置里「保存说明」与「复制 / 迁移」之间） */
.panel-sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0 16px; }
