/* =========================================================
   FINALLY BLOG · 设计系统 (Design Tokens)
   参考：https://pjax.cn/ (WordPress / Wing 主题)
   ========================================================= */
:root {
  --brand: #3366ff;
  --brand-hover: #1a53ff;
  --brand-active: #0f45ff;
  --brand-soft: #f2f5ff;
  --brand-line: #dbe4ff;

  --bg: #f7f8f9;
  --surface: #ffffff;
  --surface-2: #fbfcfd;

  --text: #303742;
  --text-2: #3b4351;
  --muted: #66758c;
  --faint: #97a3b6;
  --line: #eef0f3;
  --line-2: #e3e7ec;

  --ok: #32b643;
  --warn: #ffb700;
  --danger: #e85600;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  --shadow-card: 0 0 0 0.5px rgba(188, 195, 206, 0.12), 0 2px 10px rgba(48, 55, 66, 0.06);
  --shadow-hover: 0 0 0 0.5px rgba(188, 195, 206, 0.16), 0 6px 20px rgba(48, 55, 66, 0.1);
  --shadow-pop: 0 10px 32px rgba(48, 55, 66, 0.14);
  --shadow-brand: 0 4px 12px rgba(51, 102, 255, 0.32);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: "SF Mono", "Segoe UI Mono", Menlo, Consolas, monospace;

  --header-h: 64px;
  --shell: 1080px;
}

html[data-theme="dark"] {
  --bg: #1b1f27;
  --surface: #232831;
  --surface-2: #262c36;
  --text: #e6eaf2;
  --text-2: #cbd3e0;
  --muted: #8b97ab;
  --faint: #6b7788;
  --line: #2c333e;
  --line-2: #353d4a;
  --brand-soft: #1f2a45;
  --brand-line: #2c3d66;
  --shadow-card: 0 0 0 0.5px rgba(0, 0, 0, 0.3), 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 0 0 0.5px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .3s, color .3s;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ============ 基础工具类 ============ */
.flex { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 600; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.hide { display: none; }

.card {
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  white-space: nowrap;
}

.divider { height: 1px; background: var(--line); }

/* =========================================================
   前台布局
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.site-header__inner {
  max-width: var(--shell);
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.logo:hover { color: var(--brand); }
.logo__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.header-actions { display: flex; align-items: center; gap: 10px; }

.search {
  position: relative;
  width: 200px;
  height: 36px;
}
.search input {
  width: 100%;
  height: 100%;
  padding: 0 34px 0 14px;
  border: none;
  outline: none;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.search input::placeholder { color: var(--faint); }
.search .icon {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
}
.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-card);
  transition: .2s;
}
.icon-btn:hover { color: var(--brand); transform: translateY(-1px); }

.layout {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 8px 16px 40px;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr) 220px;
  gap: 20px;
  align-items: start;
}

.side {
  position: sticky;
  top: calc(var(--header-h) + 8px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nav-card { padding: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 14px;
  transition: .18s;
}
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--brand); }
.nav-item:hover .icon { color: var(--brand); }
.nav-item.active {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.nav-item.active .icon { color: #fff; }
.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-count { color: rgba(255, 255, 255, .75); }

.social-card { padding: 12px; }
.social-row { display: flex; align-items: center; gap: 6px; }
.social {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  transition: .18s;
}
.social:hover { background: var(--brand-soft); color: var(--brand); }

.cta-card { padding: 16px; text-align: center; }
.cta-card .btn { width: 100%; margin-top: 10px; }

/* 主列 */
.main-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.editor-box { padding: 16px 18px; }
.editor-box__input {
  width: 100%;
  min-height: 62px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.7;
}
.editor-box__input::placeholder { color: var(--faint); }
.editor-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.editor-tools { display: flex; align-items: center; gap: 2px; }
.tool {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--r-xs);
  background: transparent; color: var(--faint);
}
.tool:hover { background: var(--surface-2); color: var(--brand); }

.tabbar {
  display: flex; align-items: center; gap: 4px;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  position: sticky;
  top: calc(var(--header-h) + 4px);
  z-index: 20;
}
.tab {
  height: 32px;
  padding: 0 14px;
  display: inline-flex; align-items: center;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--muted);
  transition: .18s;
}
.tab:hover { color: var(--brand); }
.tab.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 500;
}
.tab .count { margin-left: 5px; font-size: 11.5px; opacity: .7; }

