:root {
  --green: #19c37d;
  --green-light: #55f2a8;
  --green-dark: #0b8f5a;
  --bg: #020504;
  --bg-2: #050b08;
  --surface: rgba(9, 19, 14, 0.78);
  --border: rgba(85, 242, 168, 0.18);
  --border-hover: rgba(85, 242, 168, 0.38);
  --text: #effff6;
  --text-soft: #a8b9b0;
  --text-muted: #687970;
  --danger: #ef4444;
  --warning: #f5c451;
  --radius: 16px;
  --transition: 180ms ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(circle at 15% 5%, rgba(25, 195, 125, .11), transparent 28rem),
    radial-gradient(circle at 85% 22%, rgba(25, 195, 125, .07), transparent 32rem),
    linear-gradient(180deg, #020504 0%, #030806 50%, #020504 100%);
  padding-bottom: 90px;
}

button { font: inherit; border: 0; cursor: pointer; background: none; color: inherit; }
input, select, textarea { font: inherit; }
.hidden { display: none !important; }

.bg-glow { position: fixed; width: 420px; height: 420px; border-radius: 50%; pointer-events: none; filter: blur(100px); opacity: .08; z-index: -2; }
.bg-glow-1 { top: 25%; left: -180px; background: var(--green); }
.bg-glow-2 { top: 65%; right: -180px; background: #00ff88; }

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 14px 20px;
  background: rgba(2, 5, 4, .82);
  border-bottom: 1px solid rgba(85, 242, 168, .08);
  backdrop-filter: blur(22px);
}

.topbar-inner {
  max-width: 700px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; }

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: #00170d;
  background: linear-gradient(135deg, var(--green-light), var(--green));
  box-shadow: 0 0 25px rgba(25, 195, 125, .22);
}

.balance-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 11px;
  background: rgba(25, 195, 125, .08);
  border: 1px solid rgba(85, 242, 168, .14);
  font-size: 12px;
  font-weight: 700;
  color: var(--green-light);
}

main {
  max-width: 700px;
  margin: auto;
  padding: 90px 16px 30px;
}

.page { display: none; }
.page.active { display: block; }

.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 26px; letter-spacing: -.04em; }
.page-header p { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

.filters-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.filters-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .07);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.filter-chip.active {
  color: #00170d;
  background: linear-gradient(135deg, var(--green-light), var(--green));
  border-color: transparent;
}

.products-grid { display: grid; gap: 12px; }

.product-card {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(85, 242, 168, .1);
  background: linear-gradient(145deg, rgba(10, 21, 15, .88), rgba(4, 10, 7, .82));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.product-info h3 { font-size: 15px; letter-spacing: -.02em; }
.product-info p { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.product-info .stock { color: var(--green-light); font-size: 10px; margin-top: 6px; font-weight: 700; }

.product-right { text-align: right; }
.product-price { font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.product-buy {
  margin-top: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  color: #00170d;
  background: linear-gradient(135deg, var(--green-light), var(--green));
  font-size: 11px;
  font-weight: 800;
}

.wallet-balance {
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid rgba(85, 242, 168, .14);
  background: rgba(25, 195, 125, .04);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wallet-balance span { color: var(--text-muted); font-size: 12px; font-weight: 700; }
.wallet-balance strong { color: var(--green-light); font-size: 24px; }

.crypto-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.crypto-method {
  padding: 14px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .07);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  transition: var(--transition);
}

.crypto-method.selected {
  background: rgba(25, 195, 125, .12);
  border-color: var(--green);
  color: var(--green-light);
}

.amount-input { margin-bottom: 20px; }
.amount-input label { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

.amount-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .08);
  margin-top: 8px;
}

.amount-row span { color: var(--green-light); font-size: 20px; font-weight: 800; }
.amount-row input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font-size: 20px; font-weight: 800; }

.amount-presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.amount-presets button {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .07);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.btn-primary {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  color: #00170d;
  background: linear-gradient(135deg, var(--green-light), var(--green));
  font-size: 13px;
  font-weight: 800;
}

.btn-secondary {
  padding: 13px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.orders-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab {
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .07);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}
.tab.active { color: #00170d; background: linear-gradient(135deg, var(--green-light), var(--green)); border-color: transparent; }

.orders-list { display: flex; flex-direction: column; gap: 10px; }

.order-item {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(85, 242, 168, .1);
  background: linear-gradient(145deg, rgba(10, 21, 15, .88), rgba(4, 10, 7, .82));
  cursor: pointer;
}

.order-item-header { display: flex; justify-content: space-between; align-items: center; }
.order-item-header strong { font-size: 13px; }
.order-item-id { color: var(--text-muted); font-size: 10px; font-family: monospace; }
.order-item-meta { color: var(--text-muted); font-size: 11px; margin-top: 6px; }

.order-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 8px;
}

.order-status.attente { background: rgba(245, 196, 81, .12); color: var(--warning); }
.order-status.credite { background: rgba(25, 195, 125, .12); color: var(--green-light); }

.profile-card {
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid rgba(85, 242, 168, .14);
  background: linear-gradient(145deg, rgba(10, 21, 15, .88), rgba(4, 10, 7, .82));
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.avatar {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-light), var(--green));
  color: #00170d;
  font-size: 22px;
  font-weight: 800;
}

