* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f4f6fa;
  color: #24292f;
  min-height: 100vh;
}
a { color: #2563eb; text-decoration: none; }
a:hover { opacity: .85; }

/* 顶部导航 */
.nav {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav .brand { font-size: 18px; font-weight: 700; color: #1d4ed8; }
.nav .right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.badge {
  background: #fee2e2; color: #b91c1c; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; font-size: 13px;
}

.container { max-width: 1080px; margin: 24px auto; padding: 0 16px; }

/* 卡片 */
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 18px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; margin-bottom: 12px; color: #374151; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }

/* 项目卡片 */
.pcard { border-top: 3px solid #2563eb; }
.pcard .pname { font-size: 16px; font-weight: 700; }
.pcard .price { color: #dc2626; font-weight: 700; font-size: 15px; margin: 6px 0; }
.pcard .meta { font-size: 12px; color: #6b7280; margin-bottom: 10px; }
.pcard.off { border-top-color: #9ca3af; opacity: .55; }

/* 按钮 */
.btn {
  display: inline-block; border: none; border-radius: 6px; cursor: pointer;
  font-size: 14px; padding: 8px 16px; background: #2563eb; color: #fff; text-align: center;
}
.btn:hover { opacity: .88; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.gray { background: #6b7280; }
.btn.red { background: #dc2626; }
.btn.orange { background: #ea580c; }
.btn.green { background: #16a34a; }
.btn:disabled { background: #9ca3af; cursor: not-allowed; }

/* 表单 */
.form-box { max-width: 400px; margin: 60px auto; }
.form-box h2 { text-align: center; margin-bottom: 20px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 14px; margin-bottom: 12px; background: #fff;
}
input:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
label { font-size: 13px; color: #4b5563; display: block; margin-bottom: 4px; }
.msg { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.msg.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg.ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.msg.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.form-foot { text-align: center; font-size: 13px; margin-top: 8px; color: #6b7280; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #eef0f3; }
th { color: #6b7280; font-weight: 600; font-size: 13px; background: #f9fafb; }
tr:hover td { background: #fafbfc; }
.table-wrap { overflow-x: auto; }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.waiting { background: #fef9c3; color: #a16207; }
.tag.received { background: #dcfce7; color: #15803d; }
.tag.released { background: #f3f4f6; color: #4b5563; }
.tag.blacklisted { background: #fee2e2; color: #b91c1c; }

/* 验证码展示 */
.code-box {
  text-align: center; padding: 30px 16px;
}
.code-box .code {
  font-size: 46px; font-weight: 800; letter-spacing: 8px; color: #16a34a;
  font-family: "SF Mono", Consolas, monospace; margin: 10px 0;
}
.code-box .sms { color: #6b7280; font-size: 13px; word-break: break-all; margin-top: 12px; }
.waiting-box { text-align: center; padding: 30px 16px; color: #6b7280; }
.cd-wrap { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 16px; }
.cd-num {
  font-size: 40px; font-weight: 800; color: #1d4ed8; min-width: 52px;
  font-family: "SF Mono", Consolas, monospace; display: inline-block;
}
.spinner {
  display: inline-block; width: 28px; height: 28px; border: 3px solid #dbeafe;
  border-top-color: #2563eb; border-radius: 50%; animation: spin 1s linear infinite;
  vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 统计块 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 800; color: #1d4ed8; }
.stat .lbl { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* 管理后台布局 */
.admin-wrap { display: flex; min-height: calc(100vh - 56px); }
.admin-side {
  width: 190px; background: #111827; padding: 18px 0; flex-shrink: 0;
}
.admin-side a {
  display: block; color: #d1d5db; padding: 11px 22px; font-size: 14px;
  border-left: 3px solid transparent;
}
.admin-side a:hover { background: #1f2937; color: #fff; opacity: 1; }
.admin-side a.active { background: #1f2937; color: #fff; border-left-color: #3b82f6; }
.admin-main { flex: 1; padding: 22px; min-width: 0; }
.page-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

/* 内联编辑表单 */
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input { margin-bottom: 0; width: auto; padding: 5px 8px; }
.inline-form input[type=number] { width: 90px; }

.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 12px; }
.muted { color: #6b7280; font-size: 13px; }

/* 用户卡片管理 */
.ucards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ucard { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; }
.ucard .uhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.ucard .uhead b { font-size: 15px; }
.ucard form { margin-top: 10px; }
.ucard .row { display: flex; gap: 8px; align-items: center; }
.ucard .row input { flex: 1; margin-bottom: 0; min-width: 0; }
.ucard .row .btn { flex-shrink: 0; }

/* 项目卡片编辑 */
.proj-card .uhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.proj-card .frow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.proj-card .frow .fitem { flex: 1; min-width: 110px; }
.proj-card .frow label { margin-bottom: 3px; }
.proj-card .frow input, .proj-card .frow select { margin-bottom: 0; }
.proj-card .frow .fitem.sm { flex: 0 0 90px; }
.proj-card .frow .fitem.chk { flex: 0 0 auto; align-self: center; padding-top: 14px; }
.proj-card .frow .fitem.chk label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.proj-card .frow .fitem.chk input { width: auto; }

/* 响应式：手机端表格转卡片 */
@media (max-width: 640px) {
  .resp-table thead { display: none; }
  .resp-table, .resp-table tbody, .resp-table tr, .resp-table td { display: block; width: 100%; }
  .resp-table tr { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 10px; padding: 4px 14px; }
  .resp-table td { border: none; padding: 7px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .resp-table td::before { content: attr(data-label); color: #6b7280; font-size: 13px; flex-shrink: 0; }
  .resp-table td .tag { white-space: nowrap; }
}

/* 响应式：手机端整体适配 */
@media (max-width: 760px) {
  .nav { padding: 0 12px; }
  .nav .right { gap: 8px; font-size: 13px; }
  .container { margin: 16px auto; padding: 0 12px; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat .num { font-size: 22px; }
  .form-box { margin: 30px 16px; }
  .ucards { grid-template-columns: 1fr; }
  .ucard .row { flex-wrap: wrap; }
  .code-box .code { font-size: 34px; letter-spacing: 6px; }

  .admin-wrap { flex-direction: column; }
  .admin-side { width: 100%; display: flex; overflow-x: auto; padding: 0; -webkit-overflow-scrolling: touch; }
  .admin-side a { white-space: nowrap; padding: 12px 16px; border-left: none; border-bottom: 3px solid transparent; }
  .admin-side a.active { border-left: none; border-bottom-color: #3b82f6; background: #1f2937; }
  .admin-main { padding: 14px; }

  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input, .inline-form select { width: 100%; margin-bottom: 8px; }
  .proj-card .frow .fitem { min-width: 100%; }
  .proj-card .frow .fitem.sm { flex: 1 1 100%; }
}
