/* ============================================================
   Forum — Design System CSS (DESIGN.md)
   Font: /assets/font/a.ttf
   Icons: Remix Icon (CDN)
   ============================================================ */

@font-face {
  font-family: 'ForumFont';
  src: url('../font/a.ttf') format('truetype');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* ── CSS Variables ───────────────────────────────────────── */
:root {
  /* Brand */
  --terracotta:     #c96442;
  --coral:          #d97757;
  --error:          #b53333;
  --focus-blue:     #3898ec;

  /* Surfaces */
  --parchment:      #f5f4ed;
  --ivory:          #faf9f5;
  --white:          #ffffff;
  --warm-sand:      #e8e6dc;
  --dark-surface:   #30302e;
  --deep-dark:      #141413;

  /* Text */
  --near-black:     #141413;
  --charcoal-warm:  #4d4c48;
  --olive-gray:     #5e5d59;
  --stone-gray:     #87867f;
  --dark-warm:      #3d3d3a;
  --warm-silver:    #b0aea5;

  /* Borders */
  --border-cream:   #f0eee6;
  --border-warm:    #e8e6dc;
  --border-dark:    #30302e;
  --ring-warm:      #d1cfc5;
  --ring-deep:      #c2c0b6;

  /* Admin / Badge */
  --admin-bg:       #d4a017;
  --admin-fg:       #141413;

  /* Typography */
  --font-main: 'ForumFont', Georgia, serif;

  /* Radius */
  --r-sm:   6px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-2xl:  24px;
  --r-3xl:  32px;

  /* Shadows */
  --shadow-ring:    0 0 0 1px var(--ring-warm);
  --shadow-whisper: rgba(0,0,0,.05) 0 4px 24px;
  --shadow-card:    rgba(0,0,0,.06) 0 2px 16px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--parchment);
  color: var(--near-black);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}
ul, ol { list-style: none; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--parchment); }
::-webkit-scrollbar-thumb { background: var(--ring-warm); border-radius: 3px; }

/* ── Toast / Flash ───────────────────────────────────────── */
/* PHP 注入的 flash 载体：只给 JS 提供 data-type / data-msg，本身不参与渲染。 */
.php-flash { display: none; }

