:root{
  --bg: #0b1020;
  --card: rgba(255,255,255,.06);
  --card2: rgba(255,255,255,.08);
  --text: #e8ecff;
  --muted: rgba(232,236,255,.72);
  --border: rgba(255,255,255,.12);
  --shadow: 0 16px 50px rgba(0,0,0,.45);
  --primary: #6f5eee;
  --primary2: #8b7dff;
  --danger: #ff6b7a;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

*{ box-sizing: border-box; }
html, body{ height:100%; }

/* Cuộn vẫn hoạt động; ẩn thanh cuộn (gọn trong Mini App / Telegram). */
html{
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar{
  width: 0;
  height: 0;
}

body{
  margin:0;
  font-family: var(--sans);
  background: radial-gradient(1200px 700px at 20% 0%, rgba(111,94,238,.18), transparent 60%),
              radial-gradient(900px 600px at 90% 20%, rgba(255,107,122,.12), transparent 60%),
              var(--bg);
  color: var(--text);
  overflow-x: clip;
  max-width: 100%;
}

.app{
  min-height: 100vh;
  display:flex;
  flex-direction:column;
  overflow-x: clip;
  max-width: 100%;
}

.topbar{
  padding: 14px 14px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  position: sticky;
  top:0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(11,16,32,.92), rgba(11,16,32,.72));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.topbar__left{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar__right{
  flex: 0 0 auto;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
  flex: 1 1 auto;
}

.backBtn{
  display:none;
  align-items:center;
  gap: 6px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.12);
  color: var(--text);
  cursor:pointer;
  font-weight: 900;
}
.backBtn__icon{ font-size: 16px; line-height: 1; }
.backBtn__label{ font-size: 13px; opacity:.9; }
.backBtn.is-visible{ display:inline-flex; }

/* Back button is inside product page header */
.panel__header .backBtn{
  margin-bottom: 8px;
}
.panel__header .backBtn__label{
  display:inline;
  font-size: 12px;
  opacity: .9;
}

/* Detail page */
.detailPageCard{ margin-top: 12px; }
.brand__logo{
  width:42px; height:42px; border-radius: 14px;
  display:grid; place-items:center;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 10px 30px rgba(111,94,238,.25);
  overflow:hidden;
}
.brand__avatar{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.brand__avatarFallback{
  display:block;
}
.brand__text{
  min-width: 0;
  flex: 1 1 auto;
}
.brand__name{
  font-weight: 900;
  letter-spacing: .2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand__sub{
  color: var(--muted);
  font-size: 12px;
  margin-top:2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  flex-wrap: nowrap;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
}
.chip__label{ color: var(--muted); font-size: 11px; white-space: nowrap; }
.chip__value{ font-weight: 900; font-size: 12px; white-space: nowrap; }

.main{
  flex:1 0 auto;
  width: min(980px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 14px 14px 88px;
  box-sizing: border-box;
  overflow-x: clip;
  /* Opaque fill: body has a purple radial; transparent main + flex growth showed that tint below short pages (e.g. Nạp tiền). */
  background-color: var(--bg);
}

.is-hidden{ display:none !important; }

.panel{ display:none; margin-top: 14px; }
.panel--active{ display:block; }

.panel__header{ margin: 6px 2px 12px; }
.h2{ margin:0 0 4px; font-size: 18px; }
.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.mono{ font-family: var(--mono); }

.searchRow{
  display:flex; gap:10px;
  margin: 10px 0 12px;
}

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

.product{
  grid-column: span 12;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.04));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display:flex;
  gap: 12px;
}
.product__img{
  width: 64px; height: 64px;
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  display:grid;
  place-items:center;
  font-weight: 900;
  overflow:hidden;
}
.product__thumb{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.product__body{ flex:1 1 auto; min-width:0; }
.product__name{ font-weight: 900; margin: 0 0 4px; }
.product__desc{ margin:0; color: var(--muted); font-size: 13px; }
.product__actions{ display:flex; align-items:center; }

.card{
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 100%;
  min-width: 0;
}

/* Product detail hero */
.productHero__top{
  display:flex;
  gap: 12px;
  align-items:flex-start;
  flex-wrap: wrap;
}
.productHero__imgWrap{
  width: 96px;
  height: 96px;
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  flex: 0 0 auto;
}
.productHero__imgWrap img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}
.productHero__info{ flex: 1 1 260px; min-width:0; }
.productHero__desc{
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.productHero__longDesc{
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.bankCard{ margin-top: 12px; }
.bankKV{ display:grid; gap:10px; }
.label{ display:block; font-weight: 800; margin-bottom: 8px; }
.hint{ color: var(--muted); font-size: 12px; margin-top: 8px; }

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

.input{
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  outline:none;
}
select.input{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: rgba(255,255,255,.06);
  color: var(--text);
}
select.input option,
select.input optgroup{
  background: #0b1020;
  color: #e8ecff;
}
select.input:disabled{
  opacity: .7;
}
textarea.input{
  flex: 1 1 100%;
  resize: vertical;
  min-height: 96px;
  line-height: 1.4;
}
.input:focus{
  border-color: rgba(111,94,238,.7);
  box-shadow: 0 0 0 4px rgba(111,94,238,.14);
}

.btn{
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor:pointer;
  font-weight: 800;
}
.btn--ghost{ background: transparent; }
.btn--primary{
  border-color: rgba(111,94,238,.5);
  background: linear-gradient(135deg, var(--primary), var(--primary2));
}
.btn:active{ transform: translateY(1px); }

/* Avoid primary button stretching full row width (looked like a purple band behind content). */
.row > .btn{
  flex: 0 0 auto;
}

.adminMenu{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}
.adminMenu__btn{
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 900;
  flex: 0 0 auto;
}
.adminMenu__btn--active{
  border-color: rgba(111,94,238,.5);
  background: rgba(111,94,238,.18);
  color: var(--text);
}
.adminSec{ display:none; }
.adminSec--active{ display:block; }

.kv{
  display:flex; justify-content:space-between; gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(0,0,0,.08);
}
.kv .k{ color: var(--muted); }
.kv .v{
  font-weight: 900;
  text-align:right;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Bottom nav */
.bottomNav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(11,16,32,.96), rgba(11,16,32,.7));
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 50;
}
.bottomNav{
  display:flex;
  gap: 12px;
  justify-content:center;
  align-items:center;
}
.bottomNav__btn{
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--muted);
  cursor:pointer;
  font-weight: 900;
}
.bottomNav__btn--active{
  color: var(--text);
  border-color: rgba(111,94,238,.45);
  background: rgba(111,94,238,.18);
}
.bottomNav__img{
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
  opacity: .5;
  filter: brightness(0) invert(1);
  pointer-events: none;
}
.bottomNav__btn--active .bottomNav__img{
  opacity: 1;
  filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(139,124,255,.45));
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  display:none;
  z-index: 100;
}
.modal[aria-hidden="false"]{ display:block; }
.modal__backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.78);
}
.modal__dialog{
  position: relative;
  margin: 16px auto;
  width: min(980px, calc(100% - 24px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(11,16,32,.92), rgba(11,16,32,.82));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal__header{
  flex: 0 0 auto;
  padding: 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  background: linear-gradient(135deg, rgba(111,94,238,.45), rgba(111,94,238,.18));
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.modal__title{ font-weight: 900; }
.iconBtn{
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.12);
  color: var(--text);
  cursor:pointer;
  font-weight: 900;
}
.modal__body{
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.modal__body::-webkit-scrollbar{
  width: 0;
  height: 0;
}
.modalGrid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items:start;
}

/* Improve readability on modal right column */
.modalRight{
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.38);
}
.modalRight .kv{
  background: rgba(0,0,0,.48);
  border-color: rgba(255,255,255,.18);
}
.modalRight .muted{
  color: rgba(232,236,255,.82);
}
.qrBox{
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0,0,0,.12);
  text-align:center;
}
.qrBox img{
  width: min(320px, 70vw);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
}

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

