:root {
  --navy: #0f2a4a;
  --navy-2: #173c66;
  --teal: #14b8a6;
  --teal-2: #0d9488;
  --amber: #f59e0b;
  --amber-ink: #3b2600;
  --red: #dc2626;
  --green: #16a34a;
  --bg: #f3f6fa;
  --card: #ffffff;
  --ink: #12233a;
  --muted: #64748b;
  --line: #e2e8f0;
  --tile: #ffffff;
  --shadow: 0 2px 10px rgba(15, 42, 74, .08);
  --radius: 16px;
  --hdr: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 45%, var(--teal-2) 100%);
}
[data-theme="dark"] {
  --bg: #0b1422;
  --card: #132136;
  --tile: #132136;
  --ink: #e6edf6;
  --muted: #93a3b8;
  --line: #22344d;
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #dfe6ef; color: var(--ink); font-size: 15px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--teal-2); text-decoration: none; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

#app {
  position: relative; max-width: 430px; height: 100vh; height: 100dvh; margin: 0 auto;
  background: var(--bg); overflow: hidden; display: flex; flex-direction: column;
}
@media (min-width: 500px) {
  #app { height: min(900px, 100dvh); margin-top: max(0px, calc((100dvh - 900px) / 2)); border-radius: 28px; box-shadow: 0 20px 60px rgba(15,42,74,.25); }
}
.screen { display: flex; flex-direction: column; height: 100%; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- header ---------- */
.bar {
  background: var(--hdr); color: #fff; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 14px) 12px 18px; flex-shrink: 0;
  border-radius: 0 0 22px 22px;
}
.bar h1 { flex: 1; text-align: center; font-size: 18px; font-weight: 600; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: inherit; flex-shrink: 0; }
.icon-btn:active { background: rgba(255,255,255,.15); }
.sp { width: 40px; flex-shrink: 0; }
.ico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.content { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.content.flush { padding: 0; }

/* ---------- home ---------- */
.home-top { background: var(--hdr); color: #fff; padding: calc(env(safe-area-inset-top) + 14px) 16px 64px; flex-shrink: 0; }
.home-top .row1 { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 6px; position: relative; }
.home-top .who { display: flex; align-items: center; gap: 12px; }
.home-top .who .meta { flex: 1; }
.home-top .num { font-weight: 600; font-size: 17px; letter-spacing: .3px; }
.home-top .bal { opacity: .9; font-size: 15px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: #e2e8f0; color: var(--navy); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.dot { position: absolute; top: 6px; right: 8px; width: 9px; height: 9px; background: var(--amber); border-radius: 50%; border: 2px solid var(--navy); }
.home-body { flex: 1; overflow-y: auto; margin-top: -46px; padding: 0 14px 16px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  position: relative; background: var(--tile); border-radius: var(--radius); box-shadow: var(--shadow);
  min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 18px 8px 14px; text-align: center; color: var(--ink); overflow: hidden;
}
.tile:active { transform: scale(.98); }
.tile .ico { width: 36px; height: 36px; stroke: var(--navy-2); stroke-width: 1.4; }
[data-theme="dark"] .tile .ico { stroke: var(--teal); }
.tile span { font-size: 13.5px; line-height: 1.25; }
.badge-new { position: absolute; top: 0; left: 0; right: 0; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 1px; padding: 3px 0; }
.promo { margin-top: 14px; border-radius: var(--radius); padding: 16px; color: #fff; background: linear-gradient(120deg, var(--teal-2), var(--navy-2)); display: flex; align-items: center; gap: 12px; }
.promo b { display: block; font-size: 15px; }
.promo small { opacity: .85; }

/* ---------- bottom nav ---------- */
.nav { display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px); flex-shrink: 0; }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 6px 0; }
.nav button.on { color: var(--teal-2); font-weight: 600; }
[data-theme="dark"] .nav button.on { color: var(--teal); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 13px 18px; font-weight: 600; width: 100%; }
.btn.primary { background: var(--teal-2); color: #fff; }
.btn.accent { background: var(--amber); color: var(--amber-ink); }
.btn.ghost { background: transparent; color: var(--teal-2); border: 1.5px solid var(--teal-2); }
.btn.danger { background: #fee2e2; color: var(--red); }
.btn:disabled { opacity: .5; }
.btn.sm { padding: 7px 12px; font-size: 13px; width: auto; border-radius: 9px; }
.pill-amber { background: var(--amber); color: var(--amber-ink); font-size: 12px; font-weight: 700; border-radius: 8px; padding: 6px 10px; display: inline-flex; align-items: center; gap: 4px; }
.pill-amber .ico { width: 14px; height: 14px; }
.stack > * + * { margin-top: 12px; }

/* ---------- cards / lists ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card, .card + .list, .list + .card, .list + .list { margin-top: 12px; }
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
button.row:active, a.row:active { background: rgba(20,184,166,.06); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 500; }
.row .s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .k { font-size: 10.5px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.row > .ico { color: var(--muted); }
.row .chev { width: 18px; height: 18px; color: var(--muted); }
.section-t { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .8px; margin: 20px 4px 8px; }
.section-t:first-child { margin-top: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.amt-pos { color: var(--green); font-weight: 600; }
.amt-neg { color: var(--ink); font-weight: 600; }
.tag { font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 2px 6px; background: #ccfbf1; color: #0f766e; }
.tag.grey { background: #e2e8f0; color: #475569; }
.flag { font-size: 22px; line-height: 1; }

/* profile */
.profile { display: flex; gap: 14px; position: relative; }
.profile .info { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.profile .info b { color: var(--ink); font-weight: 500; }
.profile h3 { font-size: 17px; margin-bottom: 4px; }
.profile .edit { position: absolute; top: -6px; right: -6px; color: var(--muted); }
.progress { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal-2), var(--teal)); border-radius: 6px; }
.balance-row { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(90deg, rgba(20,184,166,.12), rgba(23,60,102,.08)); border-radius: 12px; padding: 14px 16px; font-weight: 600; font-size: 16px; }

/* toggle */
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: #cbd5e1; border-radius: 26px; transition: .2s; }
.switch i::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--teal-2); }
.switch input:checked + i::after { transform: translateX(20px); }

/* forms */
label.lbl { display: block; font-size: 13px; color: var(--muted); margin: 14px 2px 6px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; outline: none;
}
.input:focus { border-color: var(--teal); }
.phone-in { display: flex; gap: 8px; }
.phone-in select { width: 110px; flex-shrink: 0; }
.err { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin-top: 14px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.search input { border: 0; outline: 0; flex: 1; background: transparent; }
.search .ico { color: var(--muted); width: 18px; height: 18px; }

/* chips / tabs */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.chip.on { border-color: var(--teal-2); background: rgba(20,184,166,.1); color: var(--teal-2); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.chips.scroll .chip { white-space: nowrap; font-weight: 500; padding: 8px 12px; }
.amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.amounts .chip { padding: 14px 0; text-align: center; }
.tabs { display: flex; background: var(--card); border-radius: 12px; padding: 4px; box-shadow: var(--shadow); }
.tabs button { flex: 1; padding: 10px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--navy-2); color: #fff; }

/* empty state */
.empty { text-align: center; padding: 30px 20px; }
.empty svg.ill { width: 170px; height: 170px; margin-bottom: 10px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin-bottom: 18px; }

/* auth */
.auth { flex: 1; overflow-y: auto; padding: calc(env(safe-area-inset-top) + 36px) 24px 24px; }
.auth .logo { width: 84px; height: 84px; margin: 0 auto 14px; display: block; }
.auth h2 { text-align: center; font-size: 22px; }
.auth .sub { text-align: center; color: var(--muted); margin-top: 4px; }
.auth .links { text-align: center; margin-top: 18px; font-size: 14px; }
.demo-hint { margin-top: 22px; background: rgba(245,158,11,.12); color: #92400e; border-radius: 12px; padding: 10px 12px; font-size: 13px; text-align: center; }
[data-theme="dark"] .demo-hint { color: #fcd34d; }
.splash { flex: 1; display: grid; place-items: center; background: var(--hdr); color: #fff; text-align: center; }
.splash img { width: 110px; height: 110px; animation: pop .6s ease; }
.splash h1 { margin-top: 14px; font-size: 26px; letter-spacing: .5px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* call */
.subnav { display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px); }
.subnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 6px 0; }
.subnav button.on { color: var(--teal-2); font-weight: 600; }
.log-ico { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.dir { width: 13px; height: 13px; vertical-align: -2px; color: var(--teal-2); }
.keypad-num { text-align: center; font-size: 30px; font-weight: 500; min-height: 46px; letter-spacing: 1px; word-break: break-all; }
.keypad-rate { text-align: center; color: var(--muted); font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 22px; max-width: 290px; margin: 0 auto; }
.key { height: 66px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); font-size: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; aspect-ratio: 1; margin: 0 auto; width: 66px; }
.key small { font-size: 9px; letter-spacing: 2px; color: var(--muted); margin-top: 3px; }
.key:active { background: var(--line); }
.key-actions { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 290px; margin: 16px auto 0; align-items: center; justify-items: center; }
.call-btn { width: 66px; height: 66px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(22,163,74,.35); }
.call-btn .ico { width: 28px; height: 28px; }
.call-btn.end { background: var(--red); box-shadow: 0 6px 18px rgba(220,38,38,.35); }

.incall { flex: 1; display: flex; flex-direction: column; align-items: center; background: var(--hdr); color: #fff; padding: calc(env(safe-area-inset-top) + 60px) 24px calc(env(safe-area-inset-bottom) + 40px); }
.incall .avatar { width: 110px; height: 110px; font-size: 38px; margin-bottom: 18px; box-shadow: 0 0 0 10px rgba(255,255,255,.08), 0 0 0 22px rgba(255,255,255,.04); }
.incall h2 { font-size: 24px; font-weight: 600; }
.incall .st { opacity: .85; margin-top: 6px; }
.incall .tm { font-size: 18px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.incall .free { margin-top: 10px; }
.incall .ctrls { margin-top: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 30px; }
.cbtn { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: #fff; }
.cbtn > div { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,.15); display: grid; place-items: center; }
.cbtn.on > div { background: #fff; color: var(--navy); }
.incall .endwrap { margin-top: 30px; }

/* sheet / modal */
.overlay { position: absolute; inset: 0; background: rgba(8, 20, 36, .5); z-index: 50; display: flex; align-items: flex-end; animation: ov .15s ease; }
.overlay.center { align-items: center; justify-content: center; padding: 24px; }
@keyframes ov { from { opacity: 0; } }
.sheet { background: var(--card); width: 100%; border-radius: 22px 22px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 20px); max-height: 88%; overflow-y: auto; animation: up .22s ease; }
.overlay.center .sheet { border-radius: 20px; padding: 22px 20px; animation: pop .2s ease; max-width: 340px; }
@keyframes up { from { transform: translateY(100%); } }
.sheet .grab { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: 0 auto 14px; }
.sheet h3 { font-size: 18px; margin-bottom: 6px; }
.pay-opt { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; width: 100%; text-align: left; }
.pay-opt.on { border-color: var(--teal-2); background: rgba(20,184,166,.08); }
.pay-opt[disabled] { opacity: .45; }
.pay-opt .grow { flex: 1; }
.radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
.pay-opt.on .radio { border: 5px solid var(--teal-2); }
.spinner { width: 46px; height: 46px; border: 4px solid var(--line); border-top-color: var(--teal-2); border-radius: 50%; animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-ic { width: 70px; height: 70px; border-radius: 50%; background: #dcfce7; color: var(--green); display: grid; place-items: center; margin: 10px auto 12px; }
.success-ic .ico { width: 36px; height: 36px; stroke-width: 2.4; }
.stars { display: flex; justify-content: center; gap: 8px; margin: 14px 0; }
.stars button .ico { width: 34px; height: 34px; color: #cbd5e1; }
.stars button.on .ico { color: var(--amber); fill: var(--amber); }

/* drawer */
.drawer-ov { position: absolute; inset: 0; background: rgba(8,20,36,.45); z-index: 40; animation: ov .15s; }
.drawer { position: absolute; top: 0; bottom: 0; right: 0; width: 80%; max-width: 320px; background: var(--card); z-index: 41; animation: slide .2s ease; display: flex; flex-direction: column; }
@keyframes slide { from { transform: translateX(100%); } }
.drawer .head { background: var(--hdr); color: #fff; padding: calc(env(safe-area-inset-top) + 28px) 20px 22px; }
.drawer .head img { width: 54px; height: 54px; }
.drawer .head b { display: block; margin-top: 8px; font-size: 16px; }
.drawer .items { flex: 1; overflow-y: auto; padding: 8px 0; }
.drawer .items button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 22px; text-align: left; }
.drawer .items button .ico { color: var(--muted); }
.drawer .items .cnt { margin-left: auto; background: var(--amber); color: var(--amber-ink); border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.drawer .foot { padding: 14px 22px calc(env(safe-area-inset-bottom) + 14px); font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* toast */
.toast { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; z-index: 100; max-width: 88%; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: toast 2.6s ease forwards; text-align: center; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* gift cards */
.gift-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gift { border-radius: 14px; aspect-ratio: 1.58; color: #fff; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; box-shadow: var(--shadow); }
.gift b { font-size: 16px; }
.gift small { opacity: .85; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.code-box { font-family: ui-monospace, monospace; font-size: 18px; letter-spacing: 2px; background: var(--bg); border: 1.5px dashed var(--teal-2); border-radius: 12px; padding: 12px; text-align: center; margin: 12px 0; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 80%; padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.4; }
.bubble.me { align-self: flex-end; background: var(--teal-2); color: #fff; border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 4px; }
.chat-in { display: flex; gap: 8px; padding: 10px 12px calc(env(safe-area-inset-bottom) + 10px); background: var(--card); border-top: 1px solid var(--line); }
.chat-in input { flex: 1; }
.chat-in button { width: 46px; border-radius: 12px; background: var(--teal-2); color: #fff; display: grid; place-items: center; }

details.faq { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 0 16px; margin-bottom: 10px; }
details.faq summary { padding: 14px 0; font-weight: 500; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--teal-2); font-size: 20px; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq p { padding: 0 0 14px; color: var(--muted); font-size: 14px; }

.pkg { display: flex; align-items: center; gap: 12px; }
.pkg .mins { font-size: 22px; font-weight: 700; color: var(--navy-2); }
[data-theme="dark"] .pkg .mins { color: var(--teal); }
.pkg .price { font-weight: 700; font-size: 16px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-row .card { text-align: center; }
.stat-row b { display: block; font-size: 22px; }
.install-banner { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); margin-top: 14px; font-size: 13px; }
.install-banner .grow { flex: 1; }
