
:root{
  --bg1:#1e3554;
  --bg2:#172a43;
  --card: rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.08);
  --text:#e9f0ff;
  --muted: rgba(233,240,255,0.65);
  --line: rgba(255,255,255,0.09);
  --green1:#32b35f;
  --green2:#1f8f4a;
  --danger:#ff5a6b;
  --warn:#ffcc66;
  --shadow: 0 18px 40px rgba(0,0,0,.35);
  --r:26px;
  --r2:18px;
  --w:430px;
  --pad:18px;
  --font: "Montserrat", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans";
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:#0f141b;
}
.app-shell{
  min-height:100%;
  display:grid;
  place-items:center;
  padding:22px 12px;
}
.phone{
  width:min(var(--w), 100%);
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  border-radius: 34px;
  box-shadow: var(--shadow);
  overflow:hidden;
  position:relative;
}
.topbar{
  display:grid;
  grid-template-columns: 54px 1fr 54px;
  align-items:center;
  padding: 14px var(--pad);
  gap: 10px;
}
.brand{
  text-align:center;
  letter-spacing:.12em;
  font-weight:700;
  font-size:14px;
  opacity:.95;
}
.avatar{
  width:38px;height:38px;border-radius:20px;
  background: rgba(50,179,95,.15);
  border: 2px solid rgba(50,179,95,.55);
  display:grid; place-items:center;
  position:relative;
}
.avatar .dot{
  width:14px;height:14px;border-radius:50%;
  background: rgba(233,240,255,.9);
  opacity:.35;
}
.icon-btn{
  width:38px;height:38px;border-radius:18px;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color:var(--text);
  display:grid; place-items:center;
  cursor:pointer;
  text-decoration:none;
}
.icon-btn:hover{background: rgba(255,255,255,0.07)}
.icon-btn .ico{font-size:22px; line-height:1}
.burger{
  width:18px;height:2px;background:var(--text);
  border-radius:2px;
  position:relative;
  opacity:.85;
}
.burger:before,.burger:after{
  content:"";
  position:absolute;left:0;
  width:18px;height:2px;background:var(--text);
  border-radius:2px;
}
.burger:before{top:-6px}
.burger:after{top:6px}

.content{
  padding: 0 var(--pad) 18px;

  min-width:0;
}
.flash-wrap{padding: 0 var(--pad) 8px}
.flash{
  border:1px solid var(--line);
  padding:10px 12px;
  border-radius:14px;
  background: rgba(255,255,255,0.04);
  font-size:13px;
  margin-bottom:8px;
}
.flash-success{border-color: rgba(50,179,95,.35)}
.flash-error{border-color: rgba(255,90,107,.35)}
.flash-warn{border-color: rgba(255,204,102,.35)}

.hero{
  padding: 8px 0 10px;
  text-align:center;
}
.hero .label{font-size:12px; letter-spacing:.18em; opacity:.65}
.hero .value{margin:8px 0 10px;}
.hero .pill{
  display:inline-flex;
  gap:12px;
  align-items:center;
  border-radius: 999px;
  padding:10px 14px;
  border:1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size:13px;
}
.hero .pill b{color:var(--text)}
.actions{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0 6px;
}
.action{
  display:grid;
  place-items:center;
  gap:8px;
  text-decoration:none;
  color:var(--text);
}
.action .aico{
  width:54px;height:54px;border-radius:20px;
  background: rgba(255,255,255,0.04);
  border:1px solid var(--line);
  display:grid; place-items:center;
  font-size:20px;
}
.action .alabel{font-size:12px; opacity:.8}

