:root {
  color-scheme: dark;
  --bg: #0f1114;
  --surface: #181b20;
  --surface-2: #20242b;
  --surface-3: #272d35;
  --line: #353b45;
  --text: #f4efe7;
  --muted: #aaa39a;
  --gold: #d8b25c;
  --red: #b9463d;
  --red-2: #d7584e;
  --green: #5fbf82;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(185, 70, 61, 0.16), transparent 34%),
    linear-gradient(180deg, #15181d 0%, var(--bg) 56%, #0b0d10 100%);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

button,
a {
  font: inherit;
}

.app-shell,
.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.shell.narrow {
  width: min(780px, calc(100% - 32px));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.shop-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: 14px;
  background: rgba(15, 17, 20, 0.92);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 42px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.steam-id {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.steam-id span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.steam-id strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.steam-button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: var(--red);
  color: white;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.steam-button:hover,
button:hover {
  background: var(--red-2);
}

button.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.admin-link,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.admin-link:hover,
.ghost-link:hover {
  border-color: rgba(216, 178, 92, 0.72);
  background: rgba(255, 255, 255, 0.05);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.status-card {
  min-height: 86px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.status-card.ready {
  border-color: rgba(95, 191, 130, 0.52);
  background: rgba(95, 191, 130, 0.09);
}

.status-card.danger {
  border-color: rgba(185, 70, 61, 0.72);
  background: rgba(185, 70, 61, 0.12);
}

.status-card strong,
.status-card span {
  display: block;
}

.status-card span {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.shop-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.category-rail {
  position: sticky;
  top: 102px;
  display: grid;
  gap: 10px;
}

.category-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.category-link:hover,
.category-link.active {
  border-color: rgba(216, 178, 92, 0.72);
  background: var(--surface-2);
}

.category-link span {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.category-link strong {
  grid-column: 1;
}

.category-link em {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  min-width: 32px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-style: normal;
  text-align: center;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(216, 178, 92, 0.10), rgba(185, 70, 61, 0.08)), var(--surface);
}

.section-head p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.section-head > span {
  align-self: start;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.product {
  display: flex;
  min-height: 264px;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.product.configured {
  border-color: rgba(95, 191, 130, 0.28);
}

.product.needs-config {
  background: var(--surface-2);
}

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

.product-head span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(216, 178, 92, 0.15);
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.product-head strong {
  font-size: 19px;
}

.product p {
  color: var(--muted);
  line-height: 1.45;
}

.product-meta {
  display: grid;
  gap: 5px;
  margin-top: auto;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.product-meta span:first-child {
  color: var(--text);
  font-weight: 800;
}

.product button {
  width: 100%;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--gold);
  font-weight: 800;
  text-decoration: none;
}

.checkout {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.lead {
  color: var(--muted);
  line-height: 1.55;
}

.checkout form {
  margin-top: 18px;
}

dl {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}

dl div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

pre {
  overflow-x: auto;
  padding: 14px;
  border: 1px solid var(--line);
  background: #0c0d0f;
  color: #eadfc9;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}

.payment-box {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.payment-box h2 {
  margin-bottom: 6px;
}

.payment-box p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.payment-status {
  min-height: 22px;
  color: var(--gold);
  font-weight: 800;
}

.local-test-form {
  padding-top: 4px;
}

.server-select {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.server-select label {
  display: grid;
  gap: 6px;
}

.server-select span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.server-select p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.command-list {
  display: grid;
  gap: 10px;
}

.delivery-summary {
  display: grid;
  gap: 10px;
}

.delivery-state {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.delivery-state strong {
  font-size: 18px;
}

.delivery-state span {
  color: var(--muted);
  line-height: 1.4;
}

.delivery-state.delivered {
  border-color: rgba(95, 191, 130, 0.7);
}

.delivery-state.failed {
  border-color: rgba(185, 70, 61, 0.8);
}

.command-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.command-row.delivered {
  border-color: rgba(95, 191, 130, 0.7);
}

.command-row.failed {
  border-color: rgba(185, 70, 61, 0.8);
}

.command-row code {
  overflow-wrap: anywhere;
  color: #eadfc9;
}

.command-row span {
  color: var(--muted);
}

.admin-shell .topbar {
  margin-bottom: 22px;
}

.admin-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-stats .status-card strong {
  font-size: 28px;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 180px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-filters.webhook-filters {
  grid-template-columns: minmax(260px, 1fr) 180px auto;
}

.admin-filters label {
  display: grid;
  gap: 6px;
}

.admin-filters span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-actionbar {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 16px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c0d0f;
  color: var(--text);
  font: inherit;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: 140px minmax(220px, 1.2fr) 150px minmax(170px, 0.75fr) minmax(160px, 0.8fr) 82px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-row.vip-row {
  grid-template-columns: 150px minmax(220px, 1.2fr) 150px minmax(170px, 0.75fr) minmax(130px, 0.55fr) 82px;
}

.admin-row.webhook-row {
  grid-template-columns: 150px minmax(230px, 1fr) 130px 130px minmax(140px, 0.75fr) minmax(220px, 1fr);
}

.admin-head {
  min-height: 44px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-row strong,
.admin-row em {
  display: block;
}

.admin-row em {
  margin-top: 3px;
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.admin-row code {
  overflow-wrap: anywhere;
  color: #eadfc9;
}

.badge {
  display: inline-flex;
  margin: 2px 4px 2px 0;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.delivered {
  border-color: rgba(95, 191, 130, 0.7);
  color: var(--green);
}

.badge.active {
  border-color: rgba(95, 191, 130, 0.7);
  color: var(--green);
}

.badge.expired {
  border-color: rgba(185, 70, 61, 0.85);
  color: var(--red-2);
}

.badge.failed {
  border-color: rgba(185, 70, 61, 0.85);
  color: var(--red-2);
}

.badge.pending {
  border-color: rgba(216, 178, 92, 0.72);
  color: var(--gold);
}

.badge.muted {
  color: var(--muted);
}

.admin-detail {
  width: min(980px, calc(100% - 32px));
}

.admin-command {
  grid-template-columns: 180px minmax(0, 1fr) minmax(120px, 0.45fr) auto;
  align-items: center;
}

.admin-command form {
  margin: 0;
}

.admin-command button {
  min-height: 36px;
  white-space: nowrap;
}

.pending-note {
  justify-self: end;
}

@media (max-width: 1040px) {
  .shop-layout {
    grid-template-columns: 1fr;
  }

  .category-rail {
    position: static;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    overflow-x: auto;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar,
  .account,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 34px;
  }

  .status-grid,
  .product-grid {
    grid-template-columns: 1fr;
  }

  .admin-stats,
  .admin-filters,
  .admin-row,
  .admin-command {
    grid-template-columns: 1fr;
  }

  .category-rail {
    grid-template-columns: 1fr;
  }

  dl div {
    grid-template-columns: 1fr;
  }
}
