/* ============================================================
   小喻子企业协同知识库系统 - 前台样式（v3 原型复刻版）
   设计依据：西安晓创原型图 —— 蓝色渐变头图 + 彩色圆角图标
   ============================================================ */
:root {
  --primary: #1a6ef5;
  --primary-deep: #0f56d0;
  --primary-soft: #e8f1ff;
  --bg: #f3f7fc;
  --card: #ffffff;
  --text: #1d2129;
  --text2: #4e5969;
  --muted: #86909c;
  --line: #e5e6eb;
  --line2: #f0f1f3;
  --green: #00b578;
  --green-soft: #e8f8f1;
  --orange: #ff8f1f;
  --orange-soft: #fff3e5;
  --purple: #7b61ff;
  --purple-soft: #f0edff;
  --cyan: #00b8d4;
  --red: #f53f3f;
  --red-soft: #ffece8;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 2px 8px rgba(26, 110, 245, .06);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
input, textarea, select, button { font: inherit; color: inherit; outline: none; }
.ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ============ 移动端容器 ============ */
.app { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--bg); padding-bottom: 70px; }
.app.no-tab { padding-bottom: 24px; }

/* 防御：前台任何图片都不得超出容器宽度（避免样式未就绪时原图撑爆布局） */
body.kb-front img { max-width: 100%; }

/* ============ 顶部栏（淡蓝渐变，同原型） ============ */
.topbar {
  background: linear-gradient(180deg, #d9e9ff 0%, rgba(217, 233, 255, 0) 100%);
  border-bottom: 0;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 700; color: var(--text); }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(26, 110, 245, .3);
}
.site-logo { width: 30px; height: 30px; border-radius: 9px; object-fit: contain; flex-shrink: 0; }
.top-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
.top-user .ava {
  width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
  border: 1px solid #c9daff;
}
.top-user .chev { color: var(--muted); }

/* 搜索框 */
.search-row { padding: 4px 16px 12px; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--card);
  border: 1px solid #dce7f7; border-radius: 20px; padding: 9px 14px;
  box-shadow: var(--shadow);
}
.search-box .ic { color: var(--muted); }
.search-box input { flex: 1; border: 0; background: transparent; font-size: 14px; color: var(--text); }
.search-box input::placeholder { color: var(--muted); }

