:root {
  /* Brand blue, matched to the "A" in the Amreesh Agro Foods logo
     (bright sky-blue at the top fading into deep navy at the base). */
  --primary: #1E88E5;
  --primary-dark: #0D3B8C;
  --primary-light: #E3F2FD;
  --accent: #ff8f00;
  --bg: #f5f8fc;
  --card: #ffffff;
  --text: #1c1f1e;
  --muted: #757575;
  --danger: #d32f2f;
  --success: #2e7d32;
  --success-light: #e8f5e9;
  --border: #e2e8f0;
  --nav-height: 60px;
  --header-height: 56px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(20, 30, 20, 0.07);
  --shadow-md: 0 4px 14px rgba(20, 30, 20, 0.09);
  --shadow-lg: 0 10px 34px rgba(20, 30, 20, 0.14);
  --transition: 160ms ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(var(--nav-height) + 10px);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

/* ---- Top header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.app-header .brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.app-header .header-icons { display: flex; gap: 16px; align-items: center; }
.app-header a { color: #fff; text-decoration: none; }
.cart-badge {
  position: relative;
}
.cart-badge .count {
  position: absolute; top: -8px; right: -10px;
  background: var(--accent); color: #fff; font-size: 10px;
  border-radius: 50%; width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ---- Bottom nav (native app style) ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 480px;
  margin: 0 auto;
  height: var(--nav-height);
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  gap: 2px;
  padding-top: 6px;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav svg { width: 22px; height: 22px; }

/* ---- Content ---- */
.content { padding: 14px; }

.page-title { font-size: 18px; font-weight: 700; margin: 6px 0 14px; }

/* ---- Search bar ---- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  padding: 4px 6px 4px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.04));
  transition: var(--transition, 0.15s ease);
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light, rgba(0,0,0,0.06)); }
.search-icon { font-size: 15px; opacity: 0.6; flex-shrink: 0; }
.search-bar input[type="search"] {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  padding: 9px 2px;
  color: var(--text);
  min-width: 0;
}
.search-bar input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-clear {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f1f1f1;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
}
.search-submit {
  flex-shrink: 0;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition, 0.15s ease);
}
.search-submit:hover { filter: brightness(1.06); }

/* ---- Category chips ---- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 6px; -webkit-overflow-scrolling: touch; }
.chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip:hover { border-color: var(--primary); }
.chip.active:hover { border-color: var(--primary); }

/* ---- Product grid ---- */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.product-card {
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition);
}
.product-card:hover, .product-card:focus-within { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card-media { display: block; text-decoration: none; position: relative; }
.product-card-media-wrap { position: relative; }
.product-card .category-tag {
  position: static;
  background: rgba(255,255,255,0.94); color: var(--primary-dark);
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  letter-spacing: 0.2px; box-shadow: var(--shadow-sm); white-space: nowrap;
}
/* .img-wrap is a fixed, square, clipped frame — ANY image placed inside it
   (product photo, or the site icon used as a placeholder) is always
   constrained to this frame, so it can never render "too big" regardless of
   the uploaded file's original resolution. */
.img-wrap { width: 100%; aspect-ratio: 1/1; background: #eef1ee; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.product-detail-img { border-radius: var(--radius-lg); margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.category-tag.static {
  display: inline-block; position: static; background: var(--primary-light); color: var(--primary-dark);
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.product-detail-card { padding-top: 14px; }
.img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--transition); }
.product-card:hover .img-wrap img { transform: scale(1.04); }
.img-wrap .placeholder-icon { width: 45%; height: 45%; object-fit: contain; opacity: 0.5; }
.product-card .placeholder { font-size: 30px; color: #bbb; }
.product-card .info { padding: 10px 11px 11px; display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 3px; flex: 1; width: 100%; }
.product-card .name-link { text-decoration: none; color: inherit; }
.product-card .name {
  font-size: 13.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.6em;
}
.product-card .unit { font-size: 11px; color: var(--muted); }
.product-card .card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.product-card .price { font-size: 15px; font-weight: 800; color: var(--primary-dark); }
.quick-add-form { margin: 0; }
.quick-add-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; font-size: 18px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: background var(--transition), transform var(--transition);
}
.quick-add-btn:hover { background: var(--primary-dark); transform: scale(1.08); }
.quick-add-btn:active { transform: scale(0.95); }
.out-of-stock-tag {
  position: absolute; inset: 0; background: rgba(255,255,255,0.72);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--danger);
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(0.985); }
.btn.secondary { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); box-shadow: none; }
.btn.secondary:hover { background: var(--primary-light); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a72521; }
.btn.small { width: auto; padding: 8px 15px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ---- Forms ---- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; margin-bottom: 5px; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 14.5px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,136,229,0.16);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: #a8aca8; }
.error-box { background: #fdecea; color: var(--danger); padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; border: 1px solid #f6c6c2; }
.success-box { background: var(--success-light); color: var(--success); padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; border: 1px solid #c3e6c5; }

/* ---- Auth screens ---- */
.auth-wrap { padding: 40px 22px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .emoji { font-size: 46px; }
.auth-logo-img { width: 88px; height: 88px; object-fit: contain; }
.auth-logo h1 { font-size: 20px; margin: 6px 0 2px; color: var(--primary-dark); }
.auth-logo p { font-size: 12.5px; color: var(--muted); margin: 0; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ---- Cart ---- */
.cart-item { display: flex; gap: 10px; background: #fff; border-radius: 10px; padding: 10px; margin-bottom: 10px; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.cart-item .thumb { width: 56px; height: 56px; border-radius: 8px; background: #eee; overflow: hidden; flex-shrink: 0; display: flex; align-items:center; justify-content:center; }
.cart-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .meta { flex: 1; min-width: 0; }
.cart-item .meta .name { font-size: 13.5px; font-weight: 600; }
.cart-item .meta .price { font-size: 12.5px; color: var(--muted); }
.qty-control { display: flex; align-items: center; gap: 10px; }
.qty-control button {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; font-size: 16px; line-height: 1; cursor: pointer; color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; transition: background var(--transition), border-color var(--transition);
}
.qty-control button:hover { background: var(--primary-light); border-color: var(--primary); }
.qty-control span { min-width: 18px; text-align: center; font-weight: 700; }

/* Larger stepper used on the product detail "Add to Cart" form */
.qty-stepper-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.qty-control-lg { gap: 0; border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.qty-control-lg button {
  width: 42px; height: 42px; border-radius: 0; border: none; background: var(--primary-light);
  font-size: 20px; color: var(--primary-dark); font-weight: 700;
}
.qty-control-lg button:hover { background: var(--primary); color: #fff; }
.qty-control-lg input[type="number"] {
  width: 52px; height: 42px; text-align: center; border: none; border-left: 1px solid var(--border);
  border-right: 1px solid var(--border); font-size: 16px; font-weight: 700; padding: 0;
  -moz-appearance: textfield;
}
.qty-control-lg input[type="number"]::-webkit-outer-spin-button,
.qty-control-lg input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.add-to-cart-form { padding-top: 16px; }
.cart-summary { background: #fff; border-radius: var(--radius-md); padding: 16px; margin-top: 8px; box-shadow: var(--shadow-sm); }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; padding: 5px 0; }
.summary-row.total { font-weight: 700; font-size: 16px; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 10px; }

/* ---- Cards / lists ---- */
.card { background: #fff; border-radius: var(--radius-md); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge.pending_payment { background: #fff3e0; color: #e65100; }
.badge.payment_submitted { background: #e3f2fd; color: #1565c0; }
.badge.approved { background: #e8f5e9; color: #2e7d32; }
.badge.delivered { background: #e0f2f1; color: #00695c; }
.badge.rejected, .badge.cancelled, .badge.dismissed { background: #fdecea; color: #c62828; }
.badge.pending { background: #fff3e0; color: #e65100; }
.badge.resolved { background: #e8f5e9; color: #2e7d32; }

.order-card .order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 6px 10px; }
.order-card .order-id { font-weight: 700; font-size: 14.5px; word-break: break-word; }
.order-card .order-date { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.order-card .item-line { font-size: 12.5px; color: var(--text); display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.order-card .item-line:last-of-type { border-bottom: none; }
.order-card .item-line .text-muted { display: block; margin-top: 2px; }
.order-card .order-total { font-weight: 700; margin-top: 8px; text-align: right; font-size: 15px; }

/* ---- Wallet ---- */
.wallet-hero { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-radius: var(--radius-lg); padding: 24px 20px; text-align: center; margin-bottom: 16px; box-shadow: var(--shadow-md); }
.wallet-hero .amount { font-size: 34px; font-weight: 800; margin: 6px 0; }
.wallet-hero .label { font-size: 12.5px; opacity: 0.9; }
.wallet-hero .wallet-add-btn {
  width: auto; display: inline-block; margin-top: 14px; padding: 9px 20px;
  background: rgba(255,255,255,0.16); border: 1.5px solid rgba(255,255,255,0.55);
  box-shadow: none; backdrop-filter: blur(2px);
}
.wallet-hero .wallet-add-btn:hover { background: rgba(255,255,255,0.28); }

/* ---- Profile hero ---- */
.profile-hero { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-radius: var(--radius-lg); padding: 26px 20px; text-align: center; margin-bottom: 16px; box-shadow: var(--shadow-md); }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 10px;
  background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800;
}
.profile-avatar-wrap { position: relative; width: 64px; margin: 0 auto 10px; }
.profile-avatar-wrap .profile-avatar { margin: 0; }
.profile-avatar-img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: block;
  border: 2px solid rgba(255,255,255,0.6);
}
.profile-avatar-edit-btn {
  position: absolute; bottom: -4px; right: -4px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff; background: var(--accent, #FF7043); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-sm);
}
.profile-name { font-size: 19px; font-weight: 800; }
.profile-mobile { font-size: 13px; opacity: 0.9; margin-top: 2px; }
.logout-btn { width: 100%; margin-top: 4px; margin-bottom: 4px; }
.ledger-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ledger-row:last-child { border-bottom: none; }
.ledger-row .amt, .amt { font-weight: 700; color: var(--success); white-space: nowrap; }

/* ---- Use wallet balance at checkout ---- */
.wallet-use-card { border: 1.5px solid var(--primary-light); }
.wallet-use-row { display: flex; gap: 8px; align-items: center; }
.wallet-use-row input[type="number"] {
  flex: 1; padding: 10px 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); font-size: 14.5px;
}
.wallet-use-row input[type="number"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,136,229,0.16); }
.wallet-use-row .btn.small { flex-shrink: 0; white-space: nowrap; }
.quick-amounts { margin: 8px 0 2px; }

/* ---- Payment remark ---- */
.remark-box {
  background: #fff8e1; border: 1px dashed #e0b73a; color: #7a5c00;
  border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; font-size: 13px; text-align: left;
}
.remark-box b { font-family: 'Courier New', monospace; letter-spacing: 0.3px; }

/* ---- Referral ---- */
.referral-code-box { background: #fff; border: 2px dashed var(--primary); border-radius: 12px; padding: 16px; text-align: center; margin-bottom: 16px; }
.referral-code-box .code { font-size: 24px; font-weight: 800; letter-spacing: 2px; color: var(--primary-dark); margin: 6px 0; }
.referral-code-box .link { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.level-block { margin-bottom: 12px; }
.level-block .level-title { font-size: 13px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.level-users { display: flex; flex-direction: column; gap: 6px; }
.level-user { background: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; display: flex; justify-content: space-between; }

/* ---- QR pay ---- */
.qr-wrap { text-align: center; background: #fff; border-radius: var(--radius-lg); padding: 22px 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.qr-wrap img { width: 220px; height: 220px; margin: 10px auto; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.upi-id-display { font-size: 15px; font-weight: 700; color: var(--primary-dark); background: var(--primary-light); padding: 9px; border-radius: var(--radius-sm); margin: 8px 0; letter-spacing: 0.2px; }
.amount-display { font-size: 28px; font-weight: 800; margin: 6px 0; color: var(--primary-dark); }

/* ---- Tables (admin) ---- */
.admin-body { padding-bottom: 30px; }
table.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius-sm); overflow: hidden; font-size: 13px; box-shadow: var(--shadow-sm); }
table.data-table th, table.data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table.data-table th { background: #eef2ee; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--muted); }
table.data-table tbody tr { transition: background var(--transition); }
table.data-table tbody tr:hover { background: #f5faf5; }
table.data-table tbody tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: var(--radius-md); padding: 16px 14px; text-align: center; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition); }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card .num { font-size: 21px; font-weight: 800; color: var(--primary-dark); }
.stat-card .label { font-size: 11px; color: var(--muted); margin-top: 3px; }

.admin-menu { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.admin-menu a {
  flex: 1 1 45%; text-align: center; padding: 11px; background: #fff; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-sm);
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.admin-menu a:hover { box-shadow: var(--shadow-md); }
.admin-menu a.active { background: var(--primary); color: #fff; }

.mrp-strike { text-decoration: line-through; color: var(--muted); font-size: 12px; font-weight: 500; }
.mrp-strike-red { text-decoration: line-through; color: var(--danger); font-size: 12px; font-weight: 600; }
.discount-badge {
  display: inline-block; background: var(--success-light); color: var(--success); font-weight: 800;
  font-size: 11px; padding: 2px 7px; border-radius: 6px; margin-left: 4px; letter-spacing: 0.2px;
}
.save-green { color: var(--success); font-weight: 800; font-size: 12px; margin-top: 2px; }
.product-card .price-row { display: flex; flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.product-card .mrp-strike, .product-card .mrp-strike-red { font-size: 11px; }
.badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 1px; }
.badge-row .category-tag { position: static; }

/* ---- Blinkit/Zepto-style floating ADD button, overlapping the photo ---- */
.blinkit-fab {
  position: absolute; right: 10px; bottom: -14px; z-index: 3;
  width: 62px; height: 30px;
}
.blinkit-add-btn {
  width: 100%; height: 100%; border: 1.5px solid var(--primary); border-radius: 8px;
  background: #fff; color: var(--primary-dark); font-size: 11.5px; font-weight: 800;
  letter-spacing: 0.3px; display: flex; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.14);
}
.blinkit-add-btn .plus { color: var(--success); font-size: 13px; font-weight: 900; }
.blinkit-add-btn:hover { background: var(--primary-light); }
.blinkit-stepper {
  width: 100%; height: 100%; display: none; align-items: center; justify-content: space-between;
  background: var(--primary); border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.14); overflow: hidden;
}
.blinkit-stepper button {
  flex: 0 0 20px; height: 100%; border: none; background: transparent; color: #fff;
  font-size: 15px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.blinkit-stepper button:hover { background: rgba(255,255,255,0.15); }
.blinkit-stepper .qty-display { color: #fff; font-weight: 800; font-size: 12.5px; }
.savings-box { background: var(--success-light); border: 1px dashed var(--success); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0; }
.savings-box .save-amt { color: var(--success); font-weight: 800; font-size: 15px; }
.savings-box .save-pct { color: var(--success); font-weight: 700; font-size: 12.5px; }
.reveal-form-btn {
  cursor: pointer; list-style: none; user-select: none; text-align: center; width: 100%;
}
.reveal-form-btn::-webkit-details-marker { display: none; }
.reveal-form-btn::marker { content: ''; }
details.reveal-form[open] .reveal-form-btn { margin-bottom: 14px; background: var(--primary-dark); }
.reveal-form-body { margin-top: 4px; }
.discount-overlay {
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
  background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; font-weight: 800;
  font-size: 10.5px; padding: 4px 9px 4px 7px; border-radius: 20px; letter-spacing: 0.2px;
  box-shadow: 0 2px 6px rgba(21,128,61,0.45);
}
.discount-overlay::before { content: '🏷️'; font-size: 9.5px; }
.img-wrap > .discount-overlay { position: absolute; top: 8px; right: 8px; z-index: 2; }
.product-detail-media { position: relative; }
.gallery-thumb-strip { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; padding-bottom: 2px; }
.gallery-thumb-btn {
  flex: 0 0 56px; width: 56px; height: 56px; padding: 0; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; background: #eef1ee; cursor: pointer; transition: border-color var(--transition);
}
.gallery-thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb-btn.active, .gallery-thumb-btn:hover { border-color: var(--primary); }
/* ---- Popup modal (used on Profile for Address / Change Password) ---- */
.app-modal {
  border: none; border-radius: var(--radius-md); padding: 0;
  width: 92%; max-width: 420px; max-height: 88vh; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.app-modal::backdrop { background: rgba(20, 30, 25, 0.55); }
.app-modal-inner { max-height: 88vh; overflow-y: auto; padding: 18px; }
.app-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.app-modal-head .title { font-weight: 800; font-size: 15.5px; }
.app-modal-close {
  border: none; background: #f1f3f1; color: var(--text); width: 30px; height: 30px;
  border-radius: 50%; font-size: 16px; line-height: 1; cursor: pointer;
}
.app-modal-close:hover { background: #e4e7e4; }
.summary-card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
/* ---- Product photo previews (admin product form) ---- */
.photo-preview-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.photo-thumb { width: 68px; height: 68px; object-fit: cover; border-radius: 8px; border: 1.5px solid var(--border); background: #eef1ee; }
.photo-thumb-new { border-style: dashed; border-color: var(--primary); opacity: 0.85; }
.photo-thumb-wrap { position: relative; }
.photo-thumb-wrap form { margin: 0; }
.photo-remove-btn {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #fff; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800;
  line-height: 1; cursor: pointer; box-shadow: var(--shadow-sm);
}
.photo-remove-btn:hover { filter: brightness(1.1); }
.summary-card-row .summary-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.auth-role-switch { display: flex; gap: 8px; margin-top: 16px; }
.auth-role-switch a {
  flex: 1; text-align: center; padding: 10px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 700;
  text-decoration: none; background: #fff; color: var(--primary); border: 1.5px solid var(--primary);
}
.auth-role-switch a:hover { background: var(--primary-light); }
.assign-branch-row { display: flex; gap: 8px; align-items: center; }
.assign-branch-row select { flex: 1; padding: 9px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }
.branch-menu { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.branch-menu a {
  background: #fff; padding: 8px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: box-shadow var(--transition);
}
.branch-menu a:hover { box-shadow: var(--shadow-md); }
.branch-menu a.active { background: var(--primary); color: #fff; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .icon { font-size: 42px; margin-bottom: 12px; opacity: 0.7; }

a.link { color: var(--primary); }
.text-muted { color: var(--muted); font-size: 12.5px; }
.fw-bold { font-weight: 700; }
.mt-2 { margin-top: 10px; }
.mb-2 { margin-bottom: 10px; }

.brand-logo { width: 24px; height: 24px; object-fit: contain; border-radius: 5px; vertical-align: middle; }

/* =========================================================================
   RESPONSIVE: mobile stays a native-app-style experience (bottom nav bar,
   narrow single column, like an Android app). Desktop switches to a normal
   wide website layout (top navigation bar, multi-column grid, no bottom nav).
   ========================================================================= */

/* Desktop top navigation — hidden on mobile by default */
.desktop-topbar { display: none; }

@media (min-width: 900px) {
  body { padding-bottom: 0; }

  .app-container { max-width: 1180px; }

  /* Hide the mobile app-style header + bottom tab bar entirely on desktop */
  .mobile-only-header, .bottom-nav { display: none; }

  /* Show the desktop top navigation bar */
  .desktop-topbar {
    display: block;
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  }
  .desktop-topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    height: 68px;
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 0 24px;
  }
  .desktop-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 19px;
    font-weight: 800;
    color: var(--primary-dark);
    text-decoration: none;
    white-space: nowrap;
  }
  .desktop-brand .brand-logo { width: 32px; height: 32px; }
  .desktop-links {
    display: flex;
    gap: 26px;
    flex: 1;
  }
  .desktop-links a {
    color: var(--text);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 600;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
  }
  .desktop-links a:hover, .desktop-links a.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
  .desktop-account { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
  .desktop-account .btn.small { width: auto; }
  .desktop-username { font-size: 13.5px; color: var(--muted); text-decoration: none; }
  .desktop-username:hover { color: var(--primary-dark); text-decoration: underline; }

  /* Content gets real website breathing room */
  .content { padding: 28px 24px 50px; }
  .page-title { font-size: 24px; margin-bottom: 20px; }

  /* Wider product / grid layouts */
  .product-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .admin-menu a { flex: 1 1 auto; }

  /* Cart / checkout / auth become centered cards instead of full-bleed mobile panels */
  .cart-summary, .qr-wrap, .card { max-width: 720px; }
  .auth-wrap {
    max-width: 420px;
    margin: 50px auto;
    background: #fff;
    border-radius: 18px;
    padding: 34px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.08);
  }

  /* Two-column shop layout: chips/filters beside product grid content stays simple,
     but give the grid area more visual room */
  .product-card .name { font-size: 14.5px; }

  /* ---- Admin & Branch panels: comfortable, centered, PC-friendly layout ---- */
  .admin-body .content { max-width: 1080px; margin: 0 auto; padding: 26px 24px 50px; }
  .admin-body .card, .admin-body .order-card { margin-left: auto; margin-right: auto; }
  .admin-body .btn-row { flex-wrap: wrap; }
  .admin-body .btn-row .btn { flex: 1 1 160px; }
}

@media (min-width: 700px) and (max-width: 899.98px) {
  /* Tablet-width phones/small tablets viewing the admin/branch panel in
     portrait or landscape: still mobile chrome (bottom-nav isn't used here
     anyway), but stop cards from looking awkwardly stretched edge-to-edge. */
  .admin-body .card, .admin-body .order-card { max-width: 640px; margin-left: auto; margin-right: auto; }
}

@media (min-width: 1200px) {
  .product-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---- Social media icon row (Profile, Contact Us) — replaces the old
   floating corner buttons, which covered page content on small screens. ---- */
.social-icons-row { display: flex; gap: 10px; justify-content: center; }
.social-icon-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 6px; border-radius: 14px; color: #fff; text-decoration: none;
  box-shadow: var(--shadow-sm); transition: var(--transition);
}
.social-icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.social-icon-btn span { font-size: 11px; font-weight: 700; }
.social-icon-btn.whatsapp { background: #25D366; }
.social-icon-btn.instagram { background: radial-gradient(circle at 30% 110%, #ffdb73 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.social-icon-btn.youtube { background: #FF0000; }

/* ---- Global "Loading / Processing" popup ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 58, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.loading-overlay.visible { opacity: 1; pointer-events: all; }
.loading-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 26px 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  min-width: 150px;
}
.loading-spinner { position: relative; width: 42px; height: 42px; }
.loading-spinner span {
  position: absolute; inset: 0; border-radius: 50%; border: 4px solid transparent;
}
.loading-spinner span:first-child {
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  animation: loading-spin 0.8s linear infinite;
}
.loading-spinner span:last-child {
  border-bottom-color: var(--accent);
  opacity: 0.6;
  animation: loading-spin 1.1s linear infinite reverse;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }
.loading-text { font-weight: 700; font-size: 13.5px; color: var(--text); }

/* ---- Contact Us / About Us ---- */
.contact-info-row {
  display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border);
  font-size: 13.5px; text-decoration: none; color: var(--text);
}
.contact-info-row:last-child { border-bottom: none; }
.contact-info-row .icon { font-size: 18px; flex-shrink: 0; }
.contact-icon-badge {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.contact-icon-badge.call { background: #E3F2FD; }
.contact-icon-badge.mail { background: #FFF3E0; }
.contact-icon-badge.loc { background: #E8F5E9; }
.about-text { font-size: 14px; line-height: 1.7; color: var(--text); white-space: pre-line; }

/* ---- Contact Us page hero ---- */
.contact-hero {
  text-align: center; padding: 22px 16px; margin-bottom: 14px; border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff;
}
.contact-hero-icon { font-size: 34px; margin-bottom: 6px; }
.contact-hero-title { font-size: 18px; font-weight: 800; }
.contact-hero-sub { font-size: 12.5px; opacity: 0.9; margin-top: 4px; }
.more-links-card a { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 14px; font-weight: 600; }
.more-links-card a:last-child { border-bottom: none; }
.more-links-card a .chevron { color: var(--muted); font-weight: 400; }

/* ---- Floating "View Cart" pill (Blinkit-style), sits above the bottom nav ---- */
.view-cart-pill-wrap {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-height) + 10px);
  z-index: 95; display: none; justify-content: center; padding: 0 14px;
  pointer-events: none;
}
.view-cart-pill-wrap.show { display: flex; }
.view-cart-pill {
  pointer-events: auto;
  width: 100%; max-width: 452px;
  background: linear-gradient(135deg, var(--primary-dark, #1565C0), var(--primary));
  color: #fff; border-radius: 14px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  box-shadow: 0 8px 22px rgba(0,0,0,0.22);
  animation: viewCartPop .25s ease-out;
}
@keyframes viewCartPop { from { transform: translateY(14px) scale(0.96); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.view-cart-pill-img {
  width: 34px; height: 34px; border-radius: 8px; background: #fff; object-fit: cover; flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.7);
}
.view-cart-pill-text { flex: 1; min-width: 0; }
.view-cart-pill-count { font-size: 11.5px; opacity: 0.9; font-weight: 600; }
.view-cart-pill-label { font-size: 14.5px; font-weight: 800; }
.view-cart-pill-arrow { font-size: 18px; font-weight: 800; flex-shrink: 0; }

/* ---- Friendlier UI for the admin push-notification diagnostics page ---- */
.diag-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.diag-row:last-child { border-bottom: none; }

/* ---- Pending-count badge on admin nav links ---- */
.admin-menu a { position: relative; }
.admin-menu a .pending-badge {
  display: inline-block; background: #E53935; color: #fff; font-size: 10px; font-weight: 800;
  border-radius: 999px; padding: 1px 6px; margin-left: 4px; line-height: 1.4; vertical-align: 2px;
}

/* ---- Easy-copy referral button ---- */
.refer-copy-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--primary); color: #fff; border: none; border-radius: 12px;
  padding: 13px; font-size: 14.5px; font-weight: 800; cursor: pointer; margin-top: 8px;
}
.refer-copy-btn.copied { background: #1E8E3E; }

/* ---- Today / This Week / This Month commission cards ---- */
.commission-period-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.commission-period-card { border-radius: 14px; padding: 14px 8px; text-align: center; color: #fff; }
.commission-period-card.today { background: linear-gradient(135deg, #1E88E5, #0D3B8C); }
.commission-period-card.week { background: linear-gradient(135deg, #8E24AA, #4A148C); }
.commission-period-card.month { background: linear-gradient(135deg, #1E8E3E, #0B5D23); }
.commission-period-card .cp-label { font-size: 10.5px; font-weight: 700; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.4px; }
.commission-period-card .cp-amt { font-size: 19px; font-weight: 800; margin-top: 4px; }

/* ---- Mini "ID card" referral widget (used on My Commission page) ---- */
.mini-idcard {
  background: linear-gradient(145deg, #1a1f29, #11151c); border-radius: 16px; padding: 16px; color: #fff;
  margin-bottom: 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.mini-idcard-head { display: flex; align-items: center; gap: 12px; }
.mini-idcard-photo, .mini-idcard-photo-placeholder { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.mini-idcard-photo-placeholder { background: #2a3140; color: #f2d98a; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; }
.mini-idcard-text { flex: 1; min-width: 0; }
.mini-idcard-name { font-weight: 800; font-size: 14.5px; }
.mini-idcard-code { font-size: 11.5px; color: #c9cedb; margin-top: 2px; }
.mini-idcard-qr { width: 44px; height: 44px; background: #fff; border-radius: 8px; padding: 3px; flex-shrink: 0; }
.mini-idcard-qr img { width: 100%; height: 100%; display: block; }
.mini-idcard-link {
  font-size: 10.5px; color: #8a909c; margin-top: 10px; word-break: break-all;
  background: rgba(255,255,255,0.06); border-radius: 8px; padding: 8px 10px;
}

/* ---- "Return to Admin" banner, shown on every page while an admin is
   logged in as a user/branch (impersonation) ---- */
.impersonate-banner {
  background: linear-gradient(120deg, #d4af37, #b8860b); color: #1a1407;
  padding: 9px 14px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 12.5px; font-weight: 700; flex-wrap: wrap;
}
.impersonate-banner form { margin: 0; }
.impersonate-banner button {
  background: #1a1407; color: #f2d98a; border: none; border-radius: 8px;
  padding: 6px 12px; font-size: 12px; font-weight: 800; cursor: pointer;
}

/* ---- Star ratings (product cards, product detail, orders, admin) ---- */
.rating-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700;
  color: #b8860b; background: #fff8e1; border-radius: 8px; padding: 2px 8px; margin-top: 4px;
}
.rating-badge .stars { letter-spacing: 1px; }
.rating-badge .count { color: var(--muted); font-weight: 600; }
.rating-badge.no-rating { color: var(--muted); background: #f1f3f6; }

.star-picker { display: flex; gap: 4px; font-size: 28px; margin: 8px 0; }
.star-picker .star { cursor: pointer; color: #d9d9d9; transition: color 120ms ease; user-select: none; }
.star-picker .star.filled { color: #f6b800; }

.rate-card { border: 1px dashed var(--border); border-radius: 12px; padding: 12px; margin-top: 10px; background: #fcfcfd; }
.rate-card .rate-head { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.rate-card textarea, .review-textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 13px;
  font-size: 13.5px; font-family: inherit; resize: vertical; min-height: 64px; margin-top: 8px;
  background: #fafbfc; transition: border-color 150ms ease, box-shadow 150ms ease;
}
.rate-card textarea:focus, .review-textarea:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(30,136,229,0.12);
}
.rate-card .your-rating { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.product-reviews .review-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.product-reviews .review-row:last-child { border-bottom: none; }
.product-reviews .review-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; }
.product-reviews .review-stars { color: #f6b800; font-size: 13px; letter-spacing: 1px; }
.product-reviews .review-text, .review-text { font-size: 13px; color: var(--text); margin-top: 3px; line-height: 1.5; }

.top-rated-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.top-rated-row:last-child { border-bottom: none; }
.top-rated-row img, .top-rated-row .ph { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--bg); flex-shrink: 0; }
.top-rated-row .name { flex: 1; font-size: 13.5px; font-weight: 600; }

/* ---- Saved address picker (Checkout) ---- */
.saved-address-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border);
  font-size: 13px; cursor: pointer;
}
.saved-address-row:last-child { border-bottom: none; }
.saved-address-row input[type="radio"] { margin-top: 3px; flex-shrink: 0; accent-color: var(--primary); width: 16px; height: 16px; }