.note-card { padding: 18px 20px; transition: .2s; }
.note-card:hover { box-shadow: var(--shadow-hover); }
.note-head { display: flex; align-items: flex-start; gap: 10px; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex: none;
  background: linear-gradient(135deg, #cfdcff, #8fb0ff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
}
.note-head__name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.note-head__sub { font-size: 12px; color: var(--faint); }
.note-more { margin-left: auto; border: none; background: none; color: var(--faint); padding: 2px; }
.note-more:hover { color: var(--brand); }

.note-body { margin-top: 10px; font-size: 14.5px; line-height: 1.85; color: var(--text-2); }
.note-body p + p { margin-top: 8px; }
.note-body .tag-inline { color: var(--brand); }

.thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #e8eefc, #cfd9f5);
  position: relative;
  overflow: hidden;
}
.thumb::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.75), transparent 45%),
    radial-gradient(circle at 70% 70%, rgba(51,102,255,.25), transparent 55%);
}

.article-card { display: flex; gap: 16px; align-items: flex-start; }
.article-card__title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}
.article-card__desc {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card__cover {
  width: 118px; height: 86px;
  border-radius: var(--r-sm);
  flex: none;
  background: linear-gradient(135deg, #dfe8fb, #b9cbf7);
}
.note-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px;
  font-size: 12px;
  color: var(--faint);
}
.note-stats { display: flex; align-items: center; gap: 14px; }
.note-stat { display: inline-flex; align-items: center; gap: 5px; }
.note-stat:hover { color: var(--brand); }
.read-more { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); }
.read-more:hover { color: var(--brand); }

/* 右栏 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px 8px; text-align: center; }
.stat__num { font-size: 19px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stat__label { font-size: 10.5px; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }

.panel { padding: 14px 16px; }
.panel__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.heatmap { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; }
.heatmap i {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--line);
  display: block;
}
.heatmap i[data-l="1"] { background: #c9d8ff; }
.heatmap i[data-l="2"] { background: #89a9ff; }
.heatmap i[data-l="3"] { background: #3366ff; }
html[data-theme="dark"] .heatmap i[data-l="1"] { background: #2c3d66; }
html[data-theme="dark"] .heatmap i[data-l="2"] { background: #3f66c4; }

.topic-row {
  display: flex; align-items: center; justify-content: space-between;
  height: 30px;
  font-size: 13px;
  color: var(--text-2);
}
.topic-row:hover { color: var(--brand); }
.topic-row em { font-style: normal; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.topic-bar {
  height: 3px; border-radius: 2px; background: var(--line); overflow: hidden;
  margin-bottom: 10px;
}
.topic-bar span { display: block; height: 100%; background: var(--brand); border-radius: 2px; }

.site-footer {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 8px 16px 40px;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}
.site-footer a { color: var(--faint); }
.site-footer a:hover { color: var(--brand); }

.fab { position: fixed; right: 22px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 35; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 18px 0 4px; }
.pager a {
  min-width: 34px; height: 34px;
  padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  box-shadow: var(--shadow-card);
}
.pager a:hover { color: var(--brand); }
.pager a.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }

/* 通用按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: .18s;
  white-space: nowrap;
}
.btn:hover { background: var(--line); color: var(--text); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); background: transparent; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 22px; font-size: 14.5px; border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: #fdeee6; color: var(--danger); }

/* 标签 */
.tag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px;
  border-radius: var(--r-xs);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
}
.tag-grey { background: var(--surface-2); color: var(--muted); }
.tag-ok { background: #e9f8ec; color: var(--ok); }
.tag-warn { background: #fff6e0; color: #b98300; }
.tag-danger { background: #fdeee6; color: var(--danger); }

/* =========================================================
   页面级：文章详情
   ========================================================= */
.post-head { padding: 26px 28px 20px; }
.post-title { font-size: 24px; line-height: 1.45; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.post-meta { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 12.5px; color: var(--faint); flex-wrap: wrap; }

.prose { padding: 4px 28px 28px; font-size: 15px; line-height: 1.95; color: var(--text-2); }
.prose h2 { font-size: 18px; font-weight: 600; color: var(--text); margin: 26px 0 10px; }
.prose h3 { font-size: 15.5px; font-weight: 600; color: var(--text); margin: 20px 0 8px; }
.prose p { margin: 12px 0; }
.prose ul { margin: 12px 0; padding-left: 20px; list-style: disc; }
.prose li { margin: 6px 0; }
.prose blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--muted);
  font-size: 14px;
}
.prose code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.prose pre {
  margin: 16px 0;
  padding: 14px 16px;
  background: #22272f;
  border-radius: var(--r-sm);
  overflow: auto;
}
.prose pre code { background: none; border: none; color: #d7e0ee; padding: 0; }
.prose figure { margin: 18px 0; }
.prose figure .thumb { aspect-ratio: 16 / 9; }
.prose figcaption { margin-top: 6px; font-size: 12px; color: var(--faint); text-align: center; }

.toc { padding: 14px 16px; }
.toc a { display: block; font-size: 13px; color: var(--muted); padding: 5px 0 5px 12px; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--brand); }
.toc a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 500; }

.author-card { padding: 18px 16px; text-align: center; }
.author-card .avatar { width: 56px; height: 56px; margin: 0 auto 10px; font-size: 18px; }
.author-card__name { font-size: 14.5px; font-weight: 600; }
.author-card__bio { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.7; }

.comment { padding: 16px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: none; }
.comment__head { display: flex; align-items: center; gap: 8px; }
.comment__name { font-size: 13px; font-weight: 600; }
.comment__time { font-size: 11.5px; color: var(--faint); }
.comment__body { margin-top: 6px; font-size: 13.5px; color: var(--text-2); line-height: 1.8; padding-left: 42px; }
.comment__reply { margin-top: 10px; margin-left: 42px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); font-size: 13px; }

