/* 云书知识库 — 现代简洁 SaaS 风格（见 DESIGN.md） */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #1f2329;
  --ink-2: #8f959e;
  --ink-3: #bbbfc4;
  --line: #e5e6eb;
  --primary: #3370ff;
  --primary-hover: #245bdb;
  --primary-soft: #ebf2ff;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --warning: #b54708;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button { font-family: inherit; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: #fff;
  border: 1px solid var(--primary); border-radius: 8px;
  padding: 8px 16px; font-size: 13.5px; font-weight: 500; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
  transition: background .16s ease-out, border-color .16s ease-out, color .16s ease-out, box-shadow .16s ease-out;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(51, 112, 255, .18); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); color: var(--primary); border-color: #d0d3d9; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f2d5d2; }
.btn-danger:hover { background: var(--danger-soft); color: #b42318; border-color: #f2d5d2; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #b42318; border-color: #b42318; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.icon-btn {
  border: none; background: none; cursor: pointer; color: var(--ink-2);
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease-out, color .15s ease-out;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }

.badge {
  font-style: normal; font-size: 11px; font-weight: 500; border-radius: 999px; padding: 2px 9px;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap;
}
.badge-muted { background: #f2f3f5; color: var(--ink-2); }
.badge-warn { background: #fef4e8; color: var(--warning); }
.badge-green { background: #e8f6ee; color: #12805c; }
/* 权限标签：浅蓝底蓝字小标签（参考站点卡片权限样式） */
.badge-perm { border-radius: 4px; padding: 2px 8px; font-size: 12px; }

/* 卡片内的分类标签：浅灰小标签，hover 变浅蓝提示可点击筛选 */
.badge-cat {
  appearance: none; -webkit-appearance: none; outline: none;
  border: none; cursor: pointer; font-family: inherit; font-style: normal;
  background: #f2f3f5; color: var(--ink-2);
  border-radius: 4px; padding: 1px 8px; font-size: 11px; font-weight: 500;
  line-height: 18px; margin-left: 2px; white-space: nowrap; vertical-align: middle;
  transition: background .14s, color .14s;
}
.badge-cat:hover { background: var(--primary-soft); color: var(--primary); }

/* 分类 tab 栏 */
.cat-tabs {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.cat-tabs-main {
  display: flex; gap: 2px; min-width: 0;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.cat-tabs-main::-webkit-scrollbar { display: none; height: 0; width: 0; }
.cat-tab {
  padding: 9px 14px; font-size: 14px; color: var(--ink-2); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; transition: color .15s;
}
.cat-tab:hover { color: var(--ink); }
.cat-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.cat-tab-count {
  font-size: 11.5px; color: var(--ink-3); background: #f2f3f5;
  border-radius: 999px; padding: 1px 7px;
}
.cat-tab.active .cat-tab-count { color: var(--primary); background: var(--primary-soft); }
.cat-manage-btn { flex: none; margin-bottom: 4px; }

/* 分类管理弹窗 */
.cat-add { display: flex; gap: 10px; }
.cat-add input { flex: 1; min-width: 0; }
.cat-add .btn { flex: none; }
.cat-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 320px; overflow-y: auto; }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.cat-item:last-child { border-bottom: none; }
.cat-item-name {
  font-size: 14px; font-weight: 500; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat-item-count { font-size: 12px; color: var(--ink-2); flex: none; }
.cat-item-acts { display: flex; gap: 2px; flex: none; }
.cat-del { color: var(--danger); }
.cat-empty { text-align: center; color: var(--ink-2); font-size: 13px; padding: 20px 0 8px; }
.field-tip { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; }

.user-chip-btn { cursor: pointer; transition: background .15s ease-out; border-radius: 999px; }
.user-chip-btn:hover { background: var(--primary-soft); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: #4e5969; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=email], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font-size: 14px; color: var(--ink);
  background: var(--surface); outline: none; font-family: inherit;
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 112, 255, .12);
}
textarea { resize: vertical; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.inline-form input[type=text], .inline-form select { padding: 5px 8px; font-size: 13px; width: auto; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }

.flash { border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; border: 1px solid transparent; }
.flash-success { background: var(--primary-soft); color: var(--primary-hover); border-color: #d7e6f5; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: #f6dcd9; }

.muted { color: var(--ink-2); font-size: 13px; margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 4px; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(8px);
  background: rgba(31, 35, 41, .92); color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: 8px; z-index: 120;
  opacity: 0; transition: opacity .2s ease-out, transform .2s ease-out; pointer-events: none;
  box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 顶部导航（标准页，内容居中与正文同宽留白） ---------- */
.topbar {
  padding: 0 22px;
  background: rgba(255, 255, 255, .9); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 25;
}
.topbar-in { display: flex; align-items: center; gap: 18px; height: 54px; max-width: 1180px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15.5px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand-badge {
  width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a { padding: 7px 14px; border-radius: 7px; color: #4e5969; text-decoration: none; font-size: 15px; transition: background .15s, color .15s; }
.topbar-nav a:hover { background: var(--primary-soft); color: var(--primary); }
.topbar-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 550; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.container { max-width: 1180px; margin: 0 auto; padding: 28px 22px 64px; }

/* ---------- 首页项目卡片 ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.proj-card {
  display: flex; flex-direction: column;
  transition: border-color .16s ease-out, box-shadow .16s ease-out;
}
.proj-card:hover { border-color: #d3d9e3; box-shadow: var(--shadow-md); }
.proj-card-main { display: block; flex: 1; padding: 18px 18px 0; color: var(--ink); text-decoration: none; }
.proj-card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.proj-tile {
  width: 40px; height: 40px; border-radius: 9px; background: var(--primary); color: #fff;
  font-weight: 600; font-size: 17px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.proj-card-title { min-width: 0; }
.proj-card-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.proj-card-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.proj-card-stats { font-size: 12px; color: var(--ink-2); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.proj-card-desc {
  font-size: 13px; color: var(--ink-2); min-height: 38px; overflow: hidden; margin-bottom: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.proj-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--ink-2); border-top: 1px solid var(--line); padding: 8px 12px 8px 18px;
}
.proj-time { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-acts { display: inline-flex; gap: 8px; flex-shrink: 0; }
.empty { padding: 60px 20px; text-align: center; color: var(--ink-2); }
.bare-icon {
  width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 13px;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: none; align-items: flex-start; justify-content: center; z-index: 1100;
  padding: 15vh 16px 16px; overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal {
  width: 440px; max-width: 100%; padding: 20px 22px; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease-out;
}
.modal.modal-sm { width: 380px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body { font-size: 14px; color: #4e5969; line-height: 1.7; }
.modal-body.modal-body-text { padding: 2px 0 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-x {
  border: none; background: none; color: var(--ink-2); cursor: pointer;
  width: 28px; height: 28px; border-radius: 7px; margin-right: -6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-x:hover { background: var(--bg); color: var(--ink); }
.modal-input { margin-bottom: 4px; }
.modal-error { display: none; color: var(--danger); font-size: 12.5px; margin-top: 8px; }
.modal-error.show { display: block; }

/* 媒体插入弹窗（图片/视频：本地上传 + 网络地址） */
.mtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.mtab {
  padding: 7px 12px; font-size: 13.5px; color: var(--ink-2); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; transition: color .15s;
}
.mtab:hover { color: var(--ink); }
.mtab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.mupload {
  border: 1.5px dashed var(--line); border-radius: 8px; padding: 26px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background-color .15s; color: var(--ink-3);
}
.mupload:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.mupload svg { width: 26px; height: 26px; margin-bottom: 6px; }
.mupload-text { font-size: 13.5px; color: var(--ink); }
.mupload-hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.mfile {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 13px;
}
.mfile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mfile-x {
  border: none; background: none; color: var(--ink-2); cursor: pointer; flex: none;
  width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
}
.mfile-x:hover { background: var(--bg); color: var(--ink); }

/* ---------- 居中页（登录 / 密码 / 404） ---------- */
.page-bare { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.bare-wrap { width: 100%; max-width: 400px; }
.bare-card { padding: 30px 28px; border-radius: 14px; }
.bare-card h1 { font-size: 20px; text-align: center; margin: 10px 0 6px; letter-spacing: -.01em; font-weight: 650; }
.bare-card .muted { text-align: center; margin-bottom: 18px; }
.brand-large { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 650; font-size: 19px; letter-spacing: -.01em; margin-bottom: 6px; }
.bare-foot { text-align: center; font-size: 12px; margin-top: 16px; }

/* ---------- 安装向导 ---------- */
.install-wrap { max-width: 560px; }
.install-card { padding: 28px 30px; border-radius: 14px; }
.install-h2 { font-size: 15px; margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.check-list { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.check-list li { padding: 5px 0; display: flex; align-items: center; gap: 8px; }
.check-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.check-list li.ok { color: var(--ink); } .check-list li.ok .check-dot { background: var(--primary); }
.check-list li.fail { color: var(--danger); } .check-list li.fail .check-dot { background: var(--danger); }
.check-list li.warn { color: var(--warning); } .check-list li.warn .check-dot { background: var(--warning); }
.install-done { text-align: center; }
.install-done h2 { margin: 10px 0 6px; }
.install-nginx { text-align: left; margin-top: 18px; font-size: 13px; color: var(--ink-2); }
.install-nginx pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 12.5px; }
.mysql-fields { display: none; }

/* ---------- 知识库阅读布局 ---------- */
.page-kb { background: var(--surface); }
.kb { display: flex; min-height: 100vh; }
.kb-overlay { display: none; }
.kb-side {
  width: 280px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--line);
  height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column;
}
.kb-side-head { display: flex; gap: 10px; padding: 16px 16px 14px; align-items: center; border-bottom: 1px solid var(--line); }
.proj-meta { min-width: 0; }
.proj-name { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-stats { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.lock-badge { color: var(--ink-2); margin-left: auto; display: flex; }

.kb-search {
  position: relative; display: flex; align-items: center; gap: 6px;
  margin: 12px 14px; padding: 0 10px;
  background: var(--bg); border: 1px solid transparent; border-radius: 8px; color: var(--ink-2);
  transition: background .15s, border-color .15s;
}
.kb-search:focus-within { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(51, 112, 255, .1); }
.kb-search input { flex: 1; min-width: 0; border: none; background: transparent; padding: 9px 0; outline: none; font-size: 13.5px; color: var(--ink); }
.kb-search input:focus { box-shadow: none; }
.kb-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-height: 320px; overflow: auto; display: none; z-index: 30;
}
.kb-search-results.show { display: block; }
.sr-item { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); text-decoration: none; }
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--primary-soft); }
.sr-item b { display: block; font-size: 13.5px; font-weight: 550; color: var(--ink); margin-bottom: 2px; }
.sr-item span { font-size: 12px; color: var(--ink-2); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 14px; text-align: center; color: var(--ink-2); font-size: 13px; }

.kb-nav { flex: 1; overflow-y: auto; padding: 2px 10px 16px; }
.kb-cat-head { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; font-weight: 600; color: #4e5969; padding: 12px 8px 8px; }
.kb-cat-head .icon-btn { width: 34px; height: 34px; }
.kb-cat-head .icon-btn svg { width: 17px; height: 17px; }
.kb-cat-empty { padding: 16px 8px; color: var(--ink-2); font-size: 13px; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { margin-left: 10px; padding-left: 8px; border-left: 1px solid var(--line); }
.tree-row {
  display: flex; align-items: center; border-radius: 7px; padding: 2px 4px 2px 0;
  position: relative; transition: background .14s ease-out;
}
.tree-row:hover { background: #f2f7ff; }
.tree-item.active > .tree-row { background: var(--primary-soft); }
.tree-item.active > .tree-row::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2.5px;
  border-radius: 2px; background: var(--primary);
}
.tree-item.active > .tree-row .tree-link { color: var(--primary); font-weight: 600; }
.tree-toggle {
  width: 24px; height: 30px; border: none; background: none; color: var(--ink-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: transform .18s ease-out;
}
.tree-item.collapsed > .tree-row .tree-toggle { transform: rotate(-90deg); }
.tree-item.collapsed > .tree { display: none; }
.tree-indent { width: 24px; flex-shrink: 0; }
.tree-link {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #4e5969; text-decoration: none; font-size: 14px; padding: 7px 0;
}
.tree-link:hover { color: var(--primary); }
.tree-actions { display: none; gap: 3px; padding-right: 2px; }
.tree-row:hover .tree-actions { display: inline-flex; }
.tree-actions button {
  width: 28px; height: 28px; border: none; background: none; color: var(--ink-2); cursor: pointer;
  border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  transition: background .14s, color .14s;
}
.tree-actions button svg { width: 15px; height: 15px; }
.tree-actions button:hover { color: var(--primary); background: var(--primary-soft); }
@media (hover: none) { .tree-actions { display: inline-flex; } }

.kb-side-foot { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.kb-side-foot a { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); text-decoration: none; padding: 5px 4px; border-radius: 6px; transition: color .14s, background .14s; }
.kb-side-foot a:hover { color: var(--primary); background: var(--primary-soft); }
.kb-power { font-size: 12px; color: var(--ink-2); padding: 5px 4px; }

.kb-main { flex: 1; min-width: 0; background: var(--surface); }
.kb-topbar { display: none; }
/* 内容栏：左右留足侧边距，阅读态正文与编辑态编辑器同宽 1080px */
.kb-content { max-width: 1280px; margin: 0 auto; padding: 40px 64px 96px; transition: opacity .12s ease-out; }
.kb-content.is-loading { opacity: .5; pointer-events: none; }
.doc-view { max-width: 1080px; margin: 0 auto; }
.doc-editor { max-width: 1080px; margin: 0 auto; }

.doc-title { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.35; margin: 0 0 10px; }
.doc-meta {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  color: var(--ink-2); font-size: 12.5px;
  padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 26px;
}
.doc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.doc-edit-link {
  color: var(--primary); text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
  font-weight: 500; cursor: pointer;
}
.doc-edit-link:hover { color: var(--primary-hover); }
button.doc-edit-link {
  border: none; background: none; padding: 0; font: inherit; font-size: 12.5px;
  margin-left: auto;
}
.doc-copy-link {
  appearance: none; -webkit-appearance: none; border: none; background: none; padding: 0;
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--primary); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.doc-meta .doc-copy-last { margin-left: auto; }
.doc-copy-link:hover { color: var(--primary-hover); }
.kb-empty { text-align: center; padding: 90px 0; color: var(--ink-2); }
.kb-empty p { margin: 14px 0 18px; }

/* 文档排版（阅读正文 16px / 1.85） */
.doc-body { font-size: 16px; line-height: 1.85; color: #3c4047; word-wrap: break-word; }
.doc-body h2 { font-size: 21px; color: var(--ink); margin: 30px 0 12px; letter-spacing: -.01em; font-weight: 650; }
.doc-body h3 { font-size: 17.5px; color: var(--ink); margin: 24px 0 10px; font-weight: 600; }
.doc-body h4 { font-size: 15.5px; color: var(--ink); margin: 20px 0 8px; }
.doc-body p, .doc-body ul, .doc-body ol { margin: 12px 0; }
.doc-body ul, .doc-body ol { padding-left: 1.5em; }
.doc-body li { margin: 4px 0; }
.doc-body img { max-width: 100%; border-radius: 8px; }
.doc-body blockquote {
  border-left: 3px solid var(--primary); background: var(--primary-soft);
  padding: 10px 16px; border-radius: 0 8px 8px 0; margin: 16px 0; color: #3c4047;
}
.doc-body blockquote p { margin: 4px 0; }
.doc-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.doc-body th, .doc-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.doc-body th { background: var(--bg); font-weight: 600; }
.doc-body code { background: var(--bg); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
.doc-body pre { background: #23272e; color: #e8e6e3; padding: 14px 16px; border-radius: 8px; overflow-x: auto; }
.doc-body pre code { background: none; border: none; color: inherit; padding: 0; }
.doc-body a { text-decoration: none; border-bottom: 1px solid rgba(51, 112, 255, .35); }
.doc-body a:hover { border-bottom-color: var(--primary); }
.doc-body hr { border: none; border-top: 1px solid var(--line); margin: 28px 0; }

/* ---------- 右侧内联编辑器 ---------- */
.doc-editor { display: none; }
.doc-doc.is-editing .doc-view { display: none; }
.doc-doc.is-editing .doc-editor { display: block; }
.doc-editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.doc-editor-title {
  flex: 1; min-width: 0; border: 1px solid transparent; outline: none; background: transparent;
  font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--ink);
  padding: 6px 8px; border-radius: 8px; line-height: 1.35;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.doc-editor-title:hover { border-color: var(--line); }
.doc-editor-title:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(51, 112, 255, .12); background: var(--surface); }
.doc-editor-bar { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
.doc-editor-status { font-size: 12.5px; color: var(--ink-2); margin-right: auto; }
#inlineToolbar {
  border: 1px solid var(--line); border-bottom: none; border-radius: 10px 10px 0 0; overflow: hidden;
  position: sticky; top: 10px; z-index: 20; background: var(--surface); box-shadow: var(--shadow-xs);
}
#inlineEditor { min-height: 55vh; cursor: text; border: 1px solid var(--line); border-radius: 0 0 10px 10px; }
#inlineEditor .w-e-text-container [data-slate-editor] { font-size: 16px; line-height: 1.85; padding-bottom: 120px; }
.doc-editor-loading { padding: 60px 0; text-align: center; color: var(--ink-2); font-size: 13.5px; }
/* wangEditor 浮层层级保险：确保上传/网络图片面板与弹窗不被遮挡 */
.w-e-panel, .w-e-modal, .w-e-hover-bar, .w-e-toolbar-tooltip { z-index: 500 !important; }
.doc-body video, #inlineEditor video { max-width: 100%; border-radius: 8px; }

/* 自定义媒体菜单图标与内置菜单等大 */
#inlineToolbar .w-e-bar-item button svg,
#toolbar-container .w-e-bar-item button svg { display: block; }

/* ---------- 编辑器全屏：重置页面容器的宽度/圆角/吸顶限制 ---------- */
.doc-editor.w-e-full-screen-container {
  z-index: 1000 !important;
  background: var(--surface);
  max-width: none !important;
  margin: 0 !important;
  padding: 18px 48px 20px !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
}
.doc-editor.w-e-full-screen-container .doc-editor-title {
  flex: none; background: var(--surface) !important;
}
.doc-editor.w-e-full-screen-container .doc-editor-bar { flex: none; }
.doc-editor.w-e-full-screen-container #inlineToolbar {
  position: static !important;
  margin-top: 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px 10px 0 0 !important;
  box-shadow: none !important;
  flex: none !important;
  overflow: visible !important;
}
.doc-editor.w-e-full-screen-container #inlineToolbar .w-e-toolbar { flex-wrap: wrap; }
.doc-editor.w-e-full-screen-container #inlineEditor {
  min-height: 0 !important;
  height: 0 !important;
  border: 1px solid var(--line) !important;
  border-top: none !important;
  border-radius: 0 0 10px 10px !important;
  flex: 1 1 auto !important;
  overflow: hidden;
}
.doc-editor.w-e-full-screen-container #inlineEditor .w-e-scroll { overflow-y: auto; }

/* ---------- 设置页 ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.settings-card { padding: 20px 22px; }
.settings-card h2 { font-size: 15.5px; font-weight: 600; margin: 0 0 14px; }
.danger-card { grid-column: 1 / -1; border-color: #f2d5d2; }
.share-status {
  font-size: 13px; color: var(--ink-2);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 14px;
}
.share-status.on { background: var(--primary-soft); border-color: #d7e6f5; color: var(--primary-hover); }

/* ---------- 管理页布局（站点配置 / 角色管理） ---------- */
.admin-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.admin-grid .card { padding: 20px 22px; }
.card-title { font-size: 15.5px; font-weight: 600; margin: 0 0 14px; }
.card-hint { font-size: 12.5px; color: var(--ink-2); margin: -6px 0 12px; line-height: 1.6; }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.ta-r { text-align: right; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 400; color: var(--ink); padding: 5px 0; cursor: pointer; }
.check-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); flex-shrink: 0; }
.proj-scope { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; max-height: 220px; overflow: auto; background: var(--surface); }
.proj-scope.is-disabled { opacity: .45; pointer-events: none; }
.proj-scope .muted { margin-top: 4px; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--ink-2); font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.table td .btn { margin-right: 4px; }
.table tr:last-child td { border-bottom: none; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-actions { white-space: nowrap; }

/* ---------- 升级页 ---------- */
.ver-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.ver-card { padding: 18px; text-align: center; }
.ver-num { font-size: 26px; font-weight: 700; color: var(--primary); letter-spacing: -.02em; }

/* ---------- 独立编辑器页（兜底保留） ---------- */
.page-edit { background: var(--surface); }
.edit-wrap { max-width: 900px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.edit-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.edit-title { flex: 1; min-width: 0; border: none; outline: none; font-size: 19px; font-weight: 600; color: var(--ink); background: transparent; padding: 6px 0; letter-spacing: -.01em; }
.edit-status { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
#toolbar-container {
  border-bottom: 1px solid var(--line);
  position: sticky; top: 53px; z-index: 20; background: var(--surface);
}
#editor-container { flex: 1; min-height: calc(100vh - 160px); cursor: text; }
#editor-container .w-e-text-container [data-slate-editor] { font-size: 16px; line-height: 1.85; padding-bottom: 120px; }

/* ---------- H5 适配（≤900px） ---------- */
@media (max-width: 900px) {
  .kb-side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
    width: 280px; max-width: 84vw;
    transform: translateX(-100%); transition: transform .24s ease-out;
    height: 100vh;
  }
  .kb-side.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .kb-overlay {
    display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    opacity: 0; pointer-events: none; transition: opacity .24s ease-out; z-index: 35;
  }
  .kb-overlay.show { opacity: 1; pointer-events: auto; }
  .kb-topbar {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(8px); z-index: 20;
  }
  .kb-topbar-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kb-content { padding: 22px 18px 64px; }
  .doc-title { font-size: 23px; }
  .doc-editor-title { font-size: 20px; }

  .container { padding: 18px 14px 48px; }
  .settings-grid { grid-template-columns: 1fr; }
  .ver-cards { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .topbar-in { gap: 10px; }
  .user-chip .user-name, .user-chip .badge { display: none; }
  .topbar-nav a { padding: 6px 8px; }
  .edit-title { font-size: 16px; }
  #toolbar-container { top: 51px; overflow-x: auto; }
  #inlineToolbar { top: 52px; }
  .doc-editor.w-e-full-screen-container { padding: 14px 14px 16px !important; }
}