.toast-container {
  position: fixed;
  top: 72px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-left: 4px solid var(--terracotta);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
  min-width: 260px; max-width: 380px;
  font-size: 15px;
  animation: slideIn .25s ease;
}
.toast.success { border-left-color: #4caf50; }
.toast.error   { border-left-color: var(--error); }
.toast.info    { border-left-color: var(--focus-blue); }
.toast i { font-size: 18px; flex-shrink: 0; }
.toast.success i { color: #4caf50; }
.toast.error   i { color: var(--error); }
.toast.info    i { color: var(--focus-blue); }
.toast-close {
  margin-left: auto; cursor: pointer; font-size: 16px;
  color: var(--stone-gray); background: none; border: none;
  padding: 0 2px; line-height: 1;
}
@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Nav ─────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--parchment);
  border-bottom: 1px solid var(--border-cream);
  backdrop-filter: blur(8px);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex; align-items: center; gap: 16px;
}
.nav-logo {
  font-size: 20px; font-weight: 600;
  color: var(--near-black);
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.nav-logo i { color: var(--terracotta); font-size: 22px; }
.nav-spacer { flex: 1; }
.nav-actions { display: flex; align-items: center; gap: 10px; }

/* avatar button */
.nav-user {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-cream);
  background: var(--ivory);
  cursor: pointer;
  transition: box-shadow .2s, background .2s;
}
.nav-user:hover { box-shadow: var(--shadow-ring); background: var(--white); }
.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-warm);
}
.nav-username { font-size: 14px; color: var(--charcoal-warm); font-weight: 500; }
.nav-dropdown {
  position: absolute; top: 54px; right: 20px;
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  min-width: 180px;
  overflow: hidden;
  display: none;
}
.nav-dropdown.open { display: block; animation: fadeDown .2s ease; }
@keyframes fadeDown {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  font-size: 14px; color: var(--charcoal-warm);
  cursor: pointer;
  transition: background .15s;
}
.dropdown-item:hover { background: var(--warm-sand); }
.dropdown-item i { font-size: 16px; color: var(--olive-gray); }
.dropdown-divider { height: 1px; background: var(--border-cream); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; cursor: pointer;
  font-size: 15px; font-family: var(--font-main);
  font-weight: 500; line-height: 1;
  padding: 9px 16px;
  border-radius: var(--r-md);
  transition: box-shadow .18s, background .18s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--terracotta); color: var(--ivory);
  box-shadow: 0 0 0 0 var(--terracotta), 0 0 0 1px var(--terracotta);
}
.btn-primary:hover { background: #b85a3a; }
.btn-secondary {
  background: var(--warm-sand); color: var(--charcoal-warm);
  box-shadow: 0 0 0 1px var(--ring-warm);
}
.btn-secondary:hover { box-shadow: 0 0 0 1px var(--ring-deep); background: var(--border-warm); }
.btn-dark {
  background: var(--dark-surface); color: var(--ivory);
}
.btn-dark:hover { background: var(--near-black); }
.btn-danger {
  background: var(--error); color: var(--white);
}
.btn-ghost {
  background: transparent; color: var(--olive-gray);
  box-shadow: 0 0 0 1px var(--border-cream);
}
.btn-ghost:hover { background: var(--warm-sand); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 24px; font-size: 16px; border-radius: var(--r-lg); }
.btn-icon { padding: 8px; }

/* ── Inputs ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-label { font-size: 14px; color: var(--charcoal-warm); font-weight: 500; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-lg);
  color: var(--near-black);
  font-size: 15px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--focus-blue);
  box-shadow: 0 0 0 3px rgba(56,152,236,.15);
}
.form-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.form-hint { font-size: 12px; color: var(--stone-gray); }
.form-error { font-size: 12px; color: var(--error); }

/* ── Container ───────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.container-xs { max-width: 480px; margin: 0 auto; padding: 0 20px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-whisper);
  overflow: hidden;
}
.card-body { padding: 24px; }
.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-cream);
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 600;
}
.card-header i { color: var(--terracotta); }

/* ── Auth Pages ──────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--parchment);
  padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-whisper);
  padding: 40px 36px;
}
.auth-logo {
  text-align: center; margin-bottom: 28px;
}
.auth-logo i { font-size: 36px; color: var(--terracotta); }
.auth-title {
  font-size: 24px; font-weight: 600; text-align: center;
  color: var(--near-black); margin-bottom: 6px;
}
.auth-subtitle {
  font-size: 14px; color: var(--stone-gray); text-align: center;
  margin-bottom: 28px;
}
.auth-link {
  text-align: center; margin-top: 20px;
  font-size: 14px; color: var(--olive-gray);
}
.auth-link a { color: var(--terracotta); font-weight: 500; }
.auth-link a:hover { text-decoration: underline; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--stone-gray); font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-warm);
}

/* ── Category Tabs ───────────────────────────────────────── */
.category-bar {
  background: var(--ivory);
  border-bottom: 1px solid var(--border-cream);
  position: sticky; top: 60px; z-index: 90;
}
.category-tabs {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; gap: 2px; overflow-x: auto;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 13px 16px;
  font-size: 14px; font-weight: 500;
  color: var(--olive-gray);
  white-space: nowrap; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
  text-decoration: none;
}
.cat-tab:hover  { color: var(--near-black); }
.cat-tab.active { color: var(--terracotta); border-bottom-color: var(--terracotta); }
.cat-tab i { font-size: 16px; }

/* ── Post List ───────────────────────────────────────────── */
.main-layout {
  max-width: 1200px; margin: 0 auto;
  padding: 24px 20px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}
.post-list { display: flex; flex-direction: column; gap: 2px; }
.post-item {
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: var(--r-xl);
  padding: 18px 20px;
  display: flex; gap: 14px;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
  text-decoration: none;
  color: inherit;
  margin-bottom: 6px;
}
.post-item:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}
.post-item.pinned {
  border-left: 3px solid var(--terracotta);
}
.post-avatar {
  width: 44px; height: 44px;
  border-radius: 50%; object-fit: cover;
  flex-shrink: 0; border: 1px solid var(--border-warm);
}
.post-body { flex: 1; min-width: 0; }
.post-meta {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 6px;
}
.post-author { font-size: 13px; font-weight: 500; color: var(--charcoal-warm); }
.badge-admin {
  font-size: 10px; font-weight: 600;
  background: var(--admin-bg); color: var(--admin-fg);
  padding: 1px 6px; border-radius: 4px;
  letter-spacing: .4px;
}
.badge-user {
  font-size: 10px;
  background: var(--warm-sand); color: var(--stone-gray);
  padding: 1px 6px; border-radius: 4px;
}
.cat-badge {
  font-size: 11px; padding: 2px 8px;
  border-radius: var(--r-2xl);
  background: var(--warm-sand); color: var(--olive-gray);
  display: flex; align-items: center; gap: 4px;
}
.post-time { font-size: 12px; color: var(--stone-gray); margin-left: auto; }
.post-title {
  font-size: 15px; font-weight: 600;
  color: var(--near-black); margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.post-excerpt { font-size: 13px; color: var(--olive-gray); line-height: 1.55; }
.post-stats {
  display: flex; gap: 14px; margin-top: 8px;
  font-size: 12px; color: var(--stone-gray);
}
.post-stats span { display: flex; align-items: center; gap: 4px; }
.pin-badge {
  font-size: 11px; background: var(--terracotta);
  color: var(--ivory); padding: 1px 7px; border-radius: 4px;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.sidebar-card {
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.sidebar-card-header {
  padding: 14px 18px;
  font-size: 14px; font-weight: 600;
  border-bottom: 1px solid var(--border-cream);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-card-header i { color: var(--terracotta); }
.sidebar-card-body { padding: 14px 18px; }
.sidebar-stat { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; color: var(--olive-gray); }
.sidebar-stat b { color: var(--near-black); }
.sidebar-cats li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; font-size: 14px; color: var(--charcoal-warm);
  border-bottom: 1px solid var(--border-cream);
}
.sidebar-cats li:last-child { border: none; }
.sidebar-cats a { display: flex; align-items: center; gap: 8px; flex:1; color: var(--charcoal-warm); }
.sidebar-cats a:hover { color: var(--terracotta); }
.sidebar-cats i { color: var(--terracotta); font-size: 15px; }

/* ── FAB ─────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 200;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--terracotta);
  color: var(--ivory);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 20px rgba(201,100,66,.4);
  transition: transform .2s, box-shadow .2s;
}
.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(201,100,66,.5);
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(20,20,19,.45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--ivory);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: rgba(0,0,0,.2) 0 -4px 40px;
  transform: translateY(20px);
  transition: transform .25s;
}
@media (min-width: 640px) {
  .modal { border-radius: var(--r-2xl); transform: scale(.97); }
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  padding: 20px 24px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-cream);
}
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--warm-sand); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--olive-gray);
  transition: background .15s;
}
.modal-close:hover { background: var(--border-warm); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-cream);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Post Detail ─────────────────────────────────────────── */
.post-detail-page { max-width: 860px; margin: 0 auto; padding: 24px 20px; }
.post-detail-header { margin-bottom: 20px; }
.post-detail-title {
  font-size: 24px; font-weight: 600;
  color: var(--near-black); line-height: 1.3; margin-bottom: 14px;
}
.post-author-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-top: 1px solid var(--border-cream);
  border-bottom: 1px solid var(--border-cream); margin-bottom: 24px;
}
.post-author-row img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.post-content {
  font-size: 16px; line-height: 1.8; color: var(--near-black);
  white-space: pre-wrap; word-break: break-word;
}
.post-images {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px; margin-top: 20px;
}
.post-images img {
  border-radius: var(--r-md); cursor: pointer;
  aspect-ratio: 1; object-fit: cover;
  transition: opacity .2s;
  border: 1px solid var(--border-cream);
}
.post-images img:hover { opacity: .88; }

/* 正文富文本（BBCode 渲染）：链接 / 图片 / 引用 / 代码 / 列表 / 对齐 */
.post-content .bb-link,
.comment-text .bb-link {
  color: var(--terracotta);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.post-content .bb-link:hover,
.comment-text .bb-link:hover { opacity: .85; }
.post-content .bb-img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: var(--r-md);
  border: 1px solid var(--border-cream);
  cursor: zoom-in;
}
.post-content .bb-code {
  background: var(--parchment);
  border: 1px solid var(--border-cream);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin: 12px 0;
  overflow-x: auto;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.7;
}
.post-content .bb-quote {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--parchment);
  border-left: 3px solid var(--border-warm);
  border-radius: var(--r-md);
  color: var(--charcoal-warm);
}
.post-content .bb-quote-by {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--stone-gray);
  margin-bottom: 6px;
}
.post-content .bb-list { margin: 10px 0 10px 22px; padding-left: 4px; }
.post-content .bb-list li { margin: 3px 0; }
.post-content .bb-hr {
  border: none;
  border-top: 1px solid var(--border-cream);
  margin: 16px 0;
}
.post-content .bb-align-center { text-align: center; }
.post-content .bb-align-right  { text-align: right; }
.post-content .bb-align-left   { text-align: left; }