.profile-info strong { font-size: 15px; }
.profile-info span { display: block; color: var(--text-muted); font-size: 11px; margin-top: 3px; }

.profile-actions { display: flex; gap: 10px; }

.admin-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tab {
  flex-shrink: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .07);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.admin-tab.active { color: #00170d; background: linear-gradient(135deg, var(--green-light), var(--green)); border-color: transparent; }

.admin-row {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(85, 242, 168, .1);
  background: rgba(255, 255, 255, .02);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.admin-row-info { flex: 1; min-width: 0; }
.admin-row-info strong { display: block; font-size: 13px; }
.admin-row-info small { color: var(--text-muted); font-size: 10px; }

.admin-input {
  width: 80px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.admin-btn {
  padding: 8px 12px;
  border-radius: 8px;
  color: #00170d;
  background: linear-gradient(135deg, var(--green-light), var(--green));
  font-size: 11px;
  font-weight: 800;
}

.admin-btn.danger {
  background: rgba(239, 68, 68, .15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, .3);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .74); backdrop-filter: blur(12px); }
.modal-card {
  position: relative;
  z-index: 1;
  width: min(450px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border: 1px solid rgba(85, 242, 168, .18);
  border-radius: 22px;
  background: #07100b;
  box-shadow: 0 35px 100px rgba(0, 0, 0, .6);
}
.modal-card h2 { font-size: 20px; letter-spacing: -.03em; margin-bottom: 8px; }
.modal-card p { color: var(--text-muted); font-size: 12px; line-height: 1.6; margin-bottom: 14px; }

.modal-price {
  padding: 16px;
  border-radius: 12px;
  background: rgba(25, 195, 125, .05);
  border: 1px solid rgba(85, 242, 168, .14);
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-price span { color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.modal-price strong { color: var(--green-light); font-size: 22px; }

.address-box {
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .4);
  border: 1px solid rgba(85, 242, 168, .14);
  margin-bottom: 14px;
}
.address-box code {
  display: block;
  font-family: monospace;
  font-size: 11px;
  color: var(--green-light);
  word-break: break-all;
  line-height: 1.5;
  margin-bottom: 10px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, .05);
  color: var(--text-muted);
  font-size: 20px;
}

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  background: rgba(2, 5, 4, .92);
  border-top: 1px solid rgba(85, 242, 168, .08);
  backdrop-filter: blur(22px);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  transition: var(--transition);
}

.nav-item span { font-size: 18px; }
.nav-item small { font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }

.nav-item.active { color: var(--green-light); background: rgba(25, 195, 125, .07); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%) translateY(20px);
  z-index: 1000;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(7, 16, 11, .96);
  border: 1px solid rgba(85, 242, 168, .24);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: .3s ease;
  box-shadow: 0 15px 50px rgba(0, 0, 0, .5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-icon { color: var(--green-light); font-weight: 800; }

.loading-card {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
.loading-spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 14px;
  border: 2px solid rgba(85, 242, 168, .15);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stock-low { color: var(--warning) !important; }
.stock-out { color: var(--danger) !important; }
