/* Farnoud Mini App + Vazirmatn */
html,body{
  font-family: Vazirmatn, Tahoma, system-ui, -apple-system, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
*{box-sizing:border-box}
button,input,select,textarea{font-family:inherit}

:root{
  --bg: var(--tg-theme-bg-color,#090910);
  --surface: color-mix(in srgb,var(--tg-theme-secondary-bg-color,#141421) 90%,transparent);
  --surface-2: color-mix(in srgb,var(--tg-theme-secondary-bg-color,#1b1b2b) 82%,transparent);
  --text: var(--tg-theme-text-color,#f8f7ff);
  --muted: var(--tg-theme-hint-color,#9796a8);
  --accent:#9b6cff;
  --accent-2:#c6a6ff;
  --success:#4ed69a;
  --danger:#ff6e86;
  --warning:#ffc75b;
  --line:color-mix(in srgb,var(--text) 10%,transparent);
  --radius:22px;
  --safe-bottom:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:radial-gradient(circle at 80% -10%,rgba(155,108,255,.18),transparent 35%),var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif}
body{min-height:100vh;overscroll-behavior-y:none}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer}
.app-shell{max-width:720px;margin:auto;min-height:100vh;padding-bottom:calc(88px + var(--safe-bottom))}
.topbar{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;padding:16px 18px 12px;background:color-mix(in srgb,var(--bg) 84%,transparent);backdrop-filter:blur(20px);border-bottom:1px solid var(--line)}
.brand{display:flex;align-items:center;gap:10px}.brand strong{display:block;font-size:15px}.brand small{display:block;color:var(--muted);font-size:11px;margin-top:2px}
.brand-mark{width:36px;height:36px;border-radius:12px;display:grid;place-items:center;background:linear-gradient(145deg,#b68cff,#6d3fe0);font-weight:900;box-shadow:0 10px 28px rgba(124,70,230,.28)}
.icon-btn{position:relative;width:40px;height:40px;border-radius:14px;background:var(--surface);border:1px solid var(--line);font-size:23px}
.icon-btn b{position:absolute;top:-3px;left:-2px;min-width:18px;height:18px;padding:0 4px;border-radius:10px;background:var(--danger);font-size:10px;display:grid;place-items:center}
.content{padding:16px 16px 8px}.page-title{font-size:25px;letter-spacing:-.5px;margin:8px 2px 4px}.page-subtitle{color:var(--muted);font-size:13px;margin:0 2px 18px}
.hero{padding:22px;border-radius:28px;background:linear-gradient(145deg,rgba(155,108,255,.18),rgba(255,255,255,.035));border:1px solid rgba(198,166,255,.13);overflow:hidden;position:relative}
.hero:after{content:"";position:absolute;width:180px;height:180px;border-radius:50%;background:rgba(155,108,255,.12);filter:blur(35px);left:-70px;top:-70px}
.status-row{display:flex;justify-content:space-between;align-items:center;gap:12px;position:relative;z-index:1}.eyebrow{font-size:11px;color:var(--muted);margin-bottom:7px}.status{font-size:19px;font-weight:800}.pill{font-size:11px;padding:7px 10px;border-radius:999px;background:rgba(78,214,154,.12);color:var(--success);border:1px solid rgba(78,214,154,.18)}
.usage{display:flex;align-items:center;gap:18px;margin-top:20px;position:relative;z-index:1}.ring{--p:0;width:142px;height:142px;border-radius:50%;display:grid;place-items:center;background:conic-gradient(var(--accent) calc(var(--p)*1%),rgba(255,255,255,.08) 0);position:relative;flex:none;transform:rotate(-90deg)}.ring:before{content:"";position:absolute;inset:10px;border-radius:50%;background:var(--bg);box-shadow:inset 0 0 0 1px var(--line)}.ring-inner{position:relative;z-index:1;text-align:center;transform:rotate(90deg)}.ring-inner strong{font-size:28px}.ring-inner small{display:block;color:var(--muted);font-size:10px;margin-top:2px}
.usage-copy strong{display:block;font-size:20px}.usage-copy span{display:block;color:var(--muted);font-size:12px;margin-top:5px}
.actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:18px}.btn{min-height:46px;border-radius:15px;padding:0 15px;font-weight:750;border:1px solid var(--line);background:var(--surface)}.btn.primary{background:var(--accent);color:#fff;border-color:transparent;box-shadow:0 10px 28px rgba(155,108,255,.25)}.btn.ghost{background:transparent}.btn:active{transform:scale(.985)}
.section{margin-top:22px}.section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.section-head h2{font-size:16px;margin:0}.section-head button{font-size:12px;color:var(--accent-2)}
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}.metric,.service-mini,.news-card,.wallet-card,.reward-card{background:var(--surface);border:1px solid var(--line);border-radius:19px;padding:15px}.metric span{color:var(--muted);font-size:11px}.metric strong{display:block;font-size:17px;margin-top:7px}.metric em{font-style:normal;color:var(--muted);font-size:10px}
.banner{margin-top:16px;min-height:150px;border-radius:23px;overflow:hidden;border:1px solid var(--line);background:linear-gradient(135deg,#251b39,#12121b);position:relative}.banner img{width:100%;height:100%;object-fit:cover;position:absolute;inset:0;opacity:.55}.banner-copy{position:relative;padding:20px;max-width:80%}.banner-copy h3{margin:0 0 7px;font-size:19px}.banner-copy p{margin:0;color:#d7d3e1;font-size:12px;line-height:1.7}
.service-list{display:grid;gap:10px}.service-mini{display:flex;align-items:center;gap:12px}.service-icon{width:44px;height:44px;border-radius:14px;display:grid;place-items:center;background:rgba(155,108,255,.12);color:var(--accent-2);font-size:19px}.service-mini .grow{flex:1}.service-mini strong{display:block;font-size:14px}.service-mini small{display:block;color:var(--muted);margin-top:4px;font-size:11px}.chev{color:var(--muted);font-size:20px}
.plan-grid{display:grid;gap:12px}.plan{background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:18px;position:relative}.plan.popular{border-color:rgba(155,108,255,.45);box-shadow:0 12px 36px rgba(155,108,255,.08)}.badge{position:absolute;top:14px;left:14px;font-size:10px;color:var(--accent-2);background:rgba(155,108,255,.12);padding:6px 8px;border-radius:999px}.plan h3{margin:0;font-size:17px}.plan .desc{font-size:11px;color:var(--muted);line-height:1.7;margin:7px 0 14px}.specs{display:flex;gap:7px;flex-wrap:wrap}.spec{font-size:10px;padding:7px 9px;border-radius:10px;background:var(--surface-2);color:#d6d2df}.price{display:flex;align-items:baseline;gap:5px;margin:15px 0}.price strong{font-size:24px}.price span{font-size:10px;color:var(--muted)}
.detail-head{display:flex;align-items:center;gap:12px;margin:8px 0 20px}.back{font-size:25px;color:var(--muted)}.detail-card{background:var(--surface);border:1px solid var(--line);border-radius:24px;padding:18px}.kv{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}.kv>div{padding:12px;border-radius:15px;background:var(--surface-2)}.kv span{display:block;color:var(--muted);font-size:10px}.kv strong{display:block;margin-top:5px;font-size:14px}.link-box{margin-top:12px;padding:12px;border-radius:14px;background:rgba(155,108,255,.08);word-break:break-all;font-size:11px;color:#d9ccff}
.balance{font-size:35px;font-weight:850;letter-spacing:-1px}.unit{font-size:12px;color:var(--muted);font-weight:500}.wallet-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:15px}.tx{display:flex;align-items:center;gap:12px;padding:13px 0;border-bottom:1px solid var(--line)}.tx:last-child{border-bottom:0}.tx-icon{width:38px;height:38px;border-radius:12px;display:grid;place-items:center;background:var(--surface-2)}.tx .grow{flex:1}.tx strong{display:block;font-size:13px}.tx small{display:block;color:var(--muted);font-size:10px;margin-top:4px}.tx .amount{font-weight:800}.positive{color:var(--success)}.negative{color:var(--danger)}
.level{display:flex;justify-content:space-between;align-items:end}.level strong{font-size:25px}.progress{height:8px;border-radius:99px;background:rgba(255,255,255,.08);overflow:hidden;margin-top:14px}.progress i{display:block;height:100%;background:linear-gradient(90deg,var(--accent),var(--accent-2));border-radius:inherit}
.ref-link{display:flex;gap:8px;margin-top:12px}.ref-link input{min-width:0;flex:1;background:var(--surface-2);border:1px solid var(--line);color:var(--text);border-radius:13px;padding:0 11px;font-size:11px}
.profile{display:flex;align-items:center;gap:14px}.avatar{width:58px;height:58px;border-radius:19px;object-fit:cover;background:var(--surface-2);display:grid;place-items:center;font-size:20px;font-weight:800}.profile h2{margin:0;font-size:18px}.profile p{margin:4px 0 0;color:var(--muted);font-size:11px}.menu-list{margin-top:20px;display:grid;gap:8px}.menu-item{width:100%;display:flex;align-items:center;gap:12px;padding:15px;border-radius:17px;background:var(--surface);border:1px solid var(--line);text-align:right}.menu-item .grow{flex:1}.menu-item small{display:block;color:var(--muted);margin-top:3px;font-size:10px}
.news-list{display:grid;gap:10px}.news-card{padding:0;overflow:hidden}.news-card img{width:100%;height:150px;object-fit:cover}.news-card .copy{padding:14px}.news-card h3{margin:0;font-size:14px}.news-card p{margin:7px 0 0;color:var(--muted);font-size:11px;line-height:1.7}
.empty{text-align:center;padding:40px 20px;color:var(--muted)}.empty .big{font-size:42px;display:block;margin-bottom:10px}.empty strong{display:block;color:var(--text);font-size:15px;margin-bottom:6px}
.bottom-nav{position:fixed;z-index:20;bottom:0;right:0;left:0;margin:auto;max-width:720px;display:grid;grid-template-columns:repeat(5,1fr);padding:9px 10px calc(9px + var(--safe-bottom));background:color-mix(in srgb,var(--bg) 90%,transparent);backdrop-filter:blur(22px);border-top:1px solid var(--line)}.bottom-nav button{display:grid;justify-items:center;gap:3px;color:var(--muted);min-height:52px;border-radius:15px}.bottom-nav button span{font-size:20px}.bottom-nav small{font-size:9px}.bottom-nav button.active{color:var(--accent-2);background:rgba(155,108,255,.08)}
.sheet-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:40;display:none;align-items:flex-end}.sheet-backdrop.is-open{display:flex!important}.sheet{width:100%;max-width:720px;margin:auto;background:var(--bg);border:1px solid var(--line);border-radius:27px 27px 0 0;padding:20px 18px calc(22px + var(--safe-bottom));max-height:88vh;overflow:auto}.sheet-close{float:left;font-size:26px;color:var(--muted)}.sheet h2{margin:0 0 14px;font-size:18px}.form-row{display:grid;gap:8px;margin:12px 0}.form-row label{font-size:11px;color:var(--muted)}.form-row input,.form-row select{height:48px;border-radius:14px;border:1px solid var(--line);background:var(--surface);color:var(--text);padding:0 13px;outline:none}.form-row input:focus,.form-row select:focus{border-color:rgba(155,108,255,.5)}
.toast{position:fixed;z-index:60;bottom:calc(88px + var(--safe-bottom));left:50%;transform:translate(-50%,20px);opacity:0;pointer-events:none;background:#1d1c27;color:#fff;padding:11px 15px;border-radius:13px;border:1px solid var(--line);font-size:12px;transition:.25s}.toast.show{opacity:1;transform:translate(-50%,0)}
.skeleton-page{display:grid;gap:12px}.sk{border-radius:20px;background:linear-gradient(90deg,rgba(255,255,255,.05),rgba(255,255,255,.1),rgba(255,255,255,.05));background-size:200% 100%;animation:shine 1.2s infinite}.sk.hero{height:285px}.sk.line{height:18px}.sk.line.short{width:45%}.sk.card{height:120px}@keyframes shine{to{background-position:-200% 0}}
@media(min-width:650px){.content{padding:22px}.grid{grid-template-columns:repeat(4,1fr)}.plan-grid{grid-template-columns:repeat(2,1fr)}}

/* force hide until opened */
#sheet:not(.is-open){display:none!important}
#sheet.is-open{display:flex!important;align-items:flex-end}
.sheet-close{cursor:pointer;background:transparent;border:0;line-height:1;padding:4px 8px}
.toast{pointer-events:none}

.nav-ico{display:flex;align-items:center;justify-content:center;line-height:0}
.nav-ico svg{display:block}
.bottom-nav button span.nav-ico{font-size:0}
.brand-mark{overflow:hidden}
.brand-mark img{display:block}
#notifyBtn{display:flex;align-items:center;justify-content:center;position:relative}
#notifyBtn svg{display:block}
#notifyBadge{position:absolute;top:2px;left:2px}

/* Refined icon system */
.nav-ico svg,.icon-btn svg,.service-icon svg,.tx-icon svg,.menu-ico svg,.empty .big svg{
  width:1em;height:1em;display:block;fill:none;stroke:currentColor;stroke-width:1.75;
  stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;
}
.nav-ico svg{width:21px;height:21px}
.icon-btn svg{width:19px;height:19px}
.service-icon svg{width:22px;height:22px}
.tx-icon svg,.menu-ico svg{width:19px;height:19px}
.empty .big svg{width:42px;height:42px;margin:0 auto;opacity:.85}
.menu-ico{width:38px;height:38px;border-radius:12px;display:grid;place-items:center;background:var(--surface-2);color:var(--accent-2);flex:none}
.chev{font-size:0;width:20px;height:20px;position:relative}
.chev:after{content:"";position:absolute;inset:5px;border-right:1.7px solid currentColor;border-bottom:1.7px solid currentColor;transform:rotate(135deg)}

.back{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:12px;background:var(--surface);border:1px solid var(--line)}
.back svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}

.spec.spec-ico{display:inline-flex;align-items:center;gap:5px}
.spec.spec-ico svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:1.75;flex:none}
.btn .nav-ico svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.75}

/* Busy / progress overlay */
.busy-overlay{
  position:fixed;inset:0;z-index:9999;
  display:flex;align-items:center;justify-content:center;
  background:rgba(0,0,0,.55);backdrop-filter:blur(8px);
  transition:opacity .2s ease;
}
.busy-overlay[hidden]{display:none!important}
.busy-card{
  width:min(86vw,300px);padding:28px 22px 22px;border-radius:20px;
  background:var(--surface-2,#1b1b2b);border:1px solid var(--line);
  text-align:center;box-shadow:0 20px 50px rgba(0,0,0,.45);
}
.busy-spinner{
  width:42px;height:42px;margin:0 auto 14px;border-radius:50%;
  border:3px solid color-mix(in srgb,var(--accent) 25%,transparent);
  border-top-color:var(--accent);animation:busySpin .7s linear infinite;
}
@keyframes busySpin{to{transform:rotate(360deg)}}
.busy-title{font-weight:700;font-size:1rem;margin-bottom:12px}
.busy-bar{
  height:6px;border-radius:99px;background:color-mix(in srgb,var(--text) 10%,transparent);
  overflow:hidden;margin-bottom:10px;
}
.busy-bar>i{
  display:block;height:100%;width:15%;border-radius:99px;
  background:linear-gradient(90deg,var(--accent),var(--accent-2));
  animation:busyBar 1.4s ease-in-out infinite;
}
@keyframes busyBar{
  0%{width:12%;margin-right:0}
  50%{width:55%;margin-right:20%}
  100%{width:12%;margin-right:70%}
}
.busy-sub{font-size:.8rem;color:var(--muted)}

/* Logo as image in brand mark */
.brand-mark.has-logo{
  background:transparent!important;padding:0;overflow:hidden;
}
.brand-mark.has-logo img{
  width:100%;height:100%;object-fit:cover;display:block;border-radius:inherit;
}
