/* ═══════════════════════════════════════════════════════════════════════════
   BundleFlow Mini App — shared design system
   Telegram-native dark. One source of truth for every mini-app screen
   (buy, wallet, orders, agent dashboard, admin).

   This is the same design system TeleFlow runs on — same elevation ladder,
   type scale, spacing and component set — so the two apps read as one family.
   BundleFlow-specific components (network picker, bundle grid, PIN pad,
   receipts) live in the last section rather than being re-invented inline.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Surfaces: bg → elev → card → field ──────────────────────────── */
  --bg:        #17212b;
  --elev:      #1c2733;
  --card:      #232e3c;
  --card2:     #1c2733;   /* legacy alias, kept so old markup still lands right */
  --field:     #1a242f;
  --overlay:   rgba(10, 16, 22, .72);

  /* ── Hairlines ───────────────────────────────────────────────────── */
  --line:      rgba(255, 255, 255, .07);
  --line-2:    rgba(255, 255, 255, .12);
  --div:       #293949;   /* legacy alias */

  /* ── Ink ─────────────────────────────────────────────────────────── */
  --text:      #ffffff;
  --text-2:    #aebac8;
  --sub:       #7d8b99;

  /* ── Accents ─────────────────────────────────────────────────────── */
  --accent:    #2cabf8;
  --accent-dim:rgba(44, 171, 248, .14);
  --btn:       #2481cc;
  --btn-hi:    #2f92e0;
  --on-btn:    #ffffff;

  --ok:        #4cbb63;
  --ok-dim:    rgba(76, 187, 99, .14);
  --warn:      #f2a63b;
  --warn-dim:  rgba(242, 166, 59, .14);
  --danger:    #eb5757;
  --danger-dim:rgba(235, 87, 87, .13);
  --purple:    #b56ce0;
  --purple-dim:rgba(181, 108, 224, .14);
  --whatsapp:  #25d366;

  /* ── Radii ───────────────────────────────────────────────────────── */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* ── Chrome heights ──────────────────────────────────────────────── */
  --appbar-h: 52px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --shadow-dock: 0 -8px 24px rgba(0, 0, 0, .35);
  --shadow-pop:  0 12px 40px rgba(0, 0, 0, .5);
  --ease: cubic-bezier(.32, .72, 0, 1);
}

/* ═══ Reset ══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }
svg { flex-shrink: 0; }

::-webkit-scrollbar { width: 0; height: 0; }

/* ═══ App shell ══════════════════════════════════════════════════════ */
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
}
.page.active { display: block; animation: tf-in .22s var(--ease); }

/* Pages that dock a CTA at the bottom need room for it as well. */
.page.has-dock { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px); }
.page.no-tabbar { padding-bottom: calc(var(--safe-b) + 20px); }
.page.no-tabbar.has-dock { padding-bottom: calc(var(--safe-b) + 96px); }

@keyframes tf-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pad     { padding: 0 14px; }
.pad-v   { padding: 14px; }
.section-pad { padding: 14px; }   /* legacy alias */
.stack > * + * { margin-top: 10px; }
.sp-8  { height: 8px; }
.sp-16 { height: 16px; }
.sp-24 { height: 24px; }

/* ═══ Typography ═════════════════════════════════════════════════════ */
.t-hero   { font-size: 26px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15; }
.t-title  { font-size: 20px; font-weight: 700; letter-spacing: -.35px; line-height: 1.25; }
.t-lg     { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.t-md     { font-size: 15px; font-weight: 600; }
.t-body   { font-size: 14px; color: var(--text-2); line-height: 1.55; }
.t-sm     { font-size: 13px; color: var(--sub); }
.t-xs     { font-size: 12px; color: var(--sub); }
.t-mono   { font-variant-numeric: tabular-nums; }
.t-num    { font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.t-hint   { color: var(--sub); }
.t-accent { color: var(--accent); }
.t-ok     { color: var(--ok); }
.t-danger { color: var(--danger); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.clamp-2  { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Group caption above a card — Telegram's signature grouped-list heading. */
.group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: .7px;
  padding: 18px 4px 8px;
}
.group-title:first-child { padding-top: 4px; }
.settings-group-title { /* legacy alias */
  font-size: 12px; font-weight: 700; color: var(--sub);
  text-transform: uppercase; letter-spacing: .7px; margin-bottom: 8px; padding-left: 4px;
}
.section-title { /* legacy alias */
  font-size: 12px; font-weight: 700; color: var(--sub);
  text-transform: uppercase; letter-spacing: .7px; padding: 16px 14px 8px;
}

/* ═══ App bar ════════════════════════════════════════════════════════ */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--appbar-h);
  padding: 8px 12px;
  /* Solid first: engines without color-mix (older Android WebViews) would
     otherwise drop the declaration entirely and render a transparent bar. */
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.appbar.scrolled { border-bottom-color: var(--line); }
.appbar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar-sub { font-size: 12px; font-weight: 500; color: var(--sub); margin-top: -2px; }
.appbar-actions { display: flex; align-items: center; gap: 4px; }

/* legacy alias so untouched markup keeps working */
.page-header { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  position: sticky; top: 0; background: var(--bg); z-index: 30; min-height: var(--appbar-h); }
.page-title { font-size: 17px; font-weight: 700; flex: 1; letter-spacing: -.2px; }

/* Icon button — 40px hit area, 22px glyph */
.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--r-pill);
  background: transparent; color: var(--accent);
  transition: background .15s, transform .1s;
}
.icon-btn:active { background: rgba(255,255,255,.08); transform: scale(.92); }
.icon-btn.plain { color: var(--text-2); }
.icon-btn.tonal { background: rgba(255,255,255,.07); }
.back-btn { /* legacy alias */
  width: 40px; height: 40px; margin-left: -8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--r-pill); background: transparent; color: var(--accent);
}
.back-btn:active { background: rgba(255,255,255,.08); }

