/* ---------- Icon ---------- */
.icon { width: 24px; height: 24px; flex-shrink: 0; display: inline-block; }
.icon svg { width: 100%; height: 100%; display: block; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-pill);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:disabled { background: #cbe2d3; color: #7b9a88; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--color-primary); border: 1.5px solid var(--color-primary); }
.btn-ghost { background: transparent; color: var(--color-text-general); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16);
  border: none;
  cursor: pointer;
  color: inherit;
}

/* ---------- Pill / badge ---------- */
.pill {
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.12);
  color: #fff;
  white-space: nowrap;
  cursor: pointer;
}
.chip {
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--color-border-1);
  background: #fff;
  color: var(--color-text-general);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
}
.badge-success { background: rgba(18,183,106,0.12); color: var(--color-success); }
.badge-warning { background: rgba(250,175,12,0.14); color: var(--color-warning); }
.badge-danger { background: rgba(255,64,64,0.12); color: var(--color-danger); }
.badge-info { background: rgba(51,139,255,0.12); color: var(--color-info); }

/* ---------- Card / panel ---------- */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
}
.panel {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ---------- Search bar ---------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: var(--radius-pill);
  padding: 13px 18px;
  box-shadow: var(--shadow-card);
  color: var(--color-text-placeholder);
  font-size: 14px;
}
.search-bar input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: var(--color-text-main);
  background: transparent;
}
.search-bar input::placeholder { color: var(--color-text-placeholder); }

/* ---------- Accordion ---------- */
.accordion-item {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  overflow: hidden;
}
.accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-main);
}
.accordion-head .chevron { transition: transform 0.2s; color: var(--color-text-secondary); }
.accordion-item.open .accordion-head .chevron { transform: rotate(180deg); }
.accordion-body {
  display: none;
  padding: 4px 14px 18px;
}
.accordion-item.open .accordion-body { display: block; }
.accordion-placeholder {
  padding: 18px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 13px;
}

/* ---------- Function grid ---------- */
.func-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 8px;
}
.func-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}
.func-item .func-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-floating);
  color: var(--color-header-bg);
}
.func-item .func-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-main);
  line-height: 1.25;
}
.func-item.on-dark .func-icon { background: rgba(255,255,255,0.16); color: #fff; }
.func-item.on-dark .func-label { color: #fff; }

/* ---------- Mini app grid (with monogram tiles) ---------- */
.miniapp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 10px;
}
.miniapp-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
}
.mono-tile {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}
/* Real app icons arrive at every aspect ratio and carry their own background
   colour; the tile clips them to one rounded square so the grid stays even,
   and the inset hairline keeps a white icon from bleeding into a white card. */
.miniapp-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  overflow: hidden;
  /* A faint tint rather than white: 21 icons decode over a few hundred
     milliseconds, and on white the un-decoded tiles read as broken. */
  background: var(--color-bg-floating);
  box-shadow: 0 3px 10px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(0,0,0,0.06);
  transition: transform 0.15s;
}
.miniapp-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.miniapp-item:active .miniapp-icon { transform: scale(0.92); }
.miniapp-item .miniapp-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-text-main);
  line-height: 1.25;
}

/* ---------- List rows ---------- */
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--color-border-2);
  cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row .row-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-floating);
  color: var(--color-header-bg);
  flex-shrink: 0;
}
.list-row .row-label { flex: 1; font-size: 14.5px; font-weight: 500; }
.list-row .row-chevron { color: var(--color-text-placeholder); }

/* ---------- Avatar ---------- */
.avatar {
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-height);
  background: #fff;
  border-top: 1px solid var(--color-border-2);
  display: flex;
  align-items: center;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 6px 0;
}
.nav-item.active { color: var(--color-header-bg); }
.nav-item .nav-label { font-size: 11px; font-weight: 600; }
.nav-fab {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: var(--shadow-float);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  border: 5px solid var(--color-page-bg);
  cursor: pointer;
  z-index: 21;
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--color-text-general); }
.field-input {
  border: 1.5px solid var(--color-border-1);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--color-text-main);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus { border-color: var(--color-primary); }
.field-input.error { border-color: var(--color-danger); }
.field-error { font-size: 12px; color: var(--color-danger); }
.field-tip { font-size: 12px; color: var(--color-text-secondary); }
.field-select { position: relative; }
.field-select select {
  appearance: none;
  width: 100%;
}

/* ---------- OTP boxes ---------- */
.otp-row { display: flex; gap: 10px; justify-content: center; }
.otp-box {
  width: 46px; height: 54px;
  border: 1.5px solid var(--color-border-1);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  outline: none;
}
.otp-box:focus { border-color: var(--color-primary); }

/* ---------- PIN boxes + keypad ---------- */
.pin-boxes { display: flex; gap: 10px; }
.pin-box {
  width: 44px; height: 52px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border-1);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.pin-box.active { border-color: var(--color-header-bg); }
