:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-muted: #f4f4f5;
  --bg-accent: #eff6ff;
  --bg-amber: #fffbeb;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --text-faint: #a1a1aa;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --primary-text: #1d4ed8;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.dark {
  --bg: #0a0a0a;
  --bg-card: #171717;
  --bg-muted: #1f1f1f;
  --bg-accent: rgba(37, 99, 235, 0.12);
  --bg-amber: rgba(217, 119, 6, 0.12);
  --border: #262626;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --text-secondary: #d4d4d8;
  --text-muted: #a1a1aa;
  --text-faint: #71717a;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.15);
  --primary-text: #93c5fd;
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.15);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.15);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: 14px; font-weight: 500;
  transition: all 0.15s; white-space: nowrap; line-height: 1.4;
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline { background: transparent; }
.btn-danger { color: var(--red); border-color: var(--red); background: transparent; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 16px; border-radius: 10px; }

/* ---- 输入 ---- */
.input, .textarea, .select {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s; outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.select { appearance: auto; }
.label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }

/* ---- 徽章 ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.7;
  background: var(--bg-muted); color: var(--text-secondary);
}
.badge-blue { background: var(--primary-soft); color: var(--primary-text); }
.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); }

/* ---- 前台导航 ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: 960px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; }
.nav-brand .logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); transition: all 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-muted); }
.nav-links a.active { color: var(--primary-text); background: var(--primary-soft); }
.nav-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-muted); color: var(--text); }

/* ---- 前台页面 ---- */
.page-main { min-height: calc(100vh - 60px - 120px); padding: 40px 0 64px; }

.hero { text-align: center; padding: 56px 0 24px; }
.hero h1 { font-size: 42px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.hero p { margin: 16px auto 28px; max-width: 560px; color: var(--text-muted); font-size: 16px; }
.hero .hero-actions { display: flex; gap: 12px; justify-content: center; }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 40px 0 8px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; transition: all 0.2s;
}
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card .num { font-size: 30px; font-weight: 800; color: var(--primary-text); }
.stat-card .cap { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.section { margin-top: 48px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-head h2 { font-size: 20px; font-weight: 700; }
.section-head a { font-size: 14px; color: var(--primary-text); font-weight: 500; }
.section-head a:hover { text-decoration: underline; }

.featured-card {
  display: block; background: var(--bg-amber); border: 1px solid var(--amber-soft);
  border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 14px;
  transition: all 0.2s;
}
.featured-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.featured-card .f-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--amber); font-weight: 600; margin-bottom: 6px; }
.featured-card h3 { font-size: 17px; font-weight: 700; }
.featured-card:hover h3 { color: var(--amber); }
.featured-card p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.post-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.post-card {
  display: flex; flex-direction: column; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px;
  transition: all 0.2s;
}
.post-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.post-card .p-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; flex-wrap: wrap; }
.post-card h3 { font-size: 17px; font-weight: 700; line-height: 1.45; }
.post-card h3 a:hover { color: var(--primary-text); }
.post-card .p-excerpt { font-size: 13.5px; color: var(--text-muted); margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .p-tags { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }

/* ---- 博客列表页 ---- */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-card); font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: all 0.15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.search-box { position: relative; }
.search-box input { width: 220px; padding: 8px 34px 8px 12px; }
.search-box .s-ico { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 13px; pointer-events: none; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 36px; }
.page-info { font-size: 13px; color: var(--text-muted); }

.empty-state { text-align: center; padding: 70px 20px; color: var(--text-muted); }
.empty-state .e-ico { font-size: 40px; margin-bottom: 12px; opacity: 0.6; }

/* ---- 文章详情 ---- */
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a:hover { color: var(--primary-text); text-decoration: underline; }
.post-detail h1 { font-size: 32px; font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; }
.post-detail .d-meta { display: flex; align-items: center; gap: 14px; margin: 14px 0 24px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.d-cover { border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 24px; border: 1px solid var(--border); }
.d-cover img { width: 100%; display: block; max-height: 420px; object-fit: cover; }
.d-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 8px; }
.d-tags a:hover { text-decoration: none; border-color: var(--primary); color: var(--primary-text); }