/* Comments */
.comments-section { margin-top: 36px; }
.comments-title {
  font-size: 18px; font-weight: 600; margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.comments-title i { color: var(--terracotta); }
.comment-item {
  display: flex; gap: 12px; padding: 16px 0;
  border-bottom: 1px solid var(--border-cream);
}
.comment-item:last-child { border: none; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-content { flex: 1; }
.comment-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment-author { font-size: 14px; font-weight: 500; }
.comment-time { font-size: 12px; color: var(--stone-gray); }
.comment-text { font-size: 14px; color: var(--charcoal-warm); line-height: 1.6; }
.comment-form { margin-top: 24px; }

/* ── Profile / Settings ──────────────────────────────────── */
.settings-page { max-width: 640px; margin: 32px auto; padding: 0 20px; }
.settings-title {
  font-size: 22px; font-weight: 600; margin-bottom: 24px;
  display: flex; align-items: center; gap: 10px;
}
.settings-title i { color: var(--terracotta); }
.avatar-upload-area {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 24px; margin-bottom: 24px;
  background: var(--parchment); border-radius: var(--r-xl);
  border: 2px dashed var(--border-warm);
}
.avatar-preview {
  width: 90px; height: 90px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--border-warm);
  cursor: pointer;
}
.avatar-upload-hint { font-size: 13px; color: var(--stone-gray); }

/* ── Admin Layout ────────────────────────────────────────── */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--near-black);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.admin-sidebar-logo {
  padding: 22px 20px 16px;
  display: flex; align-items: center; gap: 10px;
  color: var(--ivory); font-size: 17px; font-weight: 600;
  border-bottom: 1px solid var(--dark-surface);
}
.admin-sidebar-logo i { color: var(--terracotta); font-size: 22px; }
.admin-nav { padding: 12px 0; flex: 1; }
.admin-nav-section {
  padding: 10px 16px 4px;
  font-size: 10px; font-weight: 600;
  color: var(--stone-gray); letter-spacing: .8px; text-transform: uppercase;
}
.admin-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; font-size: 14px;
  color: var(--warm-silver); cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.admin-nav-item:hover  { background: var(--dark-surface); color: var(--ivory); }