/* 归档 */
.year-group { padding: 6px 0; }
.year-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  padding: 6px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.year-title span { font-size: 12px; color: var(--faint); font-weight: 400; }
.archive-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0 10px 4px;
  border-left: 2px solid var(--line);
  margin-left: 4px;
  padding-left: 18px;
  position: relative;
  font-size: 13.5px;
  color: var(--text-2);
}
.archive-item::before {
  content: "";
  position: absolute; left: -5px; top: 18px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line-2);
  border: 2px solid var(--surface);
}
.archive-item:hover { color: var(--brand); }
.archive-item:hover::before { background: var(--brand); }
.archive-item time { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; width: 44px; flex: none; }

/* 关于 */
.about-hero { padding: 30px 28px; display: flex; gap: 22px; align-items: center; }
.about-hero .avatar { width: 84px; height: 84px; font-size: 26px; }
.about-hero h2 { font-size: 20px; font-weight: 600; }
.about-hero p { margin-top: 8px; font-size: 13.5px; color: var(--muted); line-height: 1.8; }
.skill { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* 友链 */
.link-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.link-card { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.link-logo {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, #e8eefc, #c6d5f7);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-weight: 700; font-size: 14px;
}
.link-card__name { font-size: 14px; font-weight: 600; color: var(--text); }
.link-card__desc { font-size: 12px; color: var(--faint); margin-top: 3px; }

/* =========================================================
   管理后台
   ========================================================= */
.admin {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}
.admin-side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px 16px;
  font-size: 16px; font-weight: 600; color: var(--text);
}
.admin-brand__logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow-brand);
}
.admin-brand small { display: block; font-size: 11px; color: var(--faint); font-weight: 400; letter-spacing: .04em; }

.menu-label {
  padding: 14px 12px 6px;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.menu-link {
  display: flex; align-items: center; gap: 10px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13.5px;
  transition: .16s;
}
.menu-link .icon { color: var(--faint); }
.menu-link:hover { background: var(--surface-2); color: var(--brand); }
.menu-link:hover .icon { color: var(--brand); }
.menu-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.menu-link.active .icon { color: var(--brand); }
.menu-badge {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-side__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

.admin-top {
  position: sticky; top: 0; z-index: 30;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--faint); }
.crumb b { font-size: 15px; color: var(--text); font-weight: 600; }
.admin-top__right { display: flex; align-items: center; gap: 10px; }
.admin-search {
  display: flex; align-items: center; gap: 8px;
  height: 34px; width: 210px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}
.admin-search input {
  flex: 1; min-width: 0;
  border: none; outline: none; background: none;
  color: var(--text); font-size: 13px; font-family: inherit;
}
.admin-user { display: flex; align-items: center; gap: 8px; padding-left: 6px; }
.admin-user .avatar { width: 30px; height: 30px; font-size: 12px; }

.admin-body { padding: 20px 22px 40px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head h2 { font-size: 18px; font-weight: 600; color: var(--text); }
.page-head p { margin-top: 5px; font-size: 12.5px; color: var(--muted); }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { padding: 16px 18px; }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; }
.stat-card__label { font-size: 12.5px; color: var(--muted); }
.stat-card__icon {
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.stat-card__num {
  margin-top: 8px;
  font-size: 24px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.stat-card__foot { margin-top: 6px; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 4px; }
.trend-up { color: var(--ok); }
.trend-down { color: var(--danger); }

/* 内容卡 */
.panel-card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-card); }
.panel-card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-card__head h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.panel-card__body { padding: 18px; }

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

/* 柱状图 */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 132px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #5b83ff, #3366ff);
  opacity: .9;
  transition: .2s;
}
.bar:hover { opacity: 1; transform: translateY(-2px); }
.bar-col small { font-size: 11px; color: var(--faint); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12.5px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.cell-title { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
.cell-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.row-actions { display: flex; align-items: center; gap: 4px; }
.link-btn {
  border: none; background: none; padding: 4px 6px;
  border-radius: var(--r-xs);
  color: var(--brand); font-size: 12.5px;
}
.link-btn:hover { background: var(--brand-soft); }
.link-btn.is-danger { color: var(--danger); }
.link-btn.is-danger:hover { background: #fdeee6; }

.checkbox {
  width: 15px; height: 15px; border-radius: 4px;
  border: 1.5px solid var(--line-2);
  display: inline-block; vertical-align: middle;
  background: var(--surface);
}

/* 筛选栏 */
.filterbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.pill-tabs { display: flex; align-items: center; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: var(--r-sm); }
.pill-tab {
  height: 28px; padding: 0 12px;
  display: inline-flex; align-items: center;
  border-radius: 6px;
  font-size: 12.5px; color: var(--muted);
}
.pill-tab.active { background: var(--surface); color: var(--brand); font-weight: 500; box-shadow: 0 1px 3px rgba(48,55,66,.12); }
.pill-tab .count { margin-left: 4px; color: var(--faint); }

.input, .select, .textarea {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: .16s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input::placeholder { color: var(--faint); }
.textarea { height: auto; padding: 10px; line-height: 1.7; resize: vertical; }
.select { padding-right: 26px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%); background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.input-icon { position: relative; display: inline-flex; align-items: center; }
.input-icon .icon { position: absolute; left: 10px; color: var(--faint); }
.input-icon .input { padding-left: 32px; width: 190px; }

/* 表单 */
.form-row { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.form-label i { color: var(--danger); font-style: normal; }
.form-control { width: 100%; }
.form-hint { margin-top: 5px; font-size: 11.5px; color: var(--faint); }

.switch {
  width: 38px; height: 21px; border-radius: var(--r-pill);
  background: var(--line-2); position: relative; display: inline-block;
  transition: .2s; flex: none;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s;
}
.switch.on { background: var(--brand); }
.switch.on::after { left: 19px; }

/* 后台编辑器 */
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.edit-title {
  width: 100%;
  border: none; outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 22px; font-weight: 600; color: var(--text);
  padding: 4px 0 12px;
}
.edit-title::placeholder { color: var(--faint); }
.toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.toolbar .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 6px; }
.edit-area {
  width: 100%;
  min-height: 380px;
  border: none; outline: none; resize: vertical;
  padding: 18px;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-2);
  background: transparent;
}
.edit-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line); }

.side-panel { padding: 16px 18px; }
.side-panel + .side-panel { border-top: 1px solid var(--line); }
.side-panel h4 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.side-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 13px; color: var(--text-2); }
.side-row + .side-row { border-top: 1px dashed var(--line); }

.upload-box {
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  padding: 20px;
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
  background: var(--surface-2);
  transition: .18s;
}
.upload-box:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.upload-box .icon { margin: 0 auto 6px; width: 22px; height: 22px; }

