/* ==========================================================
   雪岭工作室 · 全局样式
   灵感来自现代国风：墨黑、宣纸白、朱砂点缀
   ========================================================== */

:root {
  /* —— 中性语义令牌 —— */
  --canvas: oklch(0.99 0.005 95);
  --surface: oklch(1 0 0);
  --surface-subtle: oklch(0.965 0.008 90);
  --surface-raised: oklch(1 0 0);
  --ink-strong: oklch(0.22 0.018 260);
  --ink: oklch(0.32 0.018 260);
  --ink-muted: oklch(0.5 0.015 260);
  --ink-faint: oklch(0.7 0.012 260);
  --line: oklch(0.9 0.01 80);
  --line-strong: oklch(0.78 0.012 80);
  --selected: oklch(0.95 0.012 80);
  --disabled-background: oklch(0.94 0.005 90);
  --disabled-foreground: oklch(0.65 0.01 80);

  /* —— 品牌色（参考项目 brand 命名） —— */
  --brand-paper: oklch(0.985 0.006 95);
  --brand-paper-deep: oklch(0.955 0.012 88);
  --brand-ink: oklch(0.22 0.018 260);
  --brand-cinnabar: oklch(0.5 0.18 25);     /* 朱砂 */
  --brand-cinnabar-soft: oklch(0.92 0.04 25);
  --brand-gold: oklch(0.7 0.1 75);          /* 描金 */
  --brand-jade: oklch(0.55 0.08 165);       /* 远山青 */
  --brand-cloud: oklch(0.85 0.01 80);

  /* —— 语义动作色 —— */
  --action: oklch(0.22 0.018 260);
  --action-foreground: oklch(0.99 0.005 95);
  --action-hover: oklch(0.32 0.018 260);
  --action-active: oklch(0.16 0.018 260);
  --danger: oklch(0.5 0.18 25);
  --danger-foreground: oklch(0.99 0.005 95);
  --success: oklch(0.5 0.1 150);
  --success-foreground: oklch(0.99 0.005 95);
  --warning: oklch(0.65 0.13 70);
  --warning-foreground: oklch(0.22 0.018 260);

  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);

  --font-sans: 'Inter', 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', '宋体', serif;
}

/* ==========================================================
   基础重置
   ========================================================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--ink-strong);
  font-feature-settings: 'tnum' on, 'lnum' on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6, .font-serif {
  font-family: var(--font-serif);
  letter-spacing: 0.01em;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand-cinnabar); }

/* ==========================================================
   通用工具类
   ========================================================== */
.bg-canvas       { background-color: var(--canvas); }
.bg-surface      { background-color: var(--surface); }
.bg-surface-subtle { background-color: var(--surface-subtle); }
.bg-brand-paper  { background-color: var(--brand-paper); }
.bg-brand-paper-deep { background-color: var(--brand-paper-deep); }
.bg-brand-cinnabar { background-color: var(--brand-cinnabar); }
.bg-brand-jade   { background-color: var(--brand-jade); }
.bg-ink          { background-color: var(--ink-strong); }

.text-ink        { color: var(--ink); }
.text-ink-strong { color: var(--ink-strong); }
.text-ink-muted  { color: var(--ink-muted); }
.text-ink-faint  { color: var(--ink-faint); }
.text-cinnabar   { color: var(--brand-cinnabar); }
.text-gold       { color: var(--brand-gold); }
.text-jade       { color: var(--brand-jade); }
.text-inverse    { color: var(--canvas); }

.border-line       { border-color: var(--line); }
.border-line-strong{ border-color: var(--line-strong); }
.border-ink        { border-color: var(--ink-strong); }
.border-cinnabar   { border-color: var(--brand-cinnabar); }

.rounded-brand      { border-radius: var(--radius); }
.rounded-brand-sm   { border-radius: var(--radius-sm); }
.rounded-brand-md   { border-radius: var(--radius-md); }
.rounded-brand-lg   { border-radius: var(--radius-lg); }
.rounded-brand-xl   { border-radius: var(--radius-xl); }

.shadow-paper {
  box-shadow:
    0 1px 0 oklch(0.95 0.005 95),
    0 2px 6px -2px oklch(0.22 0.018 260 / 0.06),
    0 8px 24px -8px oklch(0.22 0.018 260 / 0.08);
}
.shadow-cinnabar {
  box-shadow: 0 6px 20px -8px oklch(0.5 0.18 25 / 0.5);
}

