/* ===== CSS Variables ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Navbar ===== */
.navbar {
  background: var(--gray-900);
  color: #fff;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 24px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-logo-img {
  height: 32px;
  width: 32px;
  border-radius: 6px;
  object-fit: contain;
}
.nav-logo-text {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav-links a {
  color: #d1d5db;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
  transition: all .15s;
}
.nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
  text-decoration: none;
}
.nav-user { display: flex; align-items: center; gap: 8px; }
.nav-user-link {
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 14px;
}

/* ===== Container ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* 让主内容区撑满剩余高度，把 footer 推到底 */
main.container {
  flex: 1 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* 首页：内容较少时在可视区域垂直居中 */
.index-main {
  justify-content: center;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-100); }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-xs { padding: 2px 8px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-logout { background: transparent; border: 1px solid var(--danger); color: var(--danger); margin-left: 8px; }
.btn-logout:hover { background: var(--danger); color: #fff; opacity: 1; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color .15s;
  background: #fff;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-input.date-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: 13px; color: var(--danger); margin-top: 4px; }

/* ===== Cards ===== */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}
.card-title { font-size: 16px; font-weight: 600; color: var(--gray-800); }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
th {
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-50);
  white-space: nowrap;
}
tr:hover { background: var(--gray-50); }

/* 代替关系表格：固定列宽，两张表严格等宽、上下对齐；长标准号/名称自动换行 */
.rel-card .table-wrapper table { table-layout: fixed; }
/* 列宽：标准号20% / 代替类型10% / 名称50% / 状态10% / 实施日期10%（老板定）
   对齐：标准号、名称左对齐；代替类型/状态/实施日期居中（标题行同规则） */
