/* ================= 设计变量 ================= */
:root {
  --bg: #f6f8fc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e6ebf3;
  --primary: #2563eb;
  --indigo: #4f46e5;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 10px 30px -12px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* 买家页：柔光背景 */
body.page-buyer {
  background:
    radial-gradient(900px 500px at 10% -10%, #e0e7ff 0%, transparent 60%),
    radial-gradient(700px 420px at 100% 5%, #cffafe 0%, transparent 55%),
    var(--bg);
}

/* ================= 通用表单 ================= */
input[type="text"], input[type="url"], input[type="password"],
input[type="number"], input[type="email"], textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

input:focus, textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

textarea { resize: vertical; line-height: 1.6; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  padding: 13px 18px;
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--indigo));
  box-shadow: 0 8px 18px -8px rgba(37, 99, 235, .65);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -8px rgba(37, 99, 235, .7); }
.btn-primary:active { transform: translateY(0); }

/* ================= 买家页 ================= */
.shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
}

.card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.brand { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; }

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #22d3ee);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.brand-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--muted);
  text-transform: uppercase;
}

.product-name { font-size: 26px; line-height: 1.3; margin: 0 0 10px; letter-spacing: -.01em; }
.product-desc { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.75; }

.claim-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: block; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.alert-error { color: var(--danger); background: var(--danger-bg); border: 1px solid #fee2e2; }
.alert svg { flex: none; margin-top: 1px; }

/* 成功结果块 */
.result {
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--success);
  background: #d1fae5;
  border-radius: 999px;
  padding: 4px 10px;
}

.countdown {
  font-size: 12px;
  color: #047857;
  font-variant-numeric: tabular-nums;
}

.link-row { display: flex; gap: 8px; }
.link-row input {
  font-family: var(--mono);
  font-size: 13px;
  background: #fff;
  border-color: #d1fae5;
  padding: 11px 12px;
}
.btn-copy {
  flex: none;
  background: var(--success);
  color: #fff;
  font-size: 13px;
  padding: 0 16px;
  border-radius: 10px;
}
.btn-copy:hover { background: #047857; }

.hint { margin: 10px 0 0; font-size: 12px; line-height: 1.7; color: #047857; }

.foot { margin: 24px 0 0; text-align: center; font-size: 12px; color: #94a3b8; }

/* ================= 后台 ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
}
.topbar .brand { margin: 0; }

.tabs { display: flex; gap: 4px; }
.tab {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.tab:hover { background: #f1f5f9; color: var(--ink); }
.tab.active { background: #eff6ff; color: var(--primary); font-weight: 600; }

.topbar .spacer { flex: 1; }
.logout { font-size: 13px; color: var(--muted); text-decoration: none; }
.logout:hover { color: var(--danger); }

.container { max-width: 1040px; margin: 0 auto; padding: 26px 20px 64px; }
.page-title { font-size: 23px; margin: 0 0 18px; letter-spacing: -.01em; }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.panel-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; }
.panel-hint { font-size: 12px; color: #94a3b8; margin: 10px 0 0; }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 160px; }
.inline-form .btn { flex: none; padding: 12px 20px; }

.grid-form { display: grid; gap: 14px; }
.grid-form .btn { justify-self: start; padding: 12px 26px; }

.table-wrap { overflow-x: auto; margin: -6px; padding: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
  white-space: nowrap;
}
tbody td { padding: 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }

.mono { font-family: var(--mono); font-size: 13px; }

.pill { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-ok { color: #047857; background: #d1fae5; }
.pill-off { color: #64748b; background: #f1f5f9; }
.pill-none { color: #b45309; background: #fef3c7; }

.btn-sm {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-sm:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-sm.danger { color: var(--danger); border-color: #fecaca; }
.btn-sm.danger:hover { background: var(--danger-bg); }

.empty { text-align: center; color: #94a3b8; padding: 28px 12px; font-size: 14px; }

.saved {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #047857;
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
  padding: 6px 10px;
  border-radius: 10px;
  margin-bottom: 14px;
}

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow-md);
}
.login-card h1 { font-size: 20px; margin: 0 0 20px; }
.form-row { display: grid; gap: 12px; margin-bottom: 18px; }
.btn-block { width: 100%; }

/* ================= 移动端 ================= */
@media (max-width: 640px) {
  .shell { padding: 20px 14px; }
  .card { padding: 22px; }
  .product-name { font-size: 22px; }
  .topbar-inner { gap: 10px; padding: 10px 14px; }
  .tab { padding: 7px 10px; font-size: 13px; }
  .container { padding: 18px 14px 48px; }
  .inline-form input { min-width: 120px; }
  .btn { padding: 12px 16px; }
}
