/* ============================================================================
 * 瓦鲁知识库 · 统一界面样式（企业蓝 #3070A0，浅色卡片化，中文界面）
 * 文件：js/app.css（由 index.html 与 pages/pXX.html 独立预览页共同引用）
 * 原生 CSS，无构建、无外部依赖。基础变量见 assets/tokens.css。
 * ========================================================================== */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

h1, h2, h3, h4 { font-weight: 600; }

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  background: #F2F4F7;
  border-radius: 4px;
  padding: 1px 5px;
  color: #344054;
}

/* --------------------------------------------------------------- 布局骨架 */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-head {
  height: var(--top-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.sidebar-head .brand-logo { height: 24px; width: auto; }
.sidebar-head .brand-name { font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.sidebar-head .brand-name small { display: block; font-size: 10px; color: var(--muted); font-weight: 400; letter-spacing: .06em; }

.nav-scroll { flex: 1; overflow-y: auto; padding: 12px 10px 18px; }
.nav-scroll::-webkit-scrollbar { width: 6px; }
.nav-scroll::-webkit-scrollbar-thumb { background: #D9DCE1; border-radius: 3px; }

.nav-group { margin-bottom: 14px; }
.nav-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 6px;
  font-size: 11px;
  letter-spacing: .08em;
  color: #98A2B3;
  font-weight: 600;
}
.nav-group-title::after { content: ""; flex: 1; height: 1px; background: #EEF0F3; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 8px;
  border-left: 3px solid transparent;
  color: #344054;
  font-size: 13.5px;
  line-height: 1.3;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: #F5F7F9; color: var(--brand-dark); }
.nav-item.active {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-left-color: var(--brand);
  font-weight: 600;
}
.nav-no {
  width: 18px;
  flex: 0 0 18px;
  text-align: right;
  font-size: 11px;
  color: #98A2B3;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-no { color: var(--brand); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-foot {
  flex: 0 0 auto;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
.sidebar-foot .foot-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 5px; }
.sidebar-foot .foot-dot.is-bad { background: var(--bad); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- 顶部栏 */
.topbar {
  height: var(--top-h);
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-logo { height: 26px; width: auto; display: none; }
.topbar-titles { display: flex; flex-direction: column; min-width: 0; }
.topbar-title { font-size: 15px; font-weight: 600; letter-spacing: .01em; line-height: 1.2; white-space: nowrap; }
.topbar-sub { font-size: 11px; color: var(--muted); line-height: 1.3; white-space: nowrap; }
.topbar-divider { width: 1px; height: 22px; background: var(--line); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.api-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #F9FAFB;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.api-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #98A2B3; flex: 0 0 auto; }
.api-pill.is-ok { background: #E7F6EC; border-color: #C4E8D1; color: #0A7F3F; }
.api-pill.is-ok .dot { background: var(--ok); }
.api-pill.is-bad { background: #FEF3F2; border-color: #FBD5D1; color: #B42318; }
.api-pill.is-bad .dot { background: var(--bad); }
.api-pill.is-warn { background: #FFFAEB; border-color: #FEDF89; color: #B54708; }
.api-pill.is-warn .dot { background: var(--warn); }

.icon-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #475467;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}
.user-chip:hover { border-color: var(--brand); }
.avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, #3070A0, #1F4E73);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-meta { text-align: left; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 10.5px; color: var(--muted); }
.chev { color: #98A2B3; font-size: 12px; margin-right: 2px; }

.user-pop { position: relative; }
.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 248px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
  display: none;
  z-index: 60;
}
.user-menu.open { display: block; }
.user-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu-head strong { display: block; font-size: 13px; }
.user-menu-head span { font-size: 11px; color: var(--muted); }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  font-size: 12.5px;
  color: #344054;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.user-menu-item:hover { background: #F5F7F9; }
.user-menu-item.is-disabled { color: var(--muted); cursor: default; }
.user-menu-item.is-disabled:hover { background: none; }

.hamburger { display: none; }

/* ------------------------------------------------------------------ 主内容 */
.main {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 24px 44px;
}

.api-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid #FEDF89;
  background: #FFFAEB;
  color: #93370D;
  font-size: 12.5px;
  line-height: 1.6;
}
.api-banner strong { color: #B54708; }
.api-banner code { background: rgba(255, 255, 255, .7); }
.api-banner-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #FEDF89;
  color: #93370D;
  font-weight: 700;
  font-size: 12px;
  margin-top: 1px;
}
.api-banner-body { flex: 1; min-width: 0; }
.api-banner .btn { flex: 0 0 auto; }

.page { min-height: 40vh; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-heading { min-width: 0; }
.page-eyebrow { font-size: 12px; color: var(--muted); margin-bottom: 5px; letter-spacing: .02em; }
.page-title { margin: 0; font-size: 21px; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; }
.page-sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.page-body { display: flex; flex-direction: column; gap: 16px; }
.page-body > .card, .page-body > .grid { margin-bottom: 0; }

.footer-note {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #98A2B3;
  font-size: 11.5px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* -------------------------------------------------------------------- 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.card-title { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); font-weight: 400; }
.card-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.card-foot .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 14px; }
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  overflow: hidden;
}
.stat-card.is-accent { border-top: 3px solid var(--brand); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 27px; font-weight: 650; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-value.is-null { color: #98A2B3; }
.stat-foot { font-size: 11.5px; color: var(--muted); }
.stat-foot .up { color: var(--ok); }
.stat-foot .down { color: var(--bad); }

/* -------------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: #fff; border-color: #D0D5DD; color: #344054; }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-subtle { background: var(--brand-light); border-color: transparent; color: var(--brand-dark); }
.btn-subtle:hover:not(:disabled) { background: #DCEAF5; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #912018; border-color: #912018; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-link {
  display: inline;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  font-family: inherit;
}
.btn-link:hover { color: var(--brand-dark); text-decoration: underline; }
.btn-link.is-danger { color: var(--bad); }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ------------------------------------------------------------------ 工具栏 */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* -------------------------------------------------------------------- 表单 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.label { font-size: 12.5px; font-weight: 500; color: #344054; }
.label .req { color: var(--bad); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #D0D5DD;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(48, 112, 160, .12);
}
.input[disabled], .select[disabled], .textarea[disabled] { background: #F9FAFB; color: var(--muted); }
.textarea { height: auto; min-height: 76px; padding: 8px 10px; line-height: 1.55; resize: vertical; }
.control { width: auto; min-width: 148px; }
.control-sm { width: auto; min-width: 104px; }
.help { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: #344054; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

.field-row { display: flex; align-items: center; gap: 8px; }
.field-row .input, .field-row .select { flex: 1; }

/* -------------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
.table thead th {
  text-align: left;
  padding: 9px 14px;
  background: #F9FAFB;
  border-bottom: 1px solid var(--line);
  color: #475467;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #F0F1F3;
  vertical-align: middle;
  color: var(--ink);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFBFC; }
.table .col-actions { text-align: right; white-space: nowrap; width: 1%; }
.table .col-actions .action-row { flex-wrap: nowrap; justify-content: flex-end; }
.table .col-actions .btn { flex: 0 0 auto; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .td-strong { font-weight: 500; }
.table .td-wrap { min-width: 200px; max-width: 420px; }
.cell-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.truncate { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: #475467;
}
.nowrap { white-space: nowrap; }

.copy-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #F2F4F7;
  color: #475467;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11.5px;
  cursor: pointer;
  vertical-align: middle;
}
.copy-chip:hover { background: var(--brand-light); border-color: #B2DDFF; color: var(--brand-dark); }
.copy-chip .copy-hint { opacity: .6; font-family: system-ui, sans-serif; }

/* -------------------------------------------------------------------- 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  background: #F2F4F7;
  color: #475467;
}
.badge-ok { background: #E7F6EC; color: #0A7F3F; }
.badge-warn { background: #FEF0C7; color: #B54708; }
.badge-bad { background: #FEE4E2; color: #B42318; }
.badge-brand { background: var(--brand-light); color: var(--brand-dark); }
.badge-muted { background: #F2F4F7; color: #667085; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: #F2F4F7;
  color: #475467;
  font-size: 11.5px;
}
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* -------------------------------------------------------------------- 标签页 */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }

/* ------------------------------------------------------------------ 状态卡片 */
.state-card { display: flex; align-items: flex-start; gap: 12px; padding: 18px; }
.state-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #F2F4F7;
  color: #667085;
  font-weight: 700;
  font-size: 14px;
}
.error-card .state-icon { background: #FEE4E2; color: var(--bad); }
.empty-card .state-icon { background: var(--brand-light); color: var(--brand); }
.state-main { min-width: 0; }
.state-main h3 { margin: 0 0 4px; font-size: 14px; }
.state-main p { margin: 0 0 4px; font-size: 13px; line-height: 1.55; color: #475467; }
.state-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.state-text { font-size: 13px; color: var(--muted); align-self: center; }
.spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 2px;
  border: 2px solid #D0D5DD;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: vkb-spin .8s linear infinite;
}
@keyframes vkb-spin { to { transform: rotate(360deg); } }
.spinner-inline { display: inline-block; width: 12px; height: 12px; border-width: 2px; margin: 0; vertical-align: -1px; animation: vkb-spin .8s linear infinite; }

/* -------------------------------------------------------------------- 模态框 */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 46px 16px;
  background: rgba(16, 24, 40, .44);
  overflow-y: auto;
  animation: vkb-fade .12s ease;
}
.modal {
  width: min(580px, 100%);
  max-height: calc(100vh - 92px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(16, 24, 40, .24);
  animation: vkb-pop .14s ease;
}
.modal-lg { width: min(900px, 100%); }
.modal-sm { width: min(400px, 100%); }
.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { flex: 1; margin: 0; font-size: 15px; }
.modal-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: #667085;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.modal-close:hover { background: #F2F4F7; color: var(--ink); }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.modal-foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}
.confirm-text { margin: 0; font-size: 13.5px; line-height: 1.6; color: #344054; }
@keyframes vkb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vkb-pop { from { opacity: 0; transform: translateY(-6px) scale(.99); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------------- Toast */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .16);
  font-size: 13px;
  color: #344054;
  animation: vkb-slide .16s ease;
  word-break: break-word;
}
.toast-bad { border-left-color: var(--bad); }
.toast-warn { border-left-color: var(--warn); }
.toast-icon { font-weight: 700; color: var(--ok); }
.toast-bad .toast-icon { color: var(--bad); }
.toast-warn .toast-icon { color: var(--warn); }
.toast-out { opacity: 0; transform: translateY(-4px); transition: opacity .2s ease, transform .2s ease; }
@keyframes vkb-slide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 排版辅助 */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono-inline { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.section-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.kv { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.action-row { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.inline-note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.warn-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 12px;
  border-radius: 8px;
  background: #FFFAEB;
  border: 1px solid #FEDF89;
  color: #93370D;
  font-size: 12.5px;
  line-height: 1.55;
}
.info-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--brand-light);
  border: 1px solid #CFE2F0;
  color: var(--brand-dark);
  font-size: 12.5px;
  line-height: 1.55;
}
.danger-note { background: #FEF3F2; border-color: #FBD5D1; color: #912018; }

/* -------------------------------------------------------------------- 树形 */
.tree { font-size: 13px; }
.tree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.tree-row:hover { background: #FAFBFC; border-color: var(--line); }
.tree-indent { flex: 0 0 auto; }
.tree-name { font-weight: 500; }
.tree-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; white-space: nowrap; }

/* -------------------------------------------------------------------- 问答 */
.answer-box {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 88px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FBFCFD;
  font-size: 13.5px;
  line-height: 1.75;
}
.ref-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ref-item { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: #fff; font-size: 12.5px; line-height: 1.55; }
.ref-item .ref-title { font-weight: 600; display: block; margin-bottom: 2px; }
.qa-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.qa-item + .qa-item { margin-top: 10px; }
.qa-q { margin: 0 0 6px; font-size: 13.5px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.qa-meta { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.qa-a { font-size: 12.5px; color: #475467; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.qa-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------ 独立预览页 */
body.standalone { background: var(--bg); }
.standalone-topbar { position: static; }
.standalone-wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 22px 24px 48px; }
.api-note { display: none; margin-bottom: 16px; padding: 10px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.6; }
.api-note-warn { display: block; background: #FFFAEB; border: 1px solid #FEDF89; color: #93370D; }
.api-note code { background: rgba(255, 255, 255, .7); }

/* ============================================================== 页面组件补充 */
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quick-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  transition: border-color .12s ease, background .12s ease;
}
.quick-link:hover { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
.quick-link strong { font-size: 13px; font-weight: 600; }
.quick-link span { font-size: 11.5px; color: var(--muted); }

.count-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 0 20px; }
.count-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed #EEF0F3;
  font-size: 12.5px;
}
.count-item .num { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }

.form-error {
  display: none;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid #FBD5D1;
  border-radius: 7px;
  background: #FEF3F2;
  color: #B42318;
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-word;
}
.form-error.show { display: block; }

.recommend-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid #CFE2F0;
  border-radius: 9px;
  background: var(--brand-light);
}
.recommend-box strong { font-size: 18px; color: var(--brand-dark); }
.tier-list { display: flex; flex-direction: column; gap: 6px; }
.tier-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FBFCFD;
  flex-wrap: wrap;
}
.tier-no {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid #CFE2F0;
  border-radius: 5px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 600;
}
.tier-item .tag { margin-right: 4px; }

.issue-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.issue-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #475467;
  font-size: 12.5px;
  line-height: 1.55;
}
.section-blocks { display: flex; flex-direction: column; gap: 12px; }
.section-block { padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #FBFCFD; }
.section-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.section-block-head h4 { margin: 0; font-size: 13.5px; }
.section-block-head .mono { color: #667085; }
.section-block .answer-box { min-height: 0; background: #fff; }
.section-block .help { margin: 6px 0 0; }
.section-editor { padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 9px; background: #FBFCFD; }
.section-editor-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.section-editor-head strong { font-size: 13px; }
.section-editor .textarea { min-height: 64px; margin-bottom: 8px; background: #fff; }
.section-editor .input { background: #fff; }

.page-body .card + .card { margin-top: 0; }
.grid > .card + .card { margin-top: 0; }
.grid > .stat-card + .stat-card { margin-top: 0; }

/* -------------------------------------------------------------------- 响应式 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(16, 24, 40, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 80;
    box-shadow: 0 12px 40px rgba(16, 24, 40, .2);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .sidebar-overlay { display: block; opacity: 1; pointer-events: auto; }
  .hamburger { display: inline-flex; }
  .topbar-logo { display: block; }
  .topbar { padding: 0 14px; }
  .topbar-sub { display: none; }
  .topbar-divider { display: none; }
  .main { padding: 16px 14px 34px; }
  .grid-2, .grid-3, .grid-2-1, .grid-1-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-backdrop { padding: 14px 10px; }
  .modal { max-height: calc(100vh - 28px); }
  .standalone-wrap { padding: 16px 14px 34px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .topbar-titles { display: none; }
  .topbar-logo { height: 24px; }
  .user-meta { display: none; }
  .user-chip { padding: 3px; }
  .api-pill span.api-text { display: none; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 19px; }
  .toolbar-right { margin-left: 0; width: 100%; }
}

/* ===== mobile-a: 外壳移动端补强（仅 ≤620px 生效，桌面端不受影响） ===== */
@media (max-width: 620px) {
  body { overflow-x: hidden; }
  .main { padding: 12px 10px 28px; }
  .page-body { gap: 12px; }
  .card-body { padding: 12px; }
  .page-header { padding: 10px 2px; }
  .table-wrap { max-width: 100%; }
}

/* ===== mobile-a: 平板/手机触摸尺寸（仅 ≤960px 生效，桌面端不受影响） ===== */
@media (max-width: 960px) {
  .btn, .btn-sm, .icon-btn, .select, .input, .tab, summary { min-height: 40px; }
  .icon-btn { min-width: 40px; }
  .user-chip { min-height: 40px; }
  .mono, code { word-break: break-all; overflow-wrap: anywhere; }
}
