/* TonyGamingTZ Store — red / black / white
   Mobile-first responsive design:
   - base:        320px and up (tiny phones)
   - sm:          ≥ 480px (most phones)
   - md:          ≥ 720px (tablets)
   - lg:          ≥ 980px (small laptops)
   - xl:          ≥ 1280px (desktops)
*/
:root {
  --red: #e10600;
  --red-dark: #b00500;
  --red-soft: #fde7e6;
  --black: #0a0a0a;
  --black-2: #161616;
  --grey-1: #f4f4f5;
  --grey-2: #e5e5e5;
  --grey-3: #9a9a9a;
  --white: #ffffff;
  --shadow: 0 6px 18px rgba(0,0,0,.08);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 72px;
  --content-max: 1180px;

  /* Fluid type — scales smoothly between viewport sizes */
  --fs-xs: clamp(10px, 1.6vw, 11px);
  --fs-sm: clamp(11px, 1.8vw, 13px);
  --fs-md: clamp(13px, 2.2vw, 15px);
  --fs-lg: clamp(15px, 2.6vw, 17px);
  --fs-xl: clamp(17px, 3vw, 22px);

  --pad-x: clamp(12px, 3vw, 24px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--black);
  background: var(--grey-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Prevent overscroll bounce showing white outside the app on iOS */
  overscroll-behavior-y: contain;
}

button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* App container scales up to a comfortable max width on big screens */
.app {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  max-width: var(--content-max);
  margin: 0 auto;
  background: var(--grey-1);
}

/* ========== TOP BAR ========== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--black);
  color: var(--white);
  padding: 10px var(--pad-x) 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  display: grid;
  gap: 10px;
  border-bottom: 3px solid var(--red);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: clamp(38px, 8vw, 48px);
  height: clamp(38px, 8vw, 48px);
  border-radius: 50%;
  object-fit: cover;
  background: transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
  flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong {
  font-size: var(--fs-md);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text small { color: #cfcfcf; font-size: var(--fs-xs); letter-spacing: .3px; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--white);
  border-radius: 999px;
  padding: 9px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  min-width: 0;
}
.search-icon { width: 18px; height: 18px; fill: var(--grey-3); flex: 0 0 auto; }
.search input {
  border: 0; outline: 0;
  background: transparent;
  flex: 1; min-width: 0;
  font-size: var(--fs-md);
  color: var(--black);
}
.search input::placeholder { color: var(--grey-3); }
.clear-btn {
  border: 0; background: var(--grey-2);
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 16px; line-height: 1; color: var(--black);
  flex: 0 0 auto;
}

/* ========== CONTENT ========== */
.content { padding: 14px var(--pad-x) 24px; }

.view { display: none; }
.view.active { display: block; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px;
  margin: 16px 4px 10px;
}
.section-head h2 { margin: 0; font-size: var(--fs-lg); }
.muted { color: var(--grey-3); font-size: var(--fs-sm); }

/* ========== CATEGORIES ========== */
.cats-wrap {
  position: relative;
  margin: 4px -4px 4px;
}
.categories {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 6px 36px 10px;        /* room for the arrows on each side */
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  /* Fade the edges so cards behind the arrows look clean */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
.categories::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--grey-2);
  background: var(--white);
  color: var(--black);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: transform .1s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.cat:active { transform: scale(.97); }
.cat.active {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

/* Scroll arrows */
.cat-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--grey-2);
  background: var(--white);
  color: var(--black);
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  transition: opacity .15s ease, transform .1s ease, background .15s ease, color .15s ease;
}
.cat-arrow svg { width: 18px; height: 18px; fill: currentColor; }
.cat-arrow:hover { background: var(--red); color: var(--white); border-color: var(--red); }
.cat-arrow:active { transform: translateY(-50%) scale(.94); }
.cat-arrow:disabled,
.cat-arrow[hidden] { display: none; }
.cat-arrow-left  { left: 2px; }
.cat-arrow-right { right: 2px; }

/* Hide arrows on touch-first devices where horizontal swipe is natural */
@media (hover: none) and (pointer: coarse) {
  .cat-arrow { display: none !important; }
  .categories {
    padding: 6px 4px 10px;
    -webkit-mask-image: none;
            mask-image: none;
  }
}

