* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #eef3fb;
  color: #1a2333;
}

.container {
  width: min(1200px, 94vw);
  margin: 0 auto;
}

.topbar {
  background: #f8fbff;
  border-bottom: 1px solid #d7e3f6;
}

.topbar-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  text-decoration: none;
  color: #285f9e;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.35px;
  white-space: nowrap;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: fill;
  display: block;
  flex-shrink: 0;
}

.brand-divider {
  width: 1px;
  height: 34px;
  background: #b8c9e4;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 7px;
  line-height: 1.08;
  text-transform: uppercase;
  color: #2f5f9a;
}

.brand-text span {
  display: block;
}

.search-form {
  flex: 1;
  display: flex;
  min-width: 220px;
}

.search-form input {
  flex: 1;
  height: 42px;
  border: 1px solid #ccdbf1;
  border-right: 0;
  border-radius: 4px 0 0 4px;
  padding: 0 12px;
  font-size: 15px;
}

.search-form button {
  height: 42px;
  border: 1px solid #c6d6ed;
  border-radius: 0 4px 4px 0;
  background: #fff;
  padding: 0 16px;
  cursor: pointer;
}

.auth-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.auth-nav a {
  color: #1d2d45;
  text-decoration: none;
}

.outlined-btn-link,
.outlined-btn {
  border: 1px solid #9fb5d7;
  border-radius: 4px;
  background: #fff;
  color: #1d2d45;
  text-decoration: none;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

.link-plain {
  color: #4777b4;
}

.inline-form {
  margin: 0;
}

.menubar {
  background: #2f6cae;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.menubar-inner {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.menu-item {
  color: #dce9f8;
  text-decoration: none;
  font-size: 14px;
}

.menu-item.active,
.menu-item:hover {
  color: #fff;
}

.content {
  padding: 24px 0 52px;
}

.flash {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.flash.success {
  background: #d9f8df;
  color: #155b2f;
}

.flash.error {
  background: #ffd9d9;
  color: #6b1f1f;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-head h1 {
  margin: 0;
  font-size: 22px;
}

.section-link {
  color: #2f6cae;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 600;
}

.lead {
  margin: 0 0 4px;
  color: #4a5e80;
  font-size: 15px;
}

.muted,
.meta {
  color: #5c6780;
}

.grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #d6e2f4;
  box-shadow: 0 6px 18px rgba(45, 70, 112, 0.08);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 20px;
}

/* —— Product cards (catalog) —— */

.product-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  border: 0;
  box-shadow: 0 10px 28px rgba(30, 55, 95, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(30, 55, 95, 0.24);
}

.product-card-link {
  display: block;
  height: 100%;
  position: relative;
  text-decoration: none;
  color: #fff;
}

.product-card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  padding: 14px;
  background: linear-gradient(
    180deg,
    rgba(12, 22, 42, 0) 30%,
    rgba(12, 22, 42, 0.45) 62%,
    rgba(8, 16, 32, 0.92) 100%
  );
}

.product-card-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 600;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.product-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.platform-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(47, 108, 174, 0.85);
  color: #fff;
}

.platform-badge--light {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px);
}

.platform-badge--table {
  background: #e8f0fb;
  color: #2f5f9a;
  font-size: 11px;
}

.price-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  font-weight: 700;
  line-height: 1;
}

.price-amount {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.price-currency {
  font-size: 0.85rem;
  opacity: 0.9;
  font-weight: 600;
}

.price-tag--large {
  background: linear-gradient(135deg, #2f6cae, #3a7fc4);
  border: 0;
  color: #fff;
  padding: 8px 16px;
  box-shadow: 0 4px 14px rgba(47, 108, 174, 0.35);
}

.price-tag--large .price-amount {
  font-size: 1.75rem;
}

.price-tag--compact {
  background: #e8f0fb;
  border: 1px solid #c9daf2;
  color: #1a3d6b;
  backdrop-filter: none;
}

.price-tag--compact .price-amount {
  font-size: 1rem;
}

.stock-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

.stock-hint--out {
  color: #ffb4b4;
}

.single {
  padding: 18px;
  margin-bottom: 18px;
}

.narrow {
  max-width: 470px;
}

/* —— Product detail page —— */

.product-page.card {
  box-shadow: none;
  display: grid;
  grid-template-columns: minmax(0, 35%) minmax(0, 65%);
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.product-page--solo {
  grid-template-columns: 1fr;
}

.product-page-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-banner {
  background: #1a2a44;
  border-bottom: 1px solid #e7eef9;
}

.product-banner img {
  width: 100%;
  display: block;
  aspect-ratio: 460 / 215;
  object-fit: cover;
}

.product-page-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-page-body h1 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.25;
}

.product-detail-desc {
  margin: 2px 0 6px;
  font-size: 16px;
  line-height: 1.55;
  color: #3a4a62;
}

.product-purchase {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 14px;
  margin-top: 6px;
  border-top: 1px solid #e7eef9;
}

.product-page .price-tag--large {
  box-shadow: none;
}

.product-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-left: 1px solid #e7eef9;
  background: #f8fbff;
  min-width: 0;
  align-self: stretch;
  min-height: 100%;
}

.gallery-preview {
  flex: 1 1 auto;
  min-height: 240px;
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #d6e2f4;
  background: #dfe7f5;
}

.gallery-preview-link {
  display: block;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.gallery-preview img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.gallery-thumbs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.gallery-thumb {
  flex: 0 0 132px;
  width: 132px;
  height: 74px;
  padding: 0;
  border: 2px solid #d6e2f4;
  border-radius: 6px;
  overflow: hidden;
  background: #dfe7f5;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb:hover {
  border-color: #9fb5d7;
}

.gallery-thumb.is-active {
  border-color: #2f6cae;
}

.price-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.price-block-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5c6780;
  font-weight: 600;
}

.stock-meta {
  margin: 0;
  font-size: 14px;
  color: #3d7a52;
}

.stock-meta--out {
  color: #9a3a3a;
}

.auth-hint {
  margin: 0;
}

.auth-hint a {
  color: #2f6cae;
}

.btn-buy {
  align-self: flex-start;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
}

.btn {
  border: 0;
  border-radius: 8px;
  background: #2f6cae;
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: #285f9e;
}

.btn-small {
  padding: 7px 12px;
  font-size: 14px;
}

.balance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.payment-methods {
  border: 1px solid #d5e3f7;
  border-radius: 4px;
  padding: 12px;
  margin: 0;
}

.payment-methods legend {
  padding: 0 4px;
  font-size: 14px;
  color: #4a5e80;
}

.payment-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}

