:root {
  --paper: #f5f4f0;
  --surface: #ffffff;
  --border: #e4e2dc;
  --border-strong: #cfcbc2;
  --ink: #1c1917;
  --text: #44403c;
  --muted: #78716c;
  --faint: #a8a29e;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eef2ff;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --shadow: 0 1px 3px rgba(28, 25, 23, 0.06);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button { font: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 16px; }
.brand-mark { width: 12px; height: 12px; border-radius: 3px; background: var(--ink); }
.topbar-link { font-size: 14px; color: var(--muted); }
.topbar-link:hover { color: var(--ink); }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1fr; gap: 24px; padding: 40px 20px 32px; }
.eyebrow { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.hero h1 { font-size: 28px; line-height: 1.25; font-weight: 700; color: var(--ink); max-width: 18em; }
.lead { margin-top: 16px; max-width: 34em; color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hint { margin-top: 12px; font-size: 13px; color: var(--muted); }
.hint.done { color: var(--success); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-self: start; }
.stat { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.stat strong { display: block; margin-top: 4px; font-size: 32px; line-height: 1.1; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat strong.stat-text { font-size: 20px; line-height: 1.3; padding-top: 6px; }
.stat em { display: block; margin-top: 2px; font-size: 13px; font-style: normal; color: var(--muted); }
.stat-wide { grid-column: 1 / -1; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: var(--border-strong); border-color: var(--border-strong); color: #fff; cursor: not-allowed; }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-secondary:disabled { color: var(--muted); cursor: default; border-color: var(--border); }
.btn-secondary.is-done { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); height: 32px; padding: 0 10px; }
.btn-ghost:hover { background: var(--paper); color: var(--ink); }
.btn-danger-text { background: transparent; border-color: transparent; color: var(--danger); height: 32px; padding: 0 10px; }
.btn-danger-text:hover { background: var(--danger-soft); }

/* ---------- 上传区 ---------- */
.upload-section { display: grid; grid-template-columns: 1fr; gap: 24px; padding-bottom: 48px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.upload-card { padding: 24px 20px; display: grid; gap: 20px; }
.card-head h2 { font-size: 20px; font-weight: 600; color: var(--ink); }
.card-head p { margin-top: 4px; font-size: 13px; color: var(--muted); }

.field { display: grid; gap: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.label { font-size: 14px; font-weight: 600; color: var(--ink); }
.label em { font-style: normal; font-weight: 500; font-size: 12px; margin-left: 6px; }
.req { color: var(--danger); }
.opt { color: var(--faint); }
input[type="text"], input[type="date"], textarea, input[type="password"] {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px;
  outline: 3px solid transparent; transition: border-color 0.15s, outline-color 0.15s;
}
input:focus-visible, textarea:focus-visible { border-color: var(--primary); outline-color: rgba(29, 78, 216, 0.12); }
textarea { resize: vertical; line-height: 1.5; }
.counter { justify-self: end; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.error { font-size: 13px; color: var(--danger); }

.dropzone {
  display: grid; justify-items: center; gap: 4px; padding: 28px 16px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: 10px; background: var(--paper); cursor: pointer;
  color: var(--text); transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone svg { width: 36px; height: 36px; color: var(--muted); margin-bottom: 6px; }
.dropzone strong { font-size: 15px; color: var(--ink); }
.dropzone-sub { font-size: 13px; color: var(--muted); }
.dropzone.is-error { border-color: var(--danger); }

.previews { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.previews:empty { display: none; }
.preview { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--paper); border: 1px solid var(--border); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview-remove {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(28, 25, 23, 0.7); color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}
.preview-state { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; font-size: 11px; color: #fff; background: rgba(28, 25, 23, 0.6); }
.preview.is-done .preview-state { background: var(--success); }
.preview.is-error .preview-state { background: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-checked="true"], .chip[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip small { margin-left: 4px; font-size: 12px; opacity: 0.7; font-variant-numeric: tabular-nums; }
.chips-filter .chip { height: 32px; font-size: 13px; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.progress { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-bar { width: 120px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--primary); transition: width 0.2s ease; }

.success { display: grid; gap: 8px; justify-items: start; padding: 16px; border-radius: 10px; background: var(--success-soft); border: 1px solid #bbf7d0; }
.success strong { color: var(--success); }
.success span { font-size: 13px; color: var(--text); }

.tips { padding: 4px 4px 0; }
.tips h3 { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.tips ol { padding-left: 20px; display: grid; gap: 8px; color: var(--text); font-size: 14px; }
.tips-note { margin-top: 16px; font-size: 13px; color: var(--muted); }

/* ---------- 证据墙 ---------- */
.gallery-section { padding-bottom: 64px; }
.section-head { display: grid; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 20px; font-weight: 600; color: var(--ink); }
.count { margin-left: 6px; font-size: 14px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.item-img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--paper); cursor: zoom-in; border: 0; padding: 0; }
.item-body { padding: 10px 12px 12px; display: grid; gap: 6px; align-content: start; }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border-strong); font-size: 12px; color: var(--text); white-space: nowrap; }
.item-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item-note { font-size: 13px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-mine { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; font-size: 12px; color: var(--muted); }

.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 48px 20px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--muted); }
.empty svg { width: 52px; height: 52px; color: var(--border-strong); margin-bottom: 6px; }
.empty strong { color: var(--ink); font-size: 16px; }
.empty span { font-size: 14px; max-width: 24em; }
.empty .btn { margin-top: 8px; }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); }
.footer a { color: var(--faint); }
.footer a:hover { color: var(--ink); }

/* ---------- 灯箱 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(28, 25, 23, 0.92); padding: 56px 12px 16px; }
.lb-figure { display: grid; gap: 12px; max-width: 960px; width: 100%; max-height: 100%; justify-items: center; }
.lb-figure img { max-height: calc(100vh - 180px); max-width: 100%; object-fit: contain; border-radius: 6px; }
.lb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: #e7e5e4; font-size: 13px; width: 100%; }
.lb-meta .tag { border-color: #78716c; color: #e7e5e4; }
.lb-meta p { flex-basis: 100%; color: #d6d3d1; font-size: 14px; }
.lb-close, .lb-nav {
  position: fixed; border: 0; background: rgba(255, 255, 255, 0.1); color: #fff; cursor: pointer; border-radius: 50%;
  width: 44px; height: 44px; font-size: 28px; line-height: 1; display: grid; place-items: center;
  transition: background-color 0.15s;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lb-close { top: 12px; right: 12px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  padding: 10px 16px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 14px; max-width: calc(100% - 32px);
}
.toast.is-error { background: var(--danger); }

/* ---------- 管理页 ---------- */
.admin { padding: 24px 20px 64px; display: grid; gap: 20px; }
.admin-login { max-width: 400px; padding: 24px 20px; display: grid; gap: 12px; }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.admin-bar .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: 12px; background: var(--paper); position: sticky; top: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); cursor: zoom-in; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }

@media (min-width: 768px) {
  .hero { grid-template-columns: 3fr 2fr; gap: 40px; padding: 64px 20px 48px; align-items: center; }
  .hero h1 { font-size: 36px; }
  .upload-section { grid-template-columns: 7fr 4fr; gap: 40px; align-items: start; }
  .upload-card { padding: 28px; }
  .tips { position: sticky; top: 24px; padding-top: 8px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .section-head { grid-template-columns: auto 1fr; align-items: center; }
  .section-head .chips { justify-content: flex-end; }
}
@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