/* ==========================================================
   装饰元素：水墨分隔、印章
   ========================================================== */
/* 居中的"墨点"分隔符 */
.divider-ink::before,
.divider-ink::after {
  content: '';
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--line-strong);
  vertical-align: middle;
  margin: 0 0.75rem;
}
.divider-ink::before { margin-left: 0; }
.divider-ink::after { margin-right: 0; }

/* 印章效果：朱砂方框 + 篆体字 */
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background: var(--brand-cinnabar);
  color: var(--canvas);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  border-radius: 6px;
  letter-spacing: -0.05em;
  box-shadow:
    inset 0 0 0 2px oklch(0.99 0.005 95 / 0.6),
    0 1px 0 oklch(0 0 0 / 0.08);
  user-select: none;
}
.seal-sm { width: 2rem; height: 2rem; font-size: 0.875rem; }
.seal-lg { width: 4rem; height: 4rem; font-size: 1.75rem; }

/* 站点品牌 logo(由 partials/brand-logo 渲染) */
.brand-logo {
  display: inline-block;
  width: 4.5rem;          /* 默认尺寸: 72px */
  height: 4.5rem;
  object-fit: contain;
  vertical-align: middle;
  user-select: none;
  line-height: 0;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.08));
}
.brand-logo > svg {
  display: block;
  width: 100%;
  height: 100%;
}
.brand-logo-sm { width: 3rem;   height: 3rem; }   /* 头部品牌: 48px */
.brand-logo-lg { width: 6rem;   height: 6rem; }   /* hero / footer: 96px */
.brand-logo-xl { width: 8rem;   height: 8rem; }   /* 登录 / 错误 / 空状态: 128px */

/* 水墨垂直条 */
.ink-bar {
  display: inline-block;
  width: 4px;
  height: 1em;
  background: var(--brand-cinnabar);
  vertical-align: middle;
  margin-right: 0.5rem;
  border-radius: 2px;
}

/* 宣纸纹理背景：用 SVG 噪点模拟 */
.bg-ricepaper {
  background-color: var(--brand-paper);
  background-image:
    radial-gradient(oklch(0.85 0.01 80 / 0.4) 1px, transparent 1px),
    radial-gradient(oklch(0.78 0.01 80 / 0.2) 1px, transparent 1px);
  background-size: 22px 22px, 11px 11px;
  background-position: 0 0, 5px 5px;
}

/* 远山轮廓 SVG 装饰 */
.mountain-divider {
  width: 100%;
  height: 80px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  opacity: 0.5;
}

/* ==========================================================
   按钮
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--ink-strong);
  color: var(--canvas);
  border-color: var(--ink-strong);
}
.btn-primary:hover:not(:disabled) { background: var(--action-hover); border-color: var(--action-hover); }
.btn-cinnabar {
  background: var(--brand-cinnabar);
  color: var(--canvas);
  border-color: var(--brand-cinnabar);
}
.btn-cinnabar:hover:not(:disabled) {
  background: oklch(0.42 0.18 25);
  border-color: oklch(0.42 0.18 25);
}
.btn-outline {
  background: transparent;
  color: var(--ink-strong);
  border-color: var(--line-strong);
}
.btn-outline:hover:not(:disabled) {
  background: var(--selected);
  border-color: var(--ink-strong);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--selected); }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--line);
}
.btn-danger:hover:not(:disabled) { background: var(--brand-cinnabar-soft); border-color: var(--danger); }
.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn-block { width: 100%; }

/* ==========================================================
   表单
   ========================================================== */
.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.375rem;
  letter-spacing: 0.02em;
}
.input,
.textarea,
.select {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--ink-strong);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.input::placeholder,
.textarea::placeholder { color: var(--ink-faint); }
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--ink-strong);
  box-shadow: 0 0 0 3px oklch(0.22 0.018 260 / 0.08);
}
.textarea { min-height: 9rem; resize: vertical; line-height: 1.6; }
.field-hint { font-size: 0.75rem; color: var(--ink-muted); margin-top: 0.375rem; }
.field-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.375rem; }

