:root {
  --brand: #1f6feb;
  --brand-dark: #1a5fd0;
  --brand-soft: #eef4ff;
  --text: #1b1f24;
  --text-2: #4a5160;
  --text-3: #8a8f99;
  --line: #e9edf2;
  --bg: #f5f6f8;
  --white: #fff;
  --success: #16803c;
  --success-soft: #e8f7ee;
  --danger: #d33f2b;
  --danger-soft: #fdeceb;
  --warn: #b5760a;
  --warn-soft: #fff5e5;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------- 导航 ---------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  height: 58px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 18px;
  white-space: nowrap;
}

.brand-dot {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, #1f6feb, #4c8dff);
  color: #fff;
  font-size: 13px;
  line-height: 24px;
  text-align: center;
}

.nav-spacer {
  flex: 1;
}

.nav-link {
  font-size: 14px;
  color: var(--text-2);
  padding: 6px 10px;
  border-radius: 8px;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.nav-link.active {
  color: var(--brand);
  font-weight: 600;
}

.nav-user {
  font-size: 14px;
  color: var(--text-3);
  margin-right: 4px;
  white-space: nowrap;
}

/* ---------------- 布局 ---------------- */

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

.wrap-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 26px 20px 70px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.between {
  justify-content: space-between;
}

.muted {
  color: var(--text-3);
  font-size: 13px;
}

.small {
  font-size: 12px;
}

/* ---------------- 首页 ---------------- */

.hero {
  text-align: center;
  padding: 46px 20px 30px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 27px;
  letter-spacing: 0.5px;
}

.hero p {
  margin: 0;
  color: var(--text-3);
  font-size: 14px;
}

.searchbig {
  max-width: 640px;
  margin: 26px auto 0;
  display: flex;
  gap: 10px;
  background: #fff;
  padding: 8px;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(20, 30, 50, 0.08);
}

.searchbig input {
  flex: 1;
  border: 0;
  outline: none;
  font-size: 16px;
  padding: 10px 14px;
  font-family: inherit;
  background: transparent;
  min-width: 0;
}

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-ghost {
  background: #fff;
  border-color: #d8dee7;
  color: var(--text-2);
}

.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn-link {
  background: none;
  border: 0;
  color: var(--brand);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
}

.btn-link.danger {
  color: var(--danger);
}

/* ---------------- 统计数字 ---------------- */

.result-head {
  text-align: center;
  padding: 6px 0 4px;
}

.result-name {
  font-size: 20px;
  font-weight: 700;
  word-break: break-all;
}

.result-window {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 4px;
}

.stat {
  text-align: center;
  padding: 16px 8px;
  border-radius: 12px;
  background: #fafbfd;
  border: 1px solid var(--line);
}

.stat-num {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.stat-success .stat-num {
  color: var(--success);
}

.stat-fail .stat-num {
  color: var(--danger);
}

.stat-other .stat-num {
  color: var(--warn);
}

.stat-note {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin-top: 10px;
}

/* ---------------- 提示条 ---------------- */

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  margin-top: 14px;
}

.alert-info {
  background: var(--brand-soft);
  color: #2a5fb0;
}

.alert-warn {
  background: var(--warn-soft);
  color: #96600a;
}

.alert-error {
  background: var(--danger-soft);
  color: #a8341f;
}

/* ---------------- 徽章 ---------------- */

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 1px 9px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 500;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-fail {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-other {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-invalid {
  background: #f1f3f6;
  color: var(--text-3);
}

.badge-admin {
  background: #eef4ff;
  color: var(--brand);
}

.badge-paid {
  background: #f3efff;
  color: #6b46c1;
}

/* ---------------- 明细记录 ---------------- */

.rec {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 15px 17px;
  margin-bottom: 10px;
}

.rec-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.rec-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-all;
}

.rec-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.rec-toggle {
  margin-top: 10px;
}

.rec-body {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

.field {
  display: flex;
  gap: 12px;
  padding: 7px 0;
  font-size: 13px;
  line-height: 1.7;
}

.field-k {
  width: 96px;
  flex-shrink: 0;
  color: var(--text-3);
}

.field-v {
  flex: 1;
  color: var(--text-2);
  word-break: break-word;
  white-space: pre-wrap;
}

.field-v a {
  word-break: break-all;
}

/* ---------------- 表单 ---------------- */

.form-item {
  margin-bottom: 14px;
}

.form-item label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 5px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #d8dee7;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .stat-num {
    font-size: 24px;
  }
}

/* ---------------- 表格 ---------------- */

.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 860px;
}

table.data th,
table.data td {
  text-align: left;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data th {
  background: #fafbfd;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data td.ell {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.data tr:hover td {
  background: #fcfdff;
}

/* ---------------- 标签页 ---------------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-2);
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

/* ---------------- 弹窗 ---------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 40, 0.45);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 760px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.modal-body {
  padding: 18px 20px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.modal-close {
  border: 0;
  background: none;
  font-size: 20px;
  color: var(--text-3);
  cursor: pointer;
  line-height: 1;
}

/* ---------------- 其他 ---------------- */

.empty {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  padding: 44px 16px;
}

.loading {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 26px 0;
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(26, 32, 44, 0.92);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 10px;
  z-index: 200;
  max-width: 78vw;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

.login-box {
  max-width: 380px;
  margin: 60px auto;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-3);
}

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

.kv {
  background: #fafbfd;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.kv-num {
  font-size: 19px;
  font-weight: 700;
}

.kv-label {
  font-size: 12px;
  color: var(--text-3);
}

.rules-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.rules-row:last-child {
  border-bottom: 0;
}

.foot {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 30px 16px 10px;
  line-height: 2;
}

/* ---------------- 首页两栏：主区 + 排行榜 ---------------- */

.hero-inner {
  max-width: 1060px;
  margin: 0 auto;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px 20px;
  align-items: start;
}

.home-main {
  min-width: 0;
}

.home-side {
  position: sticky;
  top: 76px;
}

@media (max-width: 920px) {
  .home-grid {
    grid-template-columns: 1fr;
    padding: 0 20px 20px;
  }

  .home-side {
    position: static;
  }
}

/* ---------------- 排行榜 ---------------- */

.lb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
}

.lb-item:last-child {
  border-bottom: 0;
}

.lb-item:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.lb-rank {
  flex: 0 0 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 6px;
  background: #f1f3f6;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lb-rank-1 {
  background: #ffe9c7;
  color: #a35a00;
}

.lb-rank-2 {
  background: #e8edf5;
  color: #4a5c78;
}

.lb-rank-3 {
  background: #f6e8dd;
  color: #8a5a36;
}

.lb-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-count {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lb-count::after {
  content: " 次";
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
}