.payment-option:last-child {
  margin-bottom: 0;
}

.payment-option input {
  margin: 0;
}

.invoice-card {
  max-width: 760px;
}

.invoice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.invoice-head h1 {
  margin: 0;
  font-size: 22px;
}

.invoice-status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  text-transform: uppercase;
  background: #e8eef8;
  color: #3a4f73;
}

.invoice-status.pending {
  background: #fff4d8;
  color: #8a6400;
}

.invoice-status.success {
  background: #dff6e5;
  color: #1f6a35;
}

.invoice-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 20px;
  align-items: start;
}

.invoice-details p {
  margin: 0 0 10px;
}

.invoice-hint {
  margin-top: 12px;
}

.invoice-qr {
  text-align: center;
  padding: 12px;
  border: 1px solid #d8e5f7;
  border-radius: 6px;
  background: #f8fbff;
}

.invoice-qr img {
  width: 220px;
  height: 220px;
  display: block;
  margin: 0 auto 8px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form input,
.form textarea {
  width: 100%;
  margin-top: 4px;
  border: 1px solid #c7d6ee;
  border-radius: 4px;
  padding: 10px 11px;
  font: inherit;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
}

.checkbox input {
  width: auto;
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  background: #fff;
  border: 1px solid #d8e4f6;
}

th,
td {
  padding: 10px;
  font-size: 14px;
  border-bottom: 1px solid #e7eef9;
  text-align: left;
}

/* —— Admin —— */

.admin-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-toolbar h1,
.admin-form-card h1 {
  margin: 0;
  font-size: 24px;
}

.admin-subtitle {
  margin: 6px 0 0;
  color: #5c6780;
  font-size: 14px;
}

.admin-table-wrap {
  padding: 0;
  overflow: hidden;
}

.admin-table-title {
  margin: 0;
  padding: 16px 18px 0;
  font-size: 17px;
}

.admin-table {
  margin: 0;
  border: 0;
}

.admin-table th {
  background: #f0f5fc;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4a5e80;
  font-weight: 600;
  padding: 12px 14px;
}

.admin-table td {
  padding: 12px 14px;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: #f8fbff;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-form-card {
  max-width: 560px;
  padding: 22px 24px;
}

.admin-form-card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.admin-form label {
  font-size: 14px;
  font-weight: 500;
  color: #3a4a62;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge--active {
  background: #dff6e5;
  color: #1f6a35;
}

.status-badge--hidden {
  background: #eef2f8;
  color: #5c6780;
}

.mono {
  font-variant-numeric: tabular-nums;
  color: #5c6780;
}

.key-code {
  font-size: 13px;
  background: #f0f5fc;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #d8e5f7;
}

.admin-thumb {
  width: 72px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #d9e6f7;
}

.image-preview {
  margin-bottom: 14px;
}

.image-preview img {
  width: 100%;
  max-width: 320px;
  border-radius: 4px;
  border: 1px solid #d9e6f7;
}

.actions {
  display: flex;
  gap: 10px;
}

.actions a {
  text-decoration: none;
  color: #2f6cae;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.between {
  justify-content: space-between;
}

.footer {
  border-top: 1px solid #d7e3f6;
  background: #f8fbff;
  color: #5b6680;
  padding: 18px 0;
}

@media (max-width: 950px) {
  .topbar-inner {
    flex-wrap: wrap;
    padding: 10px 0;
  }

  .search-form {
    order: 3;
    width: 100%;
  }

  .product-page.card {
    grid-template-columns: 1fr;
  }

  .product-gallery {
    border-left: 0;
    border-top: 1px solid #e7eef9;
  }

  .gallery-preview {
    min-height: 200px;
  }

  .gallery-thumb {
    flex: 0 0 112px;
    width: 112px;
    height: 63px;
  }

  .invoice-grid {
    grid-template-columns: 1fr;
  }
}