/* Variant picker */
.variantList{
  margin-top: 12px;
  display:grid;
  gap: 10px;
}
.variantRow{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
}
.variantThumb{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  display:grid;
  place-items:center;
  font-weight: 900;
  flex: 0 0 auto;
}
.variantThumb__img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.variantRow__left{ min-width:0; }
.variantRow__title{
  font-weight: 900;
  margin-bottom: 2px;
  font-size: 14px;
  line-height: 1.25;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.variantRow__price{
  font-weight: 900;
  margin-top: 4px;
  white-space: nowrap;
}
.variantRow__meta{
  color: var(--muted);
  font-size: 12px;
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}
.badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.10);
  font-weight: 800;
  font-size: 12px;
}
.badge--brand{
  border-color: rgba(111,94,238,.35);
  background: rgba(111,94,238,.14);
  color: var(--text);
}
.badge--stock{
  border-color: rgba(245,199,106,.35);
  background: rgba(245,199,106,.12);
  color: #ffd58a;
}
.variantRow__right{
  display:flex;
  align-items:center;
  gap: 10px;
  flex: 0 0 auto;
}
.variantBtn{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(111,94,238,.5);
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: var(--text);
  font-weight: 900;
  cursor:pointer;
}
.variantBtn:active{ transform: translateY(1px); }

