/* Merkato Pro website. The same look as the MerkatoPro Android app (ui/theme/Color.kt,
   MerkatoPalette.kt, Shape.kt, Type.kt): Merkato blue, credit green, teal accent, Inter,
   16px cards, 18px search field. On phones the site behaves like the app (bottom tabs, sheets);
   on a computer it uses the width (top tabs, wide grid, side cart, two-column product view). */
:root {
  color-scheme: light;
  --primary: #086AA8;
  --primary-dark: #075A90;
  --primary-light: #2F86BF;
  --primary-soft: #EAF5FC;
  --primary-tint: #F4F9FD;
  --green: #2FAE49;
  --green-dark: #238739;
  --green-soft: #E7F6EA;
  --teal: #18686F;
  --bg: #F7F9FB;
  --surface: #FFFFFF;
  --surface-variant: #E8EDF2;
  --outline: #D4DEE8;
  --outline-soft: #E6ECF2;
  --ink: #1A1C1E;
  --ink-muted: #5A6570;
  --ink-subtle: #8A9199;
  --danger: #DC3545;
  --danger-soft: #FADEDE;
  --success: #28A745;
  --success-soft: #DCF5E3;
  --selling: #D85A30;
  --drop: #185FA5;
  --hot: #DC3545;
  --shadow-sm: 0 1px 3px rgba(16,24,40,.06);
  --shadow-md: 0 8px 24px rgba(16,24,40,.08);
  --shadow-lg: 0 18px 48px rgba(16,24,40,.16);
  --shadow-modal: 0 24px 64px rgba(16,24,40,.24);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --font: Inter, "Noto Sans Ethiopic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 64px;
  /* Old names still used by storefront-features.css and inline styles. */
  --brand: var(--primary);
  --brand-dark: var(--primary-dark);
  --brand-soft: var(--primary-soft);
  --brand-tint: var(--primary-tint);
  --line: var(--outline);
  --line-subtle: var(--outline-soft);
  --wash: var(--bg);
  --paper: var(--surface);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .6; }