/* ========== PRODUCT GRID ========== */
/* Always at least 2 columns even on very small phones */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
  border: 1px solid var(--grey-2);
  min-width: 0;
}
.card .img-wrap {
  height: 240px;
  background: #f8f8f8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.card img { 
  max-width: 100%; 
  max-height: 100%; 
  object-fit: contain;
  display: block;
}
.card .info { padding: 10px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.card h3 {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.3;
  /* clamp to 2 lines without forcing a fixed min-height that breaks small screens */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.card .price { font-weight: 800; color: var(--black); font-size: var(--fs-md); }
.card .price .currency { color: var(--red); font-size: var(--fs-xs); margin-right: 4px; }
.card .meta {
  display: flex; gap: 6px; flex-wrap: wrap;
  font-size: var(--fs-xs); font-weight: 600;
}
.tag { padding: 3px 8px; border-radius: 999px; line-height: 1.2; }
.tag-boxed   { background: var(--red-soft); color: var(--red-dark); }
.tag-cat     { background: var(--grey-1);   color: var(--black); border: 1px solid var(--grey-2); }
.tag-options { background: var(--black);    color: var(--white); }

.card .actions {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; padding: 0 10px 10px;
}
.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 8px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
  min-height: 36px;
}
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost   { background: var(--black); color: var(--white); }
.btn-ghost:hover { background: var(--black-2); }
.btn-accent  { background: var(--white); color: var(--black); border: 1px solid var(--grey-2); }
.btn.block   { width: 100%; padding: 12px; font-size: var(--fs-md); min-height: 44px; }

.fav {
  position: absolute; top: 8px; left: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--red); color: var(--white);
  display: grid; place-items: center;
  border: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.fav svg { width: 14px; height: 14px; fill: var(--white); }

.empty {
  text-align: center;
  color: var(--grey-3);
  padding: 24px 0;
  font-size: var(--fs-md);
}

/* ========== LIST (cart / orders) ========== */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  background: var(--white);
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  gap: 12px;
  padding: 10px;
  align-items: center;
  border: 1px solid var(--grey-2);
  min-width: 0;
}
.list-item img { 
  width: 56px; 
  height: 56px; 
  border-radius: 8px; 
  object-fit: contain;
  background: #f8f8f8;
  padding: 2px;
}
.list-item h4 { margin: 0; font-size: var(--fs-md); word-break: break-word; }
.list-item .sub { font-size: var(--fs-xs); color: var(--grey-3); }

/* WhatsApp contact button in orders */
.whatsapp-contact-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #25D366;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  flex-shrink: 0;
}
.whatsapp-contact-btn svg {
  width: 24px;
  height: 24px;
  fill: white;
}
.whatsapp-contact-btn:hover {
  background: #128C7E;
  transform: scale(1.05);
}
.whatsapp-contact-btn:active {
  transform: scale(0.95);
}

.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty button {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--grey-2); background: var(--white);
  font-size: 14px;
}
.remove { color: var(--red); background: transparent; border: 0; font-size: var(--fs-xs); padding: 4px; }

.summary {
  margin-top: 14px;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--grey-2);
}
.summary .row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: var(--fs-md);
  gap: 10px;
}

/* ========== BOTTOM NAV ========== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--white);
  border-top: 1px solid var(--grey-2);
  display: grid; grid-template-columns: repeat(6, 1fr);
  box-shadow: 0 -2px 8px rgba(0,0,0,.05);
}
.nav-item {
  border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--grey-3);
  font-size: clamp(10px, 2.6vw, 12px);
  position: relative;
  padding: 4px 2px;
}
.nav-item svg { width: 22px; height: 22px; fill: currentColor; flex: 0 0 auto; }
.nav-item span {
  white-space: normal;
  line-height: 1.05;
  text-align: center;
  max-width: 100%;
  word-break: keep-all;
}
.nav-item.active { color: var(--red); }
.nav-item.active::before {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px;
  background: var(--red); border-radius: 0 0 3px 3px;
}
.nav-item em {
  font-style: normal; font-size: 10px; font-weight: 700;
  background: var(--red); color: var(--white);
  padding: 1px 6px; border-radius: 999px; margin-left: 4px;
}

/* WhatsApp support button - special styling */
#whatsappSupport {
  color: #25D366; /* WhatsApp green */
}
#whatsappSupport.active {
  color: #25D366;
}
#whatsappSupport.active::before {
  background: #25D366;
}
#whatsappSupport svg {
  fill: #25D366;
}

