/* ==========================================================================
   内容管理系统 · 样式表
   支持浅色 / 深色主题，跟随系统并可通过按钮手动切换
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --bg-soft: #eceef2;
  --panel: #ffffff;
  --panel-soft: #fafbfc;
  --border: #e2e5ea;
  --border-strong: #cdd2da;
  --text: #1b1f2a;
  --text-soft: #4a5162;
  --muted: #838b9c;
  --primary: #2f6feb;
  --primary-soft: #e8f0fe;
  --primary-dark: #1f52bd;
  --green: #16a34a;
  --green-soft: #e7f7ed;
  --amber: #d97706;
  --amber-soft: #fdf3e3;
  --red: #dc2626;
  --red-soft: #fdeced;
  --purple: #7c3aed;
  --purple-soft: #f1ebfe;
  --gray-soft: #eef0f4;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 4px 16px rgba(16, 24, 40, .08);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --sidebar-w: 236px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218;
    --bg-soft: #151922;
    --panel: #171b24;
    --panel-soft: #1c212c;
    --border: #262c39;
    --border-strong: #333b4b;
    --text: #e8ecf3;
    --text-soft: #b7bfcd;
    --muted: #7d879a;
    --primary: #5b9bff;
    --primary-soft: #17253d;
    --primary-dark: #3f7fe0;
    --green: #4ade80;
    --green-soft: #14251c;
    --amber: #fbbf24;
    --amber-soft: #2a2113;
    --red: #f87171;
    --red-soft: #2c1618;
    --purple: #a78bfa;
    --purple-soft: #221a35;
    --gray-soft: #1f2431;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 6px 20px rgba(0, 0, 0, .45);
  }
}

:root[data-theme="dark"] {
  --bg: #0f1218;
  --bg-soft: #151922;
  --panel: #171b24;
  --panel-soft: #1c212c;
  --border: #262c39;
  --border-strong: #333b4b;
  --text: #e8ecf3;
  --text-soft: #b7bfcd;
  --muted: #7d879a;
  --primary: #5b9bff;
  --primary-soft: #17253d;
  --primary-dark: #3f7fe0;
  --green: #4ade80;
  --green-soft: #14251c;
  --amber: #fbbf24;
  --amber-soft: #2a2113;
  --red: #f87171;
  --red-soft: #2c1618;
  --purple: #a78bfa;
  --purple-soft: #221a35;
  --gray-soft: #1f2431;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 6px 20px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--gray-soft);
  color: var(--text-soft);
  padding: .12em .4em;
  border-radius: 4px;
  word-break: break-all;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.ta-c { text-align: center; }
.ta-r { text-align: right; }
.pad { padding: 16px; }
.c-green { color: var(--green); }
.c-amber { color: var(--amber); }
.c-gray { color: var(--muted); }
.link { color: var(--primary); }
.link--strong { font-weight: 600; }
.req { color: var(--red); font-style: normal; }
.wrap { width: min(1180px, 100% - 48px); margin: 0 auto; }

/* ---------- 按钮 ---------- */
/* ---------- 图标（Lucide inline sprite） ---------- */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1em; height: 1em; flex: none;
  display: inline-block; vertical-align: -0.15em;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.btn .icon { width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  font-size: 13.5px; font-weight: 550; font-family: inherit;
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--bg-soft); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn--ghost { background: transparent; border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--bg-soft); }
.btn--danger { background: var(--panel); border-color: var(--red); color: var(--red); }
.btn--danger:hover { background: var(--red-soft); }
.btn--block { width: 100%; }
.btn--lg { padding: 11px 18px; font-size: 15px; }
.btn--mini { padding: 4px 9px; font-size: 12.5px; border-radius: 5px; }
.btn--mini-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--mini-primary:hover { background: var(--primary-dark); }
.btn--icon { padding: 6px 9px; font-size: 15px; line-height: 1; }
.btn--icon .icon { width: 18px; height: 18px; }
.btn.is-disabled, .btn[disabled] { opacity: .45; pointer-events: none; }
.inline-form { display: inline; }

/* ---------- 表单 ---------- */
.input {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px; font-family: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input[disabled] { background: var(--bg-soft); color: var(--muted); }
.input--lg { padding: 12px 14px; font-size: 18px; font-weight: 600; }
.input--search { flex: 1; }
.input--select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23838b9c' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
/* textarea 自带完整输入框样式，单独使用 .textarea 也能撑满所在容器 */
.textarea {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.textarea--sm { min-height: 60px; }
.code-area { font-family: var(--mono); font-size: 13.5px; line-height: 1.75; min-height: 380px; }
.field { display: block; margin-bottom: 14px; }
.field__label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-soft);
}
.field__hint { display: block; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.field--grow { flex: 1; }
.field--check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-soft);
}
.field--check input { width: 16px; height: 16px; accent-color: var(--primary); }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.form--inline {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
}
/* inline 表单里字段自带的 margin-bottom 会参与 flex 对齐，
   导致按钮比输入框整体低一截——去掉，靠 gap 控制间距 */
.form--inline > .field { margin-bottom: 0; }
/* 允许 grow 字段收缩：否则文件选择框等固有过宽控件会把
   同排按钮挤到下一行（min-width:auto 时 flex 项不收缩） */
.form--inline > .field--grow { min-width: 0; }
.form-actions { display: flex; gap: 10px; margin: 4px 0 24px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.list { margin: 8px 0 0; padding-left: 20px; }
.list li { margin: 4px 0; }

/* ---------- 提示条 ---------- */
.alert {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 13.5px;
}
/* 前台提示条与内容区对齐 */
.site--public .site-main > .alert {
  width: min(1180px, 100% - 48px);
  margin-left: auto; margin-right: auto;
}
.alert--success { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.alert--error { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.alert--warning { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.alert--info { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.alert__icon { font-weight: 700; }
.alert__close {
  margin-left: auto; border: 0; background: none; cursor: pointer;
  color: inherit; font-size: 18px; line-height: 1; opacity: .6;
}
.alert__close:hover { opacity: 1; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px; font-weight: 600;
  border-radius: 999px;
  background: var(--gray-soft); color: var(--muted);
  white-space: nowrap;
}
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--red { background: var(--red-soft); color: var(--red); }
.badge--blue { background: var(--primary-soft); color: var(--primary); }
.badge--purple { background: var(--purple-soft); color: var(--purple); }
.badge--gray { background: var(--gray-soft); color: var(--muted); }
.badge--outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
}

/* ==========================================================================
   前台
   ========================================================================== */
.site--public { background: var(--bg); }
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner { display: flex; align-items: center; height: 60px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark { color: var(--primary); display: inline-flex; align-items: center; }
.brand__mark .icon { width: 22px; height: 22px; }
.site-nav { margin-left: auto; display: flex; gap: 18px; font-size: 14px; }
.site-nav a { color: var(--text-soft); font-weight: 550; }
.site-nav a:hover { color: var(--primary); }
.site-main { min-height: calc(100vh - 160px); }
.site-footer {
  margin-top: 40px; padding: 22px 0;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
}

.hero {
  background: linear-gradient(135deg, var(--primary-soft), var(--bg) 70%);
  border-bottom: 1px solid var(--border);
  padding: 44px 0 38px;
  margin-bottom: 28px;
}
.hero__title { font-size: 30px; }
.hero__sub { margin: 8px 0 20px; color: var(--text-soft); max-width: 620px; }
.hero__search { display: flex; gap: 10px; max-width: 520px; }

.grid-cards {
  display: grid; gap: 18px; margin-bottom: 28px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.grid-cards--roles { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card {
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); }
.card__cover { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-soft); }
.card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__body { padding: 16px; display: flex; flex-direction: column; flex: 1; gap: 8px; }
.card__meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.card__title { font-size: 17px; line-height: 1.4; }
.card__title a { color: var(--text); }
.card__title a:hover { color: var(--primary); text-decoration: none; }
.card__text { margin: 0; color: var(--muted); font-size: 13.5px; flex: 1; }
.card__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 12.5px; padding-top: 4px;
}
.card--role .card__body { gap: 6px; }

.empty {
  padding: 56px 20px; text-align: center;
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty__icon { font-size: 30px; color: var(--muted); opacity: .5; }
.empty__icon .icon { width: 30px; height: 30px; }
.empty__title { margin: 10px 0 4px; font-weight: 600; }
.empty__hint { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 24px 0 8px;
}
.pager__info { color: var(--muted); font-size: 13px; }

/* 文章页 —— 阅读优先：收窄栏目；封面只做右侧小缩略图，不再整幅铺满 */
.article__inner { max-width: 880px; padding-top: 24px; }
.crumb { display: flex; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.article { padding-bottom: 32px; }
.article__head { margin-bottom: 22px; }
.article__head-main { min-width: 0; }
.article__title { font-size: 32px; line-height: 1.3; }
.article__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 12px; font-size: 13px;
}
.article__summary {
  margin: 16px 0 0; padding: 12px 16px;
  background: var(--panel); border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
}
.article__cover {
  display: block; margin: 0;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-soft);
}
.article__cover a { display: block; width: 100%; height: 100%; }
.article__cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .3s ease;
}
.article__cover:hover img { transform: scale(1.05); }

/* 有封面时：头部两栏，封面固定成右侧缩略图（约 220×165） */
.article__head--cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 24px;
  align-items: start;
}
.article__head--cover .article__cover { aspect-ratio: 4 / 3; margin-top: 4px; }
.article__resources { margin-top: 36px; }
.section-title { font-size: 18px; margin-bottom: 14px; }
.article__nav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 36px; padding-top: 20px;
  border-top: 1px solid var(--border);
}
.article__nav-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--panel);
  max-width: 46%;
}
.article__nav-item:hover { border-color: var(--primary); text-decoration: none; }
.article__nav-item strong { color: var(--text); font-size: 14px; }
.article__nav-item--right { margin-left: auto; text-align: right; }