/* ═══ Tab bar ════════════════════════════════════════════════════════ */
#bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: flex;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
#bottom-nav.hidden { display: none; }

.nav-btn {
  position: relative;
  flex: 1;
  min-width: 0;
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  color: var(--sub);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1px;
  transition: color .18s;
}
.nav-btn svg { width: 23px; height: 23px; transition: transform .18s var(--ease); }
.nav-btn.active { color: var(--accent); }
.nav-btn.active svg { transform: translateY(-1px) scale(1.04); }
.nav-btn:active svg { transform: scale(.9); }
.nav-btn::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  width: 22px; height: 2.5px; border-radius: 0 0 3px 3px;
  background: var(--accent);
  transform: translateX(-50%) scaleX(0);
  transition: transform .22s var(--ease);
}
.nav-btn.active::before { transform: translateX(-50%) scaleX(1); }

.badge {
  position: absolute;
  top: 7px; left: 50%;
  margin-left: 4px;
  min-width: 17px; height: 17px;
  padding: 0 5px;
  display: none;
  align-items: center; justify-content: center;
  background: var(--danger);
  color: #fff;
  font-size: 10px; font-weight: 800;
  border-radius: var(--r-pill);
  border: 2px solid var(--card);
  box-sizing: content-box;
}
.badge.show { display: flex; }

/* ═══ Bottom action dock ═════════════════════════════════════════════ */
.dock {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 50;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-dock);
  display: none;
  animation: tf-dock-up .28s var(--ease);
}
.dock.show { display: block; }
/* When the tab bar is also on screen the dock sits directly on top of it. */
.dock.above-tabs { bottom: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: 10px; }
@keyframes tf-dock-up { from { transform: translateY(100%); } to { transform: none; } }

.dock-row { display: flex; align-items: center; gap: 10px; }
.dock-total { flex-shrink: 0; }
.dock-total .lbl { font-size: 11px; color: var(--sub); text-transform: uppercase; letter-spacing: .5px; }
.dock-total .val { font-size: 19px; font-weight: 800; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.dock-row .btn { flex: 1; }

/* ═══ Cards & grouped lists ══════════════════════════════════════════ */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 10px;
}
.card-pad { padding: 14px; }
.card.flat { background: var(--elev); }
.card.outline { background: transparent; border: 1px solid var(--line-2); }

/* Grouped list: rows separated by inset hairlines, like Telegram settings. */
.list { background: var(--card); border-radius: var(--r-lg); overflow: hidden; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  position: relative;
  min-height: 52px;
  transition: background .12s;
}
.list-row + .list-row::before {
  content: '';
  position: absolute; top: 0; left: 14px; right: 0;
  height: 1px; background: var(--line);
}
.list-row.tappable:active { background: rgba(255,255,255,.05); }
.list-row.inset-full + .list-row.inset-full::before { left: 0; }
.list-row .lr-main { flex: 1; min-width: 0; }
/* display:block so these work as either <div> or <span> */
.list-row .lr-title { display: block; font-size: 15px; font-weight: 600; }
.list-row .lr-sub   { display: block; font-size: 13px; color: var(--sub); margin-top: 1px; }
.list-row .lr-value { font-size: 15px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.list-row .lr-chev  { color: var(--sub); opacity: .7; }

/* Key/value row inside a padded card */
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 0; font-size: 14px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row-label { color: var(--sub); flex-shrink: 0; }
.row-value { text-align: right; font-variant-numeric: tabular-nums; }

/* Avatar / thumbnail */
.thumb {
  width: 48px; height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--elev);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.thumb.sm { width: 38px; height: 38px; border-radius: 10px; font-size: 16px; }
.thumb.lg { width: 60px; height: 60px; border-radius: 14px; font-size: 24px; }

/* ═══ Buttons ════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border: none;
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.1px;
  transition: transform .1s var(--ease), opacity .15s, background .15s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.975); opacity: .9; }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn-primary   { background: var(--btn);        color: var(--on-btn); }
.btn-primary:active { background: var(--btn-hi); }
.btn-tonal     { background: var(--accent-dim); color: var(--accent); }
.btn-secondary { background: var(--accent-dim); color: var(--accent); }  /* legacy alias */
.btn-neutral   { background: rgba(255,255,255,.08); color: var(--text); }
.btn-success   { background: var(--ok);         color: #08240f; }
.btn-danger    { background: var(--danger-dim); color: var(--danger); }
.btn-danger-solid { background: var(--danger);  color: #fff; }
.btn-warn      { background: var(--warn);       color: #241704; }
.btn-ghost     { background: transparent;       color: var(--sub); min-height: 40px; font-weight: 600; }
.btn-ghost:active { background: rgba(255,255,255,.05); }
.btn-whatsapp  { background: rgba(37,211,102,.14); color: var(--whatsapp); }

.btn-lg { min-height: 52px; font-size: 16px; border-radius: var(--r-lg); }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 13.5px; border-radius: var(--r-sm); width: auto; }
.btn-xs { min-height: 30px; padding: 5px 11px; font-size: 12.5px; border-radius: 9px; width: auto; gap: 5px; }
.btn-xs svg { width: 14px; height: 14px; }
.btn-auto { width: auto; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* Busy state — swaps the label for a spinner without changing width */
.btn.is-busy { pointer-events: none; color: transparent !important; position: relative; }
.btn.is-busy::after {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.28);
  border-top-color: currentColor;
  border-radius: 50%;
  color: var(--on-btn);
  animation: tf-spin .65s linear infinite;
}

/* Floating action button */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  z-index: 55;
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--r-pill);
  background: var(--btn); color: #fff;
  box-shadow: 0 6px 20px rgba(36,129,204,.45);
  transition: transform .12s var(--ease);
}
.fab:active { transform: scale(.9); }
.fab svg { width: 26px; height: 26px; }

/* ═══ Chips / segmented ══════════════════════════════════════════════ */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 14px 10px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chips::after { content: ''; flex: 0 0 4px; }

.chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s, color .15s, transform .1s;
}
.chip:active { transform: scale(.95); }
.chip.active { background: var(--btn); color: #fff; }
.chip .cnt {
  font-size: 11px; font-weight: 700; opacity: .65;
  font-variant-numeric: tabular-nums;
}
/* legacy aliases */
.cat-chip, .filter-chip { flex-shrink: 0; padding: 8px 15px; border: none; border-radius: var(--r-pill);
  background: var(--card); color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.cat-chip.active, .filter-chip.active { background: var(--btn); color: #fff; }
.cat-scroll, .filter-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 4px 14px 10px; scrollbar-width: none; }
.cat-scroll::-webkit-scrollbar, .filter-scroll::-webkit-scrollbar { display: none; }

/* Segmented control (compact, for period toggles) */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.07);
  gap: 2px;
}
.segmented button {
  border: none; background: transparent;
  color: var(--sub);
  font-size: 12px; font-weight: 700;
  padding: 5px 11px;
  border-radius: 7px;
  transition: background .15s, color .15s;
}
.segmented button.active { background: var(--btn); color: #fff; }

/* ═══ Form fields ════════════════════════════════════════════════════ */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--sub);
  letter-spacing: .2px;
  margin-bottom: 6px;
}
.form-label .req { color: var(--danger); }

.form-input {
  width: 100%;
  min-height: 48px;
  background: var(--field);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 16px;   /* 16px stops iOS zooming the viewport on focus */
  color: var(--text);
  outline: none;
  transition: border-color .18s, background .18s;
}
.form-input::placeholder { color: var(--sub); }
.form-input:focus { border-color: var(--accent); background: var(--elev); }
.form-input.invalid { border-color: var(--danger); }
textarea.form-input { min-height: 84px; resize: vertical; line-height: 1.5; padding-top: 12px; }
select.form-input {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237d8b99' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
}
.form-hint { font-size: 12px; color: var(--sub); margin-top: 6px; line-height: 1.45; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 6px; display: none; }
.field.invalid .form-error { display: block; }

/* Input with a trailing attached action (coupon code, search) */
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .form-input { flex: 1; }
.input-group .btn { width: auto; flex-shrink: 0; min-height: 48px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border-radius: var(--r-md);
  padding: 0 14px;
  min-height: 44px;
  transition: background .18s;
}
.search-bar:focus-within { background: var(--elev); box-shadow: inset 0 0 0 1.5px var(--accent); }
.search-bar svg { color: var(--sub); width: 18px; height: 18px; }
.search-bar input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--text);
  font-size: 16px;
  padding: 11px 0;
}
.search-bar input::placeholder { color: var(--sub); }
.search-bar input::-webkit-search-cancel-button { display: none; }