.pin-box.filled::after {
  content: '';
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--color-text-main);
}
.pin-spacer { flex: 1; min-height: 24px; }
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.keypad-tile {
  border: none;
  background: #fff;
  font-size: 24px;
  font-weight: 600;
  padding: 16px 0;
  color: var(--color-text-main);
  cursor: pointer;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.keypad-tile:active { background: var(--color-bg-floating); }
.keypad-tile-icon {
  background: transparent;
  box-shadow: none;
  border: 1.5px solid var(--color-border-1);
  color: var(--color-text-secondary);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Segmented control (two-way toggle) ---------- */
.segmented {
  display: flex;
  background: var(--color-bg-floating);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
}
.segmented-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 0;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-general);
  cursor: pointer;
  text-align: center;
}
.segmented-btn.active { background: var(--color-header-bg); color: #fff; }

/* ---------- Phone input with country-code prefix ---------- */
.phone-input-row.field-input {
  display: flex;
  align-items: center;
  padding: 0;
  overflow: hidden;
}
.phone-prefix {
  padding: 14px 12px;
  font-weight: 700;
  color: var(--color-text-main);
  border-right: 1px solid var(--color-border-1);
  background: var(--color-bg-floating);
  flex-shrink: 0;
}
.phone-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  background: transparent;
  color: var(--color-text-main);
}
.phone-input:disabled { color: var(--color-text-secondary); }

/* ---------- Amount preset grid (Topup Airtime) ---------- */
.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.amount-tile {
  background: var(--color-bg-floating);
  border-radius: var(--radius-md);
  padding: 16px 6px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  color: var(--color-header-bg);
  cursor: pointer;
  border: 1.5px solid transparent;
}
.amount-tile.active { border-color: var(--color-header-bg); background: #fff; }
.amount-tile-unit { display: block; font-size: 10.5px; font-weight: 600; margin-top: 2px; color: var(--color-text-secondary); }
.amount-tile-custom {
  background: #fff;
  border: 1.5px dashed var(--color-header-bg);
  color: var(--color-header-bg);
  font-size: 13px;
  font-weight: 700;
}
.amount-tile-custom.active { border-style: solid; }

/* ---------- Package category grid (Topup Package) ---------- */
.package-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.package-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-bg-floating);
  border-radius: var(--radius-md);
  padding: 16px;
  border: none;
  cursor: pointer;
  text-align: left;
}
.package-icon { color: var(--color-header-bg); flex-shrink: 0; display: flex; }
.package-label { font-size: 12.5px; font-weight: 600; color: var(--color-text-main); line-height: 1.25; }

/* ---------- Operator select card ---------- */
.operator-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1.5px solid rgba(var(--brand-deep-rgb),0.35);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
}
.operator-badge {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}
.operator-badge.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }
.operator-name { font-size: 15px; font-weight: 700; color: var(--color-text-main); }

/* ---------- Summary / confirm rows ---------- */
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px dashed var(--color-border-1);
  font-size: 14px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row .k { color: var(--color-text-secondary); }
.summary-row .v { font-weight: 600; text-align: right; }

/* ---------- Receipt / success ---------- */
.success-check {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: rgba(18,183,106,0.12);
  color: var(--color-success);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}
.receipt {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.receipt-divider {
  height: 1px;
  background-image: linear-gradient(to right, var(--color-border-1) 50%, transparent 0);
  background-size: 10px 1px;
  margin: 14px 0;
}

/* ---------- Bottom sheet (payment cashier) ---------- */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 70;
  opacity: 0;
  transition: opacity 0.25s;
}
.sheet-backdrop.show { opacity: 1; }
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  z-index: 71;
  padding: 18px 20px calc(env(safe-area-inset-bottom) + 20px);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 84%;
  overflow-y: auto;
}
.sheet.show { transform: translateY(0); }
.sheet-close {
  position: absolute;
  top: 14px; right: 16px;
  width: 32px; height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-general);
  display: flex; align-items: center; justify-content: center;
}
.sheet-title {
  text-align: center;
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-top: 18px;
}
.sheet-amount {
  text-align: center;
  font-size: 38px;
  font-weight: 700;
  color: var(--color-text-main);
  margin: 6px 0 22px;
  letter-spacing: -1px;
}
.sheet-amount .cur {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-right: 6px;
  letter-spacing: 0;
}
.sheet-rows { border-top: 1px solid var(--color-border-2); }
.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border-2);
  font-size: 14px;
}
.sheet-row .k { color: var(--color-text-secondary); }
.sheet-row .v { font-weight: 600; color: var(--color-text-main); }
.sheet-row-btn {
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border-2);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
}
.sheet-row .method-v { display: inline-flex; align-items: center; gap: 6px; }
.sheet-row .method-v .icon { color: var(--color-header-bg); }
.sheet-row .method-v .chev { color: var(--color-text-placeholder); }
.sheet-pay { margin-top: 22px; }

.method-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 12px;
  border: 1.5px solid var(--color-border-1);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  margin-bottom: 10px;
  font-family: inherit;
  text-align: left;
}
.method-row.selected { border-color: var(--color-header-bg); background: rgba(var(--brand-deep-rgb),0.07); }
.method-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-floating);
  color: var(--color-header-bg);
  flex-shrink: 0;
}
.method-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.method-name { font-size: 14.5px; font-weight: 600; color: var(--color-text-main); }
.method-balance { font-size: 12px; color: var(--color-text-secondary); }
.method-check { color: var(--color-header-bg); flex-shrink: 0; }

/* ---------- Toast / loading overlay ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  flex-direction: column;
  gap: 12px;
}
.overlay.active { display: flex; }
.spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--color-border-1);
  border-top-color: var(--color-primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--nav-height) + 20px);
  transform: translateX(-50%);
  background: rgba(40,40,40,0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ---------- Screen top bar (secondary screens with back button) ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 8px;
  flex-shrink: 0;
}
.topbar .back-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-floating);
  border: none;
  cursor: pointer;
  color: var(--color-text-main);
}
.topbar .topbar-title { font-size: 16px; font-weight: 700; flex: 1; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 60px 24px;
  color: var(--color-text-secondary);
  text-align: center;
  font-size: 13px;
}