.rel-card .table-wrapper th:nth-child(1),
.rel-card .table-wrapper td:nth-child(1) { width: 20%; text-align: left; }    /* 标准号 */
.rel-card .table-wrapper th:nth-child(2),
.rel-card .table-wrapper td:nth-child(2) { width: 10%; text-align: center; }  /* 代替类型 */
.rel-card .table-wrapper th:nth-child(3),
.rel-card .table-wrapper td:nth-child(3) { width: 50%; text-align: left; }    /* 名称 */
.rel-card .table-wrapper th:nth-child(4),
.rel-card .table-wrapper td:nth-child(4) { width: 10%; text-align: center; }  /* 状态 */
.rel-card .table-wrapper th:nth-child(5),
.rel-card .table-wrapper td:nth-child(5) { width: 10%; text-align: center; }  /* 实施日期 */
.rel-card .table-wrapper td { overflow-wrap: anywhere; word-break: break-word; }
.rel-card .table-wrapper td.font-mono { word-break: break-all; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f3f4f6; color: #4b5563; }
.badge-admin { background: #f3e8ff; color: #6b21a8; }
.badge-vip1 { background: #e0e7ff; color: #3730a3; }
.badge-vip2 { background: #dcfce7; color: #166534; }
.badge-vip3 { background: #fef3c7; color: #92400e; }
.badge-vip4 { background: #fce7f3; color: #9d174d; }
.badge-vip5 { background: #f3e8ff; color: #6b21a8; }
.badge-unused { background: #dbeafe; color: #1e40af; }
.badge-used { background: #dcfce7; color: #166534; }
.badge-disabled { background: #fee2e2; color: #991b1b; }
/* 代替类型：全部代替（强）/ 部分代替（中）/ 代替（站点未区分，弱） */
.badge-rel-full { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-rel-part { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.badge-rel-plain { background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }

/* ===== Status indicators ===== */
.status-active { color: var(--success); font-weight: 500; }
.status-repealed { color: var(--danger); font-weight: 500; }
.status-upcoming { color: var(--warning); font-weight: 500; }
.status-draft { color: var(--gray-500); font-weight: 500; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}
.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.pagination button:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary); }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }
.pagination .page-info { padding: 6px 12px; font-size: 14px; color: var(--gray-600); }
.pagination .page-jump { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--gray-600); margin-left: 8px; }
.pagination .page-input { width: 56px; padding: 4px 6px; border: 1px solid var(--gray-300); border-radius: 4px; font-size: 14px; text-align: center; }

/* ===== Alert ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== Grid ===== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
/* 6 列：访问量统计的 6 个指标卡一行展示；窄屏降级，避免挤成一团 */
.grid-6 { grid-template-columns: repeat(6, 1fr); }
/* 一行 6 个时适当收紧，避免数字换行 */
.grid-6 .stat-card { padding: 16px 10px; }
.grid-6 .stat-value { font-size: 24px; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }

  /* 导航不能再隐藏：本站没有汉堡菜单，隐藏等于手机上完全没有导航入口，
     用户进得来出不去（只能靠浏览器后退）。改为整体换行到第二行；
     5 个入口在 375px 窄屏仍会略超宽，故同时允许横向滑动兜底。 */
  .nav-container {
    height: auto;
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 8px 0;
  }
  .nav-logo-text { font-size: 16px; }
  /* 用户区推到行尾（原来靠 nav-links 的 flex:1 撑开，现在它在第二行） */
  .nav-user { margin-left: auto; gap: 6px; }
  /* 手机端不考虑管理页面，顶部不再显示「管理」入口 */
  .nav-admin { display: none !important; }
  /* order 让导航排到最后，第一行留 logo + 用户区 */
  .nav-links {
    order: 3;
    flex: 1 0 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  /* flex-shrink:0 —— 否则 5 个入口会被压缩成一团，滚动也就无从谈起 */
  .nav-links a { flex: 0 0 auto; padding: 5px 10px; font-size: 13px; white-space: nowrap; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 769px) and (max-width: 1280px) {
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
}

/* ===== Quick Entry Cards ===== */
.quick-entry {
  text-align: center;
  cursor: pointer;
  padding: 12px 10px;
}
.quick-entry-icon {
  font-size: 22px;
  margin-bottom: 4px;
}

/* ===== Stats ===== */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 10px;
  text-align: center;
}
.stat-value { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* ===== Clickable Table Row (代替关系表) ===== */
.row-link { cursor: pointer; transition: background-color .15s ease; }
.row-link:hover { background-color: var(--gray-50, #f8f9fa); }
.row-link.text-gray { color: var(--gray-500, #6c757d); }

/* ===== Category Stats (首页分类统计) ===== */
.type-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.type-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 6px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.type-stat-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.type-stat-name { font-size: 12px; font-weight: 500; color: var(--gray-700); text-align: center; }
.type-stat-count { font-size: 16px; font-weight: 700; color: var(--primary); }

/* ===== Status Stats (首页状态统计) ===== */
.status-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.status-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}
.status-stat-pill .status-count { font-weight: 700; }
.status-active { background: #dcfce7; color: #166534; }
.status-repealed { background: #fee2e2; color: #991b1b; }
.status-upcoming { background: #fef3c7; color: #92400e; }
.status-other { background: #f3f4f6; color: #4b5563; }

/* ===== Search bar ===== */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.search-bar .form-input { flex: 1; }

/* ===== Advanced search panel ===== */
.advanced-panel {
  border-top: 1px dashed var(--gray-300, #d1d5db);
  margin-top: 4px;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.adv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 12px;
}
.adv-grid-meta {
  grid-template-columns: 1fr 1fr 1fr auto;
  margin-top: 12px;
}
.adv-reset {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.adv-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
/* chip 由 ::before 伪元素 + data-chip 属性渲染（见下方的 .adv-field[data-chip]::before 规则） */
/* chip 用 ::before 伪元素渲染（双保险：head_extra <style> + main.css 都有同一规则） */
.adv-field[data-chip]::before {
  content: attr(data-chip) !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
  visibility: visible !important;
  width: auto !important;
  height: auto !important;
  min-width: 64px !important;
  font-size: 13px !important;
  color: #1d4ed8 !important;
  font-weight: 600 !important;
  background: #dbeafe !important;
  border: 1px solid #93c5fd !important;
  padding: 4px 10px !important;
  border-radius: 4px !important;
  line-height: 1.4 !important;
  letter-spacing: 0.3px !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  text-align: center !important;
}
.adv-pair {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.adv-pair .adv-date {
  flex: 1 1 0;
  min-width: 60px;
  font-size: 13px;
}
.adv-field > .form-input {
  flex: 1;
  min-width: 0;
}
.adv-field > .form-select {
  flex: 1;
  min-width: 0;
}
.adv-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}
.adv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.adv-date { max-width: none; }
@media (max-width: 900px) {
  .adv-grid, .adv-grid-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .adv-grid, .adv-grid-meta { grid-template-columns: 1fr; }
  .adv-pair { flex-wrap: wrap; }
}
.adv-code { max-width: 140px; }
.adv-sep { color: var(--gray-400, #9ca3af); font-size: 13px; flex-shrink: 0; }

/* 手机端搜索栏：输入框独占一行，下面筛选条件横向滑动（select 不被压缩） */
@media (max-width: 640px) {
  .search-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .search-bar .form-input {
    flex: 1 0 100%;
  }
  .search-bar .form-select {
    flex: 0 0 auto;
    min-width: 100px;
    max-width: 160px;
  }
  .search-bar .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 13px;
  }
  /* 首页 hero 搜索栏只有输入框+按钮，手机上输入框+按钮同行更紧凑 */
  .hero .search-bar .form-input { flex: 1 1 0; min-width: 0; }
}

/* ===== Filter bar ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filter-bar select { min-width: 120px; }

/* 手机端 filter-bar：「在结果中搜索」被 inline style 的 margin-left:auto 推到右边，
   空间不够就换行并撑满整行，避免和左侧排序挤成一团。 */
@media (max-width: 640px) {
  .filter-bar {
    gap: 8px;
    padding: 12px;
  }
  .filter-bar > div[style*="margin-left: auto"] {
    margin-left: 0 !important;
    width: 100%;
  }
  .filter-bar > div > .form-input {
    flex: 1 1 0 !important;
    min-width: 0;
  }
  .filter-bar > div > .btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* ===== Message board tabs ===== */
.msg-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}
/* 分类筛选放在标签行右侧，不单独占一行 */
.msg-tabs-filter {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-tabs-filter .form-select {
  width: 130px;
  padding: 4px 8px;
  height: 32px;
  font-size: 13px;
}
.msg-tab {
  position: relative;
  padding: 8px 16px;
  border-radius: var(--radius, 6px);
  cursor: pointer;
  color: var(--text-color, #4b5563);
  background: var(--bg-secondary, #f8fafc);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.msg-tab:hover { background: var(--bg-hover, #e5e7eb); }
.msg-tab.active {
  background: var(--primary, #2563eb);
  color: #fff;
}
.msg-tab .tab-dot {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 600;
}

/* ===== Misc ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-gray { color: var(--gray-500); }
.text-sm { font-size: 13px; }
.font-mono { font-family: "Fira Code", "Courier New", monospace; }
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
}
.empty-state p { margin-top: 8px; font-size: 14px; }
.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-400);
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 44px 20px;
  background: linear-gradient(135deg, var(--gray-900), var(--gray-800));
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.hero h1 { font-size: 30px; margin-bottom: 8px; }
.hero p { font-size: 15px; color: #d1d5db; margin-bottom: 16px; }
.hero .search-bar { max-width: 600px; margin: 0 auto; }
.hero .search-bar .form-input { font-size: 16px; padding: 12px 16px; }

/* ===== Code block ===== */
.code-block {
  font-family: "Fira Code", "Courier New", monospace;
  font-size: 13px;
  background: var(--gray-900);
  color: #e5e7eb;
  padding: 12px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  word-break: break-all;
}

/* ===== Footer ===== */
.footer {
  background: var(--gray-900);
  color: #9ca3af;
  padding: 12px 20px;
  text-align: center;
  font-size: 13px;
  margin-top: 24px;
  flex-shrink: 0;
}
.footer a { color: #d1d5db; }

/* 页脚：左侧文字信息 + 右侧联系我们二维码 */
.footer-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.footer-info {
  text-align: left;
  flex: 1 1 auto;
  min-width: 0;
}
.footer-contact {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
/* 「联系我们」竖排在二维码左侧 */
.footer-contact-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
}
.footer-qrcode-row {
  display: flex;
  gap: 14px;
  justify-content: center;
}
.footer-qrcode-item {
  text-align: center;
}
.footer-qrcode-img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 5px;
  background: #fff;
  padding: 3px;
  display: block;
}
.footer-qrcode-label {
  display: block;
  color: #d1d5db;
  font-size: 11px;
  margin-top: 5px;
  white-space: nowrap;
}
.footer-qrcode-tip {
  color: #9ca3af;
  font-size: 12px;
  margin: 8px 0 0;
}
@media (max-width: 768px) {
  .footer-body {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .footer-info {
    text-align: center;
  }
  .footer-contact {
    justify-content: center;
    padding-left: 0;
    padding-top: 14px;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .footer-qrcode-row {
    gap: 22px;
  }
}
@media (max-width: 420px) {
  .footer-qrcode-img {
    width: 76px;
    height: 76px;
  }
  .footer-qrcode-row {
    gap: 12px;
  }
}

/* 管理员导航菜单 */
.nav-admin { display: flex; gap: 12px; align-items: center; margin-left: 12px; }
.nav-admin-link { font-size: 13px; color: #6b7280; text-decoration: none; }
.nav-admin-link:hover { color: #2563eb; }
.badge-admin { background: #1e293b; color: #f1f5f9; }

/* ===== About Page Donut Charts ===== */
.about-donut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.about-donut-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
  text-align: center;
}
.about-donut-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.about-donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.about-donut-hole {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.about-donut-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.about-donut-label {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}
.about-donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.about-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.about-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.about-legend-name {
  color: var(--gray-600);
}
.about-legend-count {
  color: var(--gray-500);
  margin-left: auto;
  font-weight: 500;
}
@media (max-width: 1024px) {
  .about-donut-grid { grid-template-columns: 1fr; }
}

/* ===== Admin Tabs ===== */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 24px;
  padding: 0 4px;
}
.admin-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-500);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
  white-space: nowrap;
}
.admin-tab:hover {
  color: var(--primary);
  text-decoration: none;
}
.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
/* ===== 统计截止时间条（仅访问量统计使用） =====
   左侧「统计结果截止 xxx」，右侧「立即刷新」。
   访问量统计结果走 Redis 缓存（每小时整点刷新），必须显式告知截止时间，
   避免被误读成实时数据；其余列表页都是实时查询，不需要这条提示。 */
.refresh-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #1e40af;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
}
.refresh-bar strong { font-weight: 600; }
.refresh-bar-btn { margin-left: auto; flex-shrink: 0; }
@media (max-width: 768px) {
  .refresh-bar-btn { margin-left: 0; }
}

/* 二级标签：IP黑名单 收进合规管理，等级配置/激活码 收进用户管理 */
.admin-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 20px;
  padding: 0 4px;
}
.admin-subtab {
  padding: 5px 14px;
  font-size: 13px;
  color: var(--gray-500);
  text-decoration: none;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  transition: all .15s;
  white-space: nowrap;
}
.admin-subtab:hover {
  color: var(--primary);
  border-color: var(--primary);
  text-decoration: none;
}
.admin-subtab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 500;
}
@media (max-width: 768px) {
  .admin-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .admin-tab { flex-shrink: 0; }
}
/* ===== 导航栏消息提醒 ===== */
.nav-msg { position: relative; }
.nav-msg-btn {
  position: relative;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.nav-msg-btn:hover { background: rgba(255,255,255,.22); }
.nav-msg-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  box-sizing: border-box;
  background: #e24b4a;
  color: #fff;
  border-radius: 8px;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  font-weight: 500;
}
.nav-msg-panel {
  position: absolute;
  top: 38px;
  right: 0;
  width: 320px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.16);
  z-index: 1000;
  overflow: hidden;
  color: #1f2937;
}
.nav-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  font-weight: 500;
}
.nav-msg-head a { font-size: 12px; color: #2563eb; text-decoration: none; }
.nav-msg-list { max-height: 320px; overflow-y: auto; }
.nav-msg-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid #f7f7f7;
  text-decoration: none;
  color: inherit;
}
.nav-msg-item:hover { background: #f5f8ff; text-decoration: none; }
.nav-msg-item.unread { background: #f0f6ff; }
.nav-msg-title { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.nav-msg-text {
  font-size: 12px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.nav-msg-time { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.nav-msg-empty { padding: 26px 14px; text-align: center; color: #9ca3af; font-size: 13px; }
.nav-msg-more {
  display: block;
  padding: 9px 14px;
  text-align: center;
  font-size: 13px;
  color: #2563eb;
  border-top: 1px solid #f0f0f0;
  text-decoration: none;
}
@media (max-width: 768px) {
  .nav-msg-panel { width: 280px; right: -40px; }
}

/* ---------- 系统公告弹窗（打开网页后展示一次） ---------- */
.ann-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ann-box {
  background: #fff;
  border-radius: 10px;
  width: 520px;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
}
.ann-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #f0f0f0;
}
.ann-tag {
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border-radius: 4px;
  padding: 3px 8px;
}
.ann-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 4px;
}
.ann-close:hover { color: #374151; }
.ann-title {
  font-size: 17px;
  font-weight: 600;
  padding: 16px 18px 6px;
  margin: 0;
}
.ann-content {
  padding: 0 18px 8px;
  font-size: 14px;
  line-height: 1.7;
  color: #374151;
  overflow-y: auto;
  white-space: normal;
}
.ann-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid #f0f0f0;
}
.ann-time { font-size: 12px; color: #9ca3af; }

/* ---------- Markdown 渲染后的正文（公告弹窗 .ann-content / 后台预览 .md-body 共用） ---------- */
.ann-content p, .md-body p { margin: 0 0 10px; }
.ann-content > :first-child, .md-body > :first-child { margin-top: 0; }
.ann-content > :last-child, .md-body > :last-child { margin-bottom: 0; }
.ann-content h1, .md-body h1,
.ann-content h2, .md-body h2,
.ann-content h3, .md-body h3,
.ann-content h4, .md-body h4 {
  margin: 14px 0 8px;
  font-weight: 600;
  line-height: 1.4;
}
.ann-content h1, .md-body h1 { font-size: 19px; }
.ann-content h2, .md-body h2 { font-size: 17px; }
.ann-content h3, .md-body h3 { font-size: 15px; }
.ann-content h4, .md-body h4 { font-size: 14px; }
.ann-content ul, .md-body ul { list-style: disc; padding-left: 22px; }
.ann-content ol, .md-body ol { list-style: decimal; padding-left: 22px; }
.ann-content ul, .md-body ul,
.ann-content ol, .md-body ol { margin: 0 0 10px; }
.ann-content li, .md-body li { margin: 3px 0; }
.ann-content li > ul, .md-body li > ul,
.ann-content li > ol, .md-body li > ol { margin: 3px 0; }
.ann-content a, .md-body a { color: #2563eb; text-decoration: underline; }
.ann-content strong, .md-body strong { font-weight: 600; color: #1f2937; }
.ann-content em, .md-body em { font-style: italic; }
.ann-content del, .md-body del { color: #9ca3af; }
.ann-content code, .md-body code {
  background: #f3f4f6;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ann-content pre, .md-body pre {
  background: #f3f4f6;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0 0 10px;
  overflow-x: auto;
}
.ann-content pre code, .md-body pre code { background: none; padding: 0; }
.ann-content blockquote, .md-body blockquote {
  border-left: 3px solid #d1d5db;
  margin: 0 0 10px;
  padding: 2px 0 2px 12px;
  color: #6b7280;
}
.ann-content hr, .md-body hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 12px 0;
}
.ann-content table, .md-body table {
  border-collapse: collapse;
  margin: 0 0 10px;
  font-size: 13px;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
.ann-content th, .md-body th,
.ann-content td, .md-body td {
  border: 1px solid #e5e7eb;
  padding: 6px 10px;
  text-align: left;
}
.ann-content th, .md-body th { background: #f9fafb; font-weight: 600; }
.ann-content img, .md-body img { max-width: 100%; height: auto; }
.md-body { font-size: 14px; line-height: 1.75; color: #374151; }

@media (max-width: 768px) {
  .ann-box { width: 100%; }
}

/* ---------- 留言板：系统公告栏 ---------- */
.ann-board {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
}
.ann-board-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  background: #fffbeb;
}
.ann-board-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.ann-board-head .ann-board-count { font-size: 12px; color: #92400e; }
.ann-board-list { max-height: 260px; overflow-y: auto; }
.ann-board-item {
  padding: 10px 16px;
  border-bottom: 1px solid #f7f7f7;
  cursor: pointer;
}
.ann-board-item:last-child { border-bottom: none; }
.ann-board-item:hover { background: #f9fafb; }
.ann-board-item-title {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ann-board-item-title span.ann-board-date { font-size: 12px; color: #9ca3af; font-weight: 400; }
.ann-board-item-content {
  font-size: 13px;
  color: #4b5563;
  margin-top: 4px;
  white-space: pre-wrap;
}
.ann-board-empty { padding: 20px 16px; text-align: center; color: #9ca3af; font-size: 13px; }
.ann-board-item-fold {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #6b7280;
}
/* 「更多」：默认只展示最新 3 条，更早的折叠起来 */
.ann-board-list-expanded { max-height: none; overflow: visible; }
.ann-board-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 16px;
  font-size: 13px;
  color: #92400e;
  background: #fffbeb;
  border-top: 1px solid #f0f0f0;
  cursor: pointer;
  user-select: none;
}
.ann-board-more:hover { background: #fef3c7; }
.ann-board-more-arrow {
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  transition: transform .15s ease;
}
.ann-board-more-arrow.up { transform: rotate(180deg); }

/* ---------- 后台：代替关系补录行 ---------- */
.rel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
@media (max-width: 768px) {
  .rel-row { flex-wrap: wrap; }
}

/* ===== 手机端字号整体收紧（2026-09-21） =====
   原则：正文降一档（15→14px），大标题降幅更大（hero h1 32→24、h1 30→22），
   12/11px 的小字基本不动 —— 再小就看不清了。同时收紧容器与单元格内边距，
   让窄屏能多显示内容。

   ⚠️ 表单控件是唯一例外，必须保持 16px：iOS Safari 对 font-size < 16px 的
   输入框，聚焦时会自动放大整页且不会自动缩回（安卓无此行为）。原来写 14px
   属于踩了这个坑，借这次一并修正。

   放在文件末尾：与前面的移动端规则同权重时，靠后者胜出来覆盖。 */
@media (max-width: 768px) {
  body { font-size: 14px; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }
  .container { padding: 16px 14px; }

  /* 首页 hero */
  .hero { padding: 34px 16px; margin-bottom: 16px; }
  .hero h1 { font-size: 24px; margin-bottom: 8px; }
  .hero p { font-size: 14px; margin-bottom: 18px; }

  /* 统计数字与快捷入口 */
  .stat-value { font-size: 22px; }
  .grid-6 .stat-value { font-size: 20px; }
  .stat-label { font-size: 12px; }
  .quick-entry-icon { font-size: 22px; }
  .type-stat-count { font-size: 15px; }

  /* 表格：结果列表正文降一档，单元格也收紧 */
  table { font-size: 13px; }
  th, td { padding: 8px 10px; }

  /* 按钮、卡片、标签 */
  .btn { font-size: 13px; padding: 7px 14px; }
  .btn-lg { font-size: 15px; padding: 10px 20px; }
  .card-title { font-size: 15px; }
  .form-label { font-size: 13px; }
  .alert { font-size: 13px; padding: 10px 14px; }
  .filter-bar select { min-width: 100px; }

  /* 高级筛选 chip（原规则带 !important，这里只能同样用 !important 覆盖） */
  .adv-field[data-chip]::before {
    font-size: 12px !important;
    min-width: 56px !important;
    padding: 3px 8px !important;
  }

  /* 公告弹窗与关于页 */
  .ann-title { font-size: 15px; padding: 14px 16px 6px; }
  .ann-content { font-size: 13px; }
  .about-donut-num { font-size: 16px; }
  .about-donut-title { font-size: 14px; }

  /* 分页、空状态、页脚 */
  .pagination button { font-size: 13px; padding: 5px 10px; }
  .pagination .page-info,
  .pagination .page-jump { font-size: 13px; }
  .empty-state p { font-size: 13px; }
  .footer { font-size: 12px; padding: 16px; }

  /* ⚠️ 表单控件不降字号，理由见本块开头 */
  .form-input, .form-select, .form-textarea { font-size: 16px; padding: 7px 10px; }
}

/* ===== 手机端搜索区收紧（2026-09-21） =====
   老板反馈搜索页上方「搜索栏 + 排序栏」两个组件占位太大，结果列表被推到屏幕
   下半部分。原来手机上这两块合计约 300px 高（iPhone SE 屏高 667px，一半没了）。
   目标压到 150px 左右：卡片内边距、间距、控件尺寸、标题各收紧一档，排序栏
   改为单行横向滑动（原来在手机上要占三行）。 */
@media (max-width: 768px) {
  h1 { margin-bottom: 10px; }
  .card { padding: 12px; margin-bottom: 10px; }

  /* 搜索栏：第二行的 类型/状态/搜索/高级筛选 尽量压进一行。
     ⚠️ select 上带 inline style="max-width:180px/140px"，普通 CSS 盖不住，
     所以靠 flex-shrink + 更小的 min-width 让它们按需收缩（下限 76px 仍可读）。 */
  .search-bar { gap: 6px; margin-bottom: 0; }
  .search-bar .form-select { flex: 0 1 auto; min-width: 76px; padding: 6px 8px; }
  .search-bar .btn { padding: 6px 10px; font-size: 12px; }

  /* 排序栏：单行横向滑动（原先排序占一行、升降序挤着、在结果中搜索再占一行） */
  .filter-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding: 8px 10px;
    margin-bottom: 12px;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar > * { flex: 0 0 auto; }
  .filter-bar .form-select { flex: 0 1 auto; min-width: 76px; padding: 6px 8px; }
  /* 覆盖上面 640px 块里的「独占一行」规则：现在整条都在一行里横向滚动 */
  .filter-bar > div[style*="margin-left: auto"] { margin-left: 0 !important; width: auto; }
  .filter-bar > div > .form-input { flex: 0 0 auto !important; width: 130px; }
  .filter-bar > div > .btn { padding: 5px 10px; font-size: 12px; }
}

/* ===== 手机端搜索栏 3 行 → 2 行（2026-09-21） =====
   原来手机上搜索栏要占三行：输入框 / 类型+状态+搜索 / 高级筛选被挤下来。
   用 order 把「搜索」按钮提到第一行与输入框同行（输入框 flex:1 1 0 吸收剩余
   宽度，自然把后面的元素挤到第二行），第二行只剩 类型/状态/高级筛选 三个，
   360px 与 320px 窄屏都能放下，不必改按钮文案也不用横向滚动。 */
@media (max-width: 768px) {
  .card { padding: 10px; }
  /* ⚠️ flex-wrap 的换行是按「flex-basis」累加判断的，不是渲染后的宽度，
     所以光靠 order 不够：必须让第二行的三个元素 basis 足够小才不会被挤到第三行。
     - 输入框 basis 取 100%-70px（70 = 搜索按钮约 44px + 一个 gap 的余量），
       正好和「搜索」按钮凑满第一行，后面的自然换行；
     - 两个 select basis 压到 68px、再 flex-grow:1 均分第二行剩余空间，
       换行判定按 68 走（三件共 236px < 308px 可用宽），渲染出来约 98px 可读。 */
  .card .search-bar .form-input { order: 1; flex: 1 0 calc(100% - 70px); min-width: 0; }
  .card .search-bar .btn-primary { order: 2; flex: 0 0 auto; padding: 6px 10px; }
  .card .search-bar .form-select { order: 3; flex: 1 1 68px; min-width: 68px; }
  .card .search-bar .btn-outline { order: 4; flex: 0 1 auto; }
}

/* ===== 等级调整弹窗（2026-10-09 老板要求：激活码功能收起为按钮，点击展开） ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal {
  background: #fff;
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: #fff;
}
.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.modal-body {
  padding: 20px;
}