/* 分类树 */
.tree-row {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--text-2);
}
.tree-row:hover { background: var(--surface-2); }
.tree-row.child { padding-left: 34px; }
.tree-row .count { margin-left: auto; font-size: 12px; color: var(--faint); }

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--bg);
}
.login-visual {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #3366ff 0%, #1a3fd6 55%, #12246e 100%);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-visual::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 78% 18%, rgba(255,255,255,.22), transparent 42%),
    radial-gradient(circle at 12% 82%, rgba(120,255,235,.22), transparent 45%);
}
.login-visual > * { position: relative; z-index: 1; }
.login-visual h1 { font-size: 30px; line-height: 1.4; font-weight: 600; letter-spacing: -.01em; }
.login-visual p { margin-top: 14px; font-size: 14px; color: rgba(255,255,255,.72); line-height: 1.9; max-width: 380px; }
.login-quote {
  border-left: 2px solid rgba(255,255,255,.4);
  padding-left: 14px;
  font-size: 13px;
  color: rgba(255,255,255,.66);
  line-height: 1.9;
}
.login-quote b { display: block; color: #fff; font-weight: 500; margin-bottom: 4px; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: 100%; max-width: 356px; }
.login-card h2 { font-size: 22px; font-weight: 600; color: var(--text); }
.login-card > p { margin-top: 8px; font-size: 13px; color: var(--muted); }
.login-tabs { display: flex; gap: 18px; margin: 26px 0 4px; border-bottom: 1px solid var(--line); }
.login-tabs a { padding: 0 0 10px; font-size: 13.5px; color: var(--muted); position: relative; }
.login-tabs a.active { color: var(--text); font-weight: 500; }
.login-tabs a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px; }
.login-field { margin-top: 16px; }
.login-field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.login-field .input { height: 40px; width: 100%; }
.login-extra { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.login-card .btn-lg { margin-top: 20px; }
.login-foot { margin-top: 24px; font-size: 11.5px; color: var(--faint); text-align: center; line-height: 1.9; }

/* 设计稿说明浮层 */
.spec-badge {
  position: fixed; left: 16px; bottom: 16px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border-radius: var(--r-pill);
  background: rgba(48,55,66,.86);
  color: #fff; font-size: 11.5px;
  backdrop-filter: blur(6px);
}

/* 响应式 */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 176px minmax(0, 1fr); }
  .layout > .side--right { display: none; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout > .side--left { display: none; }
  .site-header__inner { padding: 0 12px; }
  .search { width: 132px; }
  .admin { grid-template-columns: minmax(0, 1fr); }
  .admin-side { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .edit-grid { grid-template-columns: minmax(0, 1fr); }
  .login-page { grid-template-columns: minmax(0, 1fr); }
  .login-visual { display: none; }
  .link-grid { grid-template-columns: minmax(0, 1fr); }
  .post-head, .prose { padding-left: 18px; padding-right: 18px; }
}

/* =========================================================
   站点应用层（P0）
   ========================================================= */

/* Pjax 顶部进度条 */
#pjax-progress {
  position: fixed; top: 0; left: 0; z-index: 9999;
  height: 2px; width: 0;
  background: linear-gradient(90deg, #3366ff, #8fb0ff);
  box-shadow: 0 0 8px rgba(51, 102, 255, .55);
  transition: width .18s ease, opacity .3s ease;
  pointer-events: none;
}
#pjax-progress.done { opacity: 0; }

/* Pjax 切换中的内容淡出 */
#pjax-container { transition: opacity .18s ease; }
body.pjax-loading #pjax-container { opacity: .45; }

/* 移动端抽屉 */
.drawer-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(24, 28, 36, .45);
  opacity: 0; visibility: hidden; transition: .22s;
}
.drawer-mask.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 51;
  width: 268px; padding: 16px;
  background: var(--bg);
  transform: translateX(-102%);
  transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.drawer.open { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 10px; }

/* 底部 tab（移动端） */
.bottom-tabs {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  height: 54px;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.bottom-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; color: var(--faint);
}
.bottom-tab .icon { width: 19px; height: 19px; }
.bottom-tab.active { color: var(--brand); }

