:root {
  --bg: #0f1218;
  --panel: #171c24;
  --accent: #f5a623;
  --text: #f1f1f1;
  --muted: #9aa4b2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Arial", sans-serif;
  background: radial-gradient(circle at top, #1a2230, #0f1218 70%);
  color: var(--text);
  line-height: 1.45;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 14px 36px;
}

.header h1 {
  font-size: 30px;
  margin: 0 0 4px;
}

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

.panel {
  background: var(--panel);
  padding: 16px;
  border-radius: 14px;
  margin-top: 12px;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}

.field span {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

textarea,
select,
input[type="file"],
input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  background: #0f141d;
  border: 1px solid #2a3342;
  color: var(--text);
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 14px;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.primary {
  background: var(--accent);
  color: #1a1a1a;
}

.secondary {
  background: #2a3342;
  color: #fff;
}

.page-nav {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.nav-btn {
  min-height: 40px;
}

.nav-btn.active {
  background: var(--accent);
  color: #191919;
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
}

.step-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.hidden {
  display: none;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

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

.badge {
  border: 1px solid #2a3342;
  border-radius: 999px;
  padding: 7px 11px;
  font-weight: 600;
  color: #ffcf6e;
}

.progress {
  background: #0f141d;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

#progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f5a623, #ffcf6e);
  transition: width 0.3s ease;
}

.errors {
  margin-top: 12px;
  color: #ff8787;
}

.error-item {
  margin-bottom: 8px;
}

.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #2a3342;
  padding: 10px;
  white-space: nowrap;
}

.credit-input {
  width: 110px;
}

.compact-panel {
  padding: 10px;
}

.mini-box {
  border: 1px solid #2a3342;
  border-radius: 10px;
  padding: 8px 10px;
  background: #121822;
  max-width: 360px;
  margin-left: auto;
}

.mini-box summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  user-select: none;
  font-size: 14px;
}

.mini-box summary::-webkit-details-marker {
  display: none;
}

.password-grid {
  margin-top: 10px;
  grid-template-columns: 1fr 1fr auto;
}

.favorite-controls {
  margin: -2px 0 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #232d3d;
  border-radius: 8px;
}

.favorites-list {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.favorite-item {
  background: transparent;
  border: 1px solid #263243;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.favorite-text {
  font-size: 12px;
  line-height: 1.3;
  color: #cfd5dd;
  word-break: break-word;
  flex: 1;
}

.favorite-actions {
  display: inline-flex;
  gap: 6px;
}

.favorite-actions .secondary,
#favoritePromptBtn.secondary {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 7px;
}

.address-box {
  min-height: 42px;
  display: flex;
  align-items: center;
  border: 1px dashed #32415a;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  word-break: break-all;
  background: #0f141d;
}

.payment-qr {
  width: 280px;
  max-width: 100%;
  border: 1px solid #2a3342;
  border-radius: 10px;
  margin-bottom: 10px;
}

#paymentCopyAddressBtn {
  margin-bottom: 10px;
}

.admin-pay-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.approve-credits {
  width: 90px;
}

.single-downloads {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.single-download-link {
  font-size: 12px;
  padding: 8px 10px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(6, 9, 14, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(380px, 100%);
  background: #101722;
  border: 1px solid #2a3342;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4);
  position: relative;
}

.modal-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #f5a623;
  animation: spin 0.8s linear infinite;
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #2a3342;
  background: #0f141d;
  color: #fff;
  cursor: pointer;
}

.modal-preview {
  margin-top: 12px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid #2a3342;
  object-fit: contain;
  max-height: 240px;
}

.modal-downloads {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.modal-help {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.35;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .container {
    max-width: 100%;
    padding: 10px 10px 22px;
  }

  .header h1 {
    font-size: 22px;
  }

  .panel {
    margin-top: 9px;
    padding: 12px;
    border-radius: 11px;
  }

  .status-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .right-actions {
    width: 100%;
    justify-content: space-between;
  }

  .grid,
  .grid-form,
  .password-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .page-nav {
    gap: 6px;
  }

  .page-nav .nav-btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    font-size: 13px;
    padding: 10px 8px;
  }

  .mini-box {
    max-width: 100%;
    margin-left: 0;
  }

  .favorite-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .favorite-actions {
    width: 100%;
  }

  .favorite-actions .secondary {
    width: 100%;
  }

  .admin-pay-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .approve-credits {
    width: 100%;
  }

  .payment-qr {
    width: 100%;
    max-width: 340px;
  }

  .step-actions {
    flex-direction: column;
    gap: 6px;
  }

  textarea,
  select,
  input[type="file"],
  input[type="text"],
  input[type="password"],
  input[type="number"] {
    font-size: 16px;
    min-height: 44px;
  }

  textarea {
    min-height: 132px;
  }

  .primary,
  .secondary {
    width: 100%;
    min-height: 42px;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody tr {
    background: #121926;
    border: 1px solid #2a3342;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
  }

  .table-wrap tbody td {
    border: 0;
    padding: 6px 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    font-size: 13px;
    white-space: normal;
  }

  .table-wrap tbody td::before {
    content: attr(data-label);
    color: #9aa4b2;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .table-wrap tbody td > * {
    max-width: 100%;
  }

  .table-wrap .secondary,
  .table-wrap .primary {
    width: 100%;
  }

  .credit-input,
  .approve-credits {
    width: 100%;
  }

  .modal-card {
    width: min(460px, 100%);
    padding: 16px;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 8px 8px 18px;
  }

  .header h1 {
    font-size: 20px;
  }

  .panel {
    padding: 10px;
    border-radius: 10px;
  }

  .status-row {
    gap: 6px;
  }

  .badge {
    padding: 6px 9px;
    font-size: 12px;
  }

  .right-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .right-actions .secondary {
    width: 100%;
  }

  .mini-box summary {
    font-size: 13px;
  }

  .address-box {
    font-size: 11px;
    padding: 8px;
  }

  .payment-qr {
    width: 100%;
    border-radius: 8px;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    border-radius: 10px;
  }
}