.h2{font-size:18px; margin: 16px 0 10px; opacity:.9}
.card{
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 12px;

  min-width:0;
}
.card.soft{background: rgba(255,255,255,0.04)}
.row{display:flex; align-items:center; justify-content:space-between; gap:12px}
.invite-center {
  justify-content: center;
}
.muted{color:var(--muted)}
.small{font-size:13px}
.kpi{font-size:32px;font-weight:600}
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 12px 16px;
  border-radius: 999px;
  border: 0;
  cursor:pointer;
  text-decoration:none;
  color: white;
  font-weight:700;
  background: linear-gradient(90deg, var(--green1), var(--green2));
  box-shadow: 0 10px 22px rgba(0,0,0,.25);
}
.btn:disabled{opacity:.55; cursor:not-allowed}
.btn.secondary{
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  box-shadow:none;
}
.btn.danger{background: linear-gradient(90deg, #ff6a7b, #ff3f55)}
.btn.block{width:100%}
.btn.sm{padding:10px 12px; font-size:13px}
.input{
  width:100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.15);
  color: var(--text);
  outline:none;
}
.input::placeholder{color: rgba(233,240,255,0.35)}

/* Password show/hide */
.pw-wrap{ position:relative; }
.pw-wrap .input{ padding-right: 48px; }
.pw-toggle{
  position:absolute;
  right:10px;
  top:50%;
  transform: translateY(-50%);
  width:34px;
  height:34px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  display:grid;
  place-items:center;
  cursor:pointer;
}
.pw-toggle:active{ transform: translateY(-50%) scale(0.98); }

/* Better selects (dark dropdown) */
select.input{
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  padding-right: 44px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(233,240,255,.75) 50%),
    linear-gradient(135deg, rgba(233,240,255,.75) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-size:6px 6px, 6px 6px;
  background-repeat:no-repeat;
}
select.input option{
  background: #0f2137;
  color: #e9f0ff;
}
select.input:focus{
  border-color: rgba(50,179,95,.55);
  box-shadow: 0 0 0 3px rgba(50,179,95,.16);
}
.field{margin: 10px 0}
label{display:block; font-size:12px; letter-spacing:.12em; opacity:.7; margin-bottom:6px}
hr.sep{border:none;border-top:1px solid var(--line); margin:12px 0}
.table{
  width:max-content;
  min-width:100%;
  border-collapse: collapse;
  font-size:13px;
}
.table th,.table td{padding:10px 8px;border-bottom:1px solid var(--line);vertical-align:top}

/* Responsive tables (important inside .phone which has overflow hidden) */
.table-wrap{
  width:100%;
  max-width:100%;
  min-width:0;
  display:block;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain;
  touch-action:pan-x pan-y;
  scrollbar-width:thin;
}
.table-wrap::-webkit-scrollbar{height:8px}
.table-wrap::-webkit-scrollbar-thumb{background:rgba(255,255,255,.18);border-radius:999px}
.table-wrap::-webkit-scrollbar-track{background:rgba(0,0,0,.15);border-radius:999px}

.table-wrap .table{
  min-width: 620px;
}
.table th{white-space:nowrap}
.table td{white-space:normal}
.badge{
  display:inline-block;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.04);
  font-size:12px;
}
.badge.ok{border-color: rgba(50,179,95,.35)}
.badge.no{border-color: rgba(255,90,107,.35)}
.badge.wait{border-color: rgba(255,204,102,.35)}
.tx{
  display:flex; justify-content:space-between; gap:14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.tx:last-child{border-bottom:none}
.tx .left{min-width:0}
.tx .t1{font-weight:700}
.tx .t2{font-size:12px;color:var(--muted);margin-top:2px}
.tx .amt{font-weight:800; white-space:nowrap}
.tx .amt.cred{color:#71ff9d}
.tx .amt.deb{color:#ff7a8a}

.drawer{position:fixed; inset:0; display:none; z-index:40}
.drawer.open{display:block}
.drawer-backdrop{position:absolute; inset:0; background: rgba(0,0,0,.55)}
.drawer-panel{
  position:absolute;
  right:0; top:0; height:100%;
  width: min(340px, 90vw);
  background: linear-gradient(180deg, rgba(30,53,84,.98), rgba(23,42,67,.98));
  border-left:1px solid var(--line);
  padding: 14px;
}
.drawer-head{display:flex; justify-content:space-between; gap:10px; align-items:flex-start}
.drawer-name{font-weight:800; font-size:16px}
.drawer-sub{font-size:12px; color:var(--muted); margin-top:2px}
.drawer-ref{font-size:12px; color:var(--muted); margin-top:10px}
.drawer-nav{margin-top:14px; display:flex; flex-direction:column; gap:6px}
.drawer-nav a{
  text-decoration:none;
  color:var(--text);
  padding: 7px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,0.04);
}
.drawer-nav a:hover{background: rgba(255,255,255,0.07)}
.drawer-nav a.danger{border-color: rgba(255,90,107,.35)}
.drawer-sep{height:1px;background:var(--line); margin:10px 0}

.bottom-nav{
  display:flex;
  gap:10px;
  padding: 12px var(--pad) 16px;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,0.10);
}
.bn-item{
  flex:1;
  text-align:center;
  text-decoration:none;
  color:var(--text);
  padding: 10px 0;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
}
.bn-item:hover{background: rgba(255,255,255,0.06)}

.center{
  text-align:center;
}
.note{
  font-size:12px;
  color: var(--muted);
  line-height:1.4;
}


/* Modal */
.modal{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:999;
}
.modal.open{display:flex}
.modal .box{
  width:min(520px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.05));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.modal .box .row{align-items:center}
.qr-wrap{
  display:grid;
  place-items:center;
  padding:14px;
  border-radius:18px;
  background: rgba(0,0,0,.18);
  border:1px solid var(--line);
}
.qr-wrap img{width:240px; height:240px; object-fit:contain;}
@media (max-width:430px){
  .qr-wrap img{width:220px;height:220px}
  .app-shell{ 
padding: unset;
}
.phone{
border-radius: unset;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.body {
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
}
}
.copyrow{
  display:flex; gap:10px; align-items:center; margin-top:10px;
}
.copyrow .input{flex:1}
.scanvideo{
  width:100%;
  border-radius:18px;
  background:#000;
  border:1px solid var(--line);
}


.scroll-hint{font-size:12px;opacity:.7;margin:8px 0 0;display:flex;gap:8px;align-items:center}
.scroll-hint:after{content:'⇆';opacity:.75}


/* YMC mini logo beside balances */
.ymc-mini{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.25);
  object-fit: cover;
  margin-right: 10px;
  flex: 0 0 auto;
}
.ymc-value, .ymc-kpi{
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
}

/* Signup video */
.signup-video-wrap{
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
  background: rgba(0,0,0,.18);
  aspect-ratio: 16 / 9;
}
.signup-video{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Merchant slider */
.merchant-slider{
  display:flex;
  gap:12px;
  overflow-x:auto;
  padding:10px 2px;
  scroll-snap-type:x proximity;
  scrollbar-width:none;
  -ms-overflow-style:none;
  cursor:grab;
}
.merchant-slider::-webkit-scrollbar{display:none}
.merchant-slider:active{cursor:grabbing}
.merchant-slide{
  min-width: 170px;
  flex: 0 0 170px;
  scroll-snap-align:start;
}
.merchant-card{
  height: 120px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
}
.merchant-logo{
  width:60px;
  height:60px;
  border-radius:999px;
  object-fit:cover;
  border:3px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
}

/* Merchant carousel controls (v5) */
.merchant-carousel{
  width:100%;
}
.merchant-carousel .merchant-slider{
  display:flex;
  gap:12px;
  overflow-x:auto;
  overflow-y:hidden;
  padding:10px 2px 4px;
  scroll-snap-type:x mandatory;
  scrollbar-width:none;
  -ms-overflow-style:none;
  scroll-behavior:smooth;
  -webkit-overflow-scrolling:touch;
  touch-action:pan-x pan-y;
}
.merchant-carousel .merchant-slider::-webkit-scrollbar{display:none}
.merchant-carousel .merchant-slide{
  min-width: 168px;
  flex:0 0 168px;
  scroll-snap-align:start;
}
.merchant-carousel .merchant-slide > .card{
  margin-bottom:0;
  height:100%;
}
.merchant-carousel .merchant-card{
  min-height:150px;
  justify-content:space-between;
  gap:8px;
}
.merchant-carousel .merchant-name{
  width:100%;
  text-align:center;
  font-weight:800;
  line-height:1.15;
  min-height:40px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  text-overflow:ellipsis;
}
.merchant-controls{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:8px;
}

/* Merchant page header actions (badge + Pay button) */
.merchant-actions{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
}
@media (max-width: 480px){
  .merchant-actions{ justify-content:flex-start; }
}

/* Token/balance helpers */
.token-row{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}
.hero-balance,
.balance-display,
.ymc-kpi{
  max-width:100%;
  min-width:0;
}
.hero-balance{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:12px;
}
.ymc-amount-stack,
.ymc-kpi-text{
  display:flex;
  flex-direction:column;
  min-width:0;
}
.ymc-amount-stack{
  align-items:flex-start;
}
.token-name{
  font-size:12px;
  font-weight:900;
  letter-spacing:.12em;
  opacity:.95;
  text-transform:uppercase;
  margin-top:4px;
  line-height:1.1;
}
.balance-amount{
  font-size:20px;
  font-weight:700;
  margin-top:0;
  letter-spacing:.02em;
  line-height:1;
  word-break:break-word;
}

.balance-display{
  display:inline-flex;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  border-radius:18px;
  background: rgba(255,255,255,0.04);
  border:1px solid var(--line);
  width:min(100%, 340px);
  justify-content:center;
}
.balance-num{
  font-size:20px;
  font-weight:900;
  line-height:1.05;
  word-break:break-word;
}

.ymc-kpi{
  display:inline-flex;
  align-items:center;
  gap:10px;
}
.ymc-kpi .ymc-mini,
.hero-balance .ymc-mini,
.balance-display .ymc-mini{
  margin-right:0;
}
.ymc-kpi-text{
  align-items:flex-end;
}
.ymc-kpi .token-short{
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
  opacity:.85;
  text-transform:uppercase;
  margin-top:4px;
  line-height:1.1;
}
.ymc-kpi .amount-inline{
  font-size:20px;
  font-weight:inherit;
  line-height:1;
  white-space:nowrap;
}
.balance-side{
  text-align:right;
  min-width:0;
}

/* Wallet category cards: keep desktop layout but slightly smaller type than the hero balance */
.balance-split .ymc-kpi .amount-inline{
  font-size:20px;
}
.balance-split .ymc-kpi .token-short{
  font-size:10px;
}
@media (max-width: 480px){

  .balance-split .ymc-kpi .amount-inline{
  font-size:20px; }

  .balance-split{
    flex-wrap:nowrap;
    align-items:center;
  }
  .balance-split .balance-side{
    width:auto;
    text-align:right;
    margin-top:0;
  }
  .balance-split .ymc-kpi,
  .balance-side .ymc-kpi{
    width:auto;
    justify-content:flex-end;
  }
  .balance-split .ymc-kpi-text{
    align-items:flex-end;
  }
  .hero-balance,
  .balance-display{
    width:100%;
    justify-content:center;
  }
  .hero .value{
    display:flex;
    justify-content:center;
  }
  .hero .pill{
    max-width:100%;
    margin-top:10px;
  }
}

/* Dashboard ads */
.ad-wrap{
  display:flex;
  justify-content:center;
  width:100%;
}
.ad-link{display:block}
.ad-slider{
  width:100%;
  max-width:430px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,0.12);
  box-shadow: 0 12px 26px rgba(0,0,0,.28);
  overflow:hidden;
  position:relative;
}
.ad-slide{display:none}
.ad-slide.active{display:block}
.ad-img{
  width:100%;
  height:200px; /* default ad size; large uploads will be cropped */
  display:block;
  object-fit:cover;
}

@media (max-width: 480px){
  .ad-img{ height:200px; }
}

/* When destination wallet has only one allowed option, keep it enabled but visually locked */
select.input.locked{
  pointer-events:none;
  opacity:0.9;
}

/* Golden / shining login background */
body.login-golden{
  background: radial-gradient(circle at 20% 0%, #fff6c7 0%, #f2c94c 28%, #a77600 60%, #0f141b 100%);
}
body.login-golden .phone{
  background: linear-gradient(135deg, rgba(255,248,214,0.95), rgba(242,201,76,0.35), rgba(167,118,0,0.35));
}
body.login-golden .phone:before{
  content:"";
  position:absolute;
  inset:-60%;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.28) 45%, rgba(255,255,255,0.06) 55%, transparent 100%);
  transform: rotate(18deg);
  animation: ymcShine 3.2s linear infinite;
  pointer-events:none;
}
@keyframes ymcShine{
  0%{transform: translateX(-35%) rotate(18deg)}
  100%{transform: translateX(35%) rotate(18deg)}
}
.merchant-nav-btn{
  width:34px;
  height:34px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,0.06);
  color:var(--text);
  display:grid;
  place-items:center;
  cursor:pointer;
  flex:0 0 34px;
  font-size:16px;
  line-height:1;
}
.merchant-nav-btn:hover{background:rgba(255,255,255,0.12)}
.merchant-nav-btn:disabled{opacity:.35;cursor:not-allowed}
.merchant-dots{
  flex:1 1 auto;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:6px;
  min-height:20px;
}
.merchant-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  border:0;
  padding:0;
  background:rgba(233,240,255,.25);
  cursor:pointer;
}
.merchant-dot.is-active{
  width:18px;
  border-radius:999px;
  background:linear-gradient(90deg,var(--green1),var(--green2));
}
@media (max-width: 640px){
  .merchant-carousel .merchant-slide{
    min-width: 78%;
    flex-basis: 78%;
  }
}
@media (max-width: 430px){
  .merchant-carousel .merchant-slide{
    min-width: 84%;
    flex-basis: 84%;
  }
}


/* Simple link helper */
.link{color:rgba(255,255,255,.85);text-decoration:underline;text-underline-offset:3px;}
.link:hover{color:#fff;}


/* Admin system total card: keep responsive without affecting dashboard wallet cards */
@media (max-width: 640px){
  .admin-system-total{
    flex-wrap:wrap;
    align-items:flex-start;
    gap:10px;
  }
  .admin-system-total .balance-side{
    width:100%;
    text-align:right;
    margin-top:4px;
  }
  .admin-system-total .ymc-kpi{
    justify-content:flex-end;
    width:100%;
  }
}
