:root {
  --bg: #0b0c10;
  --panel: #15171e;
  --panel-2: #1c1f29;
  --border: #2a2e3a;
  --text: #e8eaf0;
  --muted: #9aa0ad;
  --accent: #6d6bff;
  --accent-2: #00d4a8;
  --warn-bg: #3a2a12;
  --warn-border: #b4791f;
  --danger: #ff5d6c;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1a1c26 0%, var(--bg) 60%);
  color: var(--text);
  line-height: 1.55;
}

.wrap { width: min(960px, 92%); margin: 0 auto; }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--border); padding: 18px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.brand span { color: var(--accent); }
.site-header nav a, .site-footer a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }
.site-footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 28px 0; color: var(--muted); font-size: 14px; }

/* Hero */
.hero { padding: 56px 0 28px; text-align: center; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); margin: 0 0 12px; }
.hero p { color: var(--muted); max-width: 620px; margin: 0 auto; font-size: 18px; }

/* Product cards */
.products { display: grid; gap: 18px; padding-top: 16px; }
.loading { color: var(--muted); text-align: center; }

.product {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.product > summary {
  list-style: none;
  cursor: pointer;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.product > summary::-webkit-details-marker { display: none; }
.product-head h2 { margin: 0 0 4px; font-size: 22px; }
.product-head p { margin: 0; color: var(--muted); }
.summary-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.from-price { text-align: right; font-size: 14px; color: var(--muted); }
.from-price b { display: block; color: var(--text); font-size: 18px; }
.chevron { transition: transform .2s ease; color: var(--muted); }
.product[open] .chevron { transform: rotate(180deg); }

/* Tiers */
.tiers { border-top: 1px solid var(--border); padding: 8px; display: grid; gap: 8px; }
.tier {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.tier.out-of-stock {
  opacity: 0.55;
  background: var(--panel-2);
}
.tier-info h3 { margin: 0 0 2px; font-size: 16px; }
.tier-info p { margin: 0; color: var(--muted); font-size: 14px; }
.tier-buy { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.tier-price { font-weight: 700; font-size: 18px; }

.btn {
  border: 0; border-radius: 9px; padding: 10px 18px;
  font-weight: 700; font-size: 15px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #514fe0);
  color: #fff; transition: transform .05s ease, opacity .2s ease;
  white-space: nowrap;
}
.btn:hover { opacity: .92; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: progress; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); padding: 12px 18px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 90%;
}
.toast.error { border-color: var(--danger); }

/* ---------- Admin ---------- */
.admin-main { padding: 32px 0 64px; }
.admin-login { max-width: 360px; margin: 80px auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.admin-login h1 { margin: 0 0 16px; font-size: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; color: var(--muted); }
.field input {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 11px 12px; font-size: 15px;
}
.full { width: 100%; }
.error-text { color: var(--danger); font-size: 14px; min-height: 18px; }

.stock-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stock-table th, .stock-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.stock-table th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.stock-table tr:last-child td { border-bottom: 0; }
.product-group td { background: var(--panel-2); font-weight: 800; font-size: 15px; }
.remaining { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Low stock + out of stock highlighting */
tr.low td { background: var(--warn-bg); }
tr.low .remaining { color: #ffcf6b; }
tr.out td { background: #3a1518; }
tr.out .remaining { color: var(--danger); }

.restock { display: flex; align-items: center; gap: 8px; }
.restock input[type="file"] { display: none; }
.restock .file-btn { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 7px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.restock .file-btn:hover { border-color: var(--accent); }
.restock-status { font-size: 13px; color: var(--muted); min-width: 90px; }
.restock-status.ok { color: var(--accent-2); }
.restock-status.err { color: var(--danger); }

/* Paste-keys modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-overlay[hidden] { display: none; }
.modal { width: min(560px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-x { background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-x:hover { color: var(--text); }
.paste-area { width: 100%; resize: vertical; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 12px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 14px; line-height: 1.5; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; }
.modal-actions .restock-status { margin-right: auto; }

/* Keys modal tabs and list */
.keys-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin: 0 -22px 14px -22px; padding: 0 22px 12px; }
.keys-tab { background: none; border: 0; color: var(--muted); padding: 8px 12px; cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent; transition: color .2s ease; }
.keys-tab:hover { color: var(--text); }
.keys-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.keys-list { max-height: 300px; overflow-y: auto; }
.keys-list ul { list-style: none; padding: 0; margin: 0; }
.keys-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.keys-list li:last-child { border-bottom: 0; }
.keys-list code { background: var(--panel-2); padding: 4px 8px; border-radius: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; }

.admin-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.admin-bar h1 { margin: 0; font-size: 24px; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 20px; }

/* Success page */
.success-page { padding: 60px 0; text-align: center; }
.success-card { max-width: 500px; margin: 0 auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 32px; }
.success-icon { font-size: 56px; margin-bottom: 16px; color: var(--accent-2); }
.success-card h1 { margin: 0 0 8px; font-size: 28px; color: var(--text); }
.success-detail { margin: 0 0 28px; color: var(--muted); font-size: 16px; }
.details-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin: 20px 0; text-align: left; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; }
.detail-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.detail-label { color: var(--muted); font-size: 14px; }
.detail-value { font-weight: 600; color: var(--text); }
.success-instruction { background: rgba(109, 107, 255, .1); border: 1px solid var(--accent); border-radius: 10px; padding: 16px; margin: 24px 0; text-align: left; }
.success-instruction p { margin: 8px 0; font-size: 14px; }
.success-instruction a { color: var(--accent); text-decoration: none; }
.success-instruction a:hover { text-decoration: underline; }
.success-card .btn { margin-top: 24px; }

.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }
