:root {
  --bg: #070a12;
  --bg-2: #0b1020;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #e9eefb;
  --muted: #8b97ad;
  --dim: #5f6b80;
  --pink: #ff3d7f;
  --violet: #8b5cf6;
  --cyan: #35d0ff;
  --green: #33d69f;
  --amber: #ffb020;
  --red: #ff5c5c;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(255, 61, 127, 0.16), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(139, 92, 246, 0.18), transparent 62%),
    linear-gradient(180deg, #070a12 0%, #080c16 40%, #06080f 100%);
  background-attachment: fixed;
}

.bg-orbs { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-orbs span {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35;
  animation: float 18s ease-in-out infinite;
}
.bg-orbs span:nth-child(1) { width: 380px; height: 380px; left: -120px; top: 160px; background: #ff3d7f; }
.bg-orbs span:nth-child(2) { width: 320px; height: 320px; right: -100px; top: 60px; background: #7c5cff; animation-delay: -6s; }
.bg-orbs span:nth-child(3) { width: 260px; height: 260px; right: 30%; bottom: -120px; background: #1fb6ff; animation-delay: -12s; opacity: 0.22; }
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(20px, -30px, 0) scale(1.08); }
}

a { color: var(--cyan); text-decoration: none; }
code { font-family: var(--mono); font-size: 0.92em; background: rgba(255,255,255,.07); padding: 1px 6px; border-radius: 6px; }

/* ── topbar ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  backdrop-filter: blur(18px);
  background: rgba(7, 10, 18, 0.72);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 8px 24px rgba(255, 61, 127, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: 0.3px; }
.brand-text span { font-size: 11.5px; color: var(--dim); font-family: var(--mono); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.ghost-link { font-size: 13px; color: var(--muted); }
.ghost-link:hover { color: var(--text); }

.status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px;
  background: var(--panel);
}
.status-chip i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px rgba(51, 214, 159, 0.15);
  animation: pulse 2.4s ease-in-out infinite;
}
.status-chip.is-bad i { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 92, 92, 0.18); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ── layout ───────────────────────────────────────────── */
main { position: relative; z-index: 1; width: min(1180px, 100%); margin: 0 auto; padding: 34px clamp(16px, 4vw, 48px) 60px; }

.hero h1 {
  margin: 6px 0 10px; font-size: clamp(24px, 3.3vw, 38px); line-height: 1.2; letter-spacing: -0.5px;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--pink), var(--violet) 55%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; max-width: 760px; }

.mode-switch { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-soft); margin-bottom: 14px; }
.mode-btn {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px;
  padding: 7px 16px; border-radius: 9px; cursor: pointer; transition: .18s;
}
.mode-btn.is-active { background: linear-gradient(135deg, rgba(255,61,127,.9), rgba(139,92,246,.9)); color: #fff; font-weight: 600; }

.searchbar { display: flex; gap: 10px; align-items: stretch; }
.searchbar-input {
  position: relative; flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border-radius: 14px;
  background: rgba(12, 17, 30, 0.9);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color .18s, box-shadow .18s;
}
.searchbar-input:focus-within {
  border-color: rgba(255, 61, 127, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 61, 127, 0.12);
}
.searchbar-input svg { width: 18px; height: 18px; stroke: var(--dim); fill: none; stroke-width: 1.8; stroke-linecap: round; flex: none; }
.searchbar-input input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 15px; padding: 15px 0;
}
.searchbar-input input::placeholder { color: #4c576a; }
.clear-btn { border: 0; background: transparent; color: var(--dim); font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 6px; }
.clear-btn:hover { color: var(--text); }

.primary-btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 650; font-size: 14px; color: #fff;
  padding: 0 26px; border-radius: 14px;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 10px 30px rgba(255, 61, 127, 0.28);
  transition: transform .16s, box-shadow .16s, filter .16s;
  min-height: 52px;
}
.primary-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: .6; cursor: progress; transform: none; }

.batch-panel { margin-top: 12px; background: rgba(12,17,30,.9); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.batch-panel textarea {
  width: 100%; resize: vertical; border: 0; outline: 0; background: transparent; color: var(--text);
  font-family: var(--mono); font-size: 13px; line-height: 1.6; min-height: 96px;
}
.batch-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.batch-actions .primary-btn { min-height: 42px; padding: 0 20px; }

.examples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font: inherit; font-size: 12.5px; padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: .16s;
  font-family: var(--mono);
}
.chip:hover { color: var(--text); border-color: rgba(255,61,127,.5); background: rgba(255,61,127,.1); }

.history { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; }
.history-list { display: flex; gap: 8px; flex-wrap: wrap; }
.history-item {
  border: 1px solid var(--line-soft); background: transparent; color: var(--dim);
  font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 8px; cursor: pointer; font-family: var(--mono);
}
.history-item:hover { color: var(--text); border-color: var(--line); }

/* ── cards ────────────────────────────────────────────── */
.result { animation: rise .32s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 28px 0 14px; }
.result-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.result-actions { display: flex; gap: 8px; }
.mini-btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font: inherit; font-size: 12.5px; padding: 7px 13px; border-radius: 9px; cursor: pointer; transition: .16s;
}
.mini-btn:hover { color: var(--text); border-color: rgba(255,255,255,.2); background: var(--panel-2); }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.overview { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-bottom: 16px; }

.product-card { display: grid; grid-template-columns: 132px 1fr; gap: 18px; }
.product-thumb {
  width: 132px; height: 132px; border-radius: 14px; object-fit: cover; background: #111826;
  border: 1px solid var(--line-soft);
}
.product-thumb.is-empty { display: grid; place-items: center; color: var(--dim); font-size: 12px; }
.product-main { min-width: 0; }
.product-title { margin: 0 0 6px; font-size: 15.5px; font-weight: 680; line-height: 1.45; }
.product-shop { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.product-shop b { color: var(--text); font-weight: 600; }

.price-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.price-now { font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1;
  background: linear-gradient(120deg, #ffd1e0, var(--pink) 45%, #ff8a5c);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.price-now small { font-size: 15px; font-weight: 700; -webkit-text-fill-color: var(--pink); margin-right: 2px; }
.price-old { color: var(--dim); text-decoration: line-through; font-size: 13px; }

.pill-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 5px 10px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line-soft); color: var(--muted);
  font-family: var(--mono);
}
.pill b { color: var(--text); font-weight: 650; font-family: var(--font); }
.pill.hot { color: #ffd0dd; border-color: rgba(255,61,127,.35); background: rgba(255,61,127,.12); }
.pill.hot b { color: #fff; }
.pill.cyan { color: #c5f2ff; border-color: rgba(53,208,255,.3); background: rgba(53,208,255,.1); }
.pill.cyan b { color: #fff; }

.team-bar {
  margin-top: 14px; padding: 10px 12px; border-radius: 11px;
  border: 1px dashed rgba(255, 176, 32, 0.3); background: rgba(255, 176, 32, 0.07);
  font-size: 12.5px; color: #ffd9a0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.team-bar.is-empty { border-color: var(--line-soft); background: transparent; color: var(--dim); }
.team-bar b { color: #fff; }

.coupon-card { display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.coupon-card::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,61,127,.28), transparent 70%);
}
.coupon-label { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.coupon-amount { font-size: 44px; font-weight: 850; line-height: 1; margin: 8px 0 4px; letter-spacing: -2px;
  background: linear-gradient(120deg, #fff, #ffb3c9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.coupon-amount small { font-size: 16px; margin-right: 2px; -webkit-text-fill-color: #ffb3c9; }
.coupon-desc { font-size: 13px; color: var(--text); margin-bottom: 6px; }
.coupon-meta { font-size: 12px; color: var(--muted); line-height: 1.7; }
.coupon-card .actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.coupon-empty { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer;
  transition: .16s; text-decoration: none;
}
.btn:hover { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.09); }
.btn.primary { background: linear-gradient(135deg, var(--pink), var(--violet)); border: 0; color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }

.offers-card { padding: 18px 20px 8px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 680; }
.count {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12px;
  background: rgba(255,61,127,.16); color: #ff9fbe; border: 1px solid rgba(255,61,127,.3);
  font-family: var(--mono);
}

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.offers-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
.offers-table th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.offers-table td { padding: 14px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.offers-table tbody tr:hover { background: rgba(255,255,255,.025); }
.offers-table tbody tr:last-child td { border-bottom: 0; }
.offers-table .num { text-align: right; }
.offers-table td.num { font-family: var(--mono); }

.offer-name { font-weight: 640; color: var(--text); }
.offer-sub { color: var(--dim); font-size: 11.5px; margin-top: 3px; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.mono-copy { cursor: pointer; border-bottom: 1px dashed transparent; }
.mono-copy:hover { border-bottom-color: var(--dim); color: var(--text); }

.share-amount { font-size: 15px; font-weight: 700; color: var(--green); font-family: var(--mono); }
.share-ratio { font-size: 11px; color: var(--dim); }

.badge {
  display: inline-block; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--muted);
}
.badge.live { color: #9dffcf; border-color: rgba(51,214,159,.35); background: rgba(51,214,159,.12); }
.badge.upcoming { color: #ffe0a3; border-color: rgba(255,176,32,.35); background: rgba(255,176,32,.12); }
.badge.ended { color: #9aa5b8; border-color: var(--line); background: rgba(255,255,255,.03); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions .btn { padding: 5px 10px; font-size: 12px; }

.no-offers { padding: 26px 4px 30px; text-align: center; color: var(--dim); font-size: 13px; }
.no-offers b { display: block; color: var(--muted); margin-bottom: 6px; font-size: 14px; }

.meta-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 18px 0 10px; color: var(--dim); font-size: 12px; font-family: var(--mono); }
.meta-row span b { color: var(--muted); font-weight: 500; }

.raw-box { margin-top: 8px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(0,0,0,.35); }
.raw-box summary { cursor: pointer; padding: 10px 14px; font-size: 12.5px; color: var(--muted); }
.raw-box pre { margin: 0; padding: 0 14px 14px; overflow: auto; max-height: 420px; font-family: var(--mono); font-size: 11.5px; color: #9fb0c9; line-height: 1.6; }

/* ── states ───────────────────────────────────────────── */
.empty-state { margin-top: 46px; text-align: center; color: var(--dim); }
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center;
  font-size: 28px; color: #ff8ab0; background: var(--panel); border: 1px solid var(--line);
}
.empty-state p { font-size: 14px; max-width: 460px; margin: 0 auto; }

.error-card {
  margin-top: 28px; padding: 18px 20px; border-radius: 14px; display: flex; gap: 14px; align-items: flex-start;
  background: rgba(255,92,92,.08); border: 1px solid rgba(255,92,92,.3); color: #ffb4b4;
}
.error-card .ico { font-size: 20px; line-height: 1; }
.error-card b { display: block; color: #ffd9d9; margin-bottom: 4px; }

.skeleton { margin-top: 28px; display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.sk-block { height: 190px; border-radius: var(--radius); background: linear-gradient(100deg, rgba(255,255,255,.04) 30%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 70%); background-size: 220% 100%; animation: shimmer 1.3s infinite linear; }
.sk-block.wide { grid-column: 1 / -1; height: 260px; }
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* batch table */
.batch-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 780px; }
.batch-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.batch-table td { padding: 12px; border-bottom: 1px solid var(--line-soft); }
.batch-table tbody tr { cursor: pointer; }
.batch-table tbody tr:hover { background: rgba(255,255,255,.03); }
.batch-table .title-cell { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: rgba(20, 26, 40, 0.96); border: 1px solid var(--line);
  color: var(--text); font-size: 13px; padding: 11px 20px; border-radius: 12px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .22s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* footer */
.footer { position: relative; z-index: 1; border-top: 1px solid var(--line-soft); padding: 34px clamp(16px, 4vw, 48px) 26px; background: rgba(5, 8, 14, 0.6); }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 26px; max-width: 1100px; margin: 0 auto 24px; }
.foot-grid h4 { margin: 0 0 8px; font-size: 13px; color: var(--text); }
.foot-grid p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--dim); }
.foot-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1100px; margin: 0 auto; font-size: 12px; color: #46505f; font-family: var(--mono); }

.muted { color: var(--muted); }
.small { font-size: 12px; }

@media (max-width: 900px) {
  .overview, .skeleton { grid-template-columns: 1fr; }
  .product-card { grid-template-columns: 104px 1fr; }
  .product-thumb { width: 104px; height: 104px; }
  .searchbar { flex-direction: column; }
  .primary-btn { min-height: 48px; }
  .brand-text span { display: none; }
}

@media (max-width: 560px) {
  main { padding-top: 22px; }
  .hero h1 { font-size: 24px; }
  .product-card { grid-template-columns: 1fr; }
  .product-thumb { width: 100%; height: 180px; }
  .topbar-right .ghost-link { display: none; }
  .result-actions { width: 100%; }
  .result-actions .mini-btn { flex: 1; }
}

/* ── 后台 / 表单 ─────────────────────────────────────── */
.admin-main { width: min(1120px, 100%); margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 60px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.admin-card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 680; }
.admin-card label, .login-card label { display: block; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.admin-card input, .login-card input {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 10px;
  background: rgba(12,17,30,.9); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 14px; outline: 0; transition: border-color .16s, box-shadow .16s;
}
.admin-card input:focus, .login-card input:focus { border-color: rgba(255,61,127,.5); box-shadow: 0 0 0 3px rgba(255,61,127,.12); }
.admin-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.admin-actions .primary-btn { min-height: 40px; padding: 0 20px; }
.admin-actions .mini-btn { min-height: 40px; }

.login-wrap { display: grid; place-items: center; min-height: 62vh; }
.login-card { width: min(400px, 100%); }
.login-card h2 { margin: 0 0 6px; font-size: 20px; }
.login-card .primary-btn { width: 100%; margin-top: 18px; min-height: 46px; }

.flash { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; font-size: 13px; }
.flash.ok { background: rgba(51,214,159,.1); border: 1px solid rgba(51,214,159,.3); color: #9dffcf; }
.flash.bad { background: rgba(255,92,92,.1); border: 1px solid rgba(255,92,92,.3); color: #ffb4b4; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0 4px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b { display: block; margin-top: 6px; font-size: 24px; font-weight: 800; letter-spacing: -.5px;
  background: linear-gradient(120deg, #fff, #ffb3c9); -webkit-background-clip: text; background-clip: text; color: transparent; }

.code { margin: 10px 0; padding: 12px 14px; border-radius: 10px; background: rgba(0,0,0,.35);
  border: 1px solid var(--line-soft); font-family: var(--mono); font-size: 12px; color: #9fb0c9; line-height: 1.7; overflow-x: auto; }
.admin-body .offers-table { min-width: 640px; }