/* Toggle switch */
.toggle-switch { position: relative; width: 46px; height: 28px; flex-shrink: 0; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.14);
  border-radius: var(--r-pill);
  transition: background .22s var(--ease);
}
.slider::before {
  content: ''; position: absolute;
  width: 22px; height: 22px; top: 3px; left: 3px;
  background: #fff; border-radius: 50%;
  transition: transform .22s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
input:checked + .slider { background: var(--ok); }
input:checked + .slider::before { transform: translateX(18px); }

/* ═══ Tags / status pills ════════════════════════════════════════════ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .1px;
  background: rgba(255,255,255,.08);
  color: var(--text-2);
  white-space: nowrap;
}
.tag-pending, .tag-trial          { background: var(--warn-dim);   color: var(--warn); }
.tag-payment_confirmed,
.tag-payment_pending,
.tag-processing,
.tag-confirmed                    { background: var(--accent-dim); color: var(--accent); }
.tag-shipped                      { background: var(--purple-dim); color: var(--purple); }
.tag-delivered, .tag-active       { background: var(--ok-dim);     color: var(--ok); }
.tag-cancelled, .tag-expired,
.tag-suspended                    { background: var(--danger-dim); color: var(--danger); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* Callout banner */
.callout {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--accent-dim);
  color: var(--text-2);
  border: 1px solid transparent;
}
.callout b { color: var(--text); }
.callout svg { width: 18px; height: 18px; margin-top: 1px; color: var(--accent); }
.callout.ok     { background: var(--ok-dim); }
.callout.ok svg { color: var(--ok); }
.callout.warn   { background: var(--warn-dim); }
.callout.warn svg { color: var(--warn); }
.callout.danger { background: var(--danger-dim); }
.callout.danger svg { color: var(--danger); }

/* ═══ Product grid ═══════════════════════════════════════════════════ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 2px 14px 14px;
}

.product-card {
  background: var(--card);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  transition: transform .12s var(--ease);
  display: flex;
  flex-direction: column;
}
.product-card:active { transform: scale(.972); }

.pc-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--elev);
  overflow: hidden;
}
.pc-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-media .no-img,
.no-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  background: var(--elev);
  opacity: .55;
}

.pc-badges { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.pc-badge {
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: 10.5px; font-weight: 800;
  letter-spacing: .3px;
  background: var(--danger); color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.pc-badge.low { background: var(--warn); color: #241704; }

.pc-oos {
  position: absolute; inset: 0;
  background: rgba(12,18,25,.62);
  backdrop-filter: blur(1.5px);
  display: flex; align-items: center; justify-content: center;
}
.pc-oos span {
  font-size: 11.5px; font-weight: 800; letter-spacing: .6px;
  text-transform: uppercase;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: rgba(0,0,0,.55); color: #fff;
}

.pc-add {
  position: absolute; right: 8px; bottom: 8px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--r-pill);
  background: rgba(23,33,43,.82);
  backdrop-filter: blur(10px);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
  transition: transform .12s var(--ease), background .15s;
}
.pc-add:active { transform: scale(.85); background: var(--btn); color: #fff; }
.pc-add svg { width: 19px; height: 19px; }

.pc-body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pc-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.pc-price-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 3px; }
.pc-price { font-size: 15px; font-weight: 800; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.pc-price.sale { color: var(--danger); }
.pc-price-was { font-size: 11.5px; color: var(--sub); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.pc-meta { font-size: 11px; color: var(--sub); }

/* legacy aliases */
.product-card-body { padding: 10px 11px 12px; }
.product-card-name { font-size: 13.5px; font-weight: 600; }