a { color: var(--primary); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(8,106,168,.32); outline-offset: 2px;
}
.sr-only { position: absolute!important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hidden { display: none!important; }
svg { flex-shrink: 0; }

/* ---------- TOP APP BAR ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--outline-soft);
}
.bar {
  max-width: 1320px; margin: auto; padding: 12px 24px 8px;
  display: grid; grid-template-columns: auto minmax(260px, 640px) 1fr;
  align-items: center; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; object-fit: cover; box-shadow: var(--shadow-sm); }
.brand-copy { display: grid; line-height: 1.05; }
.wordmark { font-size: 24px; font-weight: 800; letter-spacing: -.6px; }
.wm-merkato { color: var(--primary); }
.wm-pro { color: var(--green); }
.brand-tagline { font-size: 12.5px; font-weight: 500; color: var(--ink-muted); margin-top: 3px; letter-spacing: .1px; }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 16px; width: 21px; height: 21px; color: var(--ink-muted); pointer-events: none; }
.search {
  width: 100%; height: 48px; border: 1.5px solid var(--outline);
  border-radius: 18px; padding: 0 44px 0 48px;
  background: var(--surface); color: var(--ink); font-size: 16px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search::placeholder { color: var(--ink-subtle); }
.search:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(8,106,168,.10); }
.search-wrap:focus-within .search-icon { color: var(--primary); }
.search::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: 10px; width: 30px; height: 30px; border-radius: var(--radius-full);
  background: var(--surface-variant); color: var(--ink-muted); display: grid; place-items: center; font-size: 17px;
}
.search-clear:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.head-btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 6px 14px 6px 8px; border-radius: var(--radius-full);
  color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s ease;
}
.head-btn:hover { background: var(--primary-tint); }
.head-btn-copy { display: grid; line-height: 1.2; text-align: left; }
.head-btn-copy small { font-size: 11.5px; font-weight: 500; color: var(--ink-muted); }
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 15px;
}
.avatar svg { width: 26px; height: 26px; }
.account-btn.signed-in .avatar { background: var(--primary); color: #fff; }
.account-status-dot { position: absolute; left: 34px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid #fff; }
.cart-btn { padding-left: 12px; }
.cart-icon-wrap { position: relative; display: inline-grid; color: var(--ink-muted); }
.cart-btn:hover .cart-icon-wrap { color: var(--primary); }
.cart-icon-wrap svg { width: 26px; height: 26px; }
.cart-count {
  position: absolute; top: -7px; right: -9px; display: grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-full);
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; line-height: 1;
  border: 2px solid #fff; transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.cart-count.bump { transform: scale(1.3); }

/* Desktop tabs: the app's bottom tabs, moved to the top on a wide screen. */
.tabs { border-top: 0; }
.tabs-inner { max-width: 1320px; margin: auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px 12px; color: var(--ink-muted); font-weight: 600; font-size: 14px;
  text-decoration: none; white-space: nowrap; border-radius: 10px 10px 0 0;
}
.tab svg { width: 20px; height: 20px; }
.tab:hover { color: var(--primary); background: var(--primary-tint); }
.tab.active { color: var(--primary); }
.tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.tab-ai { margin-left: auto; color: var(--teal); }
.tab-ai svg { color: var(--green); }

/* ---------- MAIN ---------- */
main { max-width: 1320px; margin: auto; padding: 22px 24px 120px; }
.view { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Welcome card: the app's profile header colours (blue to teal, soft circles). */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 26px 30px; margin-bottom: 22px; border-radius: var(--radius-xl);
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-dark) 55%, var(--teal) 100%);
  color: #fff;
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); z-index: -1; }
.hero::before { width: 260px; height: 260px; left: -90px; top: -150px; }
.hero::after { width: 300px; height: 300px; right: -80px; bottom: -190px; background: rgba(47,174,73,.22); }
.hero h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.hero p { margin: 0; font-size: 14.5px; opacity: .92; max-width: 620px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 13px; font-weight: 600; }
.hero-points span { display: inline-flex; align-items: center; gap: 6px; }
.hero-points svg { color: #8FE0A0; }
.hero-cta {
  flex-shrink: 0; background: #fff; color: var(--primary); font-weight: 700;
  padding: 12px 24px; border-radius: var(--radius-md); min-height: 48px; box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.hero-cta:hover { background: var(--primary-soft); }

/* Story circles (Selling fast, New, Price drop, shops), as on the app's home. */
.stories { display: flex; gap: 18px; overflow-x: auto; padding: 4px 2px 14px; margin-bottom: 6px; scrollbar-width: none; overscroll-behavior-inline: contain; }
.stories::-webkit-scrollbar { display: none; }
.story { flex: 0 0 auto; width: 92px; display: grid; justify-items: center; gap: 6px; padding: 2px; border-radius: var(--radius-md); }
.story-ring { position: relative; width: 80px; height: 80px; border-radius: 50%; padding: 3px; border: 3px solid var(--ring, var(--outline)); background: #fff; transition: transform .15s ease; }
.story:hover .story-ring { transform: scale(1.04); }
.story-ring img, .story-ring .story-fallback { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--primary-tint); }
.story-ring .story-fallback { display: grid; place-items: center; color: var(--primary); font-weight: 800; font-size: 22px; }
.story-icon { position: absolute; right: -4px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--ring); border: 2.5px solid #fff; }
.story-icon svg { width: 15px; height: 15px; }
.story-name { font-size: 13px; font-weight: 500; color: var(--ink-muted); max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story.active .story-name { color: var(--ink); font-weight: 700; }
.story.shop .story-ring { --ring: var(--outline); }

/* Category chips */
.cat-strip { margin: 0 -24px 16px; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 2px 24px; scrollbar-width: none; overscroll-behavior-inline: contain; scroll-snap-type: x proximity; }
.cats::-webkit-scrollbar { display: none; }
.chip {
  min-height: 38px; white-space: nowrap; border: 1px solid var(--outline);
  background: var(--surface); color: var(--ink); padding: 7px 16px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 13.5px; scroll-snap-align: start; transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.catalog-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.catalog-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex: 1; flex-wrap: wrap; min-width: 0; }
.catalog-head h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.3px; color: var(--ink); }
.status-badge { font-size: 13px; font-weight: 500; color: var(--ink-muted); }
.back-btn { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); border: 1px solid var(--outline-soft); color: var(--ink); flex-shrink: 0; }
.back-btn:hover { background: var(--primary-tint); color: var(--primary); }
.back-btn svg { width: 22px; height: 22px; }
.link-filter { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; padding: 4px 12px; border-radius: 20px; background: var(--primary-soft); color: var(--primary-dark); font-size: 12px; font-weight: 700; vertical-align: middle; }

/* ---------- PRODUCT CARDS (the app's home cards) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 18px; }
.card {
  min-width: 0; background: var(--surface); border: 1px solid var(--outline-soft);
  border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--outline); }
.card.in-cart { background: #F7FBFF; border-color: #CFE3F2; }
.photo { position: relative; aspect-ratio: 1 / 1; background: #fff; display: grid; place-items: center; overflow: hidden; cursor: pointer; }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .photo img { transform: scale(1.04); }
.photo-fallback { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--radius-lg); background: var(--primary-soft); color: var(--primary); }
.badge {
  position: absolute; left: 10px; top: 10px; z-index: 1; max-width: calc(100% - 20px);
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--radius-full);
  color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.badge svg { width: 14px; height: 14px; }
.badge-selling { background: var(--selling); }
.badge-drop { background: var(--drop); }
.badge-new { background: var(--green); }
.badge-hot { background: var(--hot); }
.badge-deal { left: auto; right: 10px; background: var(--primary-dark); }
.photo-chip {
  position: absolute; left: 10px; bottom: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 10px; background: rgba(255,255,255,.94); color: var(--primary);
  font-size: 12.5px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.photo-chip svg { width: 17px; height: 17px; }
.photo-chip.min { left: auto; right: 10px; color: var(--ink-muted); }

.body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.product-title {
  font-size: 15.5px; font-weight: 600; line-height: 1.3; margin: 0; color: var(--ink);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; cursor: pointer;
}
.product-title:hover { color: var(--primary); }
.seller-line { font-size: 13px; font-weight: 500; color: var(--ink-muted); text-transform: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sellers-pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; }
.sellers-pill svg { width: 14px; height: 14px; }
.sellers-pill:hover { background: #DCEEFA; }
.price-block { margin-top: 2px; }
.price { font-weight: 800; font-size: 22px; line-height: 1.1; color: var(--primary-dark); letter-spacing: -.3px; }
.price small { font-size: 13px; font-weight: 600; color: var(--ink-muted); margin-left: 3px; letter-spacing: 0; }
.price-note { display: inline-block; margin-top: 3px; font-size: 12px; font-weight: 500; color: var(--ink-muted); }
.price-deal { display: block; font-size: 12px; font-weight: 600; color: var(--green-dark); margin-top: 2px; }
.btn-price-locked {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: var(--radius-md);
  background: var(--primary-tint); color: var(--primary-dark); font-size: 12.5px; font-weight: 600; width: 100%;
  border: 1px dashed #9CC7E6; text-align: left;
}
.btn-price-locked:hover { background: var(--primary-soft); border-color: var(--primary); }
.btn-price-locked svg { color: var(--primary); }

.action-slot { width: 100%; margin-top: auto; padding-top: 8px; }
.btn-add {
  width: 100%; min-height: 44px; border-radius: 14px; border: 1.5px solid #9CC7E6;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, border-color .15s, color .15s;
}
.btn-add:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-add:active { transform: scale(.98); }
.card-stepper { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 4px; border-radius: 14px; background: var(--primary); }
.stepper-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; }
.stepper-btn:hover { background: rgba(255,255,255,.18); }
.stepper-qty { font-weight: 800; font-size: 15px; color: #fff; padding: 0 8px; text-align: center; }

.empty-state { grid-column: 1 / -1; padding: 60px 24px; text-align: center; background: var(--surface); border: 1px dashed var(--outline); border-radius: var(--radius-lg); color: var(--ink-muted); }
.empty-state h3 { color: var(--ink); margin: 0 0 4px; }
.empty-icon { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--ink-subtle); }
.skeleton { border-radius: var(--radius-lg); background: #fff; border: 1px solid var(--outline-soft); overflow: hidden; }
.skeleton div { background: linear-gradient(90deg, #EEF2F6 0%, #F7F9FB 50%, #EEF2F6 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton .sk-img { aspect-ratio: 1 / 1; }
.skeleton .sk-line { height: 12px; margin: 12px 14px 0; border-radius: 6px; }
.skeleton .sk-line.short { width: 50%; margin-bottom: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.load-more-wrap { display: flex; justify-content: center; padding: 28px 0 0; }
.load-more { min-width: 220px; min-height: 46px; border-radius: var(--radius-md); border: 1.5px solid var(--primary); background: #fff; color: var(--primary); font-weight: 700; }
.load-more:hover { background: var(--primary-tint); }

/* ---------- CATEGORIES AND SHOPS PAGES ---------- */
.page-heading { margin: 2px 0 16px; }
.page-heading h2 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -.8px; color: var(--primary); line-height: 1.15; }
.page-heading p { margin: 4px 0 0; font-size: 16px; color: var(--ink-muted); }
.page-search { max-width: 640px; margin-bottom: 22px; }
.text-btn { color: var(--primary); font-weight: 600; font-size: 17px; padding: 4px 0; margin-bottom: 18px; }
.text-btn:hover { text-decoration: underline; }
.section-sub { margin-bottom: 14px; }
.section-sub h3 { margin: 0; font-size: 21px; font-weight: 700; }
.section-sub p { margin: 2px 0 0; color: var(--ink-muted); font-size: 15px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.tile {
  display: flex; flex-direction: column; min-width: 0; text-align: left; padding: 0; overflow: hidden;
  background: var(--surface); border: 1.5px solid var(--outline-soft); border-radius: 20px;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, transform .2s ease;
}
.tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tile-img { aspect-ratio: 8 / 7; width: 100%; background: #fff; overflow: hidden; display: grid; place-items: center; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.tile:hover .tile-img img { transform: scale(1.04); }
.tile-fallback { display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(135deg, var(--primary-soft), #fff); color: var(--primary); font-size: 44px; font-weight: 800; }
.tile-body { padding: 14px 16px 18px; }
.tile-name { display: block; font-size: 18px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-count { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 15px; color: var(--ink-muted); }
.tile-count .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.tile-count svg { width: 19px; height: 19px; color: var(--primary); }

/* ---------- ASK AI AND BOTTOM NAVIGATION ---------- */
.ask-ai {
  position: fixed; right: 24px; bottom: 24px; z-index: 26; display: grid; place-items: center; align-content: center; gap: 2px;
  width: 84px; height: 84px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 14px;
  background: linear-gradient(140deg, var(--teal) 0%, var(--green-dark) 100%);
  box-shadow: 0 10px 28px rgba(24,104,111,.38); transition: transform .15s ease;
}
.ask-ai:hover { transform: scale(1.05); }
.ask-ai svg { width: 28px; height: 28px; }
.bottom-nav { display: none; }

/* ---------- PRODUCT DETAILS ---------- */
.lightbox-modal { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; padding: 24px; overscroll-behavior: contain; }
.lightbox-modal.show { display: grid; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(17,24,39,.55); backdrop-filter: blur(4px); }
.lightbox-dialog {
  position: relative; z-index: 1; width: min(980px, 100%); max-height: 88vh; background: #fff;
  border-radius: var(--radius-xl); box-shadow: var(--shadow-modal); overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  animation: modalZoomIn .22s cubic-bezier(.16,1,.3,1);
}
@keyframes modalZoomIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.lightbox-media { position: relative; background: var(--primary-tint); display: grid; place-items: center; min-height: 420px; max-height: 88vh; overflow: hidden; padding: 20px; }
.lightbox-media img { width: 100%; height: 100%; object-fit: contain; max-height: calc(88vh - 40px); border-radius: 18px; background: #fff; }
.lightbox-details { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: 88vh; min-width: 0; padding: 28px 26px 0; }
.lightbox-close-btn { position: absolute; right: 14px; top: 14px; z-index: 3; width: 40px; height: 40px; border-radius: 50%; background: #fff; color: var(--ink); border: 1px solid var(--outline-soft); display: grid; place-items: center; font-size: 22px; box-shadow: var(--shadow-sm); }
.lightbox-close-btn:hover { background: var(--bg); }
.lightbox-category { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--primary); }
.lightbox-title { font-size: 28px; font-weight: 800; line-height: 1.2; margin: 4px 44px 0 0; color: var(--ink); letter-spacing: -.4px; }
.lb-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 16px; color: var(--ink-muted); font-weight: 500; }
.lb-meta .badge { position: static; box-shadow: none; font-size: 13px; padding: 4px 12px; }
.lightbox-desc { color: var(--ink-muted); font-size: 14.5px; line-height: 1.6; margin: 0; white-space: pre-line; }
.lightbox-price-box { padding: 14px 16px; border-radius: var(--radius-lg); background: var(--primary-tint); border: 1px solid var(--primary-soft); }
.lightbox-price-box .price { font-size: 30px; color: var(--ink); }
.lightbox-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; color: var(--ink-muted); }
.lightbox-facts strong { color: var(--ink); }
.lb-offers { border-radius: var(--radius-lg); background: var(--bg); padding: 14px 16px 6px; }
.lb-offers h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.lb-offer { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--outline-soft); font-size: 15px; }
.lb-offer:first-of-type { border-top: 0; }
.lb-offer .qty { color: var(--ink-muted); }
.lb-offer .who { color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-offer strong { font-weight: 700; white-space: nowrap; }
.lb-offer.chosen .who { color: var(--primary); font-weight: 600; }
.lb-actionbar { position: sticky; bottom: 0; margin: auto -26px 0; padding: 14px 26px 18px; background: linear-gradient(180deg, rgba(255,255,255,0) 0, #fff 14px); }
.lightbox-action-slot .btn-add { min-height: 52px; font-size: 16px; background: var(--primary); color: #fff; border-color: var(--primary); }
.lightbox-action-slot .btn-add:hover { background: var(--primary-dark); }
.lightbox-action-slot .card-stepper { min-height: 52px; }

/* ---------- OVERLAY, CART ---------- */
.overlay { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 40; display: none; backdrop-filter: blur(3px); }
.overlay.show { display: block; }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(460px, 100%); z-index: 50; background: var(--bg);
  box-shadow: -15px 0 50px rgba(17,24,39,.2); visibility: hidden; transform: translateX(105%);
  transition: transform .26s cubic-bezier(.16,1,.3,1), visibility 0s linear .26s;
  display: flex; flex-direction: column; overflow: hidden; overscroll-behavior: contain;
}
.drawer.open { visibility: visible; transform: none; transition-delay: 0s; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 18px 20px; background: #fff; border-bottom: 1px solid var(--outline-soft); }
.drawer-head h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.drawer-subtitle { margin: 2px 0 0; color: var(--ink-muted); font-size: 13px; }
.close-btn { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; background: var(--bg); color: var(--ink); font-size: 22px; }
.close-btn:hover { background: var(--surface-variant); }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.cart-line { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px; background: #fff; border: 1px solid var(--outline-soft); border-radius: var(--radius-lg); }
.cart-thumb { width: 72px; aspect-ratio: 1 / 1; border-radius: var(--radius-md); background: var(--primary-tint); overflow: hidden; display: grid; place-items: center; color: var(--primary); font-size: 11px; font-weight: 800; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.line-copy { min-width: 0; display: grid; gap: 6px; }
.line-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.line-title { font-size: 14.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.line-total { font-size: 15px; font-weight: 800; white-space: nowrap; color: var(--primary-dark); }
.line-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.line-price { font-size: 12px; color: var(--ink-muted); font-weight: 500; }
.line-deal { font-size: 11.5px; color: var(--green-dark); font-weight: 700; }
.drawer-qty-stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--outline); border-radius: 12px; padding: 2px; background: #fff; }
.drawer-qty-stepper button { display: grid; place-items: center; border-radius: 10px; width: 32px; height: 32px; color: var(--primary); font-size: 18px; font-weight: 700; }
.drawer-qty-stepper button:hover { background: var(--primary-soft); }
.drawer-qty-stepper span { min-width: 26px; text-align: center; font-weight: 800; font-size: 14px; }
.line-remove { font-size: 12px; font-weight: 600; color: var(--ink-muted); padding: 2px; }
.line-remove:hover { color: var(--danger); text-decoration: underline; }
.empty-cart { margin: auto; padding: 40px 20px; text-align: center; color: var(--ink-muted); display: grid; justify-items: center; }
.empty-cart-icon { display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%; background: var(--surface-variant); color: var(--primary); margin-bottom: 20px; }
.empty-cart-icon svg { width: 46px; height: 46px; }
.empty-cart h3 { color: var(--ink); margin: 0 0 6px; font-size: 24px; font-weight: 700; }
.empty-cart p { margin: 0 0 22px; font-size: 15px; max-width: 300px; }
.empty-cart .btn-primary { min-width: 200px; }
.drawer-footer { border-top: 1px solid var(--outline-soft); padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; background: #fff; }
.summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--ink-muted); }
.summary-row.total { font-size: 21px; font-weight: 800; color: var(--ink); }
.btn-checkout { min-height: 52px; font-size: 16px; }

/* ---------- BUTTONS AND FORMS ---------- */
.btn-primary, .btn-pill {
  min-height: 46px; border-radius: var(--radius-md); padding: 10px 20px; font-weight: 700; font-size: 15px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-pill { background: #fff; color: var(--primary); border: 1.5px solid var(--outline); }
.btn-pill:hover { border-color: var(--primary); }
.btn-ghost { color: var(--primary); font-weight: 700; padding: 8px 12px; border-radius: var(--radius-md); }
.btn-ghost:hover { background: var(--primary-tint); }
.full { width: 100%; }
.field-label { display: block; margin: 0 0 6px; color: var(--ink); font-size: 13px; font-weight: 600; }
.field {
  display: block; width: 100%; min-height: 50px; border: 1.5px solid var(--outline); border-radius: var(--radius-md);
  padding: 10px 14px; background: #fff; color: var(--ink); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(8,106,168,.10); }
textarea.field { min-height: 88px; resize: vertical; }
.error { color: var(--danger); min-height: 18px; font-size: 13px; font-weight: 600; }
.error:empty { min-height: 0; }

/* ---------- MODALS ---------- */
.modal {
  position: fixed; z-index: 55; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 32px)); max-height: 90dvh; overflow-y: auto; background: #fff;
  border-radius: var(--radius-xl); padding: 24px; display: none; box-shadow: var(--shadow-modal); overscroll-behavior: contain;
}
.modal.show { display: block; animation: modalZoomIn .2s cubic-bezier(.16,1,.3,1); }
.modal .drawer-head { padding: 0 0 14px; background: none; }
.modal h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.modal-copy { margin: 12px 0 16px; color: var(--ink-muted); font-size: 14px; }
.form-stack { display: grid; gap: 12px; }
.form-stack .field { margin: 0; }
.switch-auth { color: var(--primary); font-weight: 700; padding: 4px; }
.switch-auth:hover { text-decoration: underline; }
.notice-box { font-size: 13px; color: var(--primary-dark); background: var(--primary-soft); padding: 10px 12px; border-radius: var(--radius-md); line-height: 1.4; }
.checkout-modal { width: min(520px, calc(100% - 32px)); }
.checkout-section { margin-top: 18px; }
.checkout-section h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }
.option-list { display: grid; gap: 10px; }
.option-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 16px; border: 2px solid var(--outline-soft); border-radius: var(--radius-lg); cursor: pointer; transition: border-color .15s, background .15s; }
.option-card:hover { border-color: #9CC7E6; }
.option-card:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card:has(input:focus-visible) { outline: 3px solid rgba(8,106,168,.32); outline-offset: 2px; }
.option-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.option-title { display: block; font-weight: 700; font-size: 15px; }
.option-desc { display: block; font-size: 12.5px; color: var(--ink-muted); }
.option-price { font-weight: 800; font-size: 15px; white-space: nowrap; text-align: right; }
.option-price small { display: block; font-size: 11px; font-weight: 700; color: var(--green-dark); }
.details-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 700; padding: 4px 0; }
.details-toggle svg { transition: transform .15s; }
.details-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.checkout-summary { margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--bg); display: grid; gap: 6px; }
.checkout-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 16px; }
.checkout-success { text-align: center; padding: 10px 0 4px; }
.success-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; background: var(--success-soft); color: var(--success); }
.checkout-success h3 { margin: 0 0 6px; font-size: 21px; }
.checkout-success p { margin: 0 0 18px; color: var(--ink-muted); }
.checkout-success .btn-row { display: grid; gap: 10px; }

/* ---------- ACCOUNT (the app's My Profile) ---------- */
#account { padding: 0; width: min(500px, calc(100% - 32px)); background: var(--bg); }
#account > .drawer-head { display: none; }
.profile-head {
  position: relative; overflow: hidden; isolation: isolate; padding: 26px 24px 30px; color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 55%, var(--teal) 100%);
  border-radius: 0 0 28px 28px;
}
.profile-head::before, .profile-head::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); z-index: -1; }
.profile-head::before { width: 220px; height: 220px; left: -80px; top: -110px; }
.profile-head::after { width: 200px; height: 200px; right: -60px; bottom: -110px; background: rgba(47,174,73,.24); }
.profile-head .close-btn { position: absolute; right: 14px; top: 14px; background: rgba(255,255,255,.18); color: #fff; }
.profile-head .close-btn:hover { background: rgba(255,255,255,.28); }
.profile-title { margin: 0 0 16px; font-size: 18px; font-weight: 700; }
.profile-row { display: flex; align-items: center; gap: 16px; }
.profile-avatar { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: #fff; color: var(--primary); font-size: 30px; font-weight: 800; box-shadow: 0 0 0 5px rgba(255,255,255,.22); }
.profile-name { font-size: 24px; font-weight: 800; letter-spacing: -.4px; line-height: 1.15; }
.profile-phone { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 5px 14px; border-radius: var(--radius-full); background: rgba(255,255,255,.18); font-weight: 600; font-size: 15px; }
.profile-phone svg { width: 16px; height: 16px; }
.profile-body { padding: 16px; display: grid; gap: 12px; }
.profile-card { background: #fff; border: 1.5px solid var(--outline-soft); border-radius: 20px; padding: 14px 16px; }
.profile-card h3 { margin: 0 0 4px; font-size: 16px; }
.profile-card p { margin: 0; font-size: 14px; color: var(--ink-muted); }
.menu-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--outline-soft); border-radius: 20px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s; }
.menu-row:hover { border-color: var(--outline); box-shadow: var(--shadow-sm); }
.menu-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.menu-icon svg { width: 24px; height: 24px; }
.menu-icon.green { background: var(--green-soft); color: var(--green-dark); }
.menu-icon.ai { background: linear-gradient(140deg, var(--teal), var(--green-dark)); color: #fff; border-radius: 50%; }
.menu-title { display: block; font-size: 16px; font-weight: 700; color: var(--ink); }
.menu-sub { display: block; font-size: 13.5px; color: var(--ink-muted); line-height: 1.35; }
.menu-chev { color: var(--ink-subtle); }
.menu-chev svg { width: 20px; height: 20px; }
.menu-row.ai .menu-chev { color: var(--primary); }
.profile-orders h3 { margin: 8px 2px 8px; font-size: 16px; }
.order-card { background: #fff; border: 1.5px solid var(--outline-soft); border-radius: var(--radius-lg); padding: 12px 14px; margin: 8px 0; }
.order-card strong { font-size: 14px; }
.order-status-badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius-full); font-size: 11.5px; font-weight: 700; background: var(--primary-soft); color: var(--primary-dark); }
.signout-btn { color: var(--danger); background: #fff; border: 1.5px solid var(--danger-soft); }
.signout-btn:hover { background: var(--danger-soft); }
/* Older account markup (kept in case another script renders it). */
.account-card { background: var(--primary-tint); border: 1px solid var(--primary-soft); border-radius: var(--radius-md); padding: 14px; margin: 14px 0 16px; }

/* ---------- CART DOCK, TOAST, FOOTER ---------- */
.cart-dock { display: none!important; }
.toast {
  position: fixed; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); z-index: 80; max-width: calc(100% - 32px);
  transform: translate(-50%, 16px); padding: 12px 18px; border-radius: var(--radius-md); background: #2F3033; color: #fff;
  font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  transition: opacity .2s ease, transform .2s ease; display: inline-flex; align-items: center; gap: 8px;
}
.toast svg { color: #65C875; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.modal-open .toast { bottom: auto; top: calc(16px + env(safe-area-inset-top)); transform: translate(-50%, -16px); }
body.modal-open .toast.show { transform: translate(-50%, 0); }
.footer { padding: 36px 24px 48px; text-align: center; color: var(--ink-subtle); font-size: 13px; border-top: 1px solid var(--outline-soft); background: #fff; }
.footer p { margin: 0 auto 6px; max-width: 980px; }
.footer a { color: var(--primary); text-decoration: none; font-weight: 600; }
.footer a:hover { text-decoration: underline; }

/* ---------- MEDIUM SCREENS ---------- */
@media (max-width: 1080px) {
  .bar { grid-template-columns: auto minmax(200px, 1fr) auto; gap: 16px; }
  .head-btn-copy { display: none; }
  .brand-tagline { display: none; }
}

/* ---------- PHONES: the app layout ---------- */
@media (max-width: 760px) {
  body { background: var(--bg); }
  .top { background: #fff; }
  .bar { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 16px 12px; }
  .brand-mark { display: none; }
  .wordmark { font-size: 28px; letter-spacing: -.8px; }
  .brand-tagline { display: block; font-size: 14px; margin-top: 4px; }
  .search-wrap { grid-column: 1 / -1; grid-row: 2; }
  .search { height: 52px; border-radius: 18px; }
  .cart-btn { display: none; }
  .head-btn { padding: 4px; min-height: 44px; }
  .avatar { width: 40px; height: 40px; }
  .account-status-dot { left: 34px; top: 6px; }
  .tabs { display: none; }
  main { padding: 14px 14px calc(var(--nav-h) + 110px); }
  .hero { flex-direction: column; align-items: stretch; padding: 18px; gap: 14px; border-radius: 20px; }
  .hero h1 { font-size: 18px; margin: 0; }
  .hero p { display: none; }
  .hero-cta { min-height: 44px; padding: 10px 18px; }
  .hero-points { display: none; }
  .stories { gap: 12px; margin: 0 -14px 4px; padding: 6px 14px 12px; }
  .story { width: 78px; }
  .story-ring { width: 70px; height: 70px; }
  .story-name { font-size: 13px; }
  .cat-strip { margin: 0 -14px 12px; }
  .cats { padding: 2px 14px; }
  .catalog-head h2 { font-size: 19px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card:hover { transform: none; }
  .body { padding: 10px 11px 12px; gap: 4px; }
  .product-title { font-size: 15px; }
  .price { font-size: 20px; }
  .badge { font-size: 11px; padding: 3px 8px; left: 8px; top: 8px; }
  .photo-chip { left: 8px; bottom: 8px; font-size: 12px; }
  .btn-add { min-height: 42px; }
  .page-heading h2 { font-size: 30px; }
  .page-heading p { font-size: 15px; }
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { border-radius: 18px; }
  .tile-body { padding: 12px 12px 14px; }
  .tile-name { font-size: 16px; }
  .tile-count { font-size: 14px; }
  .ask-ai { right: 14px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); width: 72px; height: 72px; font-size: 13px; }
  .ask-ai svg { width: 24px; height: 24px; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 28; display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--outline-soft); box-shadow: 0 -4px 16px rgba(16,24,40,.05);
  }
  .bn-item { display: grid; justify-items: center; align-content: center; gap: 3px; color: var(--ink-muted); text-decoration: none; font-size: 12px; font-weight: 500; letter-spacing: .2px; }
  .bn-item svg { width: 26px; height: 26px; }
  .bn-item.active { color: var(--primary); font-weight: 700; }
  .bn-icon { position: relative; display: inline-grid; }
  .bn-badge { position: absolute; top: -5px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }
  .toast { bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); }
  .footer { padding-bottom: calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }

  /* Sheets slide up from the bottom, as in the app. */
  .lightbox-modal { padding: 0; place-items: end center; }
  .lightbox-dialog { grid-template-columns: 1fr; max-height: 94dvh; overflow-y: auto; border-radius: 26px 26px 0 0; background: var(--primary-tint); animation: sheetUp .25s cubic-bezier(.16,1,.3,1); }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
  .lightbox-media { order: 2; min-height: 0; max-height: none; padding: 0 16px; background: transparent; }
  .lightbox-media img { max-height: 46vh; border-radius: 22px; }
  .lightbox-details { display: contents; }
  .lb-head { order: 1; padding: 22px 64px 14px 20px; }
  .lightbox-title { font-size: 26px; margin: 0; }
  .lightbox-category { display: none; }
  .lightbox-price-box { order: 3; margin: 14px 16px 0; background: transparent; border: 0; padding: 4px 4px 0; }
  .lightbox-price-box .price { font-size: 32px; }
  .lb-offers { order: 4; margin: 12px 16px 0; background: #fff; }
  .lightbox-desc { order: 5; margin: 14px 20px 0; }
  #productExtras { order: 6; margin: 12px 20px 0; }
  .lb-actionbar { order: 7; position: sticky; bottom: 0; margin: 16px 0 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--outline-soft); }
  .lightbox-close-btn { top: 18px; right: 16px; background: transparent; border: 0; box-shadow: none; font-size: 30px; }
  .drawer { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 94dvh; border-radius: 26px 26px 0 0; transform: translateY(105%); }
  .drawer.open { transform: none; }
  .modal { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%; max-height: 94dvh; border-radius: 26px 26px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  #account { width: 100%; padding: 0 0 env(safe-area-inset-bottom); }
  .profile-head { border-radius: 26px 26px 28px 28px; }
  .checkout-modal { width: 100%; }
}
@media (max-width: 380px) {
  .wordmark { font-size: 24px; }
  .grid, .tile-grid { gap: 10px; }
  .price { font-size: 18px; }
  .bn-item { font-size: 11px; }
}