/* Always show labels — only shrink them on very narrow phones */
@media (max-width: 360px) {
  .nav-item { font-size: 9px; padding: 0 1px; }
  .nav-item svg { width: 20px; height: 20px; }
}

/* ========== MODAL ========== */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.55);
  display: grid; place-items: center;
  padding: 16px;
  overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--white);
  width: 100%; max-width: 440px;
  border-radius: 16px;
  padding: 16px;
  position: relative;
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
  border-top: 4px solid var(--red);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.modal-card img { 
  width: 100%; 
  height: 400px;
  object-fit: contain; 
  border-radius: 12px;
  background: #f8f8f8;
}
.modal-card h3 { margin: 12px 0 4px; font-size: var(--fs-lg); }
.modal-card .price { font-size: var(--fs-xl); font-weight: 800; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  border: 0;
  font-size: 24px;
  line-height: 1;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.1s ease;
  backdrop-filter: blur(4px);
  z-index: 10;
}
.modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
}
.modal-close:active {
  transform: scale(0.95);
}

/* Landscape phone: smaller modal image so content fits */
@media (max-height: 520px) and (orientation: landscape) {
  .modal-card { max-width: 540px; padding: 14px; }
  .modal-card img { aspect-ratio: 16/9; max-height: 38vh; }
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--black); color: var(--white);
  padding: 10px 14px; border-radius: 999px;
  font-size: var(--fs-sm);
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  z-index: 60;
  max-width: calc(100vw - 32px);
  text-align: center;
}

/* ========== ACCOUNT ========== */
.profile-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--white);
  border: 1px solid var(--grey-2);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
  flex-wrap: wrap;
}
.avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px;
  letter-spacing: .5px;
  flex: 0 0 auto;
}
.profile-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-meta strong { font-size: var(--fs-md); }

.stats-row {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  margin: 14px 0 18px;
}
.stat {
  background: var(--white); border: 1px solid var(--grey-2);
  border-radius: var(--radius-sm);
  padding: 12px 8px; text-align: center;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.stat strong {
  font-size: var(--fs-md);
  word-break: break-word;
}

.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); font-weight: 600; }
.form input,
.form select {
  border: 1px solid var(--grey-2);
  background: var(--white);
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  color: var(--black);
  width: 100%;
}
.form input:focus,
.form select:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
.form input[readonly] { background: var(--grey-1); color: var(--grey-3); }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }

/* Warning box for important notices */
.warning-box {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 12px;
  border-radius: 6px;
  margin: 12px 0;
}
.warning-box strong {
  color: #856404;
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
}
.warning-box p {
  color: #856404;
  font-size: var(--fs-xs);
  margin: 0;
  line-height: 1.5;
}

/* ========== BREAKPOINTS ========== */

/* Larger phones — bigger cards (3 columns) */
@media (min-width: 480px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}

/* Tablet — topbar goes side-by-side, 4 columns of cards */
@media (min-width: 720px) {
  :root { --nav-h: 70px; }
  .topbar {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 16px;
  }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .form { max-width: 540px; }
  .form-actions { grid-template-columns: auto auto; justify-content: flex-start; }
  .nav-item { font-size: 12px; }
}

/* Small laptop / large tablet */
@media (min-width: 980px) {
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 540px; }
  .modal-card { max-width: 520px; }
}

/* Desktop — turn bottom nav into a top bar style with subtle scaling */
@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; }
  .content { padding-top: 18px; }
}

/* High pixel density adjustments */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .brand-logo { image-rendering: -webkit-optimize-contrast; }
}

/* Reduce motion if requested */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Print: hide app chrome, show content cleanly */
@media print {
  .topbar, .bottom-nav, .toast, .fav, .actions, .modal { display: none !important; }
  .app { padding-bottom: 0; max-width: none; }
}

/* ========== LIPA KIDOGO PLANS ========== */
.lipa-list { display: flex; flex-direction: column; gap: 14px; }

.lipa-card {
  background: var(--white);
  border: 1px solid var(--grey-2);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}