/* ═══ Shop header (storefront) ═══════════════════════════════════════ */
.shop-hero { position: relative; margin-bottom: 14px; }
.shop-banner-wrap { position: relative; }
.shop-banner {
  width: 100%;
  height: 118px;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #24425e, #16222e);
}
/* Fade the banner into the page so the identity block below it stays legible. */
.shop-banner-wrap::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 60px;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
}
.shop-ident {
  position: relative;
  z-index: 1;
  margin-top: -26px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.shop-avatar {
  width: 56px; height: 56px;
  border-radius: 17px;
  background: linear-gradient(140deg, var(--btn), #1b6ba8);
  border: 3px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.shop-meta { flex: 1; min-width: 0; }
.shop-name { font-size: 19px; font-weight: 800; letter-spacing: -.35px; }
.shop-tagline { font-size: 13px; color: var(--sub); margin-top: 1px; line-height: 1.4; }

/* ═══ Product detail ═════════════════════════════════════════════════ */
.gallery { position: relative; background: var(--elev); }
.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track img {
  flex: 0 0 100%;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  scroll-snap-align: center;
  display: block;
}
.gallery-empty {
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; opacity: .4;
}
.gallery-dots {
  position: absolute; bottom: 12px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 5px;
}
.gallery-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.4);
  transition: width .22s var(--ease), background .22s;
}
.gallery-dots i.on { width: 18px; border-radius: 3px; background: #fff; }
.gallery-count {
  position: absolute; top: 12px; right: 12px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: rgba(0,0,0,.5); backdrop-filter: blur(8px);
  font-size: 11.5px; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums;
}

.pd-head { padding: 16px 14px 4px; }
.pd-price-row { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-top: 6px; }
.pd-price { font-size: 26px; font-weight: 800; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.pd-price.sale { color: var(--danger); }
.pd-was { font-size: 15px; color: var(--sub); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.pd-off {
  font-size: 11.5px; font-weight: 800; letter-spacing: .3px;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--danger-dim); color: var(--danger);
}

/* Variant option chips */
.variant-group { margin-bottom: 16px; }
.variant-label {
  font-size: 12px; font-weight: 700; color: var(--sub);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px;
}
.variant-label .picked { color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 600; }
.variant-options { display: flex; flex-wrap: wrap; gap: 8px; }
.variant-opt {
  min-width: 46px;
  padding: 9px 15px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 14px; font-weight: 600;
  transition: all .15s;
}
.variant-opt:active { transform: scale(.94); }
.variant-opt.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.var-opt { /* legacy alias */
  padding: 9px 15px; border: 1.5px solid var(--line-2); border-radius: var(--r-sm);
  background: transparent; color: var(--text); font-size: 14px; font-weight: 600;
}

/* ═══ Quantity stepper ═══════════════════════════════════════════════ */
.qty {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,.07);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.qty button {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--accent);
  transition: background .15s, transform .1s;
}
.qty button:active { background: rgba(255,255,255,.1); transform: scale(.88); }
.qty button:disabled { color: var(--sub); opacity: .5; pointer-events: none; }
.qty button svg { width: 15px; height: 15px; }
.qty .val {
  min-width: 26px; text-align: center;
  font-size: 14.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ═══ Cart rows ══════════════════════════════════════════════════════ */
.cart-item {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 12px;
  padding: 12px 14px;
  position: relative;
}
.cart-item + .cart-item::before {
  content: ''; position: absolute; top: 0; left: 14px; right: 14px; height: 1px; background: var(--line);
}
.cart-item-img { width: 62px; height: 62px; border-radius: 12px; object-fit: cover; background: var(--elev); }
.cart-item-name { font-size: 14.5px; font-weight: 600; }
.cart-vars { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cart-var {
  font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(255,255,255,.07); color: var(--text-2);
}
.cart-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; }
.cart-line-total { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }

/* Totals block */
.totals { padding: 4px 14px; }
.totals-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; font-size: 14px;
}
.totals-row .lbl { color: var(--sub); }
.totals-row .val { font-variant-numeric: tabular-nums; }
.totals-row.grand {
  border-top: 1px solid var(--line);
  margin-top: 4px; padding-top: 12px;
  font-size: 17px; font-weight: 800; letter-spacing: -.3px;
}
.totals-row.discount .val { color: var(--ok); }

/* ═══ Order status stepper ═══════════════════════════════════════════ */
.stepper { padding: 4px 2px; }
.step-item { display: flex; gap: 13px; position: relative; padding-bottom: 20px; }
.step-item:last-child { padding-bottom: 0; }
.step-item::before {
  content: '';
  position: absolute; left: 10px; top: 22px; bottom: -2px;
  width: 2px; background: var(--line-2); border-radius: 1px;
}
.step-item:last-child::before { display: none; }
.step-item.done::before { background: var(--accent); }
.step-dot {
  width: 21px; height: 21px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; z-index: 1;
  color: transparent;
  transition: all .25s var(--ease);
}
.step-dot svg { width: 12px; height: 12px; }
.step-item.done .step-dot { border-color: var(--accent); background: var(--accent); color: #fff; }
/* The step in progress must NOT look like a completed one. It used to share
   the .done styling — filled, with a tick — so an order still at the network
   rendered a blue "Delivered ✓" it had not reached. Hollow and pulsing. */
.step-item.current .step-dot {
  border-color: var(--accent);
  background: var(--card);
  color: transparent;
  box-shadow: 0 0 0 4px var(--accent-dim);
  animation: bf-step-pulse 1.6s ease-in-out infinite;
}
.step-item.current .step-dot svg { display: none; }
.step-item.current .step-dot::after {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}
@keyframes bf-step-pulse {
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 12%, transparent); }
}
.step-item.current .step-name { color: var(--text); font-weight: 650; }
.step-body { padding-top: 1px; min-width: 0; }
.step-name { font-size: 14.5px; font-weight: 600; color: var(--sub); }
.step-item.done .step-name, .step-item.current .step-name { color: var(--text); }
.step-when { font-size: 12px; color: var(--sub); margin-top: 1px; }

/* ═══ Stats / KPI ════════════════════════════════════════════════════ */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi {
  position: relative;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 14px;
  overflow: hidden;
}
.kpi::after {
  content: '';
  position: absolute; right: -18px; bottom: -18px;
  width: 66px; height: 66px; border-radius: 50%;
  background: currentColor; opacity: .06;
}
.kpi-icon {
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: currentColor; margin-bottom: 9px;
}
.kpi-icon svg { width: 17px; height: 17px; color: var(--card); }
.kpi-val { font-size: 22px; font-weight: 800; letter-spacing: -.7px; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-label { font-size: 11.5px; color: var(--sub); font-weight: 600; margin-top: 2px; }
.kpi.a { color: var(--accent); }
.kpi.g { color: var(--ok); }
.kpi.w { color: var(--warn); }
.kpi.p { color: var(--purple); }

/* legacy stat aliases */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
.stat-card { background: var(--card); border-radius: var(--r-lg); padding: 14px; }
.stat-val { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.6px; }
.stat-label { font-size: 11.5px; color: var(--sub); font-weight: 600; margin-top: 2px; }

/* Menu tile grid (vendor dashboard) */
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: flex; align-items: center; gap: 11px;
  padding: 14px;
  border: none;
  border-radius: var(--r-lg);
  background: var(--card);
  color: var(--text);
  text-align: left;
  transition: transform .12s var(--ease), background .15s;
}
.tile:active { transform: scale(.97); background: var(--elev); }
.tile-icon {
  width: 36px; height: 36px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tile-icon svg { width: 19px; height: 19px; }
.tile-name { display: block; font-size: 14px; font-weight: 650; }
.tile-sub  { display: block; font-size: 11.5px; color: var(--sub); margin-top: 1px; }

/* ═══ Copyable link ══════════════════════════════════════════════════ */
.link-box {
  background: var(--field);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--accent);
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}

/* ═══ Empty states ═══════════════════════════════════════════════════ */
.empty {
  text-align: center;
  padding: 52px 28px;
  display: flex; flex-direction: column; align-items: center;
}
.empty-icon {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  margin-bottom: 16px;
}
.empty-icon svg { width: 32px; height: 32px; color: var(--sub); }
.empty-title { font-size: 17px; font-weight: 700; margin-bottom: 5px; }
.empty-text { font-size: 14px; color: var(--sub); line-height: 1.5; max-width: 270px; }
.empty .btn { width: auto; margin-top: 20px; padding-left: 26px; padding-right: 26px; }

/* ═══ Skeletons ══════════════════════════════════════════════════════ */
.skel {
  background: linear-gradient(100deg, var(--card) 30%, #2a3746 50%, var(--card) 70%);
  background-size: 220% 100%;
  animation: tf-shimmer 1.3s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes tf-shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }
.skel-card { border-radius: var(--r-lg); overflow: hidden; background: var(--card); }
.skel-line { height: 11px; border-radius: 5px; }

.spinner {
  width: 30px; height: 30px;
  border: 2.5px solid rgba(255,255,255,.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tf-spin .65s linear infinite;
}
@keyframes tf-spin { to { transform: rotate(360deg); } }
@keyframes spin  { to { transform: rotate(360deg); } }  /* legacy alias */
.loading-c { display: flex; justify-content: center; padding: 48px; }

/* ═══ Toast ══════════════════════════════════════════════════════════ */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  z-index: 300;
  max-width: calc(100vw - 40px);
  display: flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border-radius: var(--r-pill);
  background: rgba(35, 46, 60, .96);
  backdrop-filter: blur(16px) saturate(180%);
  color: #fff;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 12px) scale(.96);
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#toast.err { background: rgba(160, 42, 42, .96); }
#toast.ok  { background: rgba(30, 96, 52, .96); }
#toast svg { width: 17px; height: 17px; }

/* ═══ Bottom sheet ═══════════════════════════════════════════════════ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop.open { display: flex; animation: tf-fade .2s ease; }
@keyframes tf-fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 10px 18px calc(24px + var(--safe-b));
  animation: tf-sheet-up .3s var(--ease);
  max-height: 88dvh;
  overflow-y: auto;
}
@keyframes tf-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grab {
  width: 38px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.18);
  margin: 0 auto 16px;
}
.sheet-icon { font-size: 38px; text-align: center; margin-bottom: 10px; }
.sheet-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 7px; letter-spacing: -.2px; }
.sheet-body { font-size: 14px; color: var(--sub); text-align: center; line-height: 1.55; margin-bottom: 20px; }

/* ═══ Progress (onboarding) ══════════════════════════════════════════ */
.progress { display: flex; gap: 5px; }
.prog-dot { flex: 1; height: 3.5px; border-radius: 2px; background: rgba(255,255,255,.12); transition: background .3s var(--ease); }
.prog-dot.done { background: var(--accent); }

.step { display: none; }
.step.active { display: block; animation: tf-in .25s var(--ease); }

/* Numbered instruction list */
.steps-help { display: flex; flex-direction: column; gap: 13px; }
.steps-help-row { display: flex; gap: 11px; align-items: flex-start; }
.steps-help-num {
  width: 25px; height: 25px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.steps-help-txt { font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.steps-help-txt b { color: var(--text); }

code {
  background: rgba(255,255,255,.08);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ═══ Misc utilities ═════════════════════════════════════════════════ */
.flex     { display: flex; }
.between  { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.center   { display: flex; align-items: center; justify-content: center; }
.va-center{ display: flex; align-items: center; gap: 8px; }
.grow     { flex: 1; min-width: 0; }
.hide     { display: none !important; }
.tar      { text-align: right; }
.tac      { text-align: center; }

.hairline { height: 1px; background: var(--line); margin: 14px 0; }
.divider  { height: 1px; background: var(--line); margin: 16px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BundleFlow additions
   Everything above is shared with TeleFlow verbatim. Below are the pieces
   only a data-bundle app needs.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --mtn:     #ffcc00;
  --telecel: #ef4444;
  --at:      #4a9eff;
}

/* ── Balance header ─────────────────────────────────────────────────
   The wallet number is the first thing a buyer looks for, so it gets a
   dedicated surface at the top of Home rather than a row in a list. */
.balance {
  position: relative;
  margin: 0 14px 14px;
  padding: 18px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #1f5f96, #17384f 60%, #1a2a38);
  overflow: hidden;
}
.balance::after {
  content: '';
  position: absolute; right: -40px; top: -50px;
  width: 170px; height: 170px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.balance-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: rgba(255,255,255,.62);
}
.balance-value {
  font-size: 32px; font-weight: 800; letter-spacing: -1.1px;
  font-variant-numeric: tabular-nums; margin-top: 2px; line-height: 1.1;
}
.balance-value .cur { font-size: 17px; font-weight: 700; opacity: .7; margin-right: 4px; }
.balance-actions { display: flex; gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.balance-actions .btn { min-height: 40px; font-size: 13.5px; border-radius: var(--r-sm); }
.balance-actions .btn-glass {
  background: rgba(255,255,255,.14); color: #fff;
  backdrop-filter: blur(8px);
}

/* ── Network picker ─────────────────────────────────────────────────
   Three tiles, colour-keyed to the carrier so the choice is pre-attentive. */
.net-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 14px; }
.net-tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 15px 8px;
  border: 1.5px solid transparent;
  border-radius: var(--r-lg);
  background: var(--card);
  color: var(--text);
  transition: transform .12s var(--ease), border-color .18s, background .18s;
}
.net-tile:active { transform: scale(.95); }
.net-tile.selected { border-color: currentColor; background: var(--elev); }
/* A tinted disc, not a solid one — a solid fill washes the emoji out and
   makes the two red carriers indistinguishable. */
.net-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
  background: color-mix(in srgb, currentColor 22%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, currentColor 40%, transparent);
}
.net-name { font-size: 12px; font-weight: 650; color: var(--text); letter-spacing: -.1px; }
.net-tile.mtn { color: var(--mtn); }
.net-tile.telecel { color: var(--telecel); }
.net-tile.at { color: var(--at); }

/* ── Bundle grid ────────────────────────────────────────────────────
   Size is the headline, price the supporting line — buyers scan for "10 GB". */
.bundle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 2px 14px 14px;
}
.bundle-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  min-height: 78px;
  padding: 12px 6px;
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--text);
  transition: transform .12s var(--ease), border-color .16s, background .16s;
}
.bundle-card:active { transform: scale(.94); }
.bundle-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.bundle-size { font-size: 17px; font-weight: 800; letter-spacing: -.5px; }
.bundle-price {
  font-size: 12px; font-weight: 600; color: var(--sub);
  font-variant-numeric: tabular-nums;
}
.bundle-card.selected .bundle-price { color: var(--accent); }
.bundle-card .flag {
  position: absolute; top: -5px; right: -3px;
  padding: 2px 6px; border-radius: var(--r-pill);
  font-size: 9px; font-weight: 800; letter-spacing: .3px;
  background: var(--ok); color: #06210d;
}

/* ── Recipient field with a favourites shortcut ─────────────────────*/
.recipient-row { display: flex; gap: 8px; align-items: stretch; }
.recipient-row .form-input { flex: 1; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.fav-pills { display: flex; gap: 7px; overflow-x: auto; padding: 9px 0 2px; scrollbar-width: none; }
.fav-pills::-webkit-scrollbar { display: none; }
.fav-pill {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border: none; border-radius: var(--r-pill);
  background: rgba(255,255,255,.07);
  color: var(--text-2);
  font-size: 12.5px; font-weight: 600;
}
.fav-pill:active { background: var(--accent-dim); color: var(--accent); }
.fav-pill .num { font-variant-numeric: tabular-nums; opacity: .65; font-size: 11.5px; }

/* ── Order summary ──────────────────────────────────────────────────*/
.summary-hero {
  text-align: center;
  padding: 22px 14px 6px;
}
.summary-size { font-size: 38px; font-weight: 800; letter-spacing: -1.4px; line-height: 1; }
.summary-to { font-size: 13.5px; color: var(--sub); margin-top: 7px; }
.summary-to b { color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: .4px; }

/* ── PIN pad ────────────────────────────────────────────────────────
   A numeric keypad, not a text input: the WebView keyboard covers half the
   screen and reorders the layout every time it opens. */
.pin-dots { display: flex; justify-content: center; gap: 14px; padding: 6px 0 22px; }
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255,255,255,.13);
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.pin-dot.on { background: var(--accent); transform: scale(1.14); }
.pin-dot.err { background: var(--danger); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button {
  min-height: 56px;
  border: none; border-radius: var(--r-md);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 22px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background .12s, transform .1s var(--ease);
}
.keypad button:active { background: rgba(255,255,255,.14); transform: scale(.94); }
.keypad button.ghost { background: transparent; color: var(--sub); font-size: 15px; font-weight: 650; }

/* ── Receipt ────────────────────────────────────────────────────────*/
.receipt-mark {
  width: 74px; height: 74px; margin: 6px auto 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ok-dim); color: var(--ok);
}
.receipt-mark.pending { background: var(--warn-dim); color: var(--warn); }
.receipt-mark.err { background: var(--danger-dim); color: var(--danger); }
.receipt-mark svg { width: 34px; height: 34px; }
.receipt-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; color: var(--sub); word-break: break-all;
}

/* ── Amount chips (top-up presets) ──────────────────────────────────*/
.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.amount-chip {
  padding: 13px 6px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  font-size: 15px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: all .15s;
}
.amount-chip:active { transform: scale(.94); }
.amount-chip.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

/* ── Sparkline / bar chart (admin) ──────────────────────────────────*/
.chart {
  display: flex; align-items: flex-end; gap: 3px;
  height: 92px; padding: 0 2px;
}
.chart-bar {
  flex: 1; min-width: 0;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  opacity: .85;
  transition: height .4s var(--ease);
  min-height: 2px;
}
.chart-bar.zero { background: var(--line-2); }
.chart-axis {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--sub); padding-top: 7px;
  font-variant-numeric: tabular-nums;
}