.prose { font-size: 15.5px; color: var(--text-secondary); line-height: 1.9; }
.prose > * { margin-bottom: 1em; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--text); font-weight: 700; margin-top: 1.6em; margin-bottom: 0.6em; line-height: 1.4; }
.prose h1 { font-size: 24px; } .prose h2 { font-size: 21px; } .prose h3 { font-size: 18px; } .prose h4 { font-size: 16px; }
.prose p { margin-bottom: 1.1em; }
.prose a { color: var(--primary-text); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--primary); }
.prose ul, .prose ol { padding-left: 1.6em; margin-bottom: 1.1em; }
.prose ul { list-style: disc; } .prose ol { list-style: decimal; }
.prose li { margin-bottom: 0.3em; }
.prose blockquote {
  border-left: 3px solid var(--primary); background: var(--bg-muted);
  padding: 10px 18px; border-radius: 0 8px 8px 0; color: var(--text-muted);
  font-style: normal;
}
.prose code:not(pre code) {
  background: var(--bg-muted); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; font-family: var(--mono); font-size: 0.86em;
}
.prose pre {
  background: #111114; border: 1px solid #26262b; border-radius: 10px;
  padding: 16px 18px; overflow-x: auto; margin-bottom: 1.2em;
}
.prose pre code { background: transparent; border: none; padding: 0; font-size: 13.5px; font-family: var(--mono); line-height: 1.7; }
.prose img { border-radius: 8px; border: 1px solid var(--border); }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 1.2em; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--bg-muted); font-weight: 600; color: var(--text); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.6em 0; }
.prose .hljs { background: transparent; }

.pn-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 40px; }
.pn-card {
  display: block; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; background: var(--bg-card); transition: all 0.2s;
}
.pn-card:hover { border-color: var(--primary); }
.pn-card .pn-dir { font-size: 12px; color: var(--text-faint); }
.pn-card .pn-title { font-size: 14px; font-weight: 600; margin-top: 2px; color: var(--text); }
.pn-card.next { text-align: right; }

.related { margin-top: 48px; }
.related .post-grid { grid-template-columns: repeat(3, 1fr); }

/* ---- 分类/标签/关于页 ---- */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.cat-card {
  display: block; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; transition: all 0.2s;
}
.cat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cat-card h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.cat-card h3 .cnt { font-size: 12.5px; color: var(--text-faint); font-weight: 500; }
.cat-card p { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.cat-card .sub-chips { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.tag-cloud { display: flex; gap: 10px; flex-wrap: wrap; }
.tag-cloud a {
  padding: 8px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-card); font-size: 13.5px; font-weight: 500; transition: all 0.15s;
}
.tag-cloud a:hover { border-color: var(--primary); color: var(--primary-text); transform: translateY(-1px); }

/* ---- 页脚 ---- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; text-align: center; color: var(--text-faint); font-size: 13px; }
.site-footer a:hover { color: var(--text-secondary); }

/* ---- Toast ---- */
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 22px; border-radius: 10px;
  font-size: 14px; z-index: 100; box-shadow: var(--shadow-lg); opacity: 0.95;
}

/* ================= 后台 ================= */
.admin-body { overflow: hidden; }
.admin-wrap { display: flex; height: 100vh; }
.admin-sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--bg-card);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  transition: width 0.2s;
}
.admin-wrap.collapsed .admin-sidebar { width: var(--sidebar-w-collapsed); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--border); }
.sidebar-brand .logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.admin-wrap.collapsed .sidebar-brand span, .admin-wrap.collapsed .side-label, .admin-wrap.collapsed .side-link span { display: none; }
.admin-wrap.collapsed .sidebar-brand { justify-content: center; padding: 18px 0; }
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.side-label { font-size: 11px; color: var(--text-faint); padding: 10px 10px 6px; letter-spacing: 0.05em; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 2px; transition: all 0.15s;
}
.side-link .ico { width: 20px; text-align: center; flex-shrink: 0; font-size: 15px; }
.side-link:hover { background: var(--bg-muted); color: var(--text); }
.side-link.active { background: var(--primary-soft); color: var(--primary-text); }
.side-bottom { border-top: 1px solid var(--border); padding: 12px 10px; }
.admin-wrap.collapsed .side-bottom { text-align: center; }