.admin-nav-item.active { background: rgba(201,100,66,.2); color: var(--terracotta); }
.admin-nav-item i { font-size: 17px; }
.admin-main { flex: 1; background: var(--parchment); overflow-y: auto; }
.admin-topbar {
  background: var(--ivory); border-bottom: 1px solid var(--border-cream);
  padding: 0 28px; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.admin-page-title { font-size: 18px; font-weight: 600; }
.admin-content { padding: 28px; }

/* ── Admin Table ─────────────────────────────────────────── */
.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: var(--r-xl); overflow: hidden;
  box-shadow: var(--shadow-whisper);
}
.data-table thead { background: var(--warm-sand); }
.data-table th {
  padding: 12px 16px; text-align: left;
  font-size: 13px; font-weight: 600; color: var(--charcoal-warm);
  border-bottom: 1px solid var(--border-cream);
}
.data-table td {
  padding: 12px 16px; font-size: 14px; color: var(--charcoal-warm);
  border-bottom: 1px solid var(--border-cream);
  vertical-align: middle;
}
.data-table tr:last-child td { border: none; }
.data-table tr:hover td { background: rgba(245,244,237,.6); }
.status-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  font-weight: 500; display: inline-block;
}
.status-active  { background: #d4edda; color: #155724; }
.status-pending { background: #fff3cd; color: #856404; }
.status-banned  { background: #f8d7da; color: #721c24; }

/* ── Admin Stats Cards ───────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  box-shadow: var(--shadow-whisper);
}
.stat-card-icon {
  width: 42px; height: 42px; border-radius: var(--r-md);
  background: rgba(201,100,66,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--terracotta); margin-bottom: 12px;
}
.stat-card-num { font-size: 28px; font-weight: 700; color: var(--near-black); line-height: 1; }
.stat-card-label { font-size: 13px; color: var(--stone-gray); margin-top: 4px; }

/* ── Upload image preview ────────────────────────────────── */
.img-preview-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.img-preview-item {
  position: relative; width: 80px; height: 80px;
}
.img-preview-item img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: var(--r-md); border: 1px solid var(--border-warm);
}
.img-preview-remove {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--error); color: white;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 28px; flex-wrap: wrap;
}
.page-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  font-size: 14px; color: var(--charcoal-warm);
  background: var(--ivory); border: 1px solid var(--border-cream);
  cursor: pointer; transition: background .15s;
  text-decoration: none;
}
.page-btn:hover  { background: var(--warm-sand); }
.page-btn.active { background: var(--terracotta); color: var(--ivory); border-color: var(--terracotta); }
.page-btn.disabled { opacity: .4; pointer-events: none; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--stone-gray);
}
.empty-state i { font-size: 48px; opacity: .4; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ── Lightbox ────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.85);
  display: none; align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 90vw; max-height: 90vh;
  border-radius: var(--r-lg); box-shadow: 0 8px 48px rgba(0,0,0,.4);
}
.lightbox-close {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.15); border: none; cursor: pointer;
  color: white; font-size: 20px; display: flex; align-items: center; justify-content: center;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin-sidebar { width: 200px; }
}
@media (max-width: 640px) {
  .admin-wrap { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: relative; }
  .admin-nav { display: flex; overflow-x: auto; padding: 8px 0; }
  .admin-nav-section { display: none; }
  .admin-nav-item { padding: 8px 16px; flex-shrink: 0; }
  .nav-username { display: none; }
  .post-item { gap: 10px; }
  .auth-card { padding: 28px 20px; }
}