/* ── Money delta ────────────────────────────────────────────────────*/
.delta { font-variant-numeric: tabular-nums; font-weight: 700; }
.delta.up   { color: var(--ok); }
.delta.down { color: var(--danger); }

/* ── Compact two-column meta grid ───────────────────────────────────*/
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 10px; }
.meta-grid .k { font-size: 11px; color: var(--sub); text-transform: uppercase; letter-spacing: .5px; }
.meta-grid .v { font-size: 14.5px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Reduce the bundle grid to two columns on very narrow phones. */
@media (max-width: 340px) {
  .bundle-grid, .amount-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══ Arcade, guide, gifting, deal ═══════════════════════════════════
   Added when the games hub, the guide and gifting moved out of the chat
   and into the mini app. Everything below reuses the tokens above — no new
   colours, so a theme change still only happens in one place. */

/* ── Daily-cap bar ──────────────────────────────────────────────────
   A real bar, unlike `.progress`, which is the segmented onboarding dots. */
.cap-bar {
  height: 6px; border-radius: 3px; overflow: hidden;
  background: rgba(255,255,255,.10);
}
.cap-bar i {
  display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  transition: width .45s var(--ease);
}

/* ── Check-in streak ────────────────────────────────────────────────
   Seven days across, so the whole week is legible at a glance. Scrolls
   rather than shrinks below ~330px, where 7 columns stop being readable. */
.streak {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px; overflow-x: auto; scrollbar-width: none;
}
.streak::-webkit-scrollbar { display: none; }
.streak-day {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 2px; border-radius: var(--r-md);
  background: rgba(255,255,255,.04);
  border: 1px solid transparent;
  min-width: 38px;
}
.streak-n {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
  background: rgba(255,255,255,.09); color: var(--sub);
}
.streak-kb { font-size: 9.5px; color: var(--sub); white-space: nowrap; }
.streak-day.done .streak-n { background: var(--ok); color: #fff; }
.streak-day.now {
  background: var(--accent-dim); border-color: var(--accent);
}
.streak-day.now .streak-n { background: var(--accent); color: #fff; }
.streak-day.now .streak-kb { color: var(--text); font-weight: 650; }

/* ── Deal of the day ────────────────────────────────────────────────*/
.deal-card {
  width: 100%; display: flex; align-items: center; gap: 12px;
  text-align: left; position: relative; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--warn) 13%, var(--card)), var(--card));
}
.deal-card:active { transform: scale(.985); }
.deal-flag {
  position: absolute; top: 0; right: 0;
  font-size: 8.5px; font-weight: 800; letter-spacing: .8px;
  padding: 3px 8px; border-bottom-left-radius: var(--r-md);
  background: var(--warn); color: #1a1200;
}
.deal-main { flex: 1; min-width: 0; }
.deal-title { display: block; font-size: 15px; font-weight: 700; }
.deal-sub { display: block; font-size: 12px; color: var(--sub); margin-top: 2px; }
.deal-price { text-align: right; flex-shrink: 0; }
.deal-now { display: block; font-size: 16px; font-weight: 800; color: var(--warn); }
.deal-was {
  display: block; font-size: 11.5px; color: var(--sub);
  text-decoration: line-through;
}

/* ── Guide body ─────────────────────────────────────────────────────
   The guide is written for a chat window: hard-wrapped, blank-line
   paragraphs, no markup beyond bold and code. `pre-wrap` keeps the author's
   line breaks, which is the whole shape of the text. */
.guide-body {
  white-space: pre-wrap;
  font-size: 14.5px; line-height: 1.62; color: var(--text-2);
  word-break: break-word;
}
.guide-body b { color: var(--text); font-weight: 650; }
.guide-body code {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 13px; padding: 1px 5px; border-radius: 5px;
  background: rgba(255,255,255,.08);
}

/* ── Bundle card, out of reach ──────────────────────────────────────*/
.bundle-card.is-oos { opacity: .4; }
.bundle-card.is-oos:active { transform: none; }

/* ── Admin banner preview ───────────────────────────────────────────*/
.banner-preview {
  width: 100%; border-radius: var(--r-lg); display: block;
  background: rgba(255,255,255,.05); aspect-ratio: 16 / 9; object-fit: cover;
}

/* ── Delivery tracking ──────────────────────────────────────────────
   A bundle can sit in DataMart's queue for hours. An order that is merely
   slow has to look different from one that is broken, or every slow order
   becomes a support message. */
.track-slow {
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--warn) 9%, var(--card)), var(--card));
}
.track-slow .t-title { color: var(--warn); }