/* Variant detail */
.detailCard{ margin-top: 12px; }
.detailTop{
  display:flex;
  gap: 12px;
  align-items:flex-start;
  flex-wrap: wrap;
}
.detailImgWrap{
  width: 96px;
  height: 96px;
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  flex: 0 0 auto;
}
.detailImgWrap--full{
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}
.detailImgWrap img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.detailInfo{ flex: 1 1 260px; min-width: 0; }
.detailTitle{ font-weight: 900; font-size: 16px; }
.detailDesc{
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.detailMedia{ margin-top: 12px; }
.item{
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.item__top{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  align-items:baseline;
}
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.10);
  font-weight: 900;
  font-size: 12px;
}
.pill--wait{ border-color: rgba(245,199,106,.35); background: rgba(245,199,106,.12); color: #ffd58a; }
.pill--done{ border-color: rgba(74,211,160,.35); background: rgba(74,211,160,.12); color: #7df0c9; }
.pill--fail{ border-color: rgba(242,123,101,.35); background: rgba(242,123,101,.12); color: #ffb3a6; }

.topupSeg{
  display:flex;
  gap:8px;
  margin-bottom:14px;
  flex-wrap:wrap;
}
.topupSeg__btn{
  flex:1 1 auto;
  min-height:44px;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.12);
  color: var(--text);
  font-weight:800;
  font-size:14px;
  cursor:pointer;
  opacity:.9;
}
.topupSeg__btn--active{
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-color: transparent;
  color:#fff;
  opacity:1;
}
.topupSeg__btn:active{ transform: translateY(1px); }

.cardTelcoGrid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
}
.cardTelcoPick{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:56px;
  padding:10px 8px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.14);
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
}
.cardTelcoPick img{
  max-width:100%;
  height:auto;
  max-height:40px;
  width:auto;
  object-fit:contain;
  display:block;
  pointer-events:none;
}
.cardTelcoPick--active{
  border-color: rgba(111,94,238,.75);
  box-shadow: 0 0 0 2px rgba(111,94,238,.35);
  background: rgba(111,94,238,.12);
}

.cardAmountGrid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:8px;
}
.cardAmountPick{
  min-height:44px;
  padding:10px 8px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.14);
  color: var(--text);
  font-weight:800;
  font-size:13px;
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
}
.cardAmountPick--active{
  border-color: rgba(111,94,238,.75);
  box-shadow: 0 0 0 2px rgba(111,94,238,.35);
  background: linear-gradient(135deg, rgba(111,94,238,.35), rgba(139,125,255,.2));
}

@media (min-width: 820px){
  .product{ grid-column: span 6; }
  .modalGrid{ grid-template-columns: 1fr 1fr; }
}