/* ── Utility ─────────────────────────────────────────────── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-16  { margin-bottom: 16px; }
.text-muted { color: var(--stone-gray); }
.text-sm { font-size: 13px; }
.fw-600 { font-weight: 600; }
.w-100  { width: 100%; }
.text-danger { color: var(--error); }
.text-terracotta { color: var(--terracotta); }

/* ============================================================
   v2.1.0 社区玩法：签到 / 积分等级 / 点赞收藏 / 回复可见 / 通知 / 排行榜
   ============================================================ */

/* ── Nav 扩展：搜索框 / 积分 / 签到 / 消息 ──────────────── */
.nav-search {
  display: flex; align-items: center; gap: 6px;
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: var(--r-2xl);
  padding: 5px 12px;
  transition: box-shadow .2s;
}
.nav-search:focus-within { box-shadow: var(--shadow-ring); }
.nav-search i { color: var(--stone-gray); font-size: 15px; }
.nav-search input {
  border: none; outline: none; background: transparent;
  font-size: 13px; width: 130px; color: var(--near-black);
}
.nav-search input::placeholder { color: var(--warm-silver); }
@media (max-width: 900px) { .nav-search { display: none; } }

.nav-points {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; color: var(--terracotta);
  background: rgba(201,100,66,.1);
  border-radius: var(--r-2xl);
  padding: 5px 12px;
  white-space: nowrap;
}
.nav-points i { font-size: 15px; }
@media (max-width: 640px) { .nav-points { display: none; } }

.nav-bell {
  position: relative;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ivory); border: 1px solid var(--border-cream);
  color: var(--olive-gray); font-size: 18px;
  transition: box-shadow .2s, background .2s;
}
.nav-bell:hover { box-shadow: var(--shadow-ring); background: var(--white); }
.bell-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--error); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 17px;
  text-align: center;
}

