:root {
  --bg: #f6f7f9;
  --card: #fff;
  --text: #1c2024;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.main { padding: 24px 16px 48px; }
.narrow { max-width: 440px; margin: 0 auto; }
.center-box { text-align: center; padding: 32px 0; }

/* ---------- header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 60px; flex-wrap: wrap; }
.logo { font-size: 19px; font-weight: 700; color: var(--text); }
.logo:hover { text-decoration: none; color: var(--brand); }

.search { display: flex; flex: 1; max-width: 420px; }
.search input {
  flex: 1; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-right: 0;
  border-radius: 6px 0 0 6px; font-size: 14px; background: var(--bg);
}
.search input:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.search button {
  height: 36px; padding: 0 16px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; border-radius: 0 6px 6px 0; font-size: 14px;
}
.search button:hover { background: var(--brand-dark); }

.nav { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.nav a { color: var(--text); font-size: 14px; }
.nav a.active { color: var(--brand); font-weight: 600; }
.nav .me { font-size: 14px; color: var(--muted); }
.badge-vip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; font-size: 11px; font-style: normal;
  padding: 1px 6px; border-radius: 4px; margin-left: 4px; font-weight: 700;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 9px 20px; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; border-radius: 6px;
  font-size: 14px; font-family: inherit; text-align: center;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { display: block; width: 100%; margin-bottom: 10px; }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn-ghost:hover { background: rgba(37, 99, 235, .06); color: var(--brand-dark); }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand); font-size: 13px; font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.inline { display: inline; }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff; border-radius: var(--radius);
  padding: 44px 32px; margin-bottom: 24px;
}
.hero h1 { margin: 0 0 8px; font-size: 28px; }
.hero p { margin: 0 0 20px; opacity: .9; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn { background: #fff; color: var(--brand); font-weight: 600; }
.hero .btn:hover { background: #f1f5f9; }
.hero .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); }

.cat-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  background: var(--card); padding: 12px 16px;
  border-radius: var(--radius); margin-bottom: 24px; box-shadow: var(--shadow);
}
.cat-bar a { font-size: 14px; padding: 4px 12px; border-radius: 999px; background: var(--bg); color: var(--text); }
.cat-bar a:hover { background: var(--brand); color: #fff; text-decoration: none; }

/* ---------- blocks & grid ---------- */
.block { margin-bottom: 36px; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.block-head h2 { margin: 0; font-size: 18px; }
.page-title { font-size: 22px; margin: 0 0 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

.card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.1); }
.card-cover {
  display: block; position: relative; aspect-ratio: 16 / 10;
  background: #eef1f5; overflow: hidden;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #94a3b8; font: 700 26px ui-monospace, monospace;
}
.tag-free {
  position: absolute; top: 8px; left: 8px;
  background: var(--ok); color: #fff; font-size: 11px; font-style: normal;
  padding: 2px 8px; border-radius: 4px;
}
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.4; }
.card-body h3 a { color: var(--text); }
.card-body .summary {
  margin: 0 0 10px; font-size: 13px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; align-items: baseline; justify-content: space-between; margin-top: auto; }
.price strong { color: var(--danger); font-size: 17px; }
.price strong.free { color: var(--ok); }
.price del { color: var(--muted); font-size: 12px; margin-left: 6px; }
.sales { font-size: 12px; color: var(--muted); }