/* ============ 首页蓝色渐变头图（知识资产概览） ============ */
.hero {
  margin: 2px 16px 0; border-radius: var(--radius-lg); padding: 18px 18px 46px;
  background: linear-gradient(135deg, #4f93ff 0%, #1a6ef5 100%);
  color: #fff; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
}
.hero::after {
  content: ""; position: absolute; right: -30px; top: -40px; width: 130px; height: 130px;
  border-radius: 50%; background: rgba(255, 255, 255, .1);
}
.hero-txt { position: relative; z-index: 1; }
.hero-txt b { display: block; font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.hero-txt p { font-size: 12px; opacity: .85; margin-top: 5px; max-width: 200px; }
.hero-illu { position: relative; z-index: 1; flex-shrink: 0; margin-left: 10px; }

/* 概览统计卡（叠压头图底部） */
.hero-stats {
  display: flex; margin: -28px 16px 0; position: relative; z-index: 2;
  background: var(--card); border-radius: var(--radius-lg); padding: 13px 0;
  box-shadow: 0 4px 16px rgba(26, 110, 245, .1);
}
.hstat { flex: 1; text-align: center; position: relative; }
.hstat + .hstat::before {
  content: ""; position: absolute; left: 0; top: 20%; height: 60%; width: 1px; background: var(--line2);
}
.hstat b { display: block; font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.3; }
.hstat span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ============ 卡片 / 区块 ============ */
.card {
  background: var(--card); border-radius: var(--radius-lg);
  margin: 12px 16px; padding: 14px;
  box-shadow: var(--shadow);
}
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sec-head h3 { font-size: 15px; font-weight: 700; }
.sec-head a { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; }

/* 快捷入口（四色圆角图标，同原型） */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.quick-item { text-align: center; padding: 6px 0; display: block; }
.quick-ico {
  width: 46px; height: 46px; border-radius: 14px; margin: 0 auto 7px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.quick-ico.q-blue   { background: linear-gradient(135deg, #4f93ff, #1a6ef5); box-shadow: 0 4px 10px rgba(26,110,245,.28); }
.quick-ico.q-green  { background: linear-gradient(135deg, #2ed9a3, #00b578); box-shadow: 0 4px 10px rgba(0,181,120,.28); }
.quick-ico.q-orange { background: linear-gradient(135deg, #ffb03a, #ff8f1f); box-shadow: 0 4px 10px rgba(255,143,31,.28); }
.quick-ico.q-purple { background: linear-gradient(135deg, #9a86ff, #7b61ff); box-shadow: 0 4px 10px rgba(123,97,255,.28); }
.quick-item span { font-size: 12px; color: var(--text2); }

/* 知识条目（彩色文档图标，按类型着色，同原型） */
.kb-item { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line2); }
.kb-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.kb-ico {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.kb-ico.t-zhidu   { background: linear-gradient(135deg, #4f93ff, #1a6ef5); box-shadow: 0 3px 8px rgba(26,110,245,.25); }
.kb-ico.t-sop     { background: linear-gradient(135deg, #2ed9a3, #00b578); box-shadow: 0 3px 8px rgba(0,181,120,.25); }
.kb-ico.t-jishu   { background: linear-gradient(135deg, #ffb03a, #ff8f1f); box-shadow: 0 3px 8px rgba(255,143,31,.25); }
.kb-ico.t-peixun  { background: linear-gradient(135deg, #9a86ff, #7b61ff); box-shadow: 0 3px 8px rgba(123,97,255,.25); }
.kb-ico.t-other   { background: linear-gradient(135deg, #8fa4bf, #64748c); box-shadow: 0 3px 8px rgba(100,116,140,.25); }
.kb-body { flex: 1; min-width: 0; }
.kb-title { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-desc { font-size: 12px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.kb-edit { font-size: 12px; color: var(--primary); cursor: pointer; flex-shrink: 0; }
.kb-edit:hover { text-decoration: underline; }
.kb-meta .time { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; font-size: 11px; color: var(--muted); }
.ava-xs {
  width: 18px; height: 18px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex-shrink: 0;
}
.tag { font-size: 11px; padding: 1px 8px; border-radius: 4px; line-height: 1.7; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.tag.t-zhidu { background: var(--primary-soft); color: var(--primary); }
.tag.t-sop { background: var(--green-soft); color: var(--green); }
.tag.t-jishu { background: var(--orange-soft); color: var(--orange); }
.tag.t-peixun { background: var(--purple-soft); color: var(--purple); }
.tag.t-other { background: #f2f3f5; color: var(--muted); }
.tag.dept { background: var(--primary-soft); color: var(--primary); }
.tag.st-0 { background: #f2f3f5; color: var(--muted); }
.tag.st-1 { background: var(--green-soft); color: var(--green); }
.tag.st-2 { background: var(--orange-soft); color: var(--orange); }
.tag.st-3 { background: var(--red-soft); color: var(--red); }

/* ============ 知识库页 ============ */
.type-tabs { display: flex; gap: 22px; padding: 14px 16px 0; overflow-x: auto; border-bottom: 1px solid var(--line2); margin: 0 0; background: var(--card); }
.type-tabs::-webkit-scrollbar { display: none; }
.type-tab {
  flex-shrink: 0; padding: 8px 2px 10px; font-size: 14px; color: var(--text2);
  border-bottom: 2.5px solid transparent; font-weight: 500;
}
.type-tab.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.cat-chips { display: flex; gap: 8px; padding: 12px 16px 0; overflow-x: auto; }
.cat-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; font-size: 12px; padding: 4px 13px; border-radius: 14px;
  background: var(--card); color: var(--text2); border: 1px solid var(--line); cursor: pointer;
}
.chip.on { color: #fff; border-color: var(--primary); background: var(--primary); }
.plain-search {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid #dce7f7;
  border-radius: 20px; padding: 9px 14px; margin: 12px 16px 0; box-shadow: var(--shadow);
}
.plain-search .ic { color: var(--muted); }
.plain-search input { flex: 1; border: 0; background: transparent; font-size: 14px; color: var(--text); }
.plain-search input::placeholder { color: var(--muted); }

/* ============ 详情页 ============ */
.detail-top { background: var(--card); padding: 16px; }
.detail-title { font-size: 18px; font-weight: 700; line-height: 1.45; }
.detail-meta { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.detail-meta .time { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.detail-body { padding: 6px 16px 16px; font-size: 14px; color: var(--text2); word-break: break-word; }
.detail-body p { margin: 8px 0; }
.detail-body strong { color: var(--primary); }
.attach-item {
  display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line);
  border-radius: var(--radius); margin-top: 8px; background: var(--card);
}
.attach-ico {
  width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.ext-pdf .attach-ico, .ext-pdf .pub-att-ico { background: linear-gradient(135deg, #ff6b6b, #f53f3f); }
.ext-doc .attach-ico, .ext-doc .pub-att-ico { background: linear-gradient(135deg, #4f93ff, #1a6ef5); }
.ext-xls .attach-ico, .ext-xls .pub-att-ico { background: linear-gradient(135deg, #2ed9a3, #00b578); }
.ext-ppt .attach-ico, .ext-ppt .pub-att-ico { background: linear-gradient(135deg, #ffb03a, #ff8f1f); }
.ext-img .attach-ico, .ext-img .pub-att-ico { background: linear-gradient(135deg, #9a86ff, #7b61ff); }
.ext-zip .attach-ico, .ext-zip .pub-att-ico { background: linear-gradient(135deg, #8fa4bf, #64748c); }
.ext-file .attach-ico, .ext-file .pub-att-ico { background: linear-gradient(135deg, #a6b4c8, #8a99b0); }
.attach-info { flex: 1; min-width: 0; }
.attach-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { font-size: 11px; color: var(--muted); }
.attach-dl { font-size: 12px; color: var(--primary); display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
.detail-acts {
  position: sticky; bottom: 60px; display: flex; gap: 10px; padding: 10px 16px;
  background: rgba(243, 247, 252, .92); backdrop-filter: blur(6px); z-index: 5;
}
.dbtn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 10px 0; border-radius: 20px; font-size: 13px; border: 1px solid var(--line);
  background: var(--card); color: var(--text2); cursor: pointer; box-shadow: var(--shadow);
}
.dbtn .ic { color: var(--muted); }
.dbtn.primary {
  background: linear-gradient(135deg, #4f93ff, #1a6ef5);
  border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(26,110,245,.3);
}
.dbtn.primary .ic { color: #fff; }
.dbtn.danger { color: var(--red); border-color: #ffd4cc; }
.dbtn.danger .ic { color: var(--red); }

/* ============ 表单 ============ */
.form-card { margin: 12px 16px; }
.f-group { margin-bottom: 14px; }
.f-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.f-label .req { color: var(--red); margin-left: 2px; }
.f-input, .f-select, .f-textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
  font-size: 14px; background: #fafbfd; transition: border .15s; color: var(--text);
}
.f-input:focus, .f-select:focus, .f-textarea:focus { border-color: var(--primary); background: #fff; }
.f-textarea { min-height: 160px; resize: vertical; line-height: 1.7; }
.logo-field { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-preview { width: 168px; height: 56px; border: 1px solid var(--line); border-radius: var(--radius); background: #fafbfd; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 8px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview .logo-empty { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.logo-actions { flex: 1; min-width: 260px; }
.logo-actions input[type="file"] { width: 100%; font-size: 13px; color: var(--text2); }
.logo-actions .tip { font-size: 12px; color: var(--muted); }
.seg-row { display: flex; gap: 10px; flex-wrap: wrap; }
.seg {
  padding: 7px 18px; border-radius: 17px; font-size: 13px; background: #f2f3f5;
  color: var(--text2); border: 1px solid transparent; cursor: pointer; user-select: none;
}
.seg.on { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; box-shadow: 0 3px 8px rgba(26,110,245,.28); }
.seg-row.radio-seg input { display: none; }
.btn-main {
  display: block; width: 100%; padding: 12px; border: 0; border-radius: 24px;
  background: linear-gradient(135deg, #4f93ff, #1a6ef5); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 14px rgba(26,110,245,.3);
}
.btn-main:active { background: var(--primary-deep); }
.btn-ghost {
  display: block; width: 100%; padding: 11px; border-radius: 24px; text-align: center;
  background: var(--card); border: 1px solid var(--line); color: var(--text2); font-size: 14px;
  cursor: pointer; margin-top: 10px;
}
.upload-box {
  border: 1.5px dashed #b9d2f7; border-radius: var(--radius); padding: 18px; text-align: center;
  color: var(--primary); font-size: 13px; cursor: pointer; background: #f5f9ff;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.upload-box .ic { color: var(--primary); }
.upload-box:active { background: var(--primary-soft); }
.pub-att { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 8px; font-size: 13px; background: var(--card); }
.pub-att .att-del { margin-left: auto; color: var(--muted); font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.pub-att-ico {
  width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.pub-att-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-row { display: flex; align-items: center; justify-content: space-between; }
.sw { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.sw input { opacity: 0; width: 100%; height: 100%; position: absolute; z-index: 2; cursor: pointer; margin: 0; }
.sw i { position: absolute; inset: 0; background: #d6dee9; border-radius: 13px; transition: .2s; }
.sw i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.sw input:checked + i { background: var(--primary); }
.sw input:checked + i::after { transform: translateX(20px); }
.collab-list { display: flex; flex-wrap: wrap; gap: 8px; }
.collab-item {
  display: flex; align-items: center; gap: 5px; padding: 4px 10px 4px 4px; border-radius: 16px;
  background: #f2f3f5; font-size: 12px; color: var(--text2); cursor: pointer;
}
.collab-item input { display: none; }
.collab-item .cava {
  width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600;
}
.collab-item.on { background: var(--primary-soft); color: var(--primary); }
.collab-item.on .cava { background: var(--primary); color: #fff; }

/* ============ 我的 / 个人中心 ============ */
.me-head {
  background: linear-gradient(135deg, #4f93ff 0%, #1a6ef5 100%); color: #fff;
  padding: 24px 16px 42px; display: flex; align-items: center; gap: 14px; position: relative;
}
a.me-head-link { text-decoration: none; color: #fff; cursor: pointer; }
a.me-head-link:hover { filter: brightness(1.04); }
.me-edit-hint { margin-left: auto; font-size: 13px; font-weight: 500; opacity: .9; }
.me-head::after {
  content: ""; position: absolute; right: -34px; top: -50px; width: 150px; height: 150px;
  border-radius: 50%; background: rgba(255,255,255,.1);
}
.me-head .avatar {
  width: 58px; height: 58px; border-radius: 50%; background: #fff; color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 23px; font-weight: 700;
  flex-shrink: 0; border: 2px solid rgba(255,255,255,.5); position: relative; z-index: 1;
}
.me-head .avatar.s { width: 34px; height: 34px; font-size: 13px; border-width: 0; }
.me-info { flex: 1; min-width: 0; position: relative; z-index: 1; }
.me-info h2 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: #fff; }
.me-info p { font-size: 12px; opacity: .85; margin-top: 3px; }
.badge-admin { font-size: 10px; background: rgba(255,255,255,.22); color: #fff; padding: 1px 8px; border-radius: 8px; font-weight: 600; }
.me-stats {
  display: flex; margin: -26px 16px 0; position: relative; z-index: 2;
  background: var(--card); border-radius: var(--radius-lg); padding: 13px 0;
  box-shadow: 0 4px 16px rgba(26,110,245,.1);
}
.me-stats a { flex: 1; text-align: center; display: block; position: relative; }
.me-stats a + a::before { content: ""; position: absolute; left: 0; top: 18%; height: 64%; width: 1px; background: var(--line2); }
.me-stats b { display: block; font-size: 19px; color: var(--text); }
.me-stats span { font-size: 11px; color: var(--muted); }
.menu-list { background: var(--card); border-radius: var(--radius-lg); margin: 12px 16px; overflow: hidden; box-shadow: var(--shadow); }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line2); font-size: 14px; color: var(--text); }
.menu-item:last-child { border-bottom: 0; }
.menu-ico {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; color: #fff; flex-shrink: 0;
}
.menu-ico.mi-blue   { background: linear-gradient(135deg, #4f93ff, #1a6ef5); }
.menu-ico.mi-green  { background: linear-gradient(135deg, #2ed9a3, #00b578); }
.menu-ico.mi-orange { background: linear-gradient(135deg, #ffb03a, #ff8f1f); }
.menu-ico.mi-purple { background: linear-gradient(135deg, #9a86ff, #7b61ff); }
.menu-ico.mi-cyan   { background: linear-gradient(135deg, #22d3e0, #00b8d4); }
.menu-ico.mi-red    { background: linear-gradient(135deg, #ff6b6b, #f53f3f); }
.menu-item .arrow { margin-left: auto; color: #c9cdd4; display: inline-flex; }
.menu-item .m-extra { margin-left: auto; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.menu-item .arrow + .m-extra, .menu-item .m-extra + .arrow { margin-left: 0; }

/* ============ 通知 / 公告 ============ */
.notice-item { padding: 12px 0; border-bottom: 1px solid var(--line2); }
.notice-item:last-child { border-bottom: 0; }
.notice-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--text); }
.dot-unread { width: 7px; height: 7px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
.notice-time { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notice-body { font-size: 13px; color: var(--text2); margin-top: 4px; }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  max-width: 520px; margin: 0 auto; background: var(--card); border-top: 1px solid var(--line2);
  display: flex; padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(29, 33, 41, .05);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.tabbar a .ti { font-size: 20px; line-height: 1.2; display: flex; height: 28px; align-items: center; justify-content: center; }
.tabbar a.on { color: var(--primary); font-weight: 600; }
.tabbar a.on .ti { transform: translateY(-1px); }
.tab-pub .ti {
  width: 28px; height: 28px; margin: 0; border-radius: 50%;
  background: #e9edf3; color: #98a2b3;
  display: flex; align-items: center; justify-content: center;
}
/* 仅当选中发布页时圆钮才显示蓝色 */
.tab-pub.on .ti {
  background: linear-gradient(135deg, #4f93ff, #1a6ef5); color: #fff;
  box-shadow: 0 3px 10px rgba(26,110,245,.35);
}
.tab-pub .ti .ic { width: 16px; height: 16px; }
.tab-pub .tl { color: var(--muted); }
.tab-pub.on { color: var(--primary); font-weight: 600; }
.tab-pub.on .tl { color: var(--primary); }

/* ============ 登录注册 ============ */
.auth-wrap { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.auth-hero { background: linear-gradient(150deg, #4f93ff 0%, #1a6ef5 60%, #0f56d0 100%); color: #fff; padding: 46px 24px 34px; text-align: center; }
.auth-hero .logo { width: 52px; height: 52px; border-radius: 14px; background: rgba(255,255,255,.18); color: #fff; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; border: 1px solid rgba(255,255,255,.3); }
.auth-hero .auth-logo-img {
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: 14px;
  background: transparent; border: 0; padding: 0; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
}
.auth-hero .auth-logo-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.auth-hero h1 { font-size: 21px; font-weight: 700; }
.auth-hero p { font-size: 13px; opacity: .85; margin-top: 6px; }
.auth-card { margin: -18px 16px 0; background: var(--card); border-radius: var(--radius-lg); padding: 20px; box-shadow: 0 4px 20px rgba(26,110,245,.1); position: relative; }
.auth-foot { text-align: center; font-size: 12px; color: var(--muted); margin: 20px 0; }
.auth-foot a { color: var(--primary); }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 18px 2px 2px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line2); }
.btn-wechat { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 24px; padding: 12px; font-size: 15px; font-weight: 600; color: #fff; background: #07c160; text-decoration: none; margin-top: 12px; cursor: pointer; }
.btn-wechat:hover { background: #06ad56; }
.btn-wechat .ic { color: #fff; }

/* 登录 / 注册：整屏蓝色背景，白色卡片居中并与蓝色标题区自然衔接 */
body.auth-page { background: linear-gradient(165deg, #4f93ff 0%, #1a6ef5 42%, #0f56d0 100%); }
body.auth-page .app { background: transparent; max-width: none; padding-bottom: 0; }
body.auth-page .auth-wrap { max-width: 520px; background: transparent; }
body.auth-page .auth-hero { background: transparent; padding-top: 64px; padding-bottom: 30px; }
body.auth-page .auth-card {
  margin: -16px auto 36px;
  width: 440px;
  max-width: calc(100% - 32px);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(10, 40, 90, .28);
}

/* 后台登录页：无蓝色标题区（浅色页面 + 深色标题 + 白卡） */
body.adm-login-page { background: var(--bg); }
body.adm-login-page .auth-wrap { background: transparent; }
body.adm-login-page .auth-hero { background: transparent; padding: 56px 24px 4px; }
body.adm-login-page .auth-hero .logo {
  background: var(--primary-soft); color: var(--primary); border-color: transparent;
}
body.adm-login-page .auth-hero h1 { color: var(--text); font-size: 22px; }
body.adm-login-page .auth-hero p { color: var(--muted); opacity: 1; }
body.adm-login-page .auth-card {
  margin: 20px 16px 0;
  box-shadow: 0 8px 28px rgba(29, 33, 41, .08);
}

/* 微信登录（圆形图标入口式） */
.wechat-entry { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 18px; text-decoration: none; }
.wechat-circle {
  width: 58px; height: 58px; border-radius: 50%; background: #07c160;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.wechat-entry:hover .wechat-circle { background: #06ad56; }
.wechat-label { font-size: 14px; color: #4e5969; }

/* 用户头像（图片填充） */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; overflow: hidden; flex-shrink: 0;
  background: #eef1f6; color: var(--primary); vertical-align: middle;
}
.ava img, .avatar img, .ava-xs img, .ava-tbl img, .ava-prev img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block;
}

/* 头像选择器（个人设置） */
.ava-picker { display: flex; align-items: center; gap: 14px; }
.ava-prev {
  width: 56px; height: 56px; border-radius: 50%; background: #eef1f6; color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700;
  overflow: hidden; border: 1px solid var(--line2); flex-shrink: 0;
}
.ava-picker-ops { display: flex; flex-direction: column; gap: 6px; }
.ava-tip { font-size: 11px; color: var(--muted); }

/* ============ 消息 / 分页 / 空状态 ============ */
.msg-tip { margin: 12px 16px 0; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; }
.msg-ok { background: var(--green-soft); color: #008a5c; }
.msg-err { background: var(--red-soft); color: #c22f2f; }
.pager { display: flex; gap: 8px; justify-content: center; padding: 18px 0 6px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); font-size: 13px; color: var(--text2); }
.pager .cur { background: var(--primary); color: #fff; border-color: var(--primary); }
.empty { text-align: center; padding: 46px 0; color: var(--muted); font-size: 13px; }
.empty .e-ico { font-size: 36px; margin-bottom: 8px; color: var(--line); display: flex; justify-content: center; }
.empty .e-ico .ic { color: #c9d7ec; }
.page-title { padding: 16px 16px 4px; font-size: 17px; font-weight: 700; text-align: center; }

/* toast */
#toast {
  position: fixed; left: 50%; top: 18%; transform: translateX(-50%) translateY(-10px);
  background: rgba(20, 30, 50, .88); color: #fff; font-size: 13px; padding: 10px 18px;
  border-radius: 8px; z-index: 999; opacity: 0; pointer-events: none; transition: .25s; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 管理后台（保持企业克制风，不随前台变色） ============ */
.adm { display: flex; min-height: 100vh; max-width: 1280px; margin: 0 auto; background: #f4f5f7; }
.adm-side {
  width: 212px; flex-shrink: 0; background: #fff; border-right: 1px solid #e5e6eb;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.adm-logo { padding: 18px 18px; color: #1d2129; font-size: 15px; font-weight: 700; border-bottom: 1px solid #e5e6eb; display: flex; align-items: center; gap: 9px; }
.adm-logo .logo { width: 28px; height: 28px; border-radius: 7px; background: #2563eb; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.adm-logo-img { width: 28px; height: 28px; border-radius: 7px; object-fit: contain; flex-shrink: 0; }
.adm-logo span { color: #2563eb; }
.adm-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.adm-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px;
  font-size: 14px; margin-bottom: 2px; color: #4e5969;
}
.adm-nav a.on, .adm-nav a:hover { background: #eff4ff; color: #2563eb; }
.adm-nav a .ni { font-size: 17px; width: 20px; display: flex; align-items: center; justify-content: center; color: #86909c; }
.adm-nav a.on .ni, .adm-nav a:hover .ni { color: #2563eb; }
.adm-foot { padding: 14px; font-size: 12px; border-top: 1px solid #e5e6eb; }
.adm-foot a { color: #86909c; display: inline-flex; align-items: center; gap: 4px; }
.adm-main { flex: 1; min-width: 0; background: #f4f5f7; }
.adm-topbar {
  background: #fff; padding: 13px 22px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid #e5e6eb; position: sticky; top: 0; z-index: 20;
}
.adm-topbar h2 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.adm-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #4e5969; }
.adm-user .avatar.s { width: 30px; height: 30px; font-size: 12px; background: #e5e6eb; color: #4e5969; font-weight: 600; }
/* 顶栏账号 hover 下拉 */
.adm-user-dd { position: relative; }
.adm-user-btn {
  display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer;
  font-size: 13px; color: #4e5969; padding: 5px 8px; border-radius: 8px; transition: background .15s;
}
.adm-user-btn:hover { background: #f2f3f5; }
.adm-user-btn .dd-caret { display: inline-flex; color: #86909c; transition: transform .15s; }
.adm-user-dd:hover .dd-caret { transform: rotate(180deg); }
.adm-dd-menu {
  position: absolute; top: calc(100% + 4px); right: 0; min-width: 148px;
  background: #fff; border: 1px solid #e5e6eb; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(29, 33, 41, .12); padding: 6px; z-index: 80;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.adm-user-dd:hover .adm-dd-menu, .adm-user-dd:focus-within .adm-dd-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.adm-dd-menu a {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-radius: 8px; color: #1d2129; font-size: 13px; text-decoration: none;
}
.adm-dd-menu a:hover { background: #f2f6ff; color: #2563eb; }
.adm-content { padding: 20px 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border: 1px solid #e5e6eb; border-radius: 10px; padding: 16px; display: flex; align-items: center; gap: 14px; }
.stat-ico { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #2563eb; background: #eff4ff; flex-shrink: 0; }
.stat-num { font-size: 22px; font-weight: 700; line-height: 1.2; color: #1d2129; }
.stat-lab { font-size: 12px; color: #86909c; }
.adm-panel { background: #fff; border: 1px solid #e5e6eb; border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.adm-panel h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.adm-panel h3 .ic { color: #86909c; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th { text-align: left; padding: 9px 10px; background: #fafbfc; color: #4e5969; font-weight: 600; white-space: nowrap; border-bottom: 1px solid #e5e6eb; }
.adm-table td { padding: 10px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; color: #1d2129; }
.adm-table tr:hover td { background: #fafbfc; }
.ava-tbl {
  width: 34px; height: 34px; border-radius: 50%; background: #eef1f6; color: #4e5969;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; overflow: hidden; vertical-align: middle;
}
.tbl-acts a, .tbl-acts button { font-size: 12px; margin-right: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 16px; border-radius: 7px; font-size: 13px; border: 1px solid #e5e6eb;
  background: #fff; color: #1d2129; cursor: pointer;
}
.btn .ic { color: #86909c; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary .ic { color: #fff; }
.btn.green { background: #009a4d; border-color: #009a4d; color: #fff; }
.btn.orange { background: #c8730e; border-color: #c8730e; color: #fff; }
.btn.red { background: #d4380d; border-color: #d4380d; color: #fff; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.adm-filter { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.adm-filter input, .adm-filter select { border: 1px solid #e5e6eb; border-radius: 7px; padding: 7px 10px; font-size: 13px; background: #fff; }
.inline-form { display: inline; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.check-line { padding: 9px 12px; border: 1px solid #e5e6eb; border-radius: 8px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.adm-alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.adm-alert.msg-ok { background: #e9f7ef; color: #00803f; }
.adm-alert.msg-err { background: #fdecea; color: #b5290a; }

@media (max-width: 860px) {
  .adm-side { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: .25s; height: 100vh; }
  .adm-side.open { transform: translateX(0); }
  .adm-topbar { padding: 11px 14px; }
  .adm-topbar .menu-toggle { display: flex; background: none; border: 0; font-size: 20px; cursor: pointer; margin-right: 10px; color: #1d2129; align-items: center; }
  .adm-content { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .adm-table { display: block; overflow-x: auto; white-space: nowrap; }
}
.menu-toggle { display: none; }

@media (max-width: 420px) {
  .brand { font-size: 16px; }
  .hstat b { font-size: 18px; }
  .kb-title { white-space: normal; }
  .quick-ico { width: 42px; height: 42px; border-radius: 12px; }
}

/* ============================================================
   PC 宽屏适配（≥768px）
   手机端：保持现有移动端小界面（上面所有默认样式）。
   PC 宽屏：内容多栏宽版居中，导航保持底部横条（同移动端）。
   通过纯 CSS 媒体查询自动切换，无需 JS。
   仅作用于真实前台（body.kb-front），避免影响静态预览页。
   ============================================================ */
@media (min-width: 768px) {
  /* 登录/注册页保持整屏蓝色背景（auth-page），不受此浅色背景影响 */
  body.kb-front:not(.auth-page) { background: #eef2f7; }

  /* 内容区居中收敛为宽版布局，底部为导航条留出空间 */
  body.kb-front .app:not(.no-tab) {
    max-width: 1180px; margin: 0 auto; min-height: 100vh;
    padding-bottom: 78px; background: transparent;
  }

  /* 底部导航：与移动端同款横条，铺满屏宽并加高适配 PC */
  body.kb-front .tabbar {
    max-width: none; padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 16px rgba(29, 33, 41, .07);
  }
  body.kb-front .tabbar a { gap: 4px; font-size: 12px; }
  /* 图标槽位统一高度且居中，保证四个菜单图标垂直对齐，不再高的高矮的矮 */
  body.kb-front .tabbar a .ti { height: 30px; align-items: center; justify-content: center; }
  body.kb-front .tabbar a.on .ti { transform: none; }
  /* 发布按钮完全收进底部菜单栏内，与其它图标同高对齐 */
  body.kb-front .tab-pub .ti { width: 30px; height: 30px; margin: 0; font-size: 18px; }
  body.kb-front .tab-pub .ti .ic { width: 18px; height: 18px; }

  /* 内容块在宽屏下居中收敛，避免无限拉伸 */
  body.kb-front .topbar-inner, body.kb-front .search-row, body.kb-front .hero, body.kb-front .hero-stats,
  body.kb-front .card, body.kb-front .page-title, body.kb-front .type-tabs, body.kb-front .cat-chips,
  body.kb-front .plain-search, body.kb-front .msg-tip, body.kb-front .pager,
  body.kb-front .me-head, body.kb-front .me-stats, body.kb-front .menu-list {
    margin-left: auto; margin-right: auto; max-width: 1180px;
  }

  /* 知识条目列表 → 自适应多栏网格 */
  body.kb-front .kb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
  body.kb-front .kb-item {
    border: 1px solid var(--line2); border-radius: 12px; padding: 14px;
    background: var(--card); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
  }
  body.kb-front .kb-item:last-child { border-bottom: 1px solid var(--line2); padding-bottom: 14px; }
  body.kb-front .kb-item:hover { border-color: var(--primary); box-shadow: 0 6px 18px rgba(26, 110, 245, .14); }

  /* 首页快捷入口略放大 */
  body.kb-front .quick-grid { gap: 12px; }
  body.kb-front .quick-ico { width: 54px; height: 54px; border-radius: 16px; }

  /* 表单类卡片（发布 / 个人设置）收敛宽度，避免输入行过长 */
  body.kb-front .form-card { max-width: 760px; }

  /* 详情页阅读宽度收敛，正文更易读 */
  /* 详情页宽度响应式：大屏下与内容区同宽（≤1180px），消除两侧大面积空白 */
  body.kb-front .detail-top { max-width: 1180px; margin-left: auto; margin-right: auto; }
  body.kb-front .detail-body { max-width: none; padding: 6px 24px 24px; font-size: 15px; line-height: 1.9; }
  /* 按钮区跟随内容宽度居中，与移动端视觉统一 */
  body.kb-front .detail-acts { max-width: 1180px; margin: 12px auto 0; bottom: 14px; }
}