/* 空状态 */
.empty {
  padding: 48px 20px; text-align: center; color: var(--faint); font-size: 13.5px;
}
.empty .icon { width: 30px; height: 30px; margin: 0 auto 12px; opacity: .6; }

/* 提示条 */
.alert {
  padding: 10px 14px; border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.7;
  background: var(--brand-soft); color: var(--brand);
}
.alert-ok { background: #e9f8ec; color: #2a8f45; }
.alert-error { background: #fdeee6; color: var(--danger); }

/* 表单补充 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.input-block { width: 100%; height: 40px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }

/* 详情正文 */
.prose img { border-radius: var(--r-sm); margin: 16px 0; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 24px 0; }
.prose ol { margin: 12px 0; padding-left: 22px; }
.prose ol li { margin: 6px 0; }
.prose strong { color: var(--text); }
.prose a { border-bottom: 1px solid var(--brand-line); }

/* 文章卡片标题链接悬停 */
.article-card__title:hover { color: var(--brand); }

/* 点赞 / 收藏激活态 */
.note-stat.is-active { color: var(--brand); font-weight: 500; }
.note-stat.is-active .icon { stroke: var(--brand); }

/* 笔记正文里的图片网格（单图/多图） */
.note-media { margin-top: 12px; display: grid; gap: 8px; }
.note-media.cols-1 { grid-template-columns: 1fr; }
.note-media.cols-2 { grid-template-columns: repeat(2, 1fr); }
.note-media.cols-3 { grid-template-columns: repeat(3, 1fr); }
.note-media img { width: 100%; border-radius: var(--r-sm); object-fit: cover; }

/* 正文封面 */
.post-cover { margin: 0 0 4px; }
.post-cover img { width: 100%; border-radius: var(--r-sm); }

/* 页面级标题条 */
.page-hero { padding: 22px 24px; }
.page-hero h1 { font-size: 21px; font-weight: 600; margin-top: 8px; }

@media (max-width: 860px) {
  .bottom-tabs { display: flex; }
  body { padding-bottom: calc(54px + env(safe-area-inset-bottom)); }
  .fab { bottom: 70px; right: 14px; }
  .site-header__inner { padding: 0 14px; }
  .search { width: 40px; }
  .search input { padding: 0; width: 0; opacity: 0; }
  .search .icon { position: static; }
}

/* =========================================================
   媒体库
   ========================================================= */
.dropzone {
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  padding: 26px;
  text-align: center;
  color: var(--faint);
  cursor: pointer;
  background: var(--surface-2);
  transition: .18s;
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}
.dropzone .icon { margin: 0 auto 8px; width: 22px; height: 22px; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.media-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.media-card__thumb {
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
}
.media-card__info { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.media-card__name {
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-card__actions { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 8px 8px; margin-top: auto; }

/* 弹层与裁剪 */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__mask { position: absolute; inset: 0; background: rgba(24, 28, 36, .5); }
.modal__body {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal__head h3 { font-size: 14px; font-weight: 600; }
.modal__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.crop-stage {
  position: relative;
  background: #22272f;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  overflow: hidden;
  user-select: none;
}
.crop-stage img { max-width: 100%; max-height: 56vh; display: block; cursor: crosshair; }
.crop-box {
  position: absolute;
  border: 1px solid #fff;
  background: rgba(51, 102, 255, .18);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35);
  pointer-events: none;
}

@media (max-width: 1080px) {
  .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =========================================================
   统一弹窗（替代原生 confirm / alert）
   ========================================================= */
.ui-dialog { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ui-dialog[hidden] { display: none; }
.ui-dialog__mask { position: absolute; inset: 0; background: rgba(24, 28, 36, .45); backdrop-filter: blur(2px); }
.ui-dialog__body {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  padding: 20px;
  animation: ui-dialog-in .18s ease;
}
@keyframes ui-dialog-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.ui-dialog__head { display: flex; align-items: center; gap: 10px; }
.ui-dialog__icon {
  width: 30px; height: 30px; border-radius: 9px;
  background: #fdeee6; color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.ui-dialog__title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.ui-dialog__text { margin-top: 12px; font-size: 13px; color: var(--muted); line-height: 1.8; word-break: break-word; }
.ui-dialog__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.btn-solid-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 12px rgba(232, 86, 0, .28); }
.btn-solid-danger:hover { background: #cf4a00; color: #fff; }