/* 正文排版 */
.prose {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 34px;
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--text-soft);
  word-wrap: break-word;
}
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--text); margin: 1.5em 0 .6em; line-height: 1.35; }
.prose h1 { font-size: 26px; }
.prose h2 {
  font-size: 21px; padding-bottom: .3em; border-bottom: 1px solid var(--border);
}
.prose h3 { font-size: 17.5px; }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.1em; padding-left: 1.5em; }
.prose li { margin: .35em 0; }
.prose blockquote {
  margin: 1.2em 0; padding: 4px 18px;
  border-left: 3px solid var(--primary);
  background: var(--panel-soft);
  color: var(--muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.prose a { border-bottom: 1px solid color-mix(in srgb, var(--primary) 40%, transparent); }
.prose a:hover { text-decoration: none; }

/* 正文目录（参考 Gitee README：左侧标题导航 + 右侧正文） */
.article__layout--with-toc {
  max-width: 1140px;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}
.toc {
  position: sticky;
  top: 72px;
  font-size: 13px;
}
.toc__title {
  font-weight: 600; color: var(--text);
  font-size: 13px; letter-spacing: .5px;
  padding-left: 13px; margin-bottom: 8px;
}
.toc__nav {
  position: relative;
  max-height: calc(100vh - 140px);
  overflow: auto;
  overscroll-behavior: contain;
  border-left: 1px solid var(--border);
  scrollbar-width: thin;
}
.toc__list { list-style: none; margin: 0; padding: 4px 0; }
.toc__item { margin: 0; }
.toc__link {
  display: block;
  padding: 6px 10px 6px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.toc__link:hover { color: var(--text); }
.toc__link.is-active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.toc__item--l1 .toc__link { font-weight: 600; color: var(--text-soft); }
.toc__item--l1 .toc__link.is-active { color: var(--primary); }
.toc__item--l2 .toc__link { padding-left: 26px; }
.toc__item--l3 .toc__link { padding-left: 40px; }
.toc__item--l4 .toc__link, .toc__item--l5 .toc__link, .toc__item--l6 .toc__link { padding-left: 54px; }

/* 从目录跳转时，锚点不被吸顶头部遮住 */
.prose h1[id], .prose h2[id], .prose h3[id], .prose h4[id], .prose h5[id], .prose h6[id] {
  scroll-margin-top: 84px;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  /* 目录框自身跟随高亮滚动时也走平滑动画，避免瞬间跳位 */
  .toc__nav { scroll-behavior: smooth; }
}
.md-code {
  margin: 1.2em 0; padding: 14px 16px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow-x: auto;
  font-size: 13.5px; line-height: 1.6;
}
.md-code code { background: none; padding: 0; color: var(--text-soft); }
.md-table-wrap { overflow-x: auto; margin: 1.2em 0; }
.md-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.md-table th, .md-table td { padding: 9px 12px; border: 1px solid var(--border); text-align: left; }
.md-table th { background: var(--panel-soft); font-weight: 650; color: var(--text); }
.md-figure { margin: 1.6em 0; text-align: center; }
.md-figure img { max-width: 100%; border-radius: var(--radius-sm); }
.md-figure figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.md-audio { margin: 1.2em 0; }
.md-audio audio { width: 100%; }
.md-file {
  display: inline-flex; align-items: center; gap: 8px;
  margin: .4em 0; padding: 9px 14px;
  background: var(--panel-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-soft);
}
.md-file:hover { border-color: var(--primary); text-decoration: none; }
.md-file-size { color: var(--muted); font-size: 12.5px; }
.md-gallery {
  display: grid; gap: 10px; margin: 1.4em 0;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.md-gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); }
.md-missing { color: var(--amber); background: var(--amber-soft); padding: 2px 8px; border-radius: 4px; font-size: 13px; }
/* 可放大的正文图片：给个手型 + 轻微放大反馈 */
.prose img { cursor: zoom-in; }

/* ---------- 正文图片灯箱 ---------- */
.lb {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  padding: 48px 64px;
  background: rgba(10, 12, 16, .86);
}
.lb.is-open { display: flex; }
.lb__img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  opacity: 1; transition: opacity .15s ease;
}
.lb__img.is-loading { opacity: .25; }
.lb__btn {
  position: absolute; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff;
  font-size: 22px; line-height: 1;
  transition: background .15s ease;
}
.lb__btn:hover { background: rgba(255, 255, 255, .24); }
.lb__close { top: 16px; right: 18px; font-size: 26px; }
.lb__prev { left: 14px; top: 50%; margin-top: -22px; }
.lb__next { right: 14px; top: 50%; margin-top: -22px; }
.lb__cap {
  position: absolute; left: 0; right: 0; bottom: 14px;
  text-align: center; font-size: 13px; color: rgba(255, 255, 255, .8);
  padding: 0 32px;
}
.lb__count {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: rgba(255, 255, 255, .7);
}
@media (max-width: 640px) {
  .lb { padding: 24px 12px 56px; }
  .lb__prev { left: 6px; } .lb__next { right: 6px; }
}

/* ==========================================================================
   后台
   ========================================================================== */
.admin { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar__title { font-weight: 700; font-size: 15px; }
.sidebar__sub { font-size: 11.5px; color: var(--muted); }
.sidebar__nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-soft); font-size: 13.5px; font-weight: 550;
}
.nav-item:hover { background: var(--bg-soft); text-decoration: none; }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.nav-item__icon { width: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center; opacity: .9; }
.nav-item__icon .icon { width: 18px; height: 18px; }
.nav-divider { height: 1px; background: var(--border); margin: 10px 6px; }
.sidebar__foot { padding: 14px; border-top: 1px solid var(--border); }
.who { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-weight: 700; font-size: 14px;
}
.avatar--sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 12px; }
.who__meta { min-width: 0; }
.who__name { font-weight: 650; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__role { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar__title { font-weight: 650; }
.topbar__actions { margin-left: auto; display: flex; gap: 8px; }
.topbar__toggle { display: none; border: 0; background: none; font-size: 19px; cursor: pointer; color: var(--text); }
.topbar__toggle .icon { width: 22px; height: 22px; }
.admin__content { padding: 22px 24px 44px; flex: 1; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head__title { font-size: 22px; }
.page-head__sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stat-grid {
  display: grid; gap: 14px; margin-bottom: 22px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.stat {
  padding: 16px 18px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.stat__label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat__value { font-size: 28px; font-weight: 700; line-height: 1.25; margin: 4px 0 2px; }
.stat__value--sm { font-size: 20px; }
.stat__sep { color: var(--muted); font-weight: 400; margin: 0 2px; }
.stat__foot { font-size: 12.5px; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel--flush { padding: 0; }
.panel--muted { opacity: .85; }
.panel--danger { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.panel__head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
}
.panel__title { font-size: 15px; }
.panel__head .link, .panel__head .muted { margin-left: auto; font-size: 12.5px; }
.panel > .form, .panel > .form--inline, .panel > .perm-groups,
.panel > .role-picker, .panel > .res-grid, .panel > .res-list,
.panel > .callout, .panel > .stack, .panel > .perm-tags, .panel > .member-list { padding: 18px; }
.panel > .callout { margin: 18px; }
/* panel 自身不带内边距，留白一律由子容器承担（见上一条）。若把控件直接挂在
   panel 下——不包 .form / .stack 等容器——就会左右顶到边框，输入框贴着外框很难看。
   下面这条是兜底：新增页面即使漏了容器也不会贴边。推荐写法仍是包一层 .form。 */
.panel > .field,
.panel > .field-row,
.panel > p:not(.pad) { padding-left: 18px; padding-right: 18px; }
.panel__head + .field,
.panel__head + .field-row,
.panel__head + p { padding-top: 18px; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.toolbar .input { width: auto; min-width: 190px; }
.toolbar__spacer { flex: 1; }

.table-wrap { overflow-x: auto; }
.table-wrap--scroll { max-height: 620px; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 11px 14px; text-align: left; vertical-align: middle; }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 650; color: var(--muted);
  white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child { border-bottom: 0; }
.table--hover tbody tr:hover { background: var(--panel-soft); }
.cell-title { display: flex; align-items: center; gap: 10px; }
.cell-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex: 0 0 40px; }
.cell-sub { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; min-width: 132px; }
.table--matrix td, .table--matrix th { padding: 8px 12px; }
.matrix__corner { min-width: 220px; }
.matrix__group td {
  background: var(--bg-soft); font-weight: 650; font-size: 12.5px;
  color: var(--text-soft); letter-spacing: .02em;
}
.matrix__perm { font-weight: 550; color: var(--text); }
.matrix__code { font-size: 11.5px; }
.dot { color: var(--border-strong); font-size: 17px; }
.dot--on { color: var(--green); }

.timeline { list-style: none; margin: 0; padding: 14px 18px; }
.timeline__item { display: flex; gap: 12px; padding: 7px 0; }
.timeline__dot {
  width: 8px; height: 8px; margin-top: 7px; flex: 0 0 8px;
  border-radius: 50%; background: var(--primary);
}
.timeline__title { font-size: 13.5px; }
.timeline__meta { font-size: 12px; color: var(--muted); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding: 18px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.editor__main, .editor__side { display: flex; flex-direction: column; }
.editor__side { position: sticky; top: 74px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.two-col--form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.md-help {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  padding: 10px 0 0; font-size: 12.5px; color: var(--muted);
}

.callout {
  padding: 14px 18px; margin-bottom: 18px;
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-soft);
}
.callout--soft { background: var(--panel-soft); border-color: var(--border); border-left-color: var(--border-strong); }
.callout__note { margin-top: 6px; font-size: 13px; color: var(--muted); }

/* 资源 */
.res-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.res-grid--sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.res-item { display: flex; flex-direction: column; }
.res-card {
  margin: 0; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.res-card__media {
  aspect-ratio: 4 / 3; background: var(--bg-soft);
  display: grid; place-items: center; overflow: hidden;
}
.res-card__media img, .res-card__media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.res-card__ext {
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
}
.res-card__meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.res-card__name {
  font-weight: 600; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.res-card__sub { font-size: 11.5px; color: var(--muted); display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.res-edit { border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: var(--panel); }
.res-edit summary {
  padding: 8px 12px; cursor: pointer; font-size: 12.5px;
  color: var(--muted); font-weight: 600; user-select: none;
}
.res-edit summary:hover { background: var(--panel-soft); }
.res-edit__body { padding: 14px; border-top: 1px solid var(--border); }
.code-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.code-row code { flex: 1; }

.res-list { list-style: none; margin: 0; padding: 0; }
.res-list__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.res-list__item:last-child { border-bottom: 0; }
.res-list__item img {
  width: 38px; height: 38px; object-fit: cover;
  border-radius: 6px; flex: 0 0 38px;
}
.res-list__ext {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  background: var(--bg-soft); border-radius: 6px;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted);
}
.res-list__meta { flex: 1; min-width: 0; }
.res-list__name { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-list__sub { font-size: 11.5px; color: var(--muted); }
/* 附件行尾操作区（查看 / 删除）：不参与收缩，免得长文件名把按钮挤掉 */
.res-list__actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* ---------- 封面面板 ---------- */
/* 预览块：上传 / 从资源库选择 / 删除 三个入口都就地刷新它，不刷新页面。
   [hidden] 必须显式兜底——万一将来把它放进 flex 容器，UA 的 display:none 会被盖掉。 */
.cover-preview {
  display: flex; flex-direction: column;
  margin: 0 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-soft);
}
.cover-preview[hidden], [data-cover-empty][hidden] { display: none !important; }
.cover-preview img { display: block; width: 100%; max-height: 190px; object-fit: cover; }
.cover-preview__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; background: var(--panel);
  border-top: 1px solid var(--border);
}
.cover-preview__name {
  flex: 1; min-width: 0; font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 「选中即生效」的行内反馈：成功绿、失败红 */
.cover-status { font-size: 12px; }
.cover-status[data-state="ok"] { color: var(--green); }
.cover-status[data-state="err"] { color: var(--red); }

/* ---------- 附件拖拽上传区 ---------- */
/* 无 JS 时这块保持 hidden，显示的是同级的 .uploader-fallback（原生 file + 上传按钮）。
   注意 .form--inline 的 display:flex 会盖过 [hidden] 的 UA 样式，必须显式关掉 */
.uploader-fallback[hidden], .dropzone[hidden], .dz-queue[hidden] { display: none !important; }
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 22px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone:focus-visible {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone__input { display: none; }
.dropzone__icon {
  width: 42px; height: 42px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--primary); font-size: 21px; line-height: 1;
  transition: transform .15s;
}
.dropzone.is-over .dropzone__icon { transform: scale(1.08); }
.dropzone__title { font-size: 13.5px; color: var(--text-soft); }
.dropzone__hint { margin-top: 4px; font-size: 12px; color: var(--muted); }

.dz-queue { list-style: none; margin: 16px 0 0; padding: 0; text-align: left; }
.dz-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin-top: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
.dz-item:first-child { margin-top: 0; }
.dz-item__thumb {
  flex: none; width: 36px; height: 36px; border-radius: 6px; overflow: hidden;
  background: var(--gray-soft);
}
.dz-item__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dz-item__thumb--ext {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; color: var(--muted);
}
.dz-item__main { flex: 1; min-width: 0; }
.dz-item__line { display: flex; align-items: baseline; gap: 8px; }
.dz-item__name {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dz-item__pct { flex: none; font-size: 12px; color: var(--muted); }
.dz-item[data-state="done"] .dz-item__pct { color: var(--green); }
.dz-item[data-state="error"] .dz-item__pct { color: var(--red); }
.dz-item__bar {
  height: 4px; margin-top: 6px; border-radius: 999px;
  background: var(--gray-soft); overflow: hidden;
}
.dz-item__bar i {
  display: block; width: 0; height: 100%; border-radius: 999px;
  background: var(--primary); transition: width .18s;
}
.dz-item[data-state="done"] .dz-item__bar i { background: var(--green); }
.dz-item[data-state="error"] .dz-item__bar i { background: var(--red); }
.dz-item__msg {
  margin-top: 4px; font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dz-item[data-state="error"] .dz-item__msg { color: var(--red); }
.dz-item__remove {
  flex: none; padding: 2px 5px; border: 0; border-radius: 5px;
  background: none; cursor: pointer;
  color: var(--muted); font-size: 17px; line-height: 1;
}
.dz-item__remove:hover { background: var(--gray-soft); color: var(--text); }

/* 权限选择 */
.role-picker { display: flex; flex-direction: column; gap: 10px; }
.role-pick {
  display: flex; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.role-pick:hover { border-color: var(--border-strong); background: var(--panel-soft); }
.role-pick input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--primary); flex: 0 0 16px; }
.role-pick__body { display: flex; flex-direction: column; gap: 3px; }
.role-pick__name { font-weight: 650; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.role-pick__desc { font-size: 12.5px; color: var(--muted); }
.role-pick__meta { font-size: 11.5px; color: var(--muted); }

.perm-groups { display: flex; flex-direction: column; gap: 16px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.perm-group__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; background: var(--panel-soft);
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.perm-group__body { padding: 8px 14px 14px; }
.perm-item { display: flex; gap: 10px; padding: 7px 0; cursor: pointer; }
.perm-item input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--primary); flex: 0 0 16px; }
.perm-item__body { display: flex; flex-direction: column; gap: 2px; }
.perm-item__name { font-size: 13.5px; font-weight: 550; }
.perm-item__code { font-size: 11px; align-self: flex-start; }
.perm-item__desc { font-size: 12px; color: var(--muted); }
.perm-tags { display: flex; flex-wrap: wrap; gap: 7px; }

.member-list { list-style: none; margin: 0; padding: 0; }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.member-list li:last-child { border-bottom: 0; }

/* 登录 / 错误 */
.login-page { display: grid; place-items: center; min-height: 74vh; padding: 30px 0; }
.login-card {
  width: min(400px, 100%);
  padding: 32px 30px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.login-card__head { text-align: center; margin-bottom: 22px; }
.login-card__head .brand__mark .icon { width: 30px; height: 30px; }
.login-card__head h1 { font-size: 21px; margin: 8px 0 4px; }
.login-card__head p { margin: 0; color: var(--muted); font-size: 13px; }
.login-card__foot {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted); text-align: center;
}

.error-page { padding: 70px 20px; text-align: center; }
.error-page__code { font-size: 62px; font-weight: 800; color: var(--border-strong); line-height: 1; }
.error-page__title { font-size: 22px; margin: 8px 0 10px; }
.error-page__msg { color: var(--muted); margin: 0 0 22px; }
.error-page__actions { display: flex; gap: 10px; justify-content: center; }

/* 响应式 */
@media (max-width: 1080px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor__side { position: static; }
  .two-col--form { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: translateX(0); }
  .topbar__toggle { display: block; }
  .admin__content { padding: 16px 14px 40px; }
  .wrap { width: calc(100% - 32px); }
  .hero__title { font-size: 24px; }
  .article__title { font-size: 24px; }
  .prose { padding: 20px 18px; font-size: 15px; }
  .table th, .table td { padding: 9px 10px; }
  .toolbar .input { min-width: 0; width: 100%; }
}

@media (max-width: 900px) {
  /* 中等屏：封面缩略图再收一档，给标题留出更宽的一栏 */
  .article__head--cover { grid-template-columns: minmax(0, 1fr) 180px; gap: 20px; }
  /* 目录侧栏收起，正文占满整行 */
  .article__layout--with-toc { grid-template-columns: minmax(0, 1fr); max-width: 880px; }
  .toc { display: none; }
}

@media (max-width: 760px) {
  /* 窄屏：封面回到内容顶部，但只做一条矮横幅，不做整幅大图 */
  .article__head--cover { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .article__head--cover .article__cover {
    order: -1; width: 100%; aspect-ratio: 16 / 9; max-height: 180px; margin: 0;
  }
}

@media (max-width: 640px) {
  /* 手机上头部改两行：第一行品牌 + 主题开关，第二行导航；
     不改成两行的话 flex 会把中文标题压成一字一行。 */
  .site-header__inner { height: auto; min-height: 56px; padding: 8px 0; flex-wrap: wrap; row-gap: 8px; }
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .site-nav {
    order: 3; width: 100%; margin-left: 0;
    flex-wrap: wrap; gap: 8px 14px; font-size: 13px;
  }
  .site-nav > * { white-space: nowrap; }
  .site-nav .inline-form { margin: 0; }
  /* 手机上「订单」胶囊本身就是内容中心入口，省掉重复的文字链接让导航排成一行 */
  .hide-sm { display: none !important; }
}

/* ==========================================================================
   客户侧：订单号入口与内容门户
   ========================================================================== */

/* 顶部订单标识 */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--gray-soft);
  color: var(--text-soft);
  font-size: 12.5px;
}
.pill--order { font-family: var(--mono); letter-spacing: .2px; }
.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.code-inline {
  font-family: var(--mono);
  font-size: 13px;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
}

/* 订单号入口 */
.gate {
  display: grid; gap: 22px;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: start;
  margin: 30px 0 34px;
}
.gate__intro {
  padding: 28px 30px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.gate__eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 9px; border-radius: 999px;
}
.gate__title { font-size: 27px; line-height: 1.35; margin: 14px 0 8px; }
.gate__sub { color: var(--text-soft); font-size: 14.5px; line-height: 1.75; margin: 0; }
.gate__form { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.gate__hint { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 0; }
.gate__side .panel { margin-bottom: 0; }

/* 步骤列表 */
.steps { list-style: none; margin: 0; padding: 16px 18px; }
.steps li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; font-size: 13.5px; color: var(--text-soft);
}
.steps__no {
  flex: none;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 11.5px; font-weight: 700;
}

/* 分区 */
.section { margin: 28px 0 8px; }
.section-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-head .section-title { margin-bottom: 0; }

/* 内容卡片 */
.content-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
}
.content-card {
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.content-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.content-card__cover { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-soft); }
.content-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.content-card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.content-card__title { font-size: 15.5px; line-height: 1.5; }
.content-card__text { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 0; flex: 1; }
.content-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }

/* 内容中心标题 */
.library-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  padding: 26px 0 6px;
}
.library-head__eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  color: var(--green);
  background: var(--green-soft);
  padding: 3px 9px; border-radius: 999px;
}
.library-head__title { font-size: 26px; margin: 12px 0 6px; }
.library-head__sub { color: var(--muted); font-size: 13.5px; margin: 0; }
.library-head__expire { margin: 6px 0 0; font-size: 12.5px; }

/* 文章补充 */
.crumb__sep { color: var(--border-strong); }
.crumb__cur { color: var(--text-soft); }
.article__foot {
  margin-top: 30px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}

/* ==========================================================================
   后台：订单授权与行列表
   ========================================================================== */

.stat-grid--compact { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 16px; }
.stat-grid--compact .stat { padding: 12px 16px; }
.stat-grid--compact .stat__value { font-size: 22px; }

.list--rows { list-style: none; margin: 0; padding: 0; }
.list--rows .list__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.list--rows .list__item:last-child { border-bottom: 0; }
.list__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.list__side { display: flex; align-items: center; gap: 8px; flex: none; }

.panel__note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.editor__note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }

/* 勾选标签 */
.chip {
  display: inline-flex; align-items: flex-start; gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.chip:hover { border-color: var(--border-strong); }
.chip input { margin: 3px 0 0; width: 15px; height: 15px; accent-color: var(--primary); flex: none; }
.chip:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.chip--wide { width: 100%; }

/* 订单授权分组 */
.order-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.order-group > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px;
  background: var(--panel-soft);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.order-group > summary::-webkit-details-marker { display: none; }
.order-group > summary::before { content: "▸"; color: var(--muted); margin-right: 6px; font-weight: 400; }
.order-group[open] > summary::before { content: "▾"; }
.order-group__body { padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }

/* 授权范围：快速搜索 + 专辑/按篇联动 */
.pad--flush { padding: 12px 16px 0; }
.grant-search { position: relative; }
.grant-search .icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.grant-search .input { padding-left: 32px; }
.grant-search__empty { margin-top: 8px; }
.chip:has(input:indeterminate) { border-color: var(--primary); background: var(--primary-soft); }
.chip[data-col-chip] { user-select: none; }
.chip[hidden], details.order-group[hidden], .pad[hidden] { display: none !important; }

.js-copy-source {
  flex: 1; white-space: pre-wrap; word-break: break-all;
  font-size: 12.5px; line-height: 1.8;
}

@media (max-width: 900px) {
  .gate { grid-template-columns: 1fr; }
  .gate__intro { padding: 22px 20px; }
  .two-col--form { grid-template-columns: 1fr; }
}

/* 字段标签上的可选说明 */
.field__opt {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

/* ==========================================================================
   富文本编辑器（Vditor）
   正文仍以 Markdown 保存，编辑器只是编辑期的输入层。
   ========================================================================== */
.md-editor { min-height: 360px; }
.md-editor__src { margin-top: 10px; }

/* 编辑器接管后藏起源码框（它仍然在 DOM 里，负责随表单提交正文） */
[data-editor].is-mounted .md-editor__src { display: none; }
[data-editor].is-fallback .md-editor__tip { display: none; }

/* 用项目自己的主题色覆盖 Vditor 的默认配色。
   注意两点：
   1. Vditor 把 .vditor 类加在**挂载元素本身**上（它是 .md-editor 自己，
      不是子元素），所以选择器不能写成 .md-editor .vditor；
   2. 这里靠 [data-editor] 提高优先级 —— vendor 的 index.css 在 app.css 之后
      加载，同优先级会被它盖掉。 */
[data-editor] .vditor {
  --panel-background-color: var(--panel);
  --panel-shadow: var(--shadow-sm);
  --border-color: var(--border);
  --second-color: var(--muted);
  --textarea-background-color: var(--panel);
  --textarea-text-color: var(--text);
  --toolbar-background-color: var(--panel-soft);
  --toolbar-icon-color: var(--text-soft);
  --toolbar-icon-hover-color: var(--primary);
  --heading-border-color: var(--border);
  --blockquote-color: var(--muted);
  --resize-background-color: var(--border);
  --resize-hover-background-color: var(--primary);
  border-radius: var(--radius-sm);
  border-color: var(--border);
}
[data-editor] .vditor-toolbar {
  border-bottom-color: var(--border);
  padding-left: 6px;
  padding-right: 6px;
}
[data-editor] .vditor-reset { color: var(--text); }
[data-editor] .vditor-reset blockquote { border-left-color: var(--border-strong); }
[data-editor] .vditor-reset code:not(.hljs) { background: var(--gray-soft); }

/* ---------- 资源库图片选取面板 ---------- */
.respick {
  position: fixed; inset: 0; z-index: 90;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(12, 16, 24, .55);
}
.respick.is-open { display: flex; }
.respick__panel {
  display: flex; flex-direction: column;
  width: min(880px, 100%); max-height: 82vh;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.respick__head {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
}
.respick__head .input { flex: 1; }
.respick__body { overflow: auto; padding: 14px; }
.respick__grid {
  display: grid; gap: 12px; margin: 0; padding: 0; list-style: none;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.respick__item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; cursor: pointer; background: var(--panel-soft);
}
.respick__item:hover { border-color: var(--primary); }
.respick__item img {
  display: block; width: 100%; height: 104px; object-fit: cover;
  background: var(--gray-soft);
}
.respick__name {
  display: block; padding: 6px 8px;
  font-size: 12.5px; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ==========================================================================
   表格行内编辑（内容专辑等）
   同一行里放两套内容：展示态 .cell-view / 输入态 .cell-edit，靠行的 .is-editing 切换。
   输入态的 <input> 用 HTML5 form 属性归属到行尾那个隐藏 form ——
   <form> 不能包 <tr>，也不该嵌进行内的删除表单里（会提前闭合）。
   ========================================================================== */
.cell-edit { display: none; }
tr.is-editing .cell-view { display: none; }
tr.is-editing .cell-edit { display: block; }
tr.is-editing > td { background: var(--primary-soft); }
.input--num { width: 92px; }
