:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e5e9f0;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.container { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* 顶栏 */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.site-header .inner {
  max-width: 880px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand { font-size: 18px; font-weight: 700; color: var(--text); }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  padding: 6px 12px; border-radius: var(--radius);
  color: var(--muted); font-size: 14px; transition: .15s;
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--accent); color: #fff; }

/* 文章列表 */
.list { margin: 24px 0; display: grid; gap: 12px; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; display: flex; gap: 16px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04); transition: .15s;
}
.card:hover { box-shadow: 0 4px 14px rgba(16,24,40,.08); }
.card .thumb {
  width: 110px; height: 74px; object-fit: cover;
  border-radius: var(--radius); background: var(--bg); flex-shrink: 0;
}
.card .body { min-width: 0; }
.card h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.card h2 a { color: var(--text); }
.card h2 a:hover { color: var(--accent); }
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #eef2ff; color: var(--accent); font-size: 12px; font-weight: 500;
}

/* 分页 */
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0 40px; }
.pager a, .pager span {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); font-size: 14px;
}
.pager span { color: #cbd5e1; }

/* 详情 */
.article { background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px; margin: 24px 0 40px; }
.article h1 { font-size: 26px; font-weight: 700; margin-bottom: 12px; }
.article .meta { margin-bottom: 20px; }
.article .cover { width: 100%; border-radius: var(--radius); margin-bottom: 20px; }
.content { font-size: 16px; }
.content p { margin: 0 0 14px; }
.content img { max-width: 100%; border-radius: var(--radius); }
.content ul, .content ol { margin: 0 0 14px 22px; }
.content blockquote {
  border-left: 3px solid var(--border); padding-left: 14px; color: var(--muted); margin: 0 0 14px;
}

/* 按钮 */
.btn {
  display: inline-block; padding: 9px 18px; border-radius: var(--radius);
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  font-size: 14px; transition: .15s; text-decoration: none;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* 表单 */
.form-wrap { max-width: 440px; margin: 60px auto; }
.panel { background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px; box-shadow: 0 1px 3px rgba(16,24,40,.06); }
.panel h1 { font-size: 20px; margin-bottom: 20px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; font-family: inherit;
  background: var(--card); color: var(--text); transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.field textarea { min-height: 240px; resize: vertical; }
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-ok { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.tip { margin-top: 6px; font-size: 12px; line-height: 1.6; color: var(--muted); }

/* 图形验证码 */
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1; min-width: 0; letter-spacing: 4px; text-transform: uppercase; }
.captcha-btn {
  flex: 0 0 auto; padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); cursor: pointer; line-height: 0; overflow: hidden; transition: .15s;
}
.captcha-btn:hover { border-color: var(--accent); }
.captcha-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.captcha-img { display: block; width: 130px; height: 44px; }

/* 后台表格 */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin: 24px 0; }
.toolbar h1 { font-size: 22px; }
table { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
th, td { padding: 12px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; color: var(--muted); }
tr:last-child td { border-bottom: none; }
.actions { display: flex; gap: 8px; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

@media (max-width: 600px) {
  .card { flex-direction: column; }
  .card .thumb { width: 100%; height: 160px; }
  .article { padding: 18px; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  td { border: none; padding: 6px 14px; }
  tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
}

/* ============================================================
   经典 CMS 两栏版式（参照传统资讯站布局，配色克制）
   ============================================================ */
.wrap { width: 1000px; max-width: 100%; margin: 0 auto; padding: 0 12px; }

/* 顶部文字导航条 */
.topbar { background: #f1f5f9; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.topbar .wrap { display: flex; justify-content: space-between; align-items: center; height: 34px; }
.topbar a { color: var(--muted); margin: 0 2px; }
.topbar a:hover { color: var(--accent); }
.topbar .tb-right { color: #cbd5e1; }

/* 主导航菜单（深色条） */
.mainnav { background: #1e293b; }
.mainnav .wrap { display: flex; align-items: center; height: 42px; }
.mainnav a { color: #e2e8f0; font-size: 14px; font-weight: 500; padding: 0 14px; line-height: 42px; }
.mainnav a:hover, .mainnav a.on { background: var(--accent); color: #fff; }

/* 面包屑 */
.crumb { font-size: 13px; color: var(--muted); padding: 12px 12px; }
.crumb a { color: var(--accent); }

/* 两栏布局 */
.layout { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.sidebar { width: 220px; flex-shrink: 0; }
.main { flex: 1; min-width: 0; }

/* 侧栏盒子 */
.box { background: var(--card); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.box-hd {
  background: #f8fafc; border-bottom: 1px solid var(--border);
  padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--text);
  border-left: 3px solid var(--accent);
}
.box-bd { padding: 8px 0; list-style: none; }
.box-bd li { padding: 0; }
.cat-nav a {
  display: block; padding: 8px 16px; font-size: 13px; color: var(--text);
  border-bottom: 1px dashed var(--border);
}
.cat-nav a:hover, .cat-nav a.on { background: #eff6ff; color: var(--accent); }
.cat-nav li:last-child a { border-bottom: none; }
.hot-list li { padding: 7px 16px; font-size: 13px; border-bottom: 1px dashed var(--border); }
.hot-list li:last-child { border-bottom: none; }
.hot-list a { color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-list a:hover { color: var(--accent); }
.box-bd .muted { color: var(--muted); padding: 8px 16px; font-size: 13px; }

/* 右侧列表标题条 */
.list-hd {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px 8px 0 0;
  border-left: 3px solid var(--accent); padding: 10px 14px; font-size: 15px; font-weight: 600;
}
.list-hd span { color: var(--accent); }

/* 文章列表项 */
.art-list { list-style: none; background: var(--card); border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; }
.art-item { padding: 12px 16px; border-bottom: 1px dashed var(--border); }
.art-item:last-child { border-bottom: none; }
.art-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.art-title a { font-size: 15px; color: var(--text); font-weight: 500; }
.art-title a:hover { color: var(--accent); }
.art-meta { font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.art-summary { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.7; }
/* 经典分页 */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin: 20px 0 0; font-size: 13px; }
.pagination .pg-info { color: var(--muted); margin-right: 6px; }
.pagination a {
  padding: 5px 11px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--card); color: var(--text);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination a.cur { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.disabled { color: #cbd5e1; pointer-events: none; background: #f8fafc; }

/* 详情正文信息条 */
.art-info {
  text-align: center; font-size: 13px; color: var(--muted);
  padding: 10px 0; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.art-info a { color: var(--accent); }
.article { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 24px; }
.article h1 { text-align: center; font-size: 22px; }
.art-foot { margin: 16px 0; }

/* 底部 */
.footer { border-top: 1px solid var(--border); background: #f8fafc; padding: 18px 0; margin-top: 8px; }
.footer .wrap { text-align: center; font-size: 12px; color: var(--muted); line-height: 1.9; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }

/* 响应式：窄屏单栏 */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .topbar .wrap { flex-direction: column; height: auto; padding: 6px 12px; gap: 2px; }
  .mainnav .wrap { overflow-x: auto; }
  .mainnav a { white-space: nowrap; }
  .art-title { flex-direction: column; gap: 2px; }
}

/* 置顶标记 */
.top-tag {
  display: inline-block; background: var(--danger); color: #fff;
  font-size: 11px; padding: 1px 6px; border-radius: 3px; margin-right: 4px;
  vertical-align: middle; font-weight: 600;
}

/* ============================================================
   表格式文章列表（仿传统下载站：蓝表头 + 名称/时间/点击 列）
   ============================================================ */
.list-table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card); }

/* 蓝色表头 */
.lt-head {
  display: flex; align-items: center;
  background: linear-gradient(180deg, #2f80c4 0%, #2570b0 100%);
  color: #fff; font-weight: 600; font-size: 13px;
}
.lt-head .col-name { flex: 1; padding: 9px 14px; }
.lt-head .col-size { width: 80px; text-align: center; padding: 9px 6px; }
.lt-head .col-date { width: 110px; text-align: center; padding: 9px 6px; }
.lt-head .col-hits { width: 88px; text-align: center; padding: 9px 14px 9px 6px; }

/* 行 */
.lt-row { padding: 10px 0 11px; border-bottom: 1px dashed var(--border); }
.lt-row:last-child { border-bottom: none; }
.lt-row:hover { background: #f8fbff; }

.lt-line { display: flex; align-items: baseline; }
.lt-line a.col-name {
  flex: 1; padding: 0 14px; font-size: 14px; color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lt-line a.col-name:hover { color: var(--accent); }
.lt-ico { color: #2570b0; font-size: 9px; vertical-align: middle; margin-right: 5px; }
.lt-line .col-size { width: 80px; text-align: center; padding: 0 6px; font-size: 12px; color: var(--muted); }
.lt-line .col-date { width: 110px; text-align: center; padding: 0 6px; font-size: 12px; color: var(--muted); font-style: italic; }
.lt-line .col-hits { width: 88px; text-align: center; padding: 0 14px 0 6px; font-size: 13px; color: #c0392b; font-weight: 600; }

.lt-summary { padding: 5px 14px 0 28px; font-size: 12px; color: var(--muted); line-height: 1.7; }

@media (max-width: 760px) {
  .lt-head .col-size, .lt-line .col-size { display: none; }
  .lt-head .col-date, .lt-line .col-date { display: none; }
  .lt-head .col-hits { width: 64px; }
  .lt-line .col-hits { width: 64px; }
  .lt-summary { padding-left: 14px; }
}

/* 正文内嵌媒体 */
.video-box {
  position: relative; width: 100%; max-width: 720px; margin: 16px auto;
  aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden;
}
.video-box iframe, .video-box video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.content-img { max-width: 100%; height: auto; border-radius: 8px; margin: 10px 0; display: block; }
.tip { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.7; }
.tip code { background: #f1f5f9; border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; color: var(--accent); font-size: 12px; }

/* 后台编辑器：媒体插入工具栏 + 预览面板 */
.media-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.media-toolbar .btn { font-size: 13px; }
.media-preview {
  margin-top: 12px; padding: 14px; border: 1px dashed var(--border);
  border-radius: 8px; background: #f8fafc; display: grid; gap: 12px;
}
.media-preview .mp-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 12px 0; }
.media-preview .mp-item img { max-width: 100%; height: auto; border-radius: 6px; display: block; }
.media-preview .mp-item.video-box { margin: 0; max-width: 100%; }
.media-preview .mp-item video { max-width: 100%; border-radius: 6px; background: #000; display: block; }

/* 分段单选（后台「内容类型」） */
.seg { display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg-item { position: relative; padding: 8px 16px; cursor: pointer; font-size: 14px; color: var(--muted); user-select: none; transition: .15s; }
.seg-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-item:has(input:checked) { background: var(--accent); color: #fff; }
.seg-item:not(:last-child) { border-right: 1px solid var(--border); }

/* ============================================================
   下载页（detail 当 post_type=download 时使用）
   ============================================================ */
.dl-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; margin: 16px 0 24px; }
.dl-side { background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.dl-side-hd {
  background: linear-gradient(180deg, #fff8e1, #ffeebb);
  border-bottom: 1px solid #f5d76e; padding: 10px 14px; font-weight: 700; color: #b06800;
  display: flex; align-items: center; gap: 6px;
}
.dl-side-bd { padding: 12px 14px; font-size: 13px; line-height: 2; background: #fffaef; }
.dl-side-bd .row { display: flex; justify-content: space-between; }
.dl-side-bd .row b { color: var(--text); }
.dl-side-bd .row span { color: #d9534f; font-weight: 600; }
.dl-side .links { padding: 8px 14px 14px; background: #fffaef; border-top: 1px dashed #f5d76e; }
.dl-side .links a {
  display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 13px;
  color: #b06800; border-bottom: 1px dashed rgba(245, 215, 110, .6);
}
.dl-side .links a:last-child { border-bottom: none; }
.dl-side .links a:hover { color: var(--danger); }
.dl-side .links a::before { content: '⬇'; }
.dl-side .footer-tip { padding: 10px 14px; background: #fff; color: var(--muted); font-size: 12px; }
.dl-side .footer-tip b { color: var(--danger); }

.dl-main { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 22px; }
.dl-main h2.dl-section { font-size: 15px; color: var(--accent); margin: 0 0 12px; padding-left: 8px; border-left: 3px solid var(--accent); }
.dl-main h2.dl-section + h2.dl-section { margin-top: 24px; }
.dl-content { font-size: 14px; line-height: 1.85; }
.dl-content img { max-width: 100%; border-radius: 6px; }

.dl-cta { text-align: center; margin: 24px 0 12px; }
.dl-cta a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 42px; font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, #67c23a 0%, #4caf36 100%);
  border: 1px solid #3d9028; border-radius: 8px;
  box-shadow: 0 2px 6px rgba(76, 175, 54, .35); transition: .15s;
}
.dl-cta a:hover { color: #fff; box-shadow: 0 4px 12px rgba(76, 175, 54, .5); transform: translateY(-1px); }
.dl-cta .icon { font-size: 20px; }

.dl-notice-list { margin: 0; padding-left: 22px; font-size: 13px; line-height: 1.95; color: var(--text); }
.dl-notice-list li { list-style: none; margin-left: -22px; }
.dl-notice-list b { color: var(--danger); }

@media (max-width: 760px) {
  .dl-layout { grid-template-columns: 1fr; }
}

/* Lucide-style inline SVG 图标 */
.icon { display: inline-block; vertical-align: -3px; flex-shrink: 0; }
.icon-text { display: inline-flex; align-items: center; gap: 6px; }
.icon-accent { color: var(--accent); }
.icon-success { color: #16a34a; }
.icon-danger { color: var(--danger); }
.icon-muted { color: var(--muted); }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.section-title .icon { color: var(--accent); }

/* ============================================================
   后台管理布局：左侧深色侧边栏 + 顶栏 + 主区
   ============================================================ */
body.admin-body { background: #f1f5f9; min-height: 100vh; }
.admin-layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.admin-sidebar {
  width: 240px; flex-shrink: 0; background: #1e293b;
  display: flex; flex-direction: column; color: #cbd5e1;
}
.admin-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px; border-bottom: 1px solid #334155;
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 1px;
}
.admin-brand .brand-mark { display: inline-flex; color: var(--accent); }
.admin-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

/* 一级菜单组 */
.nav-group { margin-bottom: 2px; }
.nav-group-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 20px; cursor: pointer; font-size: 14px;
  color: #94a3b8; transition: .15s; user-select: none;
}
.nav-group-hd:hover { background: rgba(255,255,255,.04); color: #e2e8f0; }
.nav-caret { display: inline-flex; transition: transform .2s; }
.nav-group.open .nav-caret { transform: rotate(-90deg); }

/* 二级菜单 */
.nav-group-bd {
  list-style: none; margin: 0; padding: 0;
  max-height: 0; overflow: hidden; transition: max-height .25s ease;
}
.nav-group.open .nav-group-bd { max-height: 400px; }
.nav-group-bd li { margin: 0; }
.nav-group-bd a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px 10px 44px; font-size: 13px; color: #94a3b8;
  border-left: 3px solid transparent; transition: .15s;
}
.nav-group-bd a:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav-group-bd a.on {
  background: rgba(37, 99, 235, .15); color: #fff;
  border-left-color: var(--accent);
}
.nav-group-bd a .icon { opacity: .7; }
.nav-group-bd a.on .icon { opacity: 1; color: #93c5fd; }

.admin-side-foot {
  padding: 14px 20px; border-top: 1px solid #334155;
  font-size: 12px;
}
.admin-side-foot a { color: #94a3b8; }
.admin-side-foot a:hover { color: #fff; }

/* 顶栏 + 主区 */
.admin-main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  height: 56px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.admin-page-title { font-size: 17px; font-weight: 600; color: var(--text); }
.admin-top-actions { display: flex; align-items: center; gap: 14px; }

.admin-main { padding: 24px 28px; flex: 1; }
.admin-main .toolbar { margin: 0 0 18px; }
.admin-main .toolbar h1 { font-size: 18px; }
.admin-main table { box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.admin-main .panel { box-shadow: 0 1px 2px rgba(16,24,40,.04); }

@media (max-width: 768px) {
  .admin-sidebar { width: 64px; }
  .admin-brand .brand-name, .nav-group-hd span:not(.nav-caret),
  .nav-group-bd a span, .admin-side-foot { display: none; }
  .nav-group-bd a { padding-left: 20px; justify-content: center; }
  .nav-group-hd { justify-content: center; }
}

/* ============================================================
   后台数据中心（admin_stats.php）
   ============================================================ */
/* 侧栏顶部独立链接 */
.nav-top-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; margin: 2px 0 8px;
  color: #94a3b8; font-size: 14px; transition: .15s;
  border-left: 3px solid transparent;
}
.nav-top-link:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav-top-link.on { background: rgba(37,99,235,.15); color: #fff; border-left-color: var(--accent); }
.nav-top-link.on .icon { color: #93c5fd; }

/* 数据卡 4 列 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; position: relative; overflow: hidden;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.stat-card .stat-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--text); margin: 8px 0 4px; line-height: 1.1; }
.stat-card .stat-sub { font-size: 12px; color: var(--muted); }
.stat-card .stat-sub b { color: var(--accent); }
.stat-card .stat-deco {
  position: absolute; right: -8px; bottom: -8px; opacity: .08;
  color: var(--accent); pointer-events: none;
}
.stat-card.is-blue .stat-deco { color: #3b82f6; }
.stat-card.is-green .stat-deco { color: #16a34a; }
.stat-card.is-orange .stat-deco { color: #f59e0b; }
.stat-card.is-pink .stat-deco { color: #db2777; }

/* 中部两栏：趋势柱状图 + 分类条形 */
.stats-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 20px; }
.stats-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.stats-card .card-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stats-card .card-hd h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stats-card .card-hd h3 .icon { color: var(--accent); }
.stats-card .card-hd .legend { font-size: 12px; color: var(--muted); }

/* 柱状图 */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 8px 0; }
.bar-chart .bar {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative; min-width: 0;
}
.bar-chart .bar-fill {
  width: 100%; max-width: 38px; min-height: 4px;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  border-radius: 6px 6px 0 0; position: relative;
  transition: .2s;
}
.bar-chart .bar-fill:hover { opacity: .85; }
.bar-chart .bar-fill::after {
  content: attr(data-value); position: absolute; left: 50%; top: -20px;
  transform: translateX(-50%); font-size: 12px; color: var(--text); font-weight: 600;
  white-space: nowrap;
}
.bar-chart .bar-label { font-size: 11px; color: var(--muted); }

/* 分类水平条 */
.hbar-list { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 90px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.hbar-row .hbar-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .hbar-bar { background: #eff6ff; border-radius: 999px; height: 8px; overflow: hidden; }
.hbar-row .hbar-fill {
  height: 100%; background: linear-gradient(90deg, #60a5fa, #2563eb); border-radius: 999px;
  transition: width .3s;
}
.hbar-row .hbar-cnt { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 底部两栏列表 */
.list-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 6px 0; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.list-card .list-hd-mini { padding: 14px 20px 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.list-card .list-hd-mini h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; color: var(--text); }
.list-card .list-hd-mini h3 .icon { color: var(--accent); }
.list-card ol, .list-card ul { list-style: none; margin: 0; padding: 0; }
.list-card li {
  padding: 11px 20px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.list-card li:last-child { border-bottom: none; }
.list-card li .rank {
  width: 22px; height: 22px; border-radius: 6px; background: var(--bg); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.list-card li .rank.top-1 { background: #fef3c7; color: #b45309; }
.list-card li .rank.top-2 { background: #e0e7ff; color: #4338ca; }
.list-card li .rank.top-3 { background: #fce7f3; color: #be185d; }
.list-card li .item-title {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text);
}
.list-card li .item-title:hover { color: var(--accent); }
.list-card li .item-meta { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.list-card .empty-mini { padding: 30px 20px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: 1fr; }
}

/* ============================================================
   智能客服浮窗（前台全站）
   ============================================================ */
#chat-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 1000;
  width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(120% 120% at 30% 20%, #6366f1 0%, #4f46e5 45%, #4338ca 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow:
    0 12px 28px rgba(67, 56, 202, .35),
    0 4px 10px rgba(67, 56, 202, .22),
    inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .2s ease, box-shadow .2s ease;
  animation: chat-float 3.6s ease-in-out infinite;
}
/* 外层柔光 / 呼吸圈 */
#chat-launcher::before {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, .35), transparent 70%);
  z-index: -1; animation: chat-pulse-ring 2.4s ease-out infinite;
}
#chat-launcher:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 18px 36px rgba(67, 56, 202, .45),
    0 6px 14px rgba(67, 56, 202, .28),
    inset 0 1px 0 rgba(255, 255, 255, .25);
  animation-play-state: paused;
}
#chat-launcher:active { transform: translateY(-1px) scale(.98); }
#chat-launcher svg { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .15)); }

/* 右下角"在线"小绿点 */
.chat-launcher-dot {
  position: absolute; right: 4px; bottom: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .7);
  animation: chat-dot-pulse 2s infinite;
}
/* 右上角"AI"小徽章 */
.chat-launcher-badge {
  position: absolute; top: -2px; right: -4px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .3px;
  padding: 2px 6px; border-radius: 8px; line-height: 1;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 6px rgba(239, 68, 68, .35);
}

@keyframes chat-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes chat-pulse-ring {
  0%   { transform: scale(.85); opacity: .7; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes chat-dot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

#chat-panel {
  position: fixed; right: 24px; bottom: 90px; z-index: 1000;
  width: 360px; max-width: calc(100vw - 32px); height: 500px; max-height: calc(100vh - 120px);
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(16, 24, 40, .18);
  display: none; flex-direction: column; overflow: hidden;
}
#chat-panel.is-open { display: flex; animation: chat-in .18s ease-out; }
@keyframes chat-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.chat-hd {
  background: linear-gradient(135deg, #2563eb, #4338ca);
  color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-hd-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.chat-hd-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .25);
  animation: chat-pulse 2s infinite;
}
@keyframes chat-pulse { 0%,100% { opacity: 1 } 50% { opacity: .4 } }
.chat-hd-close {
  background: none; border: 0; color: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px;
  font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  transition: .15s;
}
.chat-hd-close:hover { background: rgba(255,255,255,.18); }

.chat-body {
  flex: 1; overflow-y: auto; padding: 14px;
  background: #f8fafc; display: flex; flex-direction: column; gap: 10px;
}
.chat-msg { display: flex; }
.chat-msg.bot { justify-content: flex-start; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble {
  max-width: 78%; padding: 9px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.6; word-break: break-word;
}
.chat-msg.bot .chat-bubble {
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); border-top-left-radius: 4px;
}
.chat-msg.user .chat-bubble {
  background: var(--accent); color: #fff; border-top-right-radius: 4px;
}
.chat-typing .chat-bubble { display: flex; gap: 4px; padding: 12px 14px; }
.chat-typing .chat-bubble span {
  width: 6px; height: 6px; border-radius: 50%; background: #94a3b8;
  animation: chat-bounce 1.4s infinite ease-in-out both;
}
.chat-typing .chat-bubble span:nth-child(2) { animation-delay: .15s; }
.chat-typing .chat-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-bounce { 0%, 80%, 100% { transform: scale(.6); opacity:.5 } 40% { transform: scale(1); opacity: 1 } }

.chat-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chat-qbtn {
  background: var(--card); border: 1px solid var(--border); color: var(--accent);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; cursor: pointer; transition: .15s;
}
.chat-qbtn:hover { background: #eff6ff; border-color: var(--accent); }

.chat-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border); background: var(--card);
}
.chat-foot .chat-human {
  font-size: 12px; color: var(--muted); padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 6px; white-space: nowrap;
}
.chat-foot .chat-human:hover { color: var(--accent); border-color: var(--accent); }
.chat-foot input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; outline: none; transition: .15s;
}
.chat-foot input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.chat-foot button {
  background: var(--accent); color: #fff; border: 0; padding: 8px 16px;
  border-radius: 8px; font-size: 13px; cursor: pointer; transition: .15s;
}
.chat-foot button:hover { background: var(--accent-hover); }
.chat-foot button:disabled { opacity: .6; cursor: wait; }

@media (max-width: 480px) {
  #chat-panel { right: 12px; left: 12px; width: auto; bottom: 80px; height: 70vh; }
  #chat-launcher { right: 16px; bottom: 16px; }
}

/* 开关样式 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 999px; transition: .2s;
}
.switch .slider::before {
  content: ''; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }
