/* ===== 基础 ===== */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6f9;
  color: #1f2d3d;
  line-height: 1.6;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { margin: 0 0 12px; }
p { margin: 0 0 10px; }
.muted { color: #8a94a6; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
code { background:#eef1f5; padding:1px 5px; border-radius:4px; }
main.container { padding-top: 24px; padding-bottom: 40px; }

/* ===== 顶栏 ===== */
.topbar { background: rgba(255,255,255,.96); border-bottom: 1px solid #eef1f5; box-shadow: 0 1px 8px rgba(15,23,42,.05); position: sticky; top: 0; z-index: 100; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-size: 21px; font-weight: 800; background: linear-gradient(135deg,#2563eb,#7c3aed); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 22px; }
.nav a { color: #4b5563; font-size: 15px; transition: color .15s; }
.nav a:hover { color: #2563eb; text-decoration: none; }
.nav .nav-admin { color: #2563eb; }
.notice {
  margin-top: 16px; padding: 12px 16px; background: linear-gradient(135deg,#fff7e6,#fff2d0);
  color: #8a5a00; border: 1px solid #ffe1a8; border-radius: 10px; font-size: 14px;
}

/* ===== Hero 横幅 ===== */
.hero {
  margin-bottom: 24px; padding: 44px 30px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  border-radius: 18px; color: #fff;
  box-shadow: 0 14px 34px rgba(37, 99, 235, .20);
}
.hero h1 { margin: 0 0 8px; font-size: 30px; font-weight: 800; letter-spacing: .5px; }
.hero p { margin: 0; font-size: 15px; opacity: .92; }

/* ===== 卡片与网格 ===== */
.card { background: #fff; border: 1px solid #eef1f5; border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.card.narrow { max-width: 560px; margin: 20px auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.product { display: flex; flex-direction: column; overflow: hidden; padding: 0; transition: transform .2s ease, box-shadow .2s ease; }
.product:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(15,23,42,.12); }
.product-cover { height: 170px; background: #eef1f5; }
.product-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.product:hover .product-cover img { transform: scale(1.06); }
.product-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.product-body h2 { font-size: 17px; margin-bottom: 6px; }
.product-desc { color: #6b7280; font-size: 13px; min-height: 40px; margin-bottom: 12px; }
.product-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.price { color: #e4393c; font-weight: 700; font-size: 18px; }
.stock { color: #8a94a6; font-size: 13px; }

/* ===== 详情 ===== */
.detail { max-width: 720px; margin: 0 auto; }
.detail-cover { margin: -20px -20px 16px; max-height: 320px; overflow: hidden; background:#f0f2f5; }
.detail-cover img { width: 100%; display: block; object-fit: cover; }
.detail-meta { display: flex; gap: 20px; align-items: baseline; margin-bottom: 12px; }
.desc { color: #374151; margin: 12px 0; white-space: normal; }

/* ===== 表单 ===== */
label { display: block; font-size: 14px; color: #374151; margin: 12px 0 6px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 14px; }
.checkbox input { width: auto; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; }
.order-form { margin-top: 16px; }

/* 支付方式选择 */
.pay-choice { display: flex; gap: 12px; }
.pay-radio {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid #d1d5db;
  border-radius: 8px; cursor: pointer; font-weight: 500; flex: 1;
}
.pay-radio input { accent-color: #2563eb; }
.pay-radio:has(input:checked) { border-color: #2563eb; background: #eff6ff; }

/* ===== 按钮 ===== */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: center; transition: .15s;
  background: #fff; color: #1f2d3d; line-height: 1.2;
}
.btn:hover { text-decoration: none; opacity: .92; }
.btn-primary { background: linear-gradient(135deg,#2563eb,#1e40af); color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,.22); }
.btn-info { background: #0ea5e9; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-ghost { background: #fff; border-color: #d1d5db; color: #374151; }
.btn-disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ===== 提示 ===== */
.alert-error { background:#fef2f2; border:1px solid #fecaca; color:#b91c1c; padding:10px 14px; border-radius:8px; margin:12px 0; }
.alert-warn { background:#fffbeb; border:1px solid #fde68a; color:#92400e; padding:10px 14px; border-radius:8px; margin:12px 0; }
.alert-info { background:#eff6ff; border:1px solid #bfdbfe; color:#1e40af; padding:10px 14px; border-radius:8px; margin:12px 0; }
.alert-ok { background:#f0fdf4; border:1px solid #bbf7d0; color:#15803d; padding:10px 14px; border-radius:8px; margin:12px 0; }
.empty { text-align:center; color:#8a94a6; padding:60px 0; }

/* ===== 订单信息 ===== */
.order-info { border-top:1px solid #eef1f5; }
.order-info .row { display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid #eef1f5; font-size:14px; }
.order-info .row span:first-child { color:#8a94a6; }
.badge { display:inline-block; padding:2px 10px; border-radius:20px; font-size:12px; font-weight:500; }
.badge.ok { background:#dcfce7; color:#15803d; }
.badge.info { background:#dbeafe; color:#1d4ed8; }
.badge.warn { background:#fef3c7; color:#b45309; }
.badge.muted { background:#e5e7eb; color:#6b7280; }

/* 支付页 */
.pay-card { text-align:center; }
.qr-box { margin:16px 0; }
.qr-box img { width: 240px; height: 240px; object-fit: contain; border:1px solid #e5e9f0; border-radius:8px; }
.card-secret { background:#f0fdf4; border:1px solid #bbf7d0; border-radius:8px; padding:16px; text-align:left; margin-top:14px; }
.card-secret pre { margin:0; white-space:pre-wrap; word-break:break-all; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:15px; }
.actions { margin-top:16px; display:flex; gap:10px; justify-content:center; }

/* 付款截图上传（醒目） */
.proof-upload {
  margin-top: 18px; padding: 18px 16px;
  background: #fff7ed; border: 2px dashed #f59e0b;
  border-radius: 12px; text-align: center;
  animation: proof-pulse 2.4s ease-in-out infinite;
}
.proof-upload h3 { margin: 0 0 6px; color: #c2410c; font-size: 17px; font-weight: 700; }
.proof-upload p { margin: 0 0 10px; }
.proof-upload input[type=file] { margin: 4px 0 10px; }
.proof-upload .btn { font-size: 15px; padding: 12px 18px; }
@keyframes proof-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .30); }
  50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, .06); }
}

/* ===== 后台布局 ===== */
.admin-body { background:#f0f2f5; }
.admin-layout { display:flex; min-height:100vh; }
.sidebar { width:220px; background:#1f2937; color:#e5e7eb; flex-shrink:0; }
.sidebar-brand { padding:20px 20px 14px; font-size:17px; font-weight:700; color:#fff; }
.sidebar-nav { display:flex; flex-direction:column; }
.sidebar-nav a { color:#d1d5db; padding:12px 20px; font-size:14px; border-left:3px solid transparent; }
.sidebar-nav a:hover { background:#374151; text-decoration:none; }
.sidebar-nav a.active { background:#374151; color:#fff; border-left-color:#2563eb; }
.sidebar-nav a.logout { margin-top:20px; color:#fca5a5; }
.admin-main { flex:1; min-width:0; display:flex; flex-direction:column; }
.admin-top { background:#fff; border-bottom:1px solid #e5e9f0; padding:14px 24px; text-align:right; font-size:14px; }
.admin-content { padding:24px; }

/* 统计 */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; }
.stat { background:#fff; border:1px solid #e5e9f0; border-radius:10px; padding:18px; text-align:center; }
.stat.mini { padding:14px; }
.stat .num { font-size:28px; font-weight:700; color:#1f2d3d; }
.stat .num.warn { color:#d97706; } .stat .num.info { color:#2563eb; } .stat .num.ok { color:#16a34a; }
.stat .label { color:#8a94a6; font-size:13px; margin-top:4px; }

/* 工具栏 / 筛选 */
.toolbar { margin-bottom:16px; display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.filter-bar { margin-bottom:16px; display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.filter-bar label { margin:0 8px 0 0; }
.filter-bar select { width:auto; min-width:200px; }
.chip { display:inline-block; padding:6px 14px; border-radius:20px; border:1px solid #d1d5db; color:#4b5563; font-size:13px; background:#fff; }
.chip:hover { text-decoration:none; background:#f3f4f6; }
.chip.active { background:#2563eb; color:#fff; border-color:#2563eb; }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 100%; }
.card > h3:first-child { margin-top:0; }
.table-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.table-head h3 { margin:0; }
table { width:100%; border-collapse:collapse; font-size:14px; }
th, td { padding:10px 12px; text-align:left; border-bottom:1px solid #eef1f5; vertical-align:middle; }
th { color:#8a94a6; font-weight:500; background:#fafbfc; }
tbody tr:hover { background:#f8fafc; }
.ops { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.thumb { margin:6px 0; } .thumb img { max-width:120px; max-height:120px; border-radius:6px; border:1px solid #e5e9f0; }
.thumb.large img { max-width:180px; max-height:180px; }
.thumb-sm { width:36px; height:36px; object-fit:cover; border-radius:4px; }
.qr-row { display:flex; gap:24px; flex-wrap:wrap; }
.qr-row > div { flex:1; min-width:200px; }
.pay-method-grid { display:flex; gap:24px; flex-wrap:wrap; margin-bottom:8px; }
.pay-method-grid > div { flex:1; min-width:220px; }
.pager { margin-top:14px; display:flex; gap:6px; flex-wrap:wrap; }
.manual-fulfill textarea { margin-bottom:10px; }

/* 登录页 */
.login-body { display:flex; align-items:center; justify-content:center; min-height:100vh; background:#1f2937; }
.login-box { background:#fff; border-radius:12px; padding:32px; width:360px; box-shadow:0 10px 40px rgba(0,0,0,.2); }
.login-box h1 { text-align:center; font-size:20px; margin-bottom:20px; }

/* 弹出公告 */
.popup-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: popup-fade .2s ease;
}
.popup-overlay[hidden] { display: none; }
.popup-dialog {
  background: #fff; border-radius: 14px; width: 100%; max-width: 430px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); overflow: hidden;
  animation: popup-pop .25s ease;
}
.popup-head { padding: 16px 20px; background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.popup-head h2 { margin: 0; color: #fff; font-size: 17px; }
.popup-body {
  padding: 20px; font-size: 14px; line-height: 1.7; color: #374151;
  max-height: 55vh; overflow-y: auto; white-space: pre-wrap;
}
.popup-foot { padding: 0 20px 20px; }
.popup-foot .btn { width: 100%; }
.popup-foot .btn:disabled { background: #cbd5e1; border-color: #cbd5e1; color: #fff; cursor: not-allowed; box-shadow: none; }
@keyframes popup-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes popup-pop { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }

/* 页脚 */
.footer { text-align:center; color:#8a94a6; font-size:13px; padding:28px 0; border-top:1px solid #eef1f5; margin-top:20px; }

/* 移动端 */
@media (max-width: 720px) {
  .container { padding: 0 12px; }
  main.container { padding-top: 16px; padding-bottom: 28px; }
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 24px; }

  /* 后台侧边栏改为顶部横排 */
  .admin-layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; }
  .sidebar-brand { padding: 12px 14px 8px; font-size: 16px; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .sidebar-nav a { border-left: none; padding: 10px 12px; font-size: 13px; border-radius: 6px; }
  .sidebar-nav a.logout { margin-top: 0; margin-left: auto; }
  .admin-main { min-width: 0; }
  .admin-top { padding: 10px 14px; text-align: left; font-size: 13px; }
  .admin-content { padding: 16px 12px; }

  /* 顶栏 */
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 8px; }
  .brand { font-size: 18px; }
  .nav { gap: 14px; }

  /* 表格小屏横向滚动 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 560px; }

  /* 卡片 / 表单 */
  .card { padding: 16px; }
  .card.narrow { margin: 12px auto; }
  .detail { max-width: 100%; }
  .detail-cover { margin: -16px -16px 12px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
  .pay-choice { flex-direction: column; gap: 8px; }
  .pay-radio { padding: 10px 12px; }
  .qr-row > div, .pay-method-grid > div { min-width: 100%; }

  /* 二维码 / 图片 */
  .qr-box img { width: 180px; height: 180px; max-width: 100%; }
  .proof-upload input[type=file] { font-size: 13px; }

  /* 按钮 / 筛选 / 分页 */
  .btn { padding: 10px 14px; }
  .ops { gap: 4px; }
  .ops .btn { font-size: 12px; padding: 4px 8px; }
  .chip { padding: 5px 10px; font-size: 12px; }
  .pager { gap: 4px; }

  /* 统计 / 商品网格 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .product-cover { height: 130px; }
  .license-grid { grid-template-columns: 1fr; }
  .license-fig img { max-height: 60vh; }

  /* 登录框 */
  .login-box { width: calc(100% - 32px); max-width: 360px; padding: 24px; }
}

/* ===== 商家资质 ===== */
.license-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.license-card { display: flex; flex-direction: column; }
.license-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.license-tag { font-size: 16px; font-weight: 700; color: #1f2d3d; }
.license-fig { display: block; border: 1px solid #eef1f5; border-radius: 10px; overflow: hidden; background: #fafbfc; }
.license-fig img { display: block; width: auto; max-width: 100%; height: auto; max-height: 440px; margin: 0 auto; }
.license-empty { padding: 48px 0; text-align: center; color: #8a94a6; border: 1px dashed #d1d5db; border-radius: 10px; }