/* ── 徽章：等级 / 精华 / 回复可见 ───────────────────────── */
/* 默认外观 = 升级前的老样式；站长配了颜色才挂 .lv-* 修饰类、用 --lv-* 变量覆盖 */
.level-badge {
  font-size: 10px; font-weight: 600;
  background: linear-gradient(135deg, #c96442, #d97757);
  color: var(--ivory);
  padding: 1px 7px; border-radius: 4px;
  letter-spacing: .2px;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 3px;
  vertical-align: middle;
}
.level-badge i { font-size: 11px; line-height: 1; }
.level-badge .lv-text { line-height: 1; }

/* 自定义配色下可选的四种铭牌样式（颜色由 --lv-color 等变量注入） */
.level-badge.lv-solid    { background: var(--lv-color); color: var(--lv-fg); }
.level-badge.lv-outline  {
  background: var(--lv-soft); color: var(--lv-color);
  box-shadow: inset 0 0 0 1px var(--lv-color);
}
.level-badge.lv-gradient {
  background: linear-gradient(135deg, var(--lv-color), var(--lv-deep));
  color: var(--lv-fg);
}
.level-badge.lv-glow {
  background: linear-gradient(135deg, var(--lv-color), var(--lv-deep));
  color: var(--lv-fg);
  box-shadow: 0 0 0 1px var(--lv-soft), 0 0 10px -2px var(--lv-color);
}

/* 勋章小图标 */
.badge-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.55;
  background: var(--ivory); color: var(--olive-gray);
  border: 1px solid var(--border-cream);
  white-space: nowrap;
}
.badge-chip i { font-size: 12px; line-height: 1; }
.badge-chip.has-color { background: var(--lv-soft); color: var(--lv-color); border-color: transparent; }
.badge-chip.badge-more { color: var(--olive-gray); opacity: .7; font-weight: 500; }

/* ── 勋章墙：个人主页 / 我的勋章 ────────────────────────── */
.badge-wall { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.badge-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px;
  border: 1px solid var(--border-cream); border-radius: 10px;
  background: var(--white);
  transition: box-shadow .18s, border-color .18s;
}
.badge-card:hover { box-shadow: var(--shadow-ring); }
.badge-card.is-owned { border-color: var(--lv-soft); cursor: pointer; }
.badge-card.is-off { opacity: .5; cursor: default; }
.badge-card .badge-pick { accent-color: var(--terracotta); width: 15px; height: 15px; }
.badge-card .bd-icon {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: var(--ivory); color: var(--olive-gray);
}
.badge-card.has-color .bd-icon { background: var(--lv-soft); color: var(--lv-color); }
.badge-card .bd-name { font-size: 13px; font-weight: 600; color: var(--dark-surface); }
.badge-card .bd-desc { font-size: 11.5px; color: var(--olive-gray); line-height: 1.5; margin-top: 2px; }
.badge-card .bd-meta { font-size: 11px; color: var(--olive-gray); opacity: .8; margin-top: 3px; }
.badge-card-body { min-width: 0; }
.essence-badge {
  font-size: 11px; background: var(--admin-bg); color: var(--admin-fg);
  padding: 1px 7px; border-radius: 4px; font-weight: 600;
}
.lock-badge {
  font-size: 11px;
  background: var(--dark-surface); color: var(--ivory);
  padding: 1px 7px; border-radius: 4px;
}
/* 高亮（道具）：暖橙渐变，与「精华」区分开 */
.highlight-badge {
  font-size: 11px; font-weight: 600;
  background: linear-gradient(135deg, #e08a2e, #c1432d);
  color: var(--ivory);
  padding: 1px 7px; border-radius: 4px;
  white-space: nowrap;
}
/* VIP 会员标记 */
.vip-badge {
  font-size: 10px; font-weight: 600;
  background: linear-gradient(135deg, #3f3a34, #6b6259);
  color: #f4e3c8;
  padding: 1px 7px; border-radius: 4px;
  letter-spacing: .2px; white-space: nowrap;
}
/* 付费主题价签 */
.price-badge {
  font-size: 11px; font-weight: 600;
  background: rgba(201,100,66,.12);
  color: var(--terracotta);
  border: 1px solid rgba(201,100,66,.35);
  padding: 1px 7px; border-radius: 4px;
  white-space: nowrap;
}
/* 高亮帖标题：左侧竖色条 + 轻微暖底 */
.title-highlight {
  position: relative;
  padding-left: 10px;
}
.title-highlight::before {
  content: '';
  position: absolute; left: 0; top: 2px; bottom: 2px;
  width: 3px; border-radius: 2px;
  background: linear-gradient(180deg, #e08a2e, #c96442);
}

/* ── 帖子操作条（点赞 / 收藏）──────────────────────────── */
.post-actions {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border-cream);
}
.action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r-2xl);
  background: var(--parchment); color: var(--olive-gray);
  border: 1px solid var(--border-warm);
  font-size: 14px; font-family: var(--font-main); font-weight: 500;
  cursor: pointer; transition: background .18s, color .18s, box-shadow .18s;
}
.action-btn:hover { background: var(--warm-sand); }
.action-btn.active {
  background: rgba(201,100,66,.12);
  border-color: rgba(201,100,66,.4);
  color: var(--terracotta);
}
.action-btn i { font-size: 16px; }

