:root {
  --brand: #10449b;
  --brand-2: #1c6be0;
  --brand-soft: #e8efff;
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #172032;
  --muted: #6b7891;
  --line: #e3e9f2;
  --warn: #b3402c;
  --ok: #177a4a;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 45, 90, .07);
  --shadow-lg: 0 12px 40px rgba(16, 40, 90, .16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Han Sans CN", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Heiti SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-decoration: none; }
img { max-width: 100%; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(120deg, #0e3c8c, #1b63cf);
  color: #fff;
  padding: 14px 18px 12px;
  box-shadow: 0 2px 14px rgba(14, 60, 140, .28);
}
.topbar-inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 26px; width: auto; flex: 0 0 auto; display: block; }
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 12px; opacity: .8; }
.admin-link {
  margin-left: auto; font-size: 13px; color: #fff; border: 1px solid rgba(255,255,255,.45);
  padding: 6px 12px; border-radius: 20px; white-space: nowrap;
}
.admin-link:hover { background: rgba(255,255,255,.15); }

/* ---------------- 搜索区 ---------------- */
.searchwrap { max-width: 1080px; margin: 0 auto; padding: 16px 18px 4px; }
.searchbox {
  position: relative; display: flex; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: 40px; padding: 6px 8px 6px 16px;
  box-shadow: var(--shadow);
}
.searchbox input {
  flex: 1; border: 0; outline: none; font-size: 16px; background: transparent;
  font-family: inherit; color: var(--text); min-width: 0;
}
.searchbox .clear {
  border: 0; background: #eef2f8; color: var(--muted); width: 26px; height: 26px;
  border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1;
}
.searchbox .go {
  border: 0; background: var(--brand-2); color: #fff; font-size: 14px; padding: 8px 18px;
  border-radius: 30px; cursor: pointer; font-family: inherit;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 5px 13px; border-radius: 20px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--brand-soft); color: var(--brand); border-color: #c8daff; font-weight: 600; }
select.chip { padding: 5px 10px; }
.stat { font-size: 13px; color: var(--muted); margin-left: auto; }
.stat b { color: var(--brand); font-size: 15px; }

/* ---------------- 列表 ---------------- */
.list { max-width: 1080px; margin: 0 auto; padding: 12px 18px 60px; display: grid; gap: 12px; }
.card {
  display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card .thumb {
  width: 132px; height: 88px; flex: 0 0 132px; border-radius: 10px; overflow: hidden;
  background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Crect width='40' height='40' fill='%23eaf0fb'/%3E%3C/svg%3E") center/cover;
  display: grid; place-items: center; color: #a9bad6; font-size: 12px;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .main { min-width: 0; flex: 1; }
.card h3 { margin: 0 0 6px; font-size: 16px; line-height: 1.5; font-weight: 700; }
.card .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card .summary {
  margin: 6px 0 0; font-size: 13.5px; color: #55617a; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.badge {
  font-size: 11px; padding: 1px 8px; border-radius: 5px; border: 1px solid var(--line);
  color: var(--muted); background: #f7f9fd;
}
.badge.word { color: #1b4fa8; border-color: #cbdcff; background: #eef4ff; }
.badge.pdf { color: #a32b1b; border-color: #fad4cc; background: #fff1ee; }
.badge.offline { color: #7b8798; border-color: #dfe4ec; background: #f1f3f7; }
.card.off { opacity: .62; }
mark { background: #ffe9a8; color: inherit; border-radius: 3px; padding: 0 1px; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 40px; opacity: .35; }

/* ---------------- 详情 ---------------- */
.reader { position: fixed; inset: 0; background: var(--bg); z-index: 60; overflow-y: auto; display: none; }
.reader.show { display: block; }
.reader-bar {
  position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
}
.reader-bar .back { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--text); padding: 0 4px; }
.reader-bar .rt { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-bar .acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 20px;
  padding: 6px 13px; font-size: 13px; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.btn:hover { background: #f4f7fd; }
.btn.primary { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.btn.primary:hover { background: #1759c4; }
.article-wrap { max-width: 820px; margin: 0 auto; background: #fff; padding: 26px 22px 80px; border-radius: var(--radius); margin-top: 14px; box-shadow: var(--shadow); }
.article-wrap h1 { font-size: 21px; line-height: 1.5; margin: 0 0 8px; }
.article-meta { color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.body p { margin: 0 0 14px; text-align: justify; }
.body h2, .body h3, .body h4 { margin: 22px 0 12px; line-height: 1.5; color: #10244a; }
.body h2 { font-size: 17px; } .body h3 { font-size: 16px; } .body h4 { font-size: 15px; }
.body p.ac, .body h2.ac, .body h3.ac { text-align: center; }
.body p.ar, .body h2.ar, .body h3.ar { text-align: right; }
.body figure { margin: 16px 0; text-align: center; }
.body img { border-radius: 8px; display: block; margin: 0 auto; }
.body table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.body td { border: 1px solid var(--line); padding: 8px 10px; }
.toolbar-bottom {
  position: sticky; bottom: 0; background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  padding: 10px 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  backdrop-filter: blur(6px);
}

/* ---------------- 弹层 ---------------- */
.mask { position: fixed; inset: 0; background: rgba(14, 26, 48, .5); z-index: 90; display: none; }
.mask.show { display: block; }
.sheet {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 91; display: none;
  background: #fff; border-radius: 16px; width: min(420px, calc(100% - 32px));
  padding: 18px; box-shadow: var(--shadow-lg);
  max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.sheet.show { display: block; }
.sheet h4 { margin: 0 0 4px; font-size: 16px; }
.sheet .tip { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.opt {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 9px; cursor: pointer; font-size: 14px;
}
.opt:hover { background: #f5f8fd; border-color: #cfdcf3; }
.opt .ic { font-size: 18px; }
.opt .sub { color: var(--muted); font-size: 12px; }
.qrbox { text-align: center; padding: 10px 0 4px; }
.qrbox img, .qrbox canvas { width: 168px; height: 168px; border: 1px solid var(--line); border-radius: 8px; display: block; margin: 0 auto; background: #fff; }
.close-sheet { width: 100%; padding: 10px; border: 0; background: #f1f4f9; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 14px; margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 200;
  background: rgba(23, 35, 60, .93); color: #fff; padding: 10px 20px; border-radius: 24px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.toast.show { opacity: 1; }

.more-wrap { text-align: center; padding: 10px 0 30px; }
.hint-bar { max-width: 1080px; margin: 0 auto; padding: 0 18px; font-size: 12.5px; color: var(--muted); }

@media (max-width: 640px) {
  .brand-logo { height: 20px; }
  .brand-title { font-size: 15px; }
  .brand-sub { display: none; }
  .card { padding: 10px; gap: 10px; }
  .card .thumb { width: 92px; height: 66px; flex-basis: 92px; }
  .card h3 { font-size: 15px; }
  .article-wrap { padding: 18px 16px 70px; margin-top: 8px; border-radius: 0; }
  .list { padding: 10px 12px 60px; }
  .searchwrap, .hint-bar { padding-left: 12px; padding-right: 12px; }
  .reader-bar .rt { font-size: 13px; }
  .reader-bar .acts .btn { padding: 6px 11px; font-size: 12.5px; }
  .stat { width: 100%; margin-left: 0; order: 9; }
}