.lipa-head { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.lipa-head img {
  width: 64px; height: 64px;
  border-radius: 10px;
  object-fit: contain;
  flex: 0 0 auto;
  background: #f8f8f8;
  padding: 4px;
}
.lipa-head .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lipa-head h4 { margin: 0; font-size: var(--fs-md); word-break: break-word; }
.lipa-head .pill {
  align-self: flex-start;
  background: var(--red); color: var(--white);
  padding: 2px 10px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 700;
}
.lipa-head .total { font-weight: 800; font-size: var(--fs-md); color: var(--black); }
.lipa-head .total .currency { color: var(--red); font-size: var(--fs-xs); margin-left: 4px; }
.lipa-head .lipa-remove {
  border: 0; background: transparent;
  color: var(--grey-3);
  font-size: 20px; line-height: 1;
  padding: 4px 6px;
  align-self: flex-start;
  cursor: pointer;
}
.lipa-head .lipa-remove:hover { color: var(--red); }

.lipa-section { display: flex; flex-direction: column; gap: 6px; }
.lipa-section .row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--fs-xs); font-weight: 700;
  color: var(--grey-3); letter-spacing: .4px; text-transform: uppercase;
}
.lipa-section .row .value { color: var(--black); text-transform: none; letter-spacing: 0; }

.bar {
  width: 100%; height: 8px;
  background: var(--grey-2);
  border-radius: 999px; overflow: hidden;
}
.bar > span {
  display: block; height: 100%;
  background: var(--red);
  border-radius: 999px;
  transition: width .3s ease;
}
.bar.bar-time > span { background: var(--black); }

.lipa-section .hint { font-size: var(--fs-xs); color: var(--grey-3); }

