:root {
  --bg: #08101d;
  --surface: rgba(18, 29, 47, .82);
  --surface-solid: #121d2f;
  --surface-soft: #17263d;
  --line: rgba(255, 255, 255, .08);
  --text: #f4f8ff;
  --muted: #8fa2bc;
  --primary: #5be0b3;
  --primary-deep: #26ba8b;
  --accent: #74a8ff;
  --danger: #ff6d7e;
  --warning: #ffbf69;
  --shadow: 0 18px 60px rgba(0, 0, 0, .28);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(62, 116, 217, .18), transparent 34%),
    linear-gradient(180deg, #091321 0%, #08101d 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  filter: blur(70px);
  opacity: .12;
  pointer-events: none;
}
.ambient-one { top: 20%; left: -150px; background: var(--primary); }
.ambient-two { right: -160px; bottom: 18%; background: var(--accent); }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar, .profile-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(91, 224, 179, .35);
  color: #071810;
  background: linear-gradient(145deg, #9af2d4, var(--primary));
  font-weight: 850;
  box-shadow: 0 8px 24px rgba(49, 203, 154, .2);
  overflow: hidden;
}
.avatar.has-photo, .profile-avatar.has-photo { background: #0b1f17; padding: 0; }
.avatar img, .profile-avatar img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar { width: 44px; height: 44px; border-radius: 15px; }
.identity h1 { margin: 2px 0 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eyebrow {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, .035);
  cursor: pointer;
}
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.page { display: none; animation: page-in .24s ease both; }
.page.active { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } }

.balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  backdrop-filter: blur(14px);
}
.balance-label, .balance-note { display: block; color: var(--muted); font-size: 11px; }
.balance-card strong { display: block; margin: 4px 0 3px; font-size: 24px; letter-spacing: -.04em; }
.soft-button, .text-button, .filter-chip, .selection-summary {
  border: 0;
  cursor: pointer;
}
.soft-button {
  flex: 0 0 auto;
  padding: 10px 13px;
  border-radius: 12px;
  color: var(--primary);
  background: rgba(91, 224, 179, .1);
  font-size: 12px;
  font-weight: 800;
}

.hero-card {
  position: relative;
  min-height: 252px;
  padding: 26px 22px;
  overflow: hidden;
  border: 1px solid rgba(116, 168, 255, .18);
  border-radius: 28px;
  background:
    linear-gradient(115deg, rgba(20, 45, 76, .96), rgba(15, 29, 49, .92)),
    var(--surface-solid);
  box-shadow: var(--shadow);
}
.hero-card::after {
  position: absolute;
  content: "";
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(90deg, #000, transparent);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 2; width: 70%; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(91, 224, 179, .15);
  border-radius: 999px;
  color: #bff7e5;
  background: rgba(91, 224, 179, .08);
  font-size: 10px;
  font-weight: 750;
}
.pill i { width: 6px; height: 6px; border-radius: 99px; background: var(--primary); box-shadow: 0 0 12px var(--primary); }
.hero-card h2 { margin: 18px 0 8px; font-size: clamp(28px, 8vw, 38px); line-height: .98; letter-spacing: -.055em; }
.hero-card p { max-width: 280px; margin: 0 0 22px; color: #aebbd0; font-size: 12px; line-height: 1.55; }
.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 17px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}
.primary-button {
  color: #071912;
  background: linear-gradient(135deg, #79ebc6, var(--primary));
  box-shadow: 0 12px 28px rgba(38, 186, 139, .18);
}
.primary-button:disabled { opacity: .55; cursor: wait; }
.primary-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.secondary-button { border: 1px solid var(--line); color: var(--text); background: var(--surface-soft); }
.wide { width: 100%; }

.hero-orbit { position: absolute; right: -34px; top: 37px; width: 174px; height: 174px; z-index: 1; }
.orbit-ring { position: absolute; inset: 0; border: 1px solid rgba(116, 168, 255, .2); border-radius: 50%; box-shadow: inset 0 0 45px rgba(116,168,255,.06); }
.orbit-ring::before, .orbit-ring::after { position: absolute; content: ""; border: 1px solid rgba(116, 168, 255, .1); border-radius: 50%; }
.orbit-ring::before { inset: 22px; }
.orbit-ring::after { inset: 47px; }
.phone-mark { position: absolute; inset: 49px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.12); border-radius: 24px; color: var(--primary); background: rgba(8,16,29,.78); font-size: 34px; font-weight: 300; transform: rotate(8deg); }
.orbit-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px var(--accent); }
.dot-one { left: 9px; top: 57px; }
.dot-two { right: 22px; bottom: 12px; background: var(--primary); }

