:root {
  --bg: #f4f6fb;
  --bg-deep: #e9edf5;
  --ink: #0f172a;
  --muted: #64748b;
  --paper: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --teal: #2563eb;
  --teal-hover: #1d4ed8;
  --teal-soft: #eff6ff;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 4px 12px rgba(15, 23, 42, 0.1), 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --radius-lg: 16px;
  --border: var(--line);
  --card: #f8fafc;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-hover); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand:hover { color: inherit; }
.brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: block;
}
.brand-mark img {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.brand-text small { color: var(--muted); font-size: 12px; margin-top: 2px; }

.search { display: flex; gap: 8px; max-width: 420px; width: 100%; margin: 0 auto; }
.search input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.search input::placeholder { color: #94a3b8; }
.search button, .btn, .btn-nav, .linkish {
  border: 0;
  cursor: pointer;
  font: inherit;
}
.search button {
  border-radius: 10px;
  padding: 10px 18px;
  background: var(--teal);
  color: #fff;
  font-weight: 600;
  transition: background 0.15s;
}
.search button:hover { background: var(--teal-hover); }

.nav { display: flex; align-items: center; gap: 14px; white-space: nowrap; font-size: 14px; }
.nav a, .nav .linkish {
  color: var(--muted);
  background: none;
  padding: 0;
  font-weight: 500;
}
.nav a:hover, .nav .linkish:hover { color: var(--ink); text-decoration: none; }
.btn-nav {
  background: var(--teal) !important;
  color: #fff !important;
  padding: 8px 14px;
  border-radius: 10px;
  text-decoration: none !important;
  font-weight: 600;
}
.btn-nav:hover { background: var(--teal-hover) !important; color: #fff !important; }
.nav-user {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--teal-soft);
  border-radius: 8px;
}
.inline { display: inline; margin: 0; }

/* Flash */
.flash {
  max-width: 1080px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
}
.flash-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #a7f3d0; }
.flash-err { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 20px 56px; }

/* Hero */
.hero { margin-bottom: 8px; }
.hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.hero p, .hint, .meta, .card-meta, .tiny { color: var(--muted); }
.hint-warn { color: var(--danger); font-weight: 500; }
.notice-warn {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid #fecaca;
  background: var(--danger-soft);
  color: #991b1b;
}
.notice-warn strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}
.notice-warn p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 16px;
  margin: 12px 0 8px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--muted);
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.tab:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  text-decoration: none;
}
.tab.on {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
  flex-wrap: wrap;
}
.sort {
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.sort:hover { border-color: var(--line-strong); color: var(--ink); text-decoration: none; }

/* Cards & lists */
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.card, .detail, .auth, .admin, .empty, .share-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card {
  display: block;
  padding: 18px 20px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card:hover {
  border-color: #bfdbfe;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  text-decoration: none;
}
.card h2, .detail h1, .auth h1, .admin h1 {
  margin: 6px 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.card h2 { font-size: 16px; line-height: 1.4; }
.detail h1 { font-size: 24px; }
.card-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
}
.stamp {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}
.stamp.mini { margin-left: 6px; }
.stamp.muted {
  margin-left: 6px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
}

.card-meta { display: flex; gap: 14px; margin: 10px 0 0; font-size: 13px; }
.card-desc {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-summary {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.65;
  color: #334155;
  white-space: pre-wrap;
}
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }

.empty { padding: 48px 24px; text-align: center; }
.empty strong { font-size: 16px; display: block; margin-bottom: 6px; }
.empty p { margin: 0; font-size: 14px; }

.pager {
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
  margin: 28px 0 0;
  font-size: 14px;
}
.pager a {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-weight: 500;
}
.pager a:hover { border-color: var(--teal); text-decoration: none; }
.pager .disabled { color: #cbd5e1; }

/* Detail & forms */
.detail, .auth, .admin { padding: 24px; }
.auth { max-width: 440px; margin: 16px auto; }
.auth.wide { max-width: 600px; }
.crumbs { display: flex; gap: 8px; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.share-box { padding: 18px; margin: 18px 0; background: var(--card); }

.form { display: grid; gap: 6px; }
.form label { font-size: 13px; font-weight: 600; margin-top: 10px; color: #334155; }
.form input, .form textarea, .form select, .copy-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  font: inherit;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.copy-row { display: flex; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover {
  border-color: var(--line-strong);
  background: var(--card);
  text-decoration: none;
}
a.btn { color: var(--ink); }
.btn.primary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
a.btn.primary { color: #fff; }
.btn.primary:hover { background: var(--teal-hover); border-color: var(--teal-hover); }
.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}
.btn.danger:hover { background: #fee2e2; }
.btn.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
  line-height: 1.2;
  box-sizing: border-box;
}
button.btn {
  font-family: inherit;
  font-weight: 600;
}

.report {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.report h2 { font-size: 17px; font-weight: 700; margin: 0 0 8px; }

/* Admin */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
  margin: 0 0 20px;
}
.stats li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  color: var(--muted);
}
.stats strong {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 4px;
  letter-spacing: -0.03em;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th {
  background: var(--card);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.02em;
}
tr:last-child td { border-bottom: 0; }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.actions form,
.actions .inline {
  display: inline-flex;
  margin: 0;
  align-items: center;
}
.wrap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
}
.wrap-actions form {
  display: inline-flex;
  margin: 0;
  align-items: center;
}
.report-group-head .actions {
  align-items: center;
}
.reason { max-width: 280px; color: #475569; }
.tiny { font-size: 12px; margin-top: 4px; line-height: 1.5; }

.foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 40px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* Captcha */
.slider-captcha { margin-top: 0.5rem; }
.slider-panel { margin-top: 8px; }
.slider-track {
  position: relative;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(90deg, #e0e7ff, #f1f5f9);
  border: 1px solid var(--line);
  overflow: hidden;
}
.slider-slot {
  position: absolute;
  top: 6px;
  width: 42px;
  height: 30px;
  margin-left: -21px;
  border-radius: 8px;
  border: 2px dashed rgba(37, 99, 235, 0.45);
  background: rgba(255, 255, 255, 0.5);
}
.slider-bar {
  position: relative;
  height: 42px;
  margin-top: 10px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  touch-action: none;
}
.slider-handle {
  position: absolute;
  left: 0;
  top: 3px;
  width: 42px;
  height: 34px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: grab;
  user-select: none;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.slider-handle:active { cursor: grabbing; }

.captcha-field { margin-top: 0.4rem; }
.captcha-row { display: flex; gap: 0.6rem; align-items: center; }
.captcha-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.captcha-row input { flex: 1; }

/* Report groups */
.report-groups { display: grid; gap: 14px; }
.report-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.report-group-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.report-group-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.nested-table { width: 100%; border-collapse: collapse; }
.nested-table th,
.nested-table td {
  padding: 10px 18px;
  text-align: left;
  border-top: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
.nested-table thead th {
  background: var(--card);
  font-size: 12px;
  color: var(--muted);
  border-top: 0;
  font-weight: 600;
}

@media (max-width: 800px) {
  .top-inner { grid-template-columns: 1fr; gap: 12px; }
  .search { max-width: none; }
  .nav { justify-content: flex-start; flex-wrap: wrap; gap: 10px; }
  .hero h1 { font-size: 22px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .copy-row { flex-direction: column; }
  .detail, .auth, .admin { padding: 18px; }
}
