:root {
  --bg: #0b1220;
  --panel: #152033;
  --text: #e8eef6;
  --muted: #8b9bb0;
  --brand: #0f766e;
  --brand-2: #14b8a6;
  --line: rgba(255, 255, 255, 0.08);
  --danger: #f07167;
  --ok: #5eead4;
  --radius: 14px;
  --font-display: "Outfit", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", "Segoe UI", sans-serif;
  --max: 960px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  background:
    radial-gradient(1000px 480px at 10% -10%, rgba(20, 184, 166, 0.16), transparent 55%),
    linear-gradient(180deg, #0d1524 0%, var(--bg) 40%, #090e18 100%);
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 12px;
}

.wrap {
  width: min(var(--max), calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 16px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.logo:hover { text-decoration: none; color: var(--brand-2); }
.nav a { margin-left: 14px; color: var(--muted); }
.nav a:hover { color: var(--text); }

.hero {
  padding: 48px 0 28px;
}
.hero p { color: var(--muted); margin: 0; max-width: 36em; }

.product-list {
  display: grid;
  gap: 14px;
  padding-bottom: 64px;
}
.product {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(21, 32, 51, 0.72);
}
.product h3 { margin: 0 0 6px; font-size: 1.2rem; }
.product .desc { color: var(--muted); margin: 0 0 8px; font-size: 0.95rem; }
.product .meta { color: var(--muted); font-size: 0.88rem; }
.price {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ok);
}
.price small { font-size: 0.7em; margin-right: 2px; }
.buy-col { text-align: right; display: grid; gap: 10px; justify-items: end; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 650;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #0d9488);
  color: #fff;
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--text);
}
.btn-danger {
  background: rgba(240, 113, 103, 0.15);
  border-color: rgba(240, 113, 103, 0.35);
  color: #ffb4ad;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(21, 32, 51, 0.72);
  margin-bottom: 20px;
}
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.err { color: var(--danger); }
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.key-box {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 16px 0;
}
.key-box code {
  flex: 1;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(20, 184, 166, 0.35);
  background: rgba(15, 118, 110, 0.16);
  color: #9fe8dc;
  user-select: all;
  word-break: break-all;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 32, 40, 0.95);
  border: 1px solid rgba(20, 184, 166, 0.4);
  color: var(--ok);
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0 32px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Admin */
.admin-layout { padding: 28px 0 64px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.tab.active {
  color: var(--text);
  border-color: rgba(20, 184, 166, 0.45);
  background: rgba(15, 118, 110, 0.2);
}
.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
label { display: grid; gap: 6px; font-size: 0.88rem; color: var(--muted); }
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
textarea { min-height: 120px; resize: vertical; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }
.login-box {
  max-width: 380px;
  margin: 80px auto;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
}
.badge.paid { color: var(--ok); border-color: rgba(94, 234, 212, 0.35); }
.badge.pending { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); }
.badge.closed { color: var(--muted); }

@media (max-width: 640px) {
  .product { grid-template-columns: 1fr; }
  .buy-col { justify-items: stretch; text-align: left; }
  .key-box { flex-direction: column; align-items: stretch; }
}