.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  height: 56px; flex-shrink: 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  background: color-mix(in srgb, var(--bg-card) 82%, transparent); backdrop-filter: blur(8px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 999px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.admin-content { flex: 1; overflow-y: auto; padding: 24px; }

/* 登录页 */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-card {
  width: 380px; max-width: 100%; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px 32px; box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; }
.login-logo .logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.login-card h1 { text-align: center; font-size: 20px; font-weight: 700; }
.login-card .sub { text-align: center; color: var(--text-muted); font-size: 13px; margin: 6px 0 26px; }
.login-card .field { margin-bottom: 16px; }
.login-error {
  background: var(--red-soft); color: var(--red); border-radius: 8px;
  padding: 9px 14px; font-size: 13px; margin-bottom: 16px;
}

/* 页面标题 */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h2 { font-size: 22px; font-weight: 700; }
.page-head .sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* 统计卡 */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.admin-stat {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; transition: all 0.2s;
}
.admin-stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.admin-stat .as-num { font-size: 26px; font-weight: 800; }
.admin-stat .as-cap { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.admin-stat.blue .as-num { color: var(--primary-text); }
.admin-stat.green .as-num { color: var(--green); }
.admin-stat.amber .as-num { color: var(--amber); }
.admin-stat.red .as-num { color: var(--red); }

/* 表格 */
.table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-toolbar .search-box input { width: 200px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 10px 18px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); background: var(--bg-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-muted); }
.table .t-title { font-weight: 600; font-size: 14px; }
.table .t-title a:hover { color: var(--primary-text); }
.table .actions { display: flex; gap: 4px; flex-wrap: wrap; }
.table .actions .btn { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.checked-row td { background: var(--bg-accent); }
.checkbox { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* 编辑器 */
.editor-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.editor-pane { display: flex; flex-direction: column; gap: 10px; }
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; }
.editor-toolbar button {
  width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary); font-size: 13px; font-weight: 600;
  transition: all 0.15s;
}
.editor-toolbar button:hover { border-color: var(--primary); color: var(--primary-text); }
.md-input {
  min-height: 460px; font-family: var(--mono); font-size: 13.5px; line-height: 1.7;
  padding: 14px; resize: vertical;
}
.preview-pane {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; min-height: 460px; max-height: 70vh; overflow-y: auto;
}
.preview-pane .prose { font-size: 14.5px; }
.side-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.side-panel h4 { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.side-panel .field { margin-bottom: 12px; }
.side-panel .field:last-child { margin-bottom: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; color: var(--text-secondary); }
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px;
  transition: 0.2s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 999px; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* 媒体库 */
.media-layout { display: grid; grid-template-columns: 190px 1fr; gap: 16px; align-items: start; }
.folder-tree { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.folder-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px;
  font-size: 13.5px; color: var(--text-secondary); cursor: pointer; width: 100%; border: none; background: none; text-align: left;
}
.folder-item:hover { background: var(--bg-muted); color: var(--text); }
.folder-item.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 500; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-item {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all 0.15s; position: relative;
}
.media-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.media-item.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.media-item .m-thumb { height: 100px; display: flex; align-items: center; justify-content: center; background: var(--bg-muted); overflow: hidden; }
.media-item .m-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-item .m-thumb .m-ico { font-size: 32px; opacity: 0.5; }
.media-item .m-info { padding: 8px 10px; }
.media-item .m-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-item .m-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.media-item .m-check {
  position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; accent-color: var(--primary);
  opacity: 0; transition: 0.15s;
}
.media-item:hover .m-check, .media-item.selected .m-check { opacity: 1; }

/* 弹窗 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 480px; max-width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  padding: 24px;
}
.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 18px; }
.modal .field { margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 活动日志 */
.log-list { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 18px; }
.log-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.log-item:last-child { border-bottom: none; }
.log-item .l-time { color: var(--text-faint); font-size: 12px; white-space: nowrap; }

@media (max-width: 900px) {
  .post-grid, .cat-grid { grid-template-columns: 1fr; }
  .related .post-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .editor-wrap { grid-template-columns: 1fr; }
  .media-layout { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-box input { width: 100%; }
  .hero h1 { font-size: 32px; }
  .nav-links a { padding: 6px 8px; font-size: 13px; }
  .admin-wrap { position: relative; }
  .admin-sidebar { position: absolute; left: 0; top: 0; bottom: 0; z-index: 40; }
  .admin-wrap.collapsed .admin-sidebar { width: var(--sidebar-w-collapsed); }
  .pn-nav { grid-template-columns: 1fr; }
}