:root {
  --bg: #fff8fc;
  --bg2: #f8fbff;
  --card: #ffffff;
  --text: #3a3341;
  --muted: #8a7f90;
  --primary: #ff7eb6;
  --primary-dark: #ff5ea3;
  --line: #f1dceb;
  --ok: #28a36a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 15% 20%, #ffe9f3 0%, transparent 45%),
              radial-gradient(circle at 85% 15%, #eaf4ff 0%, transparent 40%),
              linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #f7d9ea;
  padding: 12px 18px;
}
.topbar-min { min-height: 56px; }
nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
a { text-decoration: none; }
main { max-width: 980px; margin: 22px auto; padding: 0 14px 34px; }
.home-main {
  max-width: 640px;
  min-height: calc(100vh - 76px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 10px 14px;
}
.card {
  background: var(--card);
  border: 1px solid #f8dbe8;
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(255,126,182,.08);
}
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
h2, h3 { margin: 0 0 10px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 10px; line-height: 1.55; }
label { font-size: 13px; color: #6e5f74; }
input, textarea {
  width: 100%;
  margin: 6px 0 10px;
  border: 1px solid #efd6e5;
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}
input:focus, textarea:focus {
  outline: none;
  border-color: #ff9cc8;
  box-shadow: 0 0 0 3px rgba(255,126,182,.2);
}
button {
  border: 0;
  border-radius: 12px;
  padding: 10px 15px;
  min-height: 50px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s ease;
}
button:hover { background: var(--primary-dark); transform: translateY(-1px); }
button.ghost { background: #fff0f7; color: #a54679; }
button.ghost:hover { background: #ffe3f1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.result { margin-top: 8px; font-weight: 700; color: var(--ok); }
ul { margin: 0; padding-left: 20px; }
li { margin-bottom: 8px; }
.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #ffe8f2;
  color: #a54679;
  margin-left: 6px;
}
.page-intro { margin-bottom: 14px; }
.home-main .page-intro { margin-bottom: 0; width: 100%; }
.center-all { text-align: center; }
.center-all .row, .center-all .inline-actions { justify-content: center; }
.center-all #claimBtn { margin: 6px auto 0; display: inline-block; width: clamp(220px, 78vw, 420px); min-height: 52px; font-size: 16px; }
.hero-card { border: 1px solid #f3c4dc; box-shadow: 0 10px 28px rgba(255,126,182,.14); }
.hero-badge { display:inline-block; padding:4px 10px; border-radius:999px; background:#fff0f7; color:#a54679; font-size:12px; font-weight:700; margin-bottom:8px; }
.product-grid { gap: 12px; }
.product-card { padding: 12px; transition: transform .15s ease, box-shadow .15s ease; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.08); }
.product-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.product-name { font-weight: 800; }
.stock-badge { font-size:12px; border-radius:999px; padding:3px 8px; border:1px solid transparent; }
.stock-badge.ok { background:#ecfdf3; color:#157347; border-color:#b7ebc9; }
.stock-badge.warn { background:#fff9e8; color:#9a6700; border-color:#f6df9f; }
.stock-badge.danger { background:#fff1f2; color:#b42318; border-color:#fecdd3; }
.kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:10px; margin-top:10px; }
.kpi { background:#fff4fa; border:1px solid #f6c7df; border-radius:12px; padding:10px; }
.kpi .label { font-size:12px; color:#8a7f90; }
.kpi .value { font-size:20px; font-weight:800; color:#a54679; }
.section-title { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.inline-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.center-wrap { justify-content: center; }
.responsive-btn {
  width: clamp(180px, 55vw, 320px);
  max-width: 100%;
  text-align: center;
}
.list-compact li { padding:8px 0; border-bottom:1px dashed #f3d3e4; }
.list-compact li:last-child { border-bottom:0; }
.tip {
  margin-top: 8px;
  font-size: 13px;
  color: #9a5d80;
  background: #fff4fa;
  border: 1px dashed #f6c7df;
  border-radius: 10px;
  padding: 8px 10px;
}
.tip-strong {
  color: #8a2452;
  font-weight: 700;
  background: #fff1f7;
  border-style: solid;
}
.bottom-contact { width: 100%; text-align: center; margin-top: 10px; }
.bottom-contact a { color: #2563eb; font-weight: 600; text-decoration: none; }
.bottom-contact a:hover { text-decoration: underline; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 60;
}
.modal-card {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
}
.modal-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:8px; }
.modal-head h3 { margin: 0; }
.history-item {
  list-style: none;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
  background: #fff;
}
.history-time {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}
.history-code-box {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: #1e2b4f;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 6px 10px;
}

body.theme-dark {
  --bg: #12151f;
  --bg2: #1a2130;
  --card: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: #374151;
  background: linear-gradient(180deg, #12151f 0%, #1a2130 100%);
}
body.theme-dark .topbar {
  background: rgba(17,24,39,.85);
  border-bottom-color: #374151;
}
body.theme-dark .card,
body.theme-dark input,
body.theme-dark textarea {
  border-color: #374151;
  background: #111827;
  color: #e5e7eb;
}
body.theme-dark .tip,
body.theme-dark .kpi {
  background: #1f2937;
  border-color: #374151;
  color: #cbd5e1;
}
body.theme-dark button.ghost {
  background: #273449;
  color: #e5e7eb;
}
body.theme-dark .bottom-contact a { color: #60a5fa; }
body.theme-dark .modal-card { background: #111827; border-color: #374151; color: #e5e7eb; }
body.theme-dark .history-item { background: #111827; border-color: #374151; }
body.theme-dark .history-time { color: #9ca3af; }
body.theme-dark .history-code-box { background: #1f2937; border-color: #4b5563; color: #e5e7eb; }

.brand-topbar { justify-content: space-between; }
.brand-left { font-weight: 900; color: #a54679; letter-spacing: .5px; }
.app-toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 88px; background: rgba(26,26,26,.9); color:#fff;
  padding: 8px 12px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .2s;
  z-index: 99;
}
.app-toast.show { opacity: 1; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  .topbar { padding: 10px 10px; gap: 8px; }
  .topbar h1 { font-size: 15px; margin: 0; }
  main { margin: 12px auto; padding: 0 10px 24px; }
  .home-main { padding: 8px 10px; min-height: calc(100vh - 64px); }
  .card { border-radius: 14px; padding: 12px; }
  .grid2, .kpi-grid { grid-template-columns: 1fr; }
  .kpi .value { font-size: 18px; }
  input, textarea, select { font-size: 16px; padding: 10px 11px; }
  .center-all #claimBtn, .responsive-btn {
    width: 100%;
    min-height: 52px;
    font-size: 16px;
  }
  nav button { padding: 8px 10px; }
}