/* ==========================================================
   卡片
   ========================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px oklch(0.22 0.018 260 / 0.04);
}
.card-elevated {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 0 oklch(0.95 0.005 95),
    0 2px 6px -2px oklch(0.22 0.018 260 / 0.06),
    0 8px 24px -8px oklch(0.22 0.018 260 / 0.08);
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ==========================================================
   标签 / 徽章
   ========================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink-muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-cinnabar {
  background: var(--brand-cinnabar-soft);
  color: var(--brand-cinnabar);
  border-color: oklch(0.5 0.18 25 / 0.25);
}
.badge-jade {
  background: oklch(0.92 0.04 165);
  color: var(--brand-jade);
  border-color: oklch(0.55 0.08 165 / 0.25);
}
.badge-gold {
  background: oklch(0.95 0.05 75);
  color: oklch(0.45 0.1 75);
  border-color: oklch(0.7 0.1 75 / 0.3);
}
.badge-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
}

/* ==========================================================
   表格
   ========================================================== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}
.table thead th {
  text-align: left;
  padding: 0.625rem 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
}
.table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: oklch(0.99 0.005 95); }
.table-action { text-align: right; white-space: nowrap; }

/* ==========================================================
   提示条（flash message）
   ========================================================== */
.alert {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid;
  margin-bottom: 1rem;
}
.alert-success { background: oklch(0.96 0.04 150); border-color: oklch(0.7 0.1 150 / 0.4); color: oklch(0.3 0.1 150); }
.alert-error   { background: var(--brand-cinnabar-soft); border-color: oklch(0.5 0.18 25 / 0.4); color: oklch(0.32 0.18 25); }
.alert-info    { background: oklch(0.95 0.02 250); border-color: oklch(0.7 0.06 250 / 0.4); color: oklch(0.3 0.06 250); }

/* ==========================================================
   后台布局
   ========================================================== */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.25rem 0.5rem 1rem 0.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.75rem;
}
.sidebar-nav-group { margin-top: 0.5rem; }
.sidebar-nav-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.5rem 0.75rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
  border-radius: var(--radius-md);
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-link:hover { background: var(--selected); color: var(--ink-strong); }
.sidebar-link.active {
  background: var(--ink-strong);
  color: var(--canvas);
}
.sidebar-link.active .sidebar-icon { color: var(--canvas); }
.sidebar-icon { width: 1rem; height: 1rem; color: var(--ink-faint); flex-shrink: 0; }
.sidebar-link:hover .sidebar-icon { color: var(--ink); }
.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }

.main-area { display: flex; flex-direction: column; min-height: 100vh; background: var(--canvas); }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--ink-strong); }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.content { flex: 1; padding: 1.5rem 2rem 3rem; max-width: 1280px; width: 100%; }
.content-narrow { max-width: 800px; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--ink-strong); margin: 0; }
.page-subtitle { font-size: 0.875rem; color: var(--ink-muted); margin: 0.25rem 0 0; }

/* ==========================================================
   前台
   ========================================================== */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: oklch(0.99 0.005 95 / 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid oklch(0.9 0.01 80 / 0.6);
}
.site-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-brand { display: flex; align-items: center; gap: 0.625rem; }

/* ---------- 站内搜索框(在 brand 和 nav 之间) ---------- */
.site-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 18rem;
  display: flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 2.25rem;
  padding: 0 0.4rem 0 0.85rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.site-search:hover { border-color: #d8c48a; }
.site-search:focus-within {
  border-color: var(--brand-cinnabar);
  box-shadow: 0 0 0 3px rgba(179, 74, 58, .12);
  background: #fff;
}
.site-search-icon { color: var(--ink-muted); flex-shrink: 0; }
.site-search:focus-within .site-search-icon { color: var(--brand-cinnabar); }

.site-search-input {
  flex: 1; min-width: 0;
  border: 0; outline: 0;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink-strong);
  padding: 0 0.5rem;
  /* 去掉浏览器自带 search input 的小叉号/放大镜 */
  appearance: none;
  -webkit-appearance: none;
}
.site-search-input::-webkit-search-decoration,
.site-search-input::-webkit-search-cancel-button,
.site-search-input::-webkit-search-results-button,
.site-search-input::-webkit-search-results-decoration {
  display: none;
}
.site-search-input::placeholder { color: var(--ink-muted); }

