:root {
  --bg: #0e0e10;
  --bg-2: #17171b;
  --bg-3: #1f1f25;
  --border: #2a2a33;
  --text: #ececec;
  --muted: #8b8b94;
  --accent: #ffb33a;
  --accent-2: #4aa3ff;
  --danger: #ff5b6e;
  --success: #4ad28e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
body { padding-bottom: 40px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.topbar-left { display: flex; align-items: center; gap: 8px; }
.icon-btn { background: none; border: none; color: var(--text); padding: 6px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-family: inherit; font-size: 15px; }
.icon-btn:active { background: var(--bg-3); }
.icon-btn.star { color: var(--accent); }

.container { padding: 16px; max-width: 720px; margin: 0 auto; }
.step { margin-bottom: 28px; }
.step h2 { font-size: 20px; margin: 0 0 12px; font-weight: 700; }

.search-wrap { position: relative; background: var(--bg-3); border-radius: 14px; padding: 14px 44px 14px 16px; }
.search-wrap.grow { flex: 1; }
.search-wrap input { background: none; border: none; outline: none; color: var(--text); font-size: 16px; width: 100%; font-family: inherit; }
.search-wrap svg { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.row { display: flex; gap: 8px; margin-bottom: 12px; }
.sort-btn { background: var(--bg-3); border: none; color: var(--text); padding: 0 18px; border-radius: 14px; font-size: 15px; cursor: pointer; min-width: 92px; font-family: inherit; }

.card-list { background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px; margin-top: 12px; overflow: hidden; }
.card-list .item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.card-list .item:last-child { border-bottom: none; }
.card-list .item:active { background: var(--bg-3); }
.svc-ico-wrap, .svc-letter, .card-list .item .flag {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  overflow: hidden;
}
.svc-ico-wrap { position: relative; padding: 0; }
.svc-letter-bg { position: absolute; inset: 0; display: inline-flex; align-items: center; justify-content: center; }
.svc-logo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.card-list .item .flag { font-size: 24px; background: var(--bg-3); }
.card-list .item .name { flex: 1; font-size: 16px; }
.card-list .item .right { text-align: right; }
.card-list .item .right .price { font-weight: 700; font-size: 15px; }
.card-list .item .right .count { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-list .empty-line { padding: 18px; text-align: center; color: var(--muted); }

.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px; font-weight: 700; }
.pager .link { background: none; border: none; color: var(--muted); font-weight: 700; cursor: pointer; font-size: 15px; font-family: inherit; }
.pager .link:disabled { opacity: .35; cursor: default; }

.selected { display: flex; align-items: center; gap: 12px; background: var(--bg-3); border-radius: 14px; padding: 14px 16px; margin-top: 12px; position: relative; }
.selected .x { background: none; border: none; color: var(--muted); font-size: 22px; padding: 4px 8px; cursor: pointer; }
.selected #selSvcIco { display: inline-flex; }
.selected .name { flex: 1; font-weight: 600; }
.selected .badge { position: absolute; right: 12px; top: -10px; background: #b9c4d3; color: #1f2733; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }

.empty { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--bg-3); border-radius: 14px; padding: 20px; color: var(--muted); margin-top: 12px; }

.hidden { display: none !important; }

.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 84%; max-width: 360px; background: var(--bg); border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform .22s ease; z-index: 50; padding-top: 64px; }
.drawer.open { transform: translateX(0); box-shadow: 0 0 50px rgba(0,0,0,.5); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-inner { padding: 24px; }
.drawer-inner h3 { font-size: 22px; text-align: center; margin: 0 0 18px; }
.drawer-card { background: var(--bg-3); border-radius: 14px; padding: 4px 0; }
.row-line { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.row-line:last-child { border-bottom: none; }
.ico-wrap { color: var(--muted); display: flex; }
.row-name { flex: 1; font-weight: 600; }
.row-val { color: var(--text); font-weight: 600; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 100; }
.modal-inner { background: var(--bg-2); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 22px 20px 28px; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal .muted { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.num-block { background: var(--bg-3); border-radius: 14px; padding: 16px; text-align: center; margin-bottom: 14px; }
.num { font-size: 24px; font-weight: 700; letter-spacing: 0.5px; }
.copy { margin-top: 8px; background: none; border: 1px solid var(--border); color: var(--text); padding: 6px 14px; border-radius: 10px; font-size: 13px; cursor: pointer; }
.status { margin-top: 10px; color: var(--muted); font-size: 14px; transition: color .2s; }
.status .elapsed { color: var(--accent); font-variant-numeric: tabular-nums; transition: color .2s; }
.status .dots::after {
  content: '…';
  display: inline-block;
  animation: dotsPulse 1.4s infinite ease-in-out;
}
@keyframes dotsPulse {
  0%, 100% { opacity: 0.35; letter-spacing: 0; }
  50% { opacity: 1; letter-spacing: 1px; }
}
.sms-row { margin-top: 10px; background: var(--bg); padding: 10px; border-radius: 10px; display: flex; align-items: center; gap: 8px; }
.sms-row .sms { flex: 1; padding: 0; background: none; margin: 0; }
.sms { background: var(--bg); padding: 10px; border-radius: 10px; font-size: 18px; font-weight: 700; color: var(--success); letter-spacing: 1px; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.btn { padding: 14px 16px; border-radius: 12px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn.primary { background: var(--accent); color: #1a1a1a; }
.btn.ghost { background: var(--bg-3); color: var(--text); }
.btn:disabled { opacity: .55; cursor: default; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--bg-3); color: var(--text); padding: 12px 18px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.4); z-index: 200; font-size: 14px; }

/* Clickable drawer row */
.row-line.clickable { cursor: pointer; transition: background .12s; }
.row-line.clickable:active { background: var(--bg); }

/* Language toggle */
.lang-toggle { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 3px; gap: 2px; }
.lang-btn { background: none; border: none; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit; }
.lang-btn.active { background: var(--accent); color: #1a1a1a; }

/* Modal head (shared) */
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 18px; flex: 1; }
.x-btn { background: none; border: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 10px; border-radius: 8px; }
.x-btn:active { background: var(--bg-3); }

/* Activations modal */
.activations-modal { max-height: 88vh; overflow-y: auto; }
.activations-list { display: flex; flex-direction: column; gap: 12px; }
.act-card { background: var(--bg-3); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.act-head { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.act-main { display: flex; align-items: center; gap: 12px; }
.act-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.act-svc { font-size: 16px; font-weight: 700; color: var(--text); }
.act-country { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.act-country .flag { font-size: 18px; line-height: 1; }
.act-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px; }
.act-actions .btn { padding: 10px 8px; font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#detService, #detCountry { display: inline-flex; align-items: center; gap: 8px; }
#detService .svc-ico-wrap, #detService .svc-letter { width: 22px; height: 22px; font-size: 11px; }
#detService .svc-logo { width: 22px; height: 22px; }
#detCountry .flag { font-size: 18px; }

.badge-btn { padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; border: none; cursor: pointer; font-family: inherit; }
.badge-btn.status-ok { background: rgba(74,210,142,.15); color: var(--success); cursor: default; }
.badge-btn.status-cancel { background: rgba(255,91,110,.15); color: var(--danger); cursor: default; }
.badge-btn.status-wait { background: rgba(255,179,58,.18); color: var(--accent); cursor: default; }

/* Details modal */
.det-rows { background: var(--bg-3); border-radius: 14px; padding: 4px 16px; margin-bottom: 14px; }
.det-row { display: flex; align-items: center; gap: 6px; padding: 12px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.det-row:last-child { border-bottom: none; }
.det-row > span:first-child { color: var(--muted); }
.det-row > span:last-child { font-weight: 600; color: var(--text); text-align: right; }
.dots-fill { flex: 1; min-width: 12px; }

.det-section { margin-bottom: 14px; }
.det-label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.copy-row { display: flex; align-items: center; gap: 10px; background: var(--bg-3); border-radius: 12px; padding: 12px 14px; }
.copy-row > span { flex: 1; font-weight: 700; font-size: 16px; letter-spacing: .3px; word-break: break-all; }
.copy-icon { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.copy-icon:active { background: var(--bg-2); color: var(--accent); }

.det-status-banner { padding: 12px 14px; border-radius: 12px; text-align: center; font-weight: 700; font-size: 15px; }
.det-status-banner.status-ok { background: rgba(74,210,142,.15); color: var(--success); }
.det-status-banner.status-cancel { background: rgba(255,91,110,.15); color: var(--danger); }
.det-status-banner.status-wait { background: rgba(255,179,58,.18); color: var(--accent); }

#insufficientModal .insufficient-modal-inner { background: var(--bg-2); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 28px 22px; text-align: center; position: relative; }
#insufficientModal .insufficient-x { position: absolute; top: 10px; right: 12px; }
#insufficientModal .insufficient-icon { font-size: 44px; margin-bottom: 8px; }
#insufficientModal h3 { margin: 0 0 6px; font-size: 20px; }
#insufficientModal .muted { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
#insufficientModal .insufficient-detail { background: var(--bg-3); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--text); margin-bottom: 16px; }
#insufficientModal .actions { display: flex; flex-direction: column; gap: 8px; }