/* ---------- filters ---------- */
.filters { background: var(--card); padding: 14px 16px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filter-row:last-child { margin-bottom: 0; }
.filter-label { font-size: 13px; color: var(--muted); min-width: 32px; }
.chip { font-size: 13px; padding: 3px 12px; border-radius: 999px; background: var(--bg); color: var(--text); }
.chip:hover { background: #e2e8f0; text-decoration: none; }
.chip.on { background: var(--brand); color: #fff; }
.result-count { font-size: 13px; color: var(--muted); margin: 0 0 14px; }

/* ---------- detail ---------- */
.detail { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.detail-main { background: var(--card); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.detail-main h1 { margin: 0 0 10px; font-size: 22px; }
.detail-main .meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.detail-cover { width: 100%; border-radius: 8px; margin-bottom: 18px; }
.lead { font-size: 15px; color: #374151; background: var(--bg); padding: 12px 14px; border-radius: 8px; }
.rich { line-height: 1.8; overflow-wrap: break-word; }
.rich img { max-width: 100%; height: auto; border-radius: 6px; }
.rich pre { background: #1e293b; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow-x: auto; }
.rich table { border-collapse: collapse; width: 100%; }
.rich td, .rich th { border: 1px solid var(--line); padding: 6px 10px; }

.detail-side { position: sticky; top: 76px; }
.buy-box { background: var(--card); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
.buy-price { margin-bottom: 16px; }
.buy-price strong { font-size: 28px; color: var(--danger); }
.buy-price strong.free { color: var(--ok); }
.buy-price del { color: var(--muted); font-size: 14px; margin-left: 8px; }
.price-reason { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.pay-types { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 12px; }
.pay-types label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.buy-facts { margin: 16px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.tip { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

/* ---------- plans ---------- */
.member-intro { background: var(--card); padding: 20px 24px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.member-intro h2 { margin: 0 0 10px; font-size: 17px; }
.member-intro ul { margin: 0; padding-left: 20px; color: #374151; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.plan-card {
  background: var(--card); border-radius: var(--radius); padding: 22px 20px;
  text-align: center; box-shadow: var(--shadow); border: 1px solid transparent;
}
.plan-card:hover { border-color: var(--brand); }
.plan-card h3 { margin: 0 0 10px; font-size: 16px; }
.plan-price { font-size: 26px; font-weight: 700; color: var(--danger); margin: 0 0 4px; }
.plan-meta { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.plan-discount { font-size: 14px; color: var(--warn); font-weight: 600; margin: 0 0 8px; }
.plan-intro { font-size: 12px; color: var(--muted); margin: 0 0 14px; min-height: 32px; }
.plan-grid.big .plan-card { padding: 28px 22px; }
.plan-card .pay-types { justify-content: center; }

/* ---------- forms ---------- */
.form { background: var(--card); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.form.wide { max-width: none; }
.form label { display: block; margin-bottom: 16px; font-size: 14px; }
.form label.check { display: flex; align-items: center; gap: 8px; }
.form input[type=text], .form input[type=email], .form input[type=password],
.form input[type=number], .form input[type=url], .form select, .form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fff;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.form textarea { resize: vertical; }
.form small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.form-foot { text-align: center; font-size: 14px; margin-top: 16px; }
.search-inline { display: flex; gap: 8px; margin-bottom: 16px; }
.search-inline input { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- collector ---------- */
.collector-title { margin-bottom: 2px; }
.muted-line { color: var(--muted); margin: 0; font-size: 14px; }
.collector-form fieldset { border: 0; padding: 0; margin: 0 0 24px; }
.collector-form legend { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.collector-mode { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.collector-mode .choice-card {
  display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 14px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.collector-mode .choice-card:has(input:checked) { border-color: var(--brand); background: #eff6ff; }
.batch-options[hidden] { display: none; }
.choice-card input { margin-top: 5px; }
.choice-card span, .choice-card strong { display: block; }
.choice-card small { margin: 2px 0 0; }
.collector-rules { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 0; margin-bottom: 24px; }
.collector-rules summary { cursor: pointer; color: var(--brand); font-weight: 600; margin-bottom: 14px; }
.collector-checks { display: flex; gap: 24px; flex-wrap: wrap; }
.collector-preview, .collector-results { background: var(--card); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-top: 24px; }
.collector-preview h2, .collector-results h2 { margin: 0 0 14px; font-size: 18px; }
.preview-meta { display: grid; grid-template-columns: 70px minmax(0, 1fr); margin: 0 0 18px; font-size: 14px; }
.preview-meta dt, .preview-meta dd { padding: 6px 0; margin: 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.preview-meta dt { color: var(--muted); }
.preview-body { max-height: 600px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.result-url { display: block; max-width: 620px; overflow-wrap: anywhere; color: var(--muted); margin-top: 2px; }
.bulk-bar, .csv-import { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--card); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; box-shadow: var(--shadow); }
.bulk-bar select, .bulk-bar input, .csv-import input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; }
.progress { width: 150px; max-width: 100%; height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); }
.mini-cover { width: 72px; height: 48px; object-fit: cover; border-radius: 5px; }
.err-text { display: block; color: var(--danger); max-width: 320px; overflow-wrap: anywhere; }
.admin-two-col { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin-bottom: 24px; }
.admin-two-col h2, .form h2 { margin-top: 0; font-size: 18px; }
.danger-bg { background: var(--danger); }
.danger-bg:hover { background: #b91c1c; }
.file-list { max-height: 300px; overflow: auto; }
.totp-qr { display: block; width: 220px; height: 220px; margin: 12px 0; }
.secret-code { display: block; overflow-wrap: anywhere; padding: 8px; background: var(--bg); margin-bottom: 12px; }

/* ---------- alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert.err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.ok-title { color: var(--ok); }
.empty { color: var(--muted); background: var(--card); padding: 32px; border-radius: var(--radius); text-align: center; }

/* ---------- tables ---------- */
.table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 14px;
}
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { background: #f9fafb; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .ops { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.st { font-size: 12px; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.st.ok { background: #ecfdf5; color: var(--ok); }
.st.wait { background: #fffbeb; color: var(--warn); }
.st.off { background: #f3f4f6; color: var(--muted); }

/* ---------- nav bars ---------- */
.sub-nav, .admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.sub-nav a, .admin-nav a {
  font-size: 14px; padding: 6px 14px; border-radius: 6px;
  background: var(--card); color: var(--text); box-shadow: var(--shadow);
}
.sub-nav a:hover, .admin-nav a:hover { background: var(--brand); color: #fff; text-decoration: none; }
.sub-nav a.on, .admin-nav a.on { background: var(--brand); color: #fff; }

.user-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.stat-num { display: block; font-size: 24px; font-weight: 700; color: var(--brand); }
.stat-label { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; font-size: 14px; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer {
  background: var(--card); border-top: 1px solid var(--line);
  padding: 24px 0; text-align: center; font-size: 13px; color: var(--muted);
}
.site-footer p { margin: 4px 0; }
.site-footer .links { display: flex; gap: 16px; justify-content: center; }

/* ---------- pay redirect page ---------- */
.pay-redirect { display: grid; place-items: center; min-height: 100vh; }
.pay-redirect .center-box { background: var(--card); padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); max-width: 420px; }
.pay-redirect h1 { font-size: 19px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .header-inner { height: auto; padding: 10px 0; }
  .search { order: 3; max-width: none; width: 100%; }
  .nav { margin-left: 0; font-size: 13px; }
  .table { display: block; overflow-x: auto; }
  .collector-mode { grid-template-columns: 1fr; }
  .admin-two-col { grid-template-columns: 1fr; }
}