.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 28px 2px 13px; }
.section-heading h2, .page-title h2 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.03em; }
.text-button { padding: 6px 0; color: var(--primary); background: transparent; font-size: 11px; font-weight: 800; }

.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.service-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 15px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease;
}
.service-card:active { transform: scale(.97); }
.service-card:hover { border-color: rgba(91, 224, 179, .3); }
.service-logo {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  margin-bottom: 9px;
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  overflow: hidden;
}
.service-logo img { width: 100%; height: 100%; object-fit: cover; }
.service-logo span { color: #15243a; font-size: 16px; font-weight: 900; }
.service-card strong { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; text-align: center; }
.skeleton-card {
  height: 82px;
  border-radius: 17px;
  background: linear-gradient(90deg, var(--surface) 25%, rgba(255,255,255,.07) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.stack-list, .order-list { display: grid; gap: 10px; }
.empty-state {
  padding: 24px;
  border: 1px dashed rgba(255,255,255,.12);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}
.mini-order, .transaction-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.025);
}
.mini-icon, .transaction-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  color: var(--primary);
  background: rgba(91,224,179,.09);
  font-weight: 900;
}
.mini-order > div:nth-child(2), .transaction-item > div:nth-child(2) { min-width: 0; flex: 1; }
.mini-order strong, .transaction-item strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-order span, .transaction-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
.status-dot.completed { background: var(--primary); }
.status-dot.failed, .status-dot.canceled { background: var(--danger); }

.page-title { margin: 8px 2px 20px; }
.page-title h2 { font-size: 28px; }
.page-title p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.row-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 15px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.035);
}
.search-box svg { width: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }
.search-box input::placeholder { color: #60738e; }
.selection-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  margin-bottom: 12px;
  color: var(--primary);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}