.site-search-btn {
  appearance: none; border: 0; cursor: pointer;
  flex-shrink: 0;
  width: 1.75rem; height: 1.75rem;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.site-search-btn:hover {
  background: var(--brand-cinnabar);
  color: #faf6ee;
}
.site-brand-logo {
  height: 2rem;
  max-width: 12rem;
  width: auto;
  object-fit: contain;
  display: block;
}
.site-brand-name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink-strong);
  letter-spacing: 0.04em;
}
.site-brand-tag { font-size: 0.75rem; color: var(--ink-muted); margin-left: 0.25rem; }
.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.site-nav a {
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
  border-radius: var(--radius-md);
}
.site-nav a:hover { color: var(--ink-strong); background: var(--selected); }
.site-nav a.active { color: var(--ink-strong); font-weight: 500; }

/* ---------- 已登录用户头像下拉菜单 ---------- */
.site-user-menu {
  position: relative;
  display: inline-block;
  margin-left: 0.5rem;
}
/* 把原 .site-nav-user 胶囊同时作为下拉触发器:补齐 button 默认值 */
.site-user-menu-trigger {
  appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.site-user-menu-trigger:hover {
  border-color: #d8c48a;
  background: #fdf6e3;
  color: var(--ink-strong);
}
.site-user-menu.open .site-user-menu-trigger {
  border-color: #b34a3a;
  background: #fdf1ec;
  color: #b34a3a;
}
.site-user-menu-caret {
  margin-left: .15rem;
  opacity: .55;
  transition: transform .18s ease, opacity .15s ease;
  flex-shrink: 0;
}
.site-user-menu.open .site-user-menu-caret {
  transform: rotate(180deg);
  opacity: 1;
}

.site-user-menu-dropdown {
  position: absolute;
  top: calc(100% + .55rem);
  right: 0;
  min-width: 14rem;
  background: #fdfbf5;
  border: 1px solid #e0cfa3;
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(140,90,40,.06),
    0 12px 32px rgba(140,90,40,.14);
  padding: .35rem;
  z-index: 60;
  display: none;
  /* 极轻的国风淡入 */
  opacity: 0;
  transform: translateY(-4px) scale(.98);
  transform-origin: top right;
  transition: opacity .14s ease, transform .14s ease;
}
.site-user-menu.open .site-user-menu-dropdown {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.site-user-menu-head {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .65rem .55rem;
}
.site-user-menu-head-text { min-width: 0; }
.site-user-menu-head-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-strong);
  line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.site-user-menu-head-role { margin-top: .2rem; }
.site-user-menu-badge {
  display: inline-block;
  background: #e8dec0;
  color: #6b4f2b;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  padding: 2px 7px;
  border-radius: 4px;
}
.site-user-menu-badge-admin {
  background: #b34a3a;
  color: #faf6ee;
}
.site-user-menu-divider {
  height: 1px;
  margin: .25rem 0;
  background: linear-gradient(90deg, transparent, #d8c48a 30%, #d8c48a 70%, transparent);
}
.site-user-menu-form { margin: 0; padding: 0; }
.site-user-menu-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .55rem .65rem;
  font-size: .875rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  font: inherit;
  line-height: 1.2;
  transition: background .12s ease, color .12s ease;
}
.site-user-menu-item svg { color: var(--ink-muted); flex-shrink: 0; }
.site-user-menu-item:hover {
  background: #f5e9c8;
  color: var(--ink-strong);
}
.site-user-menu-item:hover svg { color: #b34a3a; }
.site-user-menu-item-danger { color: #8a4a3a; }
.site-user-menu-item-danger svg { color: #b34a3a; }
.site-user-menu-item-danger:hover {
  background: #fbe4dd;
  color: #b34a3a;
}
.site-user-menu-item-danger:hover svg { color: #b34a3a; }

/* 窄屏:菜单贴右边仍可用,但触发器只露头像 */
@media (max-width: 520px) {
  .site-user-menu-trigger { padding: .15rem .35rem; gap: .25rem; }
  .site-nav-user-name { display: none; }
}
@media (max-width: 380px) {
  .site-user-menu-dropdown { min-width: 12rem; }
}

/* 原 .site-nav-user 胶囊样式(现在是下拉触发器) */
.site-nav-user {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.625rem 0.25rem 0.25rem;
  margin: 0 0.25rem 0 0.5rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.8125rem;
  line-height: 1;
  max-width: 12rem;
}
.site-nav-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
@media (max-width: 520px) {
  .site-nav-user-name { display: none; }
  .site-nav-user { padding: 0.15rem; }
}

/* ==========================================================
   适配机型选择器(逐条添加)
   ========================================================== */
.device-picker { display: flex; flex-direction: column; gap: .5rem; }
.device-picker-input {
  display: flex; gap: .5rem; align-items: stretch;
}
.device-picker-input .input { flex: 1; min-width: 0; }
.device-picker-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: .4rem;
  min-height: 2rem;
}
.device-picker-list:empty { display: none; }
.device-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .55rem .3rem .75rem;
  background: #fdf1ec;
  color: #8a3a2d;
  border: 1px solid #f0d4c5;
  border-radius: 999px;
  font-size: .8125rem;
  line-height: 1.1;
  max-width: 100%;
  animation: chipIn .12s ease-out;
}
.device-chip-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 24rem;
}
.device-chip-remove {
  appearance: none; background: transparent; border: 0;
  color: #b34a3a; font-size: 1.05rem; line-height: 1;
  cursor: pointer; padding: 0 .1rem;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.1rem; height: 1.1rem;
  transition: background .12s, color .12s;
}
.device-chip-remove:hover { background: #b34a3a; color: #fffaf2; }
.device-chip-remove:focus-visible { outline: 2px solid #b34a3a; outline-offset: 1px; }
@keyframes chipIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* 访客模式下的「注册」入口：朱砂描边,跟「登录」做区分 */
.site-nav a.site-nav-reg {
  border: 1px solid var(--brand-cinnabar);
  color: var(--brand-cinnabar);
  padding: .35rem .75rem;
  border-radius: var(--radius-md);
  margin-right: .25rem;
  transition: background .15s, color .15s;
}
.site-nav a.site-nav-reg:hover {
  background: var(--brand-cinnabar);
  color: var(--canvas);
}

.site-footer {
  margin-top: 4rem;
  padding: 2.5rem 1.5rem 2rem;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.8125rem;
}
.site-footer .seal { margin: 0 auto 0.75rem; }

/* Hero */
.hero {
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  position: relative;
}
.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.875rem;
  color: var(--ink-strong);
}
.hero .hero-sub {
  font-size: 1.125rem;
  color: var(--ink-muted);
  max-width: 36rem;
  margin: 0 auto 2rem;
  line-height: 1.7;
}
.hero-cta { display: flex; gap: 0.625rem; justify-content: center; flex-wrap: wrap; }
.hero-decor { margin-top: 2.5rem; color: var(--ink-faint); }

/* 网格容器 */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* 内容列表卡 */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow:
    0 4px 8px -4px oklch(0.22 0.018 260 / 0.08),
    0 12px 24px -10px oklch(0.22 0.018 260 / 0.1);
}
.post-card-cover {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--brand-paper-deep), var(--surface));
  border-bottom: 1px solid var(--line);
}
.post-card-body { padding: 1rem 1.125rem 1.125rem; flex: 1; display: flex; flex-direction: column; }
.post-card-title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.375rem;
  color: var(--ink-strong);
}
.post-card-summary {
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.6;
  margin: 0 0 0.875rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--ink-faint); }