/* ── 回复可见区块 ───────────────────────────────────────── */
.hide-block {
  margin: 18px 0;
  border-radius: var(--r-lg);
  padding: 16px 18px;
  font-size: 15px; line-height: 1.8;
}
.hide-block.locked {
  display: flex; align-items: center; gap: 10px;
  background: var(--parchment);
  border: 1px dashed var(--ring-warm);
  color: var(--olive-gray);
  justify-content: center;
  text-align: center;
}
.hide-block.locked i { color: var(--terracotta); font-size: 18px; }
.hide-block.locked b { color: var(--terracotta); }
.hide-block.revealed {
  background: rgba(201,100,66,.05);
  border-left: 3px solid var(--terracotta);
}
.hide-block-tag {
  font-size: 12px; color: var(--terracotta); font-weight: 600;
  margin-bottom: 8px;
}

/* ── 签到 ──────────────────────────────────────────────── */
.checkin-card {
  background: linear-gradient(135deg, rgba(201,100,66,.08), rgba(217,119,87,.04));
  border: 1px solid var(--border-cream);
  border-radius: var(--r-xl);
  padding: 18px;
}
.checkin-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.checkin-streak { font-size: 12px; color: var(--olive-gray); line-height: 1.7; }
.checkin-streak b { color: var(--terracotta); font-size: 15px; }
.checkin-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; margin-top: 12px;
}
.cal-day {
  aspect-ratio: 1; border-radius: 5px;
  background: var(--warm-sand); color: var(--stone-gray);
  font-size: 10px; display: flex; align-items: center; justify-content: center;
}
.cal-day.checked { background: var(--terracotta); color: var(--ivory); font-weight: 600; }
.cal-day.today { box-shadow: 0 0 0 2px rgba(201,100,66,.45); }
.checkin-wall { display: flex; flex-wrap: wrap; gap: 8px; }
.checkin-wall-user {
  display: flex; align-items: center; gap: 6px;
  background: var(--parchment); border-radius: var(--r-2xl);
  padding: 3px 10px 3px 3px; font-size: 12px; color: var(--charcoal-warm);
}
.checkin-wall-user img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }

/* ── 排行榜 ────────────────────────────────────────────── */
.rank-list { display: flex; flex-direction: column; }
.rank-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; font-size: 14px;
  border-bottom: 1px solid var(--border-cream);
}
.rank-item:last-child { border: none; }
.rank-no {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%; background: var(--warm-sand); color: var(--olive-gray);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rank-no.top1 { background: #d4a017; color: #fff; }
.rank-no.top2 { background: #b0aea5; color: #fff; }
.rank-no.top3 { background: #c98a5b; color: #fff; }
.rank-item img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--charcoal-warm); }
.rank-name:hover { color: var(--terracotta); }
.rank-score { color: var(--terracotta); font-weight: 600; font-size: 13px; white-space: nowrap; }

/* ── 标签页 / 排序条 ───────────────────────────────────── */
.tab-bar {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border-cream);
  margin-bottom: 20px;
}
.tab-item {
  padding: 10px 16px; font-size: 14px; font-weight: 500;
  color: var(--olive-gray); border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 6px;
  transition: color .2s, border-color .2s;
}
.tab-item:hover { color: var(--near-black); }
.tab-item.active { color: var(--terracotta); border-bottom-color: var(--terracotta); }

/* ── 通知中心 ──────────────────────────────────────────── */
.notice-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 20px; border-bottom: 1px solid var(--border-cream);
  transition: background .15s;
}
.notice-item:last-child { border: none; }
.notice-item:hover { background: rgba(245,244,237,.6); }
.notice-item.unread { background: rgba(201,100,66,.045); }
.notice-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%; background: rgba(201,100,66,.12);
  color: var(--terracotta); font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.notice-title { font-size: 14px; font-weight: 500; color: var(--near-black); }
.notice-text { font-size: 13px; color: var(--olive-gray); margin-top: 3px; line-height: 1.6; }
.notice-time { font-size: 12px; color: var(--stone-gray); margin-top: 5px; }
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--error); flex-shrink: 0; margin-top: 6px;
}

/* ── 个人中心小统计 ────────────────────────────────────── */
.stat-mini-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}
.stat-mini {
  background: var(--parchment); border-radius: var(--r-lg);
  padding: 14px 16px; text-align: center;
}
.stat-mini b { display: block; font-size: 22px; font-weight: 700; color: var(--terracotta); line-height: 1.3; }
.stat-mini span { font-size: 12px; color: var(--olive-gray); }
.level-progress {
  height: 6px; border-radius: 3px; background: var(--warm-sand);
  overflow: hidden; margin-top: 8px;
}
.level-progress i { display: block; height: 100%; background: var(--terracotta); border-radius: 3px; }

/* ── 积分商店 / 我的道具（v2.2.0）────────────────────────── */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.shop-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--ivory);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  transition: box-shadow .18s, border-color .18s;
}
.shop-item:hover { border-color: rgba(201,100,66,.4); box-shadow: 0 4px 16px rgba(0,0,0,.05); }
.shop-item-icon {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: var(--r-md, 10px);
  background: var(--parchment); color: var(--terracotta);
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.shop-item-body { flex: 1; min-width: 0; }
.shop-item-name { font-size: 15px; font-weight: 600; color: var(--near-black); }
.shop-item-desc { font-size: 12px; color: var(--olive-gray); margin-top: 3px; line-height: 1.6; }
.shop-item-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.shop-price { font-size: 15px; font-weight: 700; color: var(--terracotta); white-space: nowrap; }
.shop-price i { font-size: 14px; }

.item-list { display: flex; flex-direction: column; gap: 12px; }
.item-use-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.item-use-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 16px 0; padding: 12px 16px;
  font-size: 13px; line-height: 1.7;
  background: rgba(201,100,66,.05);
  border-left: 3px solid var(--terracotta);
  border-radius: var(--r-lg);
}
.item-use-bar > i { color: var(--terracotta); font-size: 17px; }

@media (max-width: 640px) {
  .shop-item { flex-wrap: wrap; }
  .shop-item-buy { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .item-use-form { margin-left: 0; width: 100%; }
  .item-use-form .form-select { flex: 1; min-width: 0; }
}

/* ── 站点描述条（首页顶部，内容来自后台「站点描述」）───────── */
.site-intro {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--parchment);
  border-left: 3px solid var(--terracotta);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--charcoal-warm);
  word-break: break-word;
}
.site-intro > i { color: var(--terracotta); font-size: 16px; margin-top: 3px; flex-shrink: 0; }

/* ── 「已编辑」标记 ─────────────────────────────────────── */
.edited-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--stone-gray);
  white-space: nowrap;
}
.edited-tag i { font-size: 12px; }

/* ── 帖子编辑页 ─────────────────────────────────────────── */
.edit-page { max-width: 860px; margin: 0 auto; padding: 24px 20px; }
.edit-fieldset {
  border: 1px solid var(--border-cream);
  border-radius: var(--r-lg);
  padding: 4px 16px 0;
  margin: 0 0 20px;
}
.edit-fieldset > legend {
  padding: 0 8px; font-size: 13px; font-weight: 600;
  color: var(--olive-gray);
}
/* 已有图片：勾选框 = 保留，取消勾选即删除 */
.edit-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.edit-img-item {
  position: relative;
  border: 1px solid var(--border-warm);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--parchment);
  cursor: pointer;
  transition: border-color .18s, opacity .18s;
}
.edit-img-item img { display: block; width: 100%; height: 88px; object-fit: cover; }
.edit-img-item input { position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; }
.edit-img-item .edit-img-state {
  display: block; font-size: 11px; text-align: center;
  padding: 3px 0; color: var(--olive-gray); background: var(--ivory);
}
.edit-img-item.is-removed { opacity: .45; border-color: var(--error); }
.edit-img-item.is-removed .edit-img-state { color: var(--error); }
.edit-warn {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; line-height: 1.75;
  padding: 11px 15px; margin-bottom: 18px;
  border-radius: var(--r-lg);
  background: rgba(201,100,66,.06);
  border-left: 3px solid var(--terracotta);
  color: var(--charcoal-warm);
}
.edit-warn > i { color: var(--terracotta); font-size: 16px; margin-top: 2px; }
.edit-warn.info { background: var(--parchment); border-left-color: var(--border-warm); }
.edit-warn.info > i { color: var(--olive-gray); }
.edit-warn.error { background: rgba(220,53,69,.06); border-left-color: var(--error); }
.edit-warn.error > i { color: var(--error); }
