* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f8fc;
  color: #2c3e50;
  line-height: 1.7;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: #fff;
  border-bottom: 1px solid #e6eef8;
  position: sticky; top: 0; z-index: 100;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { font-size: 18px; font-weight: 700; color: #1e40af; }
.topnav a { margin-left: 18px; font-size: 14px; color: #475569; }

.footer {
  background: #fff; border-top: 1px solid #e6eef8; margin-top: 40px;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 20px 24px;
  text-align: center; color: #94a3b8; font-size: 13px;
}

/* home */
.home-main { max-width: 1200px; margin: 0 auto; padding: 30px 24px; }
.hero { text-align: center; padding: 30px 0 20px; }
.hero h1 { font-size: 30px; color: #1e3a8a; margin-bottom: 10px; }
.hero p { color: #64748b; }
.home-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 20px;
}
.card {
  background: #fff; border-radius: 14px; padding: 22px;
  box-shadow: 0 2px 12px rgba(37,99,235,0.06);
  border: 1px solid #eaf1fb;
}
.card-title { font-size: 18px; color: #1e40af; margin-bottom: 12px; border-left: 4px solid #3b82f6; padding-left: 10px; }

/* tree */
.tree-list { list-style: none; }
.tree-node { margin: 2px 0; min-width: 0; }
.tree-row { display: flex; align-items: center; min-width: 0; }
.tree-toggle {
  background: #eaf1ff; border: 1px solid #c9dcff; cursor: pointer;
  font-size: 11px; line-height: 1;
  width: 20px; height: 20px; border-radius: 6px;
  color: #4f6bff; flex: 0 0 auto; text-align: center;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease;
  padding: 0;
}
.tree-toggle:hover { background: #d6e4ff; }
.tree-spacer { width: 14px; display: inline-block; flex: 0 0 auto; }
.tree-link { font-size: 14px; padding: 3px 6px; border-radius: 6px; white-space: nowrap; display: inline-block; vertical-align: middle; }
.tree-link:hover { background: #eff6ff; }
.tree-link.active { background: #dbeafe; color: #1e40af; font-weight: 600; }
.tree-children.hidden { display: none; }
.tree-children { min-width: 0; }

/* article layout */
.layout {
  max-width: 1200px; margin: 0 auto; padding: 24px;
  display: grid; grid-template-columns: 320px 1fr; gap: 24px;
}
.sidebar {
  background: #fff; border-radius: 14px; padding: 16px;
  border: 1px solid #eaf1fb; max-height: calc(100vh - 100px);
  overflow-y: auto; position: sticky; top: 80px;
}
.side-chapter { margin-bottom: 14px; }
.side-chapter-title {
  font-weight: 700; color: #1e40af; font-size: 14px;
  padding: 6px 8px; background: #eff6ff; border-radius: 8px; margin-bottom: 6px;
}
.article-card {
  background: #fff; border-radius: 14px; padding: 30px 36px;
  border: 1px solid #eaf1fb;
  box-shadow: 0 2px 12px rgba(37,99,235,0.06);
}
.article-title { font-size: 26px; color: #1e3a8a; margin-bottom: 20px; }

/* markdown */
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 18px 0 10px; color: #1e3a8a; }
.markdown-body p { margin: 10px 0; }
.markdown-body img { max-width: 100%; border-radius: 8px; }
.markdown-body code {
  background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px;
}
.markdown-body pre {
  background: #1e293b; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow-x: auto;
}
.markdown-body pre code { background: none; color: inherit; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.markdown-body th, .markdown-body td { border: 1px solid #e2e8f0; padding: 8px 12px; }
.markdown-body th { background: #f8fafc; }
.markdown-body blockquote {
  border-left: 4px solid #93c5fd; background: #f0f7ff; padding: 8px 14px; margin: 12px 0;
  border-radius: 0 8px 8px 0;
}
.markdown-body ul, .markdown-body ol { padding-left: 24px; }

.pager {
  display: flex; justify-content: space-between; margin-top: 30px;
  padding-top: 18px; border-top: 1px solid #eef2f7;
}

/* login */
.login-wrap { max-width: 400px; margin: 60px auto; }
.login-card {
  background: #fff; padding: 30px; border-radius: 14px;
  border: 1px solid #eaf1fb; box-shadow: 0 2px 16px rgba(37,99,235,0.08);
}
.login-title { text-align: center; color: #1e3a8a; margin-bottom: 18px; }
.login-error { background: #fef2f2; color: #dc2626; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.login-label { display: block; font-size: 13px; color: #64748b; margin: 10px 0 4px; }
.login-input {
  width: 100%; padding: 10px 12px; border: 1px solid #dbe4f0; border-radius: 8px;
  font-size: 14px; outline: none;
}
.login-input:focus { border-color: #3b82f6; }
.login-btn {
  width: 100%; margin-top: 18px; padding: 11px; background: #2563eb; color: #fff;
  border: none; border-radius: 8px; font-size: 15px; cursor: pointer;
}
.login-btn:hover { background: #1d4ed8; }

/* admin */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.admin-head h1 { color: #1e3a8a; font-size: 24px; }
.admin-actions, .admin-chapter-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 7px 14px; border-radius: 8px; font-size: 13px;
  background: #fff; border: 1px solid #dbe4f0; color: #334155; cursor: pointer;
}
.btn:hover { background: #f1f5f9; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.hidden { display: none !important; }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.inline-form input { padding: 6px 10px; border: 1px solid #dbe4f0; border-radius: 6px; font-size: 13px; }
.admin-warn { background: #fffbeb; color: #b45309; padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.admin-chapter {
  background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 16px;
  border: 1px solid #eaf1fb;
}
.admin-chapter-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.admin-chapter-head h2 { color: #1e40af; font-size: 17px; }
.admin-tree { list-style: none; margin-top: 12px; }
.admin-node { padding: 6px 0; border-bottom: 1px dashed #eef2f7; }
.admin-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.admin-path { color: #94a3b8; font-size: 12px; background: #f8fafc; padding: 1px 6px; border-radius: 4px; }
.admin-title { font-weight: 600; }
.admin-node-actions { margin-left: 10px; }
.admin-sub { list-style: none; padding-left: 24px; }

/* edit form */
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.md-editor {
  width: 100%; border: 1px solid #dbe4f0; border-radius: 8px; padding: 10px;
  font-family: Menlo, Consolas, monospace; font-size: 13px; margin-top: 4px;
}
.edit-actions { margin-top: 14px; }
.preview-label { font-size: 13px; color: #64748b; margin-bottom: 6px; }
.preview-box {
  background: #f8fafc; border-radius: 8px; padding: 16px; min-height: 400px;
  border: 1px solid #eef2f7; overflow-y: auto;
}

/* responsive */
@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .edit-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .article-card { padding: 20px; }
}

/* doc-children 子文档列表：靠左、不换行、紧凑 */
.doc-children { margin: 24px 0 8px; }
.doc-children-title {
  font-size: 16px; font-weight: 700; color: #1e3a8a;
  margin: 0 0 12px; padding-left: 10px; border-left: 4px solid #3b82f6;
}
.doc-children-list {
  list-style: none; margin: 0; padding: 0;
}
.doc-children-list li {
  margin: 6px 0; min-width: 0;
}
.doc-child-link {
  display: block; color: #2563eb; font-size: 14px;
  text-decoration: none; padding: 6px 10px; border-radius: 8px;
  white-space: nowrap; text-align: left;
}
.doc-child-link:hover { background: #eff6ff; color: #1e40af; }

/* ===== 图片编辑弹窗 ===== */
.img-edit-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 99999;
}
.img-edit-modal.open { display: block; }
.img-edit-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(15,23,42,0.6);
}
.img-edit-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(920px, 94vw);
  max-height: 92vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15,23,42,0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.img-edit-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #eef2f7;
  font-size: 16px; font-weight: 600; color: #1e3a8a;
}
.img-edit-close {
  background: none; border: none;
  font-size: 24px; line-height: 1;
  color: #64748b; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px;
}
.img-edit-close:hover { background: #f1f5f9; color: #1e293b; }
.img-edit-toolbar {
  display: flex; gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid #eef2f7;
  flex-wrap: wrap;
}
.tool-btn {
  padding: 7px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}
.tool-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.img-edit-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.img-edit-canvas-wrap {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  overflow: auto;
  max-height: 52vh;
}
.img-edit-canvas-wrap canvas {
  max-width: 100%;
  max-height: 50vh;
  background: #fff;
  touch-action: none;
}
.img-edit-controls .ctrl-row { margin: 6px 0; }
.img-edit-controls label { font-size: 13px; color: #334155; }
.img-edit-controls input[type=range] { width: 100%; }
.img-edit-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #eef2f7;
  flex-wrap: wrap;
}
.img-edit-footer .btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}
.img-edit-footer .btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.img-edit-footer .btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
@media (max-width: 600px) {
  .img-edit-panel {
    width: 96vw;
    max-height: 94vh;
  }
  .img-edit-toolbar { padding: 10px 12px; }
  .img-edit-body { padding: 12px; }
  .img-edit-footer { padding: 10px 12px; }
}

/* 编辑页返回按钮 */
.back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.back-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.admin-head { display: flex; align-items: center; gap: 12px; }
.admin-head h1 { margin: 0; }

/* ===== 首页 · 未来科技感 ===== */
.home-main { max-width: 1200px; margin: 0 auto; padding: 30px 24px 50px; }

/* Hero 区 */
.hero-tech {
  position: relative;
  border-radius: 22px;
  padding: 44px 40px 38px;
  text-align: center;
  background: linear-gradient(135deg, #eef4ff 0%, #f4f0ff 45%, #eaf7ff 100%);
  border: 1px solid rgba(99,132,255,0.18);
  overflow: hidden;
  margin-bottom: 34px;
}
.hero-grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(96,130,255,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96,130,255,0.07) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 90% 90% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 90% at 50% 0%, #000 40%, transparent 100%);
  pointer-events: none;
}
.hero-glow {
  position: absolute; border-radius: 50%; filter: blur(70px);
  opacity: 0.55; pointer-events: none;
}
.hero-glow-1 { width: 320px; height: 320px; background: #7aa8ff; top: -120px; left: -60px; }
.hero-glow-2 { width: 280px; height: 280px; background: #b39aff; bottom: -120px; right: -40px; }
.hero-content { position: relative; z-index: 2; }
.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  font-size: 12px; letter-spacing: 2px; color: #5b6cff;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(99,132,255,0.35);
  border-radius: 999px;
  margin-bottom: 18px;
  box-shadow: 0 2px 12px rgba(99,132,255,0.15);
}
.hero-title {
  font-size: 40px; font-weight: 800; line-height: 1.25;
  color: #101c3f; margin: 0 0 14px;
  letter-spacing: 1px;
}
.hero-accent {
  background: linear-gradient(90deg, #4f6bff, #8b5cf6);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-sub { font-size: 15px; color: #5a6b8c; line-height: 1.8; margin: 0 0 26px; }
.hero-stats { display: flex; justify-content: center; gap: 44px; flex-wrap: wrap; }
.stat-item { display: flex; flex-direction: column; align-items: center; }
.stat-num {
  font-size: 28px; font-weight: 800; color: #3347d6;
  background: rgba(255,255,255,0.7);
  padding: 6px 18px; border-radius: 12px;
  border: 1px solid rgba(99,132,255,0.25);
  box-shadow: 0 4px 16px rgba(99,132,255,0.12);
}
.stat-label { font-size: 12px; color: #6b7a9c; margin-top: 8px; letter-spacing: 1px; }

/* 章节卡片 */
.home-grid-tech {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  align-items: start;
}
.card-tech {
  background: #fff;
  border: 1px solid #e6ecf8;
  border-radius: 18px;
  padding: 20px 18px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  box-shadow: 0 2px 10px rgba(37,99,235,0.05);
  position: relative;
  overflow: hidden;
}
.card-tech::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #4f6bff, #8b5cf6, #38bdf8);
  opacity: 0; transition: opacity .25s ease;
}
.card-tech:hover {
  transform: translateY(-4px);
  border-color: rgba(99,132,255,0.45);
  box-shadow: 0 12px 32px rgba(79,107,255,0.14);
}
.card-tech:hover::before { opacity: 1; }
.card-tech-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.card-tech-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(190,208,255,0.6));
  border: 1px solid rgba(120,150,255,0.4);
  color: var(--icon-color);
  flex: 0 0 auto;
}
.card-tech-title { font-size: 17px; font-weight: 700; color: #1e2c54; margin: 0; }
.card-tech-count { font-size: 12px; color: #8b99b8; }
.card-tech-body .tree-list { margin: 0; }
.card-tech-body .tree-children { transition: none; }
.card-tech-body .tree-link { color: #40537f; }
.card-tech-body .tree-link:hover { color: #3347d6; }

@media (max-width: 640px) {
  .home-grid-tech { grid-template-columns: 1fr; }
  .hero-tech { padding: 38px 22px 32px; }
  .hero-title { font-size: 28px; }
  .hero-stats { gap: 22px; }
  .stat-num { font-size: 22px; }
}

/* 搜索结果页 */
.search-page { max-width: 860px; margin: 0 auto; padding: 30px 24px 60px; }
.search-title { font-size: 22px; color: #1e3a8a; margin-bottom: 8px; }
.search-count { color: #64748b; font-size: 13px; margin-bottom: 16px; }
.search-results { display: flex; flex-direction: column; gap: 10px; }
.search-item {
  display: block; background: #fff; border: 1px solid #eaf1fb; border-radius: 12px;
  padding: 14px 18px; text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-item:hover { border-color: #93c5fd; box-shadow: 0 4px 14px rgba(37,99,235,0.08); }
.search-item-title { font-size: 15px; font-weight: 600; color: #1e40af; }
.search-tag { font-size: 11px; color: #b45309; background: #fffbeb; padding: 1px 8px; border-radius: 999px; margin-left: 8px; }
.search-item-path { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.search-empty { color: #64748b; font-size: 14px; padding: 30px 0; }

/* 汉堡按钮（手机端显示） */
.hamburger-btn {
  display: none; position: fixed; top: 14px; right: 14px; z-index: 1001;
  width: 42px; height: 42px; border-radius: 10px;
  background: #2563eb; color: #fff; border: none; font-size: 20px;
  cursor: pointer; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 999;
  background: rgba(15,23,42,0.45);
}
.sidebar-overlay.show { display: block; }

@media (max-width: 900px) {
  .hamburger-btn { display: inline-flex; }
  .layout { grid-template-columns: 1fr; padding-top: 8px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
    width: 300px; max-width: 82vw; max-height: 100vh;
    border-radius: 0 16px 16px 0; padding: 64px 16px 20px;
    transform: translateX(-100%); transition: transform .22s ease;
    overflow-y: auto; background: #fff;
  }
  .sidebar.open { transform: translateX(0); }
  body.sidebar-open { overflow: hidden; }
  .top-search { max-width: none; flex-basis: 100%; order: 3; margin: 8px 12px 0; }
  .topbar-inner { flex-wrap: wrap; }
}

/* ===== 科技感搜索框 ===== */
.top-search {
  position: relative; display: flex; align-items: center;
  max-width: 340px; flex: 1 1 220px;
  background: linear-gradient(135deg, #eef4ff, #f7faff);
  border: 1px solid #cdddf7; border-radius: 24px;
  padding: 0 6px 0 12px; height: 42px;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.top-search:focus-within {
  border-color: #6ea8ff; background: #fff;
  box-shadow: 0 0 0 3px rgba(110,168,255,.18), 0 8px 24px -8px rgba(59,130,246,.35);
}
.top-search .search-ico { width: 16px; height: 16px; color: #7b96c9; flex: none; }
.top-search input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-size: 14px; color: #1e3a5f; padding: 8px 10px;
}
.top-search input::placeholder { color: #a3b7d6; }
.top-search .search-btn {
  flex: none; border: none; cursor: pointer;
  background: linear-gradient(135deg, #4f8df9, #6a5cf5);
  color: #fff; font-size: 13px; border-radius: 18px;
  height: 32px; padding: 0 16px;
  transition: box-shadow .25s, transform .15s;
  box-shadow: 0 4px 12px -2px rgba(79,141,249,.45);
}
.top-search .search-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -2px rgba(79,141,249,.55); }

/* ===== 联想下拉面板 ===== */
.suggest-panel {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 1200;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid #dbe7fb; border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(30,64,120,.25);
  max-height: 380px; overflow-y: auto;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.suggest-panel.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.suggest-group {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: #4f6fa5;
  padding: 9px 14px 4px; letter-spacing: .5px;
}
.sg-dot { width: 6px; height: 6px; border-radius: 50%; background: linear-gradient(135deg,#4f8df9,#6a5cf5); box-shadow: 0 0 6px rgba(79,141,249,.6); }
.suggest-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 26px; color: #22355c; font-size: 13.5px;
  text-decoration: none; position: relative; transition: background .15s;
}
.suggest-item .si-ico { color: #7b96c9; flex: none; }
.suggest-item .si-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .si-tag {
  flex: none; font-size: 10px; color: #6a5cf5;
  border: 1px solid #cfc8fb; background: #f1effe;
  border-radius: 8px; padding: 1px 7px;
}
.suggest-item:hover { background: linear-gradient(90deg, rgba(79,141,249,.08), rgba(106,92,245,.06)); }
.suggest-item.active {
  background: linear-gradient(90deg, rgba(79,141,249,.14), rgba(106,92,245,.10));
}
.suggest-item.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  border-radius: 2px; background: linear-gradient(180deg,#4f8df9,#6a5cf5);
}
.suggest-empty { padding: 22px 14px; text-align: center; color: #93a7c8; font-size: 13px; }

/* 手机端联想面板跟随搜索框宽度 */
@media (max-width: 900px) {
  .top-search { max-width: none; }
  .suggest-panel { max-height: 320px; }
}

/* ===== 前端内联编辑器（管理员） ===== */
.article-title-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.article-title-row h1 { margin-bottom: 0; }
.inline-edit-btn {
  flex: none; border: none; cursor: pointer;
  background: linear-gradient(135deg, #4f8df9, #6a5cf5);
  color: #fff; font-size: 13px; font-weight: 500;
  border-radius: 20px; height: 34px; padding: 0 16px;
  box-shadow: 0 4px 12px -2px rgba(79,141,249,.45);
  transition: transform .15s, box-shadow .25s;
}
.inline-edit-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -2px rgba(79,141,249,.55); }

.ie-modal {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(15,23,42,.5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s;
}
.ie-modal.show { opacity: 1; visibility: visible; }
body.ie-modal-open { overflow: hidden; }
.ie-modal-panel {
  width: 860px; max-width: 96vw; max-height: 88vh;
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 64px -16px rgba(30,64,120,.35);
  display: flex; flex-direction: column;
  transform: translateY(10px); transition: transform .2s ease;
}
.ie-modal.show .ie-modal-panel { transform: translateY(0); }
.ie-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid #eef2f8;
}
.ie-modal-title { font-size: 15px; font-weight: 600; color: #1e3a5f; }
.ie-close {
  border: none; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: #8aa0c0;
  width: 32px; height: 32px; border-radius: 8px;
}
.ie-close:hover { background: #f0f4fb; color: #dc2626; }
.ie-modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.ie-field { margin-bottom: 12px; }
.ie-label { display: block; font-size: 12.5px; font-weight: 600; color: #4f6fa5; margin-bottom: 6px; }
.ie-input {
  width: 100%; box-sizing: border-box; border: 1px solid #d6e4f8;
  border-radius: 10px; padding: 9px 12px; font-size: 14px; color: #1e3a5f;
  outline: none; background: #fbfdff; transition: border-color .2s, box-shadow .2s;
}
.ie-input:focus { border-color: #6ea8ff; box-shadow: 0 0 0 3px rgba(110,168,255,.15); }
.ie-editor { border: 1px solid #d6e4f8; border-radius: 12px; overflow: hidden; }
.ie-tabs {
  display: flex; gap: 4px; padding: 6px 8px; background: #f3f7fd;
  border-bottom: 1px solid #e4edf8;
}
.ie-tab {
  border: none; background: transparent; cursor: pointer;
  font-size: 13px; color: #5b769f; padding: 5px 16px; border-radius: 8px;
  transition: background .15s, color .15s;
}
.ie-tab.active { background: #fff; color: #2563eb; font-weight: 600; box-shadow: 0 1px 4px rgba(30,64,120,.12); }
.ie-textarea {
  width: 100%; box-sizing: border-box; border: none; outline: none;
  height: 46vh; min-height: 240px; resize: vertical;
  padding: 14px; font-size: 13.5px; line-height: 1.65;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #1e3a5f; background: #fff;
}
.ie-preview {
  height: 46vh; min-height: 240px; overflow-y: auto; padding: 14px 18px;
  background: #fff;
}
.ie-error {
  margin-top: 10px; font-size: 13px; color: #dc2626;
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 8px 12px;
}
.ie-modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid #eef2f8;
}
.ie-cancel {
  border: 1px solid #d6e4f8; background: #fff; cursor: pointer;
  color: #475569; font-size: 13.5px; border-radius: 10px;
  height: 38px; padding: 0 22px; transition: background .15s;
}
.ie-cancel:hover { background: #f4f7fc; }
.ie-save {
  border: none; cursor: pointer;
  background: linear-gradient(135deg, #4f8df9, #6a5cf5);
  color: #fff; font-size: 13.5px; font-weight: 500;
  border-radius: 10px; height: 38px; padding: 0 26px;
  box-shadow: 0 4px 12px -2px rgba(79,141,249,.45);
  transition: transform .15s, box-shadow .25s;
}
.ie-save:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -2px rgba(79,141,249,.55); }
.ie-save:disabled { opacity: .6; cursor: not-allowed; transform: none; }

@media (max-width: 640px) {
  .ie-modal-panel { max-height: 92vh; }
  .ie-textarea, .ie-preview { height: 42vh; }
}

/* ===== Markdown 编辑器工具栏（前端内联 + 后台共用） ===== */
.md-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 10px; margin: 10px 0 0;
  background: linear-gradient(135deg, #f2f6fe, #f7f5ff);
  border: 1px solid #dfe8fa; border-radius: 12px 12px 0 0;
}
.md-tool-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 13px; color: #3d5a8c; line-height: 1;
  padding: 7px 10px; border-radius: 8px;
  transition: background .15s, color .15s, transform .1s;
  min-height: 30px;
}
.md-tool-btn:hover { background: rgba(79,141,249,.12); color: #2563eb; }
.md-tool-btn:active { transform: translateY(1px); }
.md-tool-btn b, .md-tool-btn i, .md-tool-btn s { font-size: 13px; }
.md-tool-sep { width: 1px; height: 18px; background: #d6e2f5; margin: 0 4px; flex: none; }
.md-upload-btn {
  background: linear-gradient(135deg, #4f8df9, #6a5cf5);
  color: #fff; font-weight: 500; padding: 7px 14px;
  box-shadow: 0 3px 10px -2px rgba(79,141,249,.4);
}
.md-upload-btn:hover { background: linear-gradient(135deg, #4f8df9, #6a5cf5); color: #fff; opacity: .92; }

/* 预览图片编辑按钮 */
.img-wrap { position: relative; display: inline-block; max-width: 100%; margin: 6px 0; }
.img-wrap img { max-width: 100%; }
.img-wrap:hover .img-edit-btn { opacity: 1; }
.img-edit-btn {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  opacity: 0; transition: opacity .2s;
  background: rgba(37,99,235,.92); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
  padding: 5px 12px; font-size: 12.5px;
  box-shadow: 0 4px 12px rgba(30,64,120,.3);
}
.img-edit-btn:hover { background: #1d4ed8; }

/* 内联编辑器内 textarea 与预览衔接工具栏 */
.ie-tabs { margin-top: 12px; }
.ie-editor2 { border: 1px solid #d6e4f8; border-radius: 0 0 12px 12px; }
.ie-textarea {
  border-radius: 0 0 12px 12px;
  border: 1px solid #d6e4f8; border-top: none;
}
.ie-preview {
  border: 1px solid #d6e4f8; border-top: none;
  border-radius: 0 0 12px 12px;
}

/* ===== 图片库 ===== */
.gallery-tip {
  background: linear-gradient(135deg, #eef4ff, #f7f5ff);
  border: 1px solid #dbe7fb; border-radius: 12px;
  padding: 12px 16px; font-size: 13px; color: #44597e;
  margin-bottom: 16px; line-height: 1.7;
}
.gallery-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.gallery-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.gfilter {
  border: 1px solid #d8e4f7; background: #fff; color: #4a6288;
  border-radius: 999px; padding: 7px 18px; font-size: 13px; cursor: pointer;
  transition: all .15s;
}
.gfilter:hover { border-color: #9dbdf2; }
.gfilter.active {
  background: linear-gradient(135deg, #4f8df9, #6a5cf5);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px -3px rgba(79,141,249,.5);
}
.gallery-search { flex: 1; min-width: 180px; }
.gallery-search input {
  width: 100%; border: 1px solid #d8e4f7; border-radius: 999px;
  padding: 8px 16px; font-size: 13px; outline: none; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.gallery-search input:focus { border-color: #6ea8ff; box-shadow: 0 0 0 3px rgba(110,168,255,.15); }
.gallery-count { font-size: 13px; color: #7b90b8; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.gitem {
  background: #fff; border: 1px solid #e5edfa; border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .15s;
}
.gitem:hover { box-shadow: 0 10px 28px -10px rgba(30,64,120,.2); transform: translateY(-2px); }
.gitem-thumb {
  height: 140px; background: #f6f9ff; cursor: zoom-in;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.gitem-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gitem-info { padding: 10px 12px 4px; min-width: 0; }
.gitem-name {
  font-size: 12px; color: #33476e; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gitem-meta { font-size: 11px; color: #8ba1c4; margin-top: 3px; }
.gitem-ref { color: #2563eb; }
.gitem-noref { color: #a8b8d6; }
.gitem-actions {
  display: flex; gap: 6px; padding: 8px 12px 12px;
}
.gitem-actions .sml-btn[disabled] { opacity: .4; cursor: not-allowed; }
.gallery-loading {
  grid-column: 1 / -1; text-align: center; color: #8ba1c4;
  padding: 60px 0; font-size: 14px;
}
.preview-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(860px, 94vw); max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 16px; box-shadow: 0 24px 70px rgba(15,23,42,.4);
  padding: 20px; text-align: center;
}
.preview-panel img { max-width: 100%; max-height: 74vh; }
.preview-close {
  position: absolute; top: 10px; right: 12px;
  background: rgba(15,23,42,.6); color: #fff; border: none;
  width: 34px; height: 34px; border-radius: 50%; font-size: 18px; cursor: pointer;
}
.preview-meta {
  font-size: 12px; color: #7b90b8; margin-top: 10px;
  word-break: break-all; text-align: center;
}
@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .gitem-thumb { height: 100px; }
}

/* ===== 图库选择弹窗（贴图） ===== */
.picker-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(680px, 94vw); max-height: 88vh;
  background: #fff; border-radius: 16px; box-shadow: 0 24px 70px rgba(15,23,42,.4);
  display: flex; flex-direction: column; overflow: hidden;
}
.picker-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid #eef2f7;
  font-size: 16px; font-weight: 600; color: #1e3a8a;
}
.picker-search { padding: 12px 20px; border-bottom: 1px solid #f0f4fa; }
.picker-search input {
  width: 100%; border: 1px solid #d8e4f7; border-radius: 999px;
  padding: 8px 16px; font-size: 13px; outline: none;
}
.picker-search input:focus { border-color: #6ea8ff; box-shadow: 0 0 0 3px rgba(110,168,255,.15); }
.picker-grid {
  flex: 1; overflow-y: auto; padding: 14px 20px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px;
}
.picker-item {
  border: 1px solid #e5edfa; border-radius: 10px; overflow: hidden;
  cursor: pointer; background: #fafcff; text-align: center;
  transition: border-color .15s, box-shadow .15s;
}
.picker-item:hover { border-color: #93b8f5; box-shadow: 0 6px 16px -6px rgba(37,99,235,.3); }
.picker-item img { width: 100%; height: 78px; object-fit: cover; display: block; background: #f2f6ff; }
.picker-item span {
  display: block; font-size: 11px; color: #5a7094; padding: 5px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