/* 详情 */
.post-detail { max-width: 720px; margin: 0 auto; }
.post-detail h1 { font-size: 2rem; font-weight: 700; margin: 1.5rem 0 0.75rem; }
.post-detail .post-meta { color: var(--ink-muted); font-size: 0.875rem; margin-bottom: 2rem; }
.post-detail .post-content {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.95;
  color: var(--ink);
  white-space: pre-wrap;
}

/* Stat 卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat-card { padding: 1.125rem 1.25rem; }
.stat-label { font-size: 0.75rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-family: var(--font-serif); font-size: 1.75rem; font-weight: 700; color: var(--ink-strong); margin-top: 0.25rem; }
.stat-delta { font-size: 0.75rem; color: var(--ink-muted); margin-top: 0.25rem; }

/* ==========================================================
   工具
   ========================================================== */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.04em; }
.leading-relaxed { line-height: 1.7; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none; }
@media (max-width: 768px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .content { padding: 1.25rem 1rem 3rem; }
  .topbar { padding: 0.75rem 1rem; }
  .site-header-inner { flex-wrap: wrap; }
  .site-nav { width: 100%; justify-content: center; }
  .site-search { order: 3; width: 100%; max-width: none; }
  .post-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  /* 极窄屏:整行给搜索框,导航和用户菜单换行 */
  .site-search { height: 2rem; padding: 0 0.4rem 0 0.75rem; }
  .site-search-input { font-size: 0.8125rem; }
}