.lipa-summary {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.lipa-summary .box {
  background: var(--grey-1);
  border: 1px solid var(--grey-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.lipa-summary .label {
  font-size: var(--fs-xs); font-weight: 700;
  color: var(--grey-3); letter-spacing: .4px; text-transform: uppercase;
}
.lipa-summary .amount { font-size: var(--fs-md); font-weight: 800; margin-top: 4px; }
.lipa-summary .box.remaining .amount { color: var(--red); }

.lipa-card .actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lipa-card .actions-row .btn { flex: 1 1 auto; }
.btn-link {
  background: transparent; border: 0;
  color: var(--red); font-weight: 700; font-size: var(--fs-sm);
  padding: 6px 8px; cursor: pointer;
  text-decoration: underline;
}
.btn-link:hover { color: var(--red-dark); }

.lipa-card.completed { border-left-color: #1f8a55; }
.lipa-card.completed .pill { background: #1f8a55; }
.lipa-card.completed .bar > span { background: #1f8a55; }
.lipa-card.completed .lipa-summary .box.remaining .amount { color: #1f8a55; }

/* History list inside lipa card */
.payments {
  background: var(--grey-1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.payments .p-row {
  display: flex; justify-content: space-between;
  font-size: var(--fs-sm);
  padding: 4px 0;
  border-bottom: 1px dashed var(--grey-2);
}
.payments .p-row:last-child { border-bottom: 0; }
.payments .p-amount { font-weight: 700; }
.payments .p-empty { color: var(--grey-3); font-size: var(--fs-xs); }

/* Plan picker */
.plan-options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.plan-option {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--grey-2);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: var(--fs-md);
  cursor: pointer;
  text-align: left;
}
.plan-option:hover { border-color: var(--red); }
.plan-option .months { font-weight: 700; }
.plan-option .per-mo { color: var(--red); font-weight: 700; }

/* Payment dialog */
.pay-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 12px 0;
}
.pay-meta > div {
  background: var(--grey-1);
  border: 1px solid var(--grey-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.pay-meta strong { font-size: var(--fs-md); }
.pay-input {
  display: flex; flex-direction: column; gap: 6px;
  font-size: var(--fs-sm); font-weight: 600;
  margin-bottom: 8px;
}
.pay-input input {
  border: 1px solid var(--grey-2);
  background: var(--white);
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  color: var(--black);
}
.pay-input input:focus { outline: 2px solid var(--red); border-color: var(--red); }

/* ========== PRODUCT DETAIL ========== */
.product-detail { max-width: 520px; }

.gallery {
  position: relative;
  background: var(--grey-1);
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
}
.gallery-main {
  width: 100%;
  aspect-ratio: 4/3;
  display: grid; place-items: center;
  padding: 12px;
}
.gallery-main img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--grey-2);
  background: rgba(255,255,255,.92);
  color: var(--black);
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  z-index: 2;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.gallery-nav svg { width: 20px; height: 20px; fill: currentColor; }
.gallery-nav:hover { background: var(--red); color: var(--white); border-color: var(--red); }
.gallery-nav:active { transform: translateY(-50%) scale(.94); }
.gallery-nav.prev { left: 8px; }
.gallery-nav.next { right: 8px; }
.gallery-nav[hidden] { display: none; }

.thumbs {
  display: flex; gap: 8px; flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
.thumb {
  width: 56px; height: 56px;
  border-radius: 10px;
  border: 2px solid var(--grey-2);
  background: var(--white);
  padding: 4px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: border-color .15s ease, transform .1s ease;
}
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb.active { border-color: var(--red); }
.thumb:active { transform: scale(.96); }
.thumb-count { text-align: center; margin: 6px 0 0; font-size: var(--fs-sm); }

.detail-section { margin-top: 14px; }
.detail-section h4 {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--grey-3);
}
.desc-text {
  margin: 0;
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--black);
}

.share-row { display: flex; gap: 10px; flex-wrap: wrap; }
.share-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--grey-2);
  background: var(--white);
  color: var(--black);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .1s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.share-btn svg { width: 20px; height: 20px; fill: currentColor; }
.share-btn:hover { background: var(--red); color: var(--white); border-color: var(--red); }
.share-btn:active { transform: scale(.94); }

.modal-actions.three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.modal-actions.three .btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  font-size: var(--fs-xs);
  padding: 12px 8px;
  min-height: 44px;
}
.modal-actions.three .btn svg { width: 16px; height: 16px; fill: currentColor; }

@media (max-width: 380px) {
  .modal-actions.three { grid-template-columns: 1fr; }
}

/* ========== LIPA SASA (BUY NOW) ========== */
.buy-hero {
  background: var(--grey-1);
  border: 1px solid var(--grey-2);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  place-items: center;
  margin: 14px 0 12px;
}
.buy-hero img {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4/3;
  object-fit: contain;
  background: var(--white);
  border-radius: 12px;
}
.buy-info {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  text-align: center;
  margin-bottom: 12px;
}
.buy-info h4 {
  margin: 0;
  font-size: var(--fs-lg);
  word-break: break-word;
}
.buy-info .price {
  margin: 0;
  font-weight: 800;
  font-size: var(--fs-lg);
}
.buy-info .price .currency { color: var(--red); font-size: var(--fs-sm); margin-right: 4px; }

.buy-qty {
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--white);
  border: 1px solid var(--grey-2);
  border-radius: 999px;
  padding: 2px 4px;
}
.buy-qty button {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 0;
  background: var(--grey-1);
  font-size: 16px; line-height: 1;
  cursor: pointer;
  color: var(--black);
}
.buy-qty button:hover { background: var(--red); color: var(--white); }
.buy-qty span {
  min-width: 24px; text-align: center;
  font-weight: 700; font-size: var(--fs-md);
}

.buy-summary {
  background: var(--grey-1);
  border: 1px solid var(--grey-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 4px 0 12px;
}
.buy-summary .row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--fs-md);
}
.buy-summary .total-row strong { color: var(--red); font-size: var(--fs-lg); }

/* ========== AUTH (login / signup / gate) ========== */
.auth-card { text-align: center; }
.auth-logo {
  display: grid; place-items: center;
  margin: 6px 0 10px;
}
.auth-logo img {
  width: 72px; height: 72px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.auth-card h3 { margin: 4px 0 6px; font-size: var(--fs-xl); }

/* Description + Share inside the Lipa Sasa preview */
.buy-section { margin-top: 16px; }
.buy-section:first-of-type {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--grey-2);
}
.buy-section .desc-text { font-size: var(--fs-sm); }

/* Auth tabs (Ingia / Sajili in one panel) */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--grey-1);
  border: 1px solid var(--grey-2);
  border-radius: 999px;
  padding: 4px;
  margin: 14px 0 14px;
  position: relative;
}
.auth-tab {
  border: 0; background: transparent;
  padding: 9px 12px;
  font-weight: 700; font-size: var(--fs-sm);
  letter-spacing: .4px;
  color: var(--grey-3);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.auth-tab.active {
  background: var(--red);
  color: var(--white);
}
.auth-pane[hidden] { display: none; }
.auth-pane { text-align: left; }
.auth-pane .muted { margin: 0 0 4px; text-align: left; }

.modal-actions.single { grid-template-columns: 1fr; }

/* Phone auth status pill */
.auth-status {
  display: flex; align-items: center; gap: 8px;
  margin: -2px 0 4px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--grey-1);
  border: 1px solid var(--grey-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.auth-status[hidden] { display: none; }
.auth-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--grey-3);
  flex: 0 0 auto;
}
.auth-status.checking .dot { background: var(--grey-3); animation: pulse 1s ease-in-out infinite; }
.auth-status.existing { color: #1f8a55; border-color: #c9ecd9; background: #effbf5; }
.auth-status.existing .dot { background: #1f8a55; }
.auth-status.new { color: var(--red-dark); border-color: var(--red-soft); background: #fff5f5; }
.auth-status.new .dot { background: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* Account guest panel (signed out) */
.account-guest {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  gap: 10px;
  padding: 28px 18px 22px;
  margin: 12px 0 6px;
  background: var(--white);
  border: 1px solid var(--grey-2);
  border-top: 4px solid var(--red);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.account-guest-logo {
  width: 84px; height: 84px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  margin-bottom: 4px;
}
.account-guest h3 { margin: 4px 0 0; font-size: var(--fs-xl); }
.account-guest .muted { max-width: 360px; }
.account-guest .btn { max-width: 360px; margin-top: 10px; }

/* ========== CHECKOUT / PAYMENT ========== */
.checkout-summary {
  background: var(--grey-1);
  border: 1px solid var(--grey-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 12px 0 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.checkout-summary .row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--fs-sm);
  gap: 10px;
}
.checkout-summary .row span:last-child { color: var(--black); text-align: right; }
.checkout-summary .total-row {
  font-size: var(--fs-md);
  border-top: 1px dashed var(--grey-2);
  padding-top: 8px;
  margin-top: 4px;
}
.checkout-summary .total-row strong { color: var(--red); font-size: var(--fs-lg); }

.checkout-h {
  margin: 6px 0 8px;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--grey-3);
}

/* Phone input in checkout */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--black);
  margin-bottom: 8px;
}
.form-group .input {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--fs-md);
  font-weight: 500;
  border: 2px solid var(--grey-2);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
  background: var(--white);
  color: var(--black);
  letter-spacing: 0.5px;
}
.form-group .input:focus {
  outline: none;
  border-color: var(--red);
}
.form-group .input::placeholder {
  color: var(--grey-3);
  font-weight: 400;
}
.form-group small {
  display: block;
  margin-top: 6px;
  color: var(--grey-3);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

.pay-methods { display: flex; flex-direction: column; gap: 8px; }
.pay-method {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--grey-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.pay-method:hover { border-color: var(--red); }
.pay-method.active {
  border-color: var(--red);
  background: var(--red-soft);
}
.pm-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
  color: var(--white);
  flex: 0 0 auto;
}
.pm-icon.mpesa  { background: #00a651; }
.pm-icon.tigo   { background: #1f60d8; }
.pm-icon.airtel { background: #e10600; }
.pm-icon.halo   { background: #f7a600; color: #0a0a0a; }
.pm-icon.cash   { background: var(--black); }
.pm-text { display: flex; flex-direction: column; gap: 2px; }
.pm-text strong { font-size: var(--fs-md); }
.pm-text small  { color: var(--grey-3); font-size: var(--fs-xs); }

.pay-instruction {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.pay-instruction strong { color: #ffd1d1; }

.o-badge {
  display: inline-block;
  padding: 1px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase;
}
.o-badge.paid    { background: #e7f6ee; color: #1f8a55; }
.o-badge.pending { background: var(--red-soft); color: var(--red-dark); }

/* ========== TERMS & CONDITIONS (Lipa Kidogo) ========== */
.terms {
  margin: 14px 0 10px;
  background: var(--white);
  border: 1px solid var(--grey-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.terms summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--black);
  background: var(--grey-1);
  user-select: none;
}
.terms summary::-webkit-details-marker { display: none; }
.terms-title {
  display: inline-flex; align-items: center; gap: 8px;
}
.terms-title svg {
  width: 16px; height: 16px; fill: var(--red); flex: 0 0 auto;
}
.terms-chev {
  width: 18px; height: 18px; fill: var(--grey-3);
  transition: transform .2s ease;
}
.terms[open] .terms-chev { transform: rotate(180deg); }

.terms-body {
  padding: 12px 14px 14px;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--black);
  background: var(--white);
}
.terms-body h5 {
  margin: 12px 0 4px;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--red);
}
.terms-body h5:first-child { margin-top: 0; }
.terms-body p { margin: 0 0 6px; }
.terms-body ul {
  margin: 0 0 8px;
  padding-left: 22px;
  display: flex; flex-direction: column; gap: 4px;
}
.terms-body ul li::marker { color: var(--red); }

.terms-important {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--red);
}
.terms-important strong {
  display: block;
  font-size: var(--fs-xs);
  letter-spacing: 1px;
  color: var(--red-soft);
  margin-bottom: 4px;
}
.terms-important p { margin: 0; font-size: var(--fs-sm); line-height: 1.5; }

.plan-options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* Favorites */
.fav.active {
  background: var(--white);
  border: 1px solid var(--red);
}
.fav.active svg { fill: var(--red); }

.favorites-section { margin-top: 22px; }
.favorites-section .section-head { margin: 0 4px 12px; }
.favorites-section h3 { margin: 0; font-size: var(--fs-lg); }

@media (min-width: 720px) {
  .stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: none; }
}

/* Force-hide for elements that have a display rule overriding [hidden] */
[hidden] { display: none !important; }

/* ========== HARAKAPAY PAY STATUS ========== */
.pay-status {
  margin: 10px 0 4px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.45;
  border: 1px solid transparent;
}
.pay-status--loading {
  background: #fffbea;
  border-color: #f5c518;
  color: #7a5c00;
}
.pay-status--pending {
  background: #eaf4ff;
  border-color: #4a9eff;
  color: #0a4a8f;
}
.pay-status--success {
  background: #e8f9ee;
  border-color: #1f8a55;
  color: #0e4d2e;
}
.pay-status--error {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red-dark);
}


/* ========== Payment receipt modal ========== */
.receipt-card {
  text-align: center;
}
.receipt-icon {
  width: 64px; height: 64px; margin: 0 auto 8px;
  border-radius: 50%;
  background: #e7f6ee;
  display: grid; place-items: center;
}
.receipt-icon svg { width: 36px; height: 36px; fill: #1f8a55; }
.receipt-rows {
  background: #f7f7f8;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 14px 0 8px;
  text-align: left;
  display: grid; gap: 8px;
}
.receipt-rows .row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: var(--fs-sm);
}
.receipt-rows .row span:first-child { color: var(--grey-3); }
.receipt-rows .row strong { color: var(--black); font-size: var(--fs-md); }
.receipt-rows .row strong#receiptRef { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* Extra order badges */
.o-badge.failed   { background: var(--red-soft); color: var(--red-dark); }
.o-badge.shipped,
.o-badge.delivered { background: #eaf4ff; color: #1c61b3; }
.o-badge.cancelled { background: #efefef; color: #666; }

/* Receipt line under an order in the customer's Orders tab */
.o-receipt {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: var(--fs-xs);
  color: var(--grey-3);
}


/* ========== Lipa Kidogo completed receipt ========== */
.lipa-receipt {
  display: flex; align-items: center; gap: 10px;
  background: #e7f6ee;
  border: 1px solid rgba(31, 138, 85, .22);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 10px 0 4px;
}
.lipa-receipt-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(31, 138, 85, .15);
  display: grid; place-items: center; flex-shrink: 0;
}
.lipa-receipt-icon svg { width: 18px; height: 18px; fill: #1f8a55; }
.lipa-receipt-body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.lipa-receipt-title {
  color: #1f8a55; font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
}
.lipa-receipt-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: var(--fs-sm); color: var(--black);
}
.lipa-receipt-row span:first-child { color: var(--grey-3); }
.lipa-receipt-row code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: rgba(0,0,0,.04); padding: 0 6px; border-radius: 4px;
}