.selection-summary svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.catalog-content { min-height: 300px; }
.country-list, .operator-list { display: grid; gap: 10px; }
.country-card, .operator-card {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.country-flag {
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
}
.country-main, .operator-main { min-width: 0; flex: 1; }
.country-main strong, .operator-main strong { display: block; font-size: 13px; text-transform: capitalize; }
.country-main span, .operator-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.country-price { text-align: right; }
.country-price strong { display: block; color: var(--primary); font-size: 13px; }
.country-price span { color: var(--muted); font-size: 9px; }
.operator-badge { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: var(--accent); background: rgba(116,168,255,.09); font-size: 11px; font-weight: 900; text-transform: uppercase; flex: 0 0 auto; }
.operator-card img { width: 42px; height: 42px; border-radius: 14px; object-fit: contain; background: rgba(255,255,255,.06); flex: 0 0 auto; padding: 4px; }
.chevron { width: 18px; fill: none; stroke: #657995; stroke-width: 2; }

.filter-row { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.filter-chip { padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 10px; font-weight: 800; }
.filter-chip.active { border-color: rgba(91,224,179,.22); color: var(--primary); background: rgba(91,224,179,.08); }
.order-card { padding: 15px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.order-service { display: flex; gap: 10px; align-items: center; min-width: 0; }
.order-service-icon { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 auto; border-radius: 13px; color: var(--primary); background: rgba(91,224,179,.09); font-weight: 900; }
.order-service strong { display: block; font-size: 13px; }
.order-service span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.status-badge { padding: 6px 8px; border-radius: 999px; color: var(--warning); background: rgba(255,191,105,.08); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.status-badge.completed { color: var(--primary); background: rgba(91,224,179,.08); }
.status-badge.canceled, .status-badge.cancel, .status-badge.failed, .status-badge.expired { color: var(--danger); background: rgba(255,109,126,.08); }
.number-box, .otp-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; margin-top: 12px; border-radius: 14px; background: rgba(4,10,18,.38); }
.number-box span, .otp-box span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.number-box strong { display: block; margin-top: 4px; font-size: 14px; letter-spacing: .03em; }
.otp-box { border: 1px solid rgba(91,224,179,.12); }
.otp-box strong { display: block; margin-top: 4px; color: var(--primary); font-size: 23px; letter-spacing: .16em; }
.copy-button { padding: 8px 10px; border: 0; border-radius: 10px; color: var(--primary); background: rgba(91,224,179,.09); cursor: pointer; font-size: 10px; font-weight: 850; }
.order-actions { display: flex; gap: 8px; margin-top: 12px; }
.order-actions button { flex: 1; min-height: 37px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(255,255,255,.025); cursor: pointer; font-size: 10px; font-weight: 800; }
.order-actions button.danger { color: var(--danger); }
.refund-note { display: block; margin-top: 10px; color: var(--primary); font-size: 9px; }

.profile-head { display: grid; justify-items: center; padding: 12px 0 20px; text-align: center; }
.profile-avatar { width: 76px; height: 76px; border-radius: 25px; font-size: 27px; }
.profile-head h2 { margin: 14px 0 4px; font-size: 22px; }
.profile-head p { margin: 0; color: var(--muted); font-size: 11px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stats-grid article { padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.stats-grid span { display: block; color: var(--muted); font-size: 10px; }
.stats-grid strong { display: block; margin-top: 7px; font-size: 21px; }
.transaction-amount { text-align: right; font-size: 11px; }
.transaction-amount.credit { color: var(--primary); }
.transaction-amount.debit { color: var(--danger); }
.info-card { display: flex; gap: 13px; padding: 16px; margin-top: 24px; border: 1px solid rgba(116,168,255,.13); border-radius: 18px; background: rgba(116,168,255,.055); }
.info-icon { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 10px; color: var(--accent); background: rgba(116,168,255,.12); font-weight: 900; }
.info-card strong { display: block; font-size: 11px; }
.info-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 620px);
  padding: 9px 12px max(9px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(8, 16, 29, .88);
  backdrop-filter: blur(22px);
  transform: translateX(-50%);
}
.nav-item {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 5px;
  border: 0;
  color: #627691;
  background: transparent;
  cursor: pointer;
}
.nav-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item span { font-size: 9px; font-weight: 750; }
.nav-item.active { color: var(--primary); }
.nav-badge { position: absolute; top: 0; left: calc(50% + 9px); display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border: 2px solid var(--bg); border-radius: 999px; color: #071912; background: var(--primary); font-size: 8px; font-style: normal; font-weight: 900; }

.sheet-backdrop { position: fixed; z-index: 30; inset: 0; background: rgba(0,0,0,.58); backdrop-filter: blur(5px); }
.bottom-sheet {
  position: fixed;
  z-index: 31;
  left: 50%;
  bottom: 0;
  width: min(100%, 620px);
  padding: 10px 18px max(22px, env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: #101c2e;
  box-shadow: 0 -24px 80px rgba(0,0,0,.48);
  transform: translateX(-50%);
  animation: sheet-in .25s ease both;
}
@keyframes sheet-in { from { transform: translate(-50%, 30px); opacity: 0; } }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 17px; border-radius: 99px; background: #34445b; }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.sheet-header h2 { margin: 4px 0 0; font-size: 21px; }
.sheet-header .icon-button { width: 34px; height: 34px; font-size: 22px; }
.confirm-details { display: grid; gap: 1px; margin-bottom: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--line); }
.confirm-row { display: flex; justify-content: space-between; gap: 20px; padding: 12px 13px; background: var(--surface-solid); }
.confirm-row span { color: var(--muted); font-size: 10px; }
.confirm-row strong { font-size: 11px; text-align: right; text-transform: capitalize; }
.confirm-row.total strong { color: var(--primary); font-size: 15px; }
.sheet-note { margin: 11px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.topup-placeholder { padding: 20px 12px 26px; text-align: center; }
.topup-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 20px; color: var(--primary); background: rgba(91,224,179,.09); font-size: 25px; }
.topup-placeholder h3 { margin: 0 0 8px; font-size: 17px; }
.topup-placeholder p { max-width: 390px; margin: auto; color: var(--muted); font-size: 11px; line-height: 1.6; }

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: #1a2a41;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  font-size: 11px;
  text-align: center;
  animation: toast-in .2s ease both;
}
.toast.error { border-color: rgba(255,109,126,.25); color: #ffc5cc; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.loading-overlay { position: fixed; z-index: 80; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: var(--bg); transition: opacity .25s ease; }
.loading-overlay.done { opacity: 0; pointer-events: none; }
.loading-overlay p { color: var(--muted); font-size: 11px; }
.loader { width: 38px; height: 38px; border: 3px solid rgba(255,255,255,.08); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

@media (max-width: 390px) {
  .app-shell { padding-inline: 14px; }
  .hero-card { min-height: 265px; }
  .hero-copy { width: 78%; }
  .hero-orbit { right: -70px; }
  .service-grid.compact { grid-template-columns: repeat(4, minmax(68px, 1fr)); overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
