*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #050816;
  --bg-card: rgba(16, 24, 40, 0.92);
  --bg-card-soft: rgba(15, 23, 42, 0.85);
  --border-subtle: rgba(148, 163, 184, 0.25);
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.18);
  --accent-strong: #22c55e;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --text-main: #e5e7eb;
  --text-soft: #9ca3af;
  --text-muted: #6b7280;
  --shadow-soft: 0 24px 40px rgba(15, 23, 42, 0.65);
  --radius-lg: 18px;
  --radius-xl: 20px;
  --radius-full: 999px;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at top left, #1e293b 0, #020617 55%, #000 100%);
}

/* Topbar */

.topbar {
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
  background: linear-gradient(to right, rgba(15, 23, 42, 0.95), rgba(3, 7, 18, 0.95));
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.brand-title {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Layout */

.page {
  max-width: 1240px;
  margin: 24px auto 40px;
  padding: 0 16px 32px;
}

.cards-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.85), var(--bg-card-soft));
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow-soft);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.hero-card {
  margin-bottom: 18px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.hero-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}

.hero-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-soft);
}

.hero-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Wallet */

.wallet-balance {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.wallet-balance span:first-child {
  font-size: 22px;
  font-weight: 600;
}

.wallet-balance .unit {
  font-size: 12px;
  color: var(--text-muted);
}

.wallet-meta {
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Text helpers */

.meta-line {
  font-size: 13px;
  margin: 3px 0;
  color: var(--text-soft);
}

.big-number {
  font-size: 26px;
  font-weight: 600;
  margin: 4px 0 8px;
}

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

.small {
  font-size: 12px;
}

.tiny {
  font-size: 11px;
}

/* Fields / buttons */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 12px;
}

.field span {
  color: var(--text-soft);
}

input[type="text"],
input[type="number"] {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 10px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.btn {
  border-radius: var(--radius-full);
  padding: 7px 14px;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn.small {
  padding: 5px 11px;
  font-size: 12px;
}

.btn.fullwidth {
  width: 100%;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  box-shadow: 0 12px 24px rgba(16, 185, 129, 0.35);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(16, 185, 129, 0.4);
}

.btn.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.btn.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.status-message {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

/* Tags */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  background: rgba(31, 41, 55, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.9);
}

/* Referral card */

.referral-link-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.referral-input {
  flex: 1;
  font-size: 12px;
}

.referral-stats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
}

.referral-stats .label {
  color: var(--text-muted);
  display: block;
}

.referral-stats .value {
  font-weight: 500;
}

.referral-qr {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.referral-qr img {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.8);
}

/* Signals card */

.signals-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
}

.signals-grid .label {
  color: var(--text-muted);
}

.signals-grid .value {
  font-weight: 500;
}

/* Withdraw */

.address-line {
  word-break: break-all;
}

#pendingWithdrawalText {
  margin-bottom: 8px;
}

.auth-card {
  max-width: 420px;
  margin: 40px auto 0;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  background: radial-gradient(circle at top, rgba(17, 24, 39, 0.96), rgba(3, 7, 18, 0.98));
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 18px 20px 16px;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-soft);
}

.modal-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}

.modal-text {
  font-size: 13px;
  color: var(--text-soft);
  margin: 4px 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* Utility */

.hidden {
  display: none !important;
}

/* Responsive */

@media (max-width: 640px) {
  .topbar {
    padding: 0 16px;
  }
  .hero-card {
    padding: 18px 16px;
  }
  .page {
    padding: 0 12px 24px;
  }
}



/* Wallet & Security action row + 2FA setup */

.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ga-setup {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  align-items: start;
  margin-top: 8px;
}

.ga-qr {
  display: flex;
  justify-content: center;
  align-items: center;
}

.ga-qr img {
  width: 128px;
  height: 128px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.8);
}

.ga-details input[type="text"] {
  width: 100%;
}

@media (max-width: 520px) {
  .ga-setup {
    grid-template-columns: 1fr;
  }
  .ga-qr img {
    width: 156px;
    height: 156px;
  }
}

/* =========================
   Toast notifications
   ========================= */
#toastContainer{
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 44px));
}
.toast{
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(10,14,24,0.92);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 14px 50px rgba(0,0,0,0.45);
  font-size: 14px;
  line-height: 1.35;
  transform: translateY(-6px);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.toast--show{ opacity: 1; transform: translateY(0); }
.toast--success{ border-color: rgba(34,197,94,0.5); }
.toast--error{ border-color: rgba(239,68,68,0.55); }
.toast--info{ border-color: rgba(59,130,246,0.5); }
