/* =========================================================
   Kirana Online: shared styles (customer shop + admin)
   ========================================================= */
:root {
  /* Todamart theme: deep purple and coral from the logo, on clean white */
  --forest: #3A1155;         /* deep purple (logo background) */
  --forest-2: #4A1868;
  --gold: #F27E78;           /* coral (logo "T" and "mart") */
  --gold-deep: #E85F62;
  --cream: #FFFFFF;
  --brand: #4A1A6B;          /* buttons, cart bar */
  --brand-strong: #3A1155;
  --brand-soft: #F2EBF8;
  --brand-text: #4A1A6B;
  --on-brand: #FFFFFF;
  --head-bg: #FFFFFF;
  --head-ink: #2E0C45;
  --head-sub: #6E6380;
  --turmeric: #F27E78;       /* discount badges */
  --turmeric-soft: #FFF1EE;  /* notice ribbon */
  --turmeric-ink: #8C2E33;
  --chili: #C62F3B;
  --chili-soft: #FDE8EA;
  --bg: #F8F6FB;
  --card: #FFFFFF;
  --tile: #F4EFF8;
  --ink: #1E1528;
  --muted: #6A6475;
  --line: #ECE6F2;
  --field: #FFFFFF;
  --shadow: 0 1px 2px rgba(58, 17, 85, .06), 0 6px 18px rgba(58, 17, 85, .07);
  --radius-s: 10px;
  --radius-m: 14px;
  --font-head: "Poppins", "Segoe UI", system-ui, sans-serif;
  --font-body: "Hind", "Segoe UI", system-ui, sans-serif;
  --font-shop: "Rozha One", "Playfair Display", Georgia, "Times New Roman", serif;   /* classic signboard face for the shop name */
  --nav-h: 0px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* app feel on phones: no grey tap flash, no double-tap zoom delay */
button, a, label, .chip, .cat-tile { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { -webkit-user-select: none; user-select: none; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.3px; }
h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.2px; }
h3 { font-size: 1.08rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
img { max-width: 100%; display: block; }
a { color: var(--brand-text); }
svg { flex: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--turmeric); outline-offset: 2px; }

/* ---------- buttons & inputs ---------- */
button, .btn {
  font: inherit; font-weight: 600;
  border: 0; cursor: pointer;
  border-radius: var(--radius-s);
  padding: .6rem 1rem;
  background: var(--brand); color: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  text-decoration: none; min-height: 42px;
}
button:hover, .btn:hover { background: var(--brand-strong); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { background: var(--chili); color: #fff; }
.btn-danger:hover { background: var(--chili); filter: brightness(.92); }
.btn-turmeric { background: var(--turmeric); color: #18221D; }
.btn-turmeric:hover { background: var(--turmeric); filter: brightness(.95); }
.btn-block { width: 100%; }
.btn-small { min-height: 34px; padding: .35rem .7rem; font-size: .9rem; }

label { display: block; font-weight: 500; font-size: .92rem; margin-bottom: .75rem; }
input, select, textarea {
  font: inherit; font-size: 16px; /* 16px stops iPhone from zooming into fields */ color: var(--ink);
  width: 100%; margin-top: .25rem;
  padding: .6rem .7rem;
  background: var(--field);
  border: 1px solid var(--line); border-radius: var(--radius-s);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
textarea { resize: vertical; min-height: 70px; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--brand); }
/* lets the page notice when a browser autofills a search box */
@keyframes autofillSeen { from { opacity: 1; } to { opacity: 1; } }
input[type="search"]:-webkit-autofill { animation: autofillSeen 1ms; }
.row { display: flex; gap: .75rem; }
.row > * { flex: 1; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.check input { width: auto; margin: 0; }

/* ---------- layout & navbar ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1rem; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--head-bg); color: var(--head-ink);
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(37, 67, 42, .05);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .7rem; }
.topbar h1 { color: var(--head-ink); font-size: 1.3rem; }
.topbar .sub { font-size: .85rem; color: var(--head-sub); }
.topbar button, .topbar .btn { background: transparent; color: var(--head-ink); white-space: nowrap; }
.topbar button:hover { background: var(--brand-soft); }
.topbar .row button { border: 1px solid var(--line); }

/* customer navbar: brand | search | actions (search drops to its own row on phones) */
.topbar .head-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "brand search actions";
  align-items: center; gap: .75rem 1.25rem; padding-block: .7rem; }
.brand { grid-area: brand; display: flex; align-items: center; gap: .7rem; min-width: 0; text-decoration: none; color: inherit; }
.brand-logo { width: 52px; height: 52px; border-radius: 14px; flex: none; box-shadow: 0 2px 8px rgba(37,67,42,.28); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.wordmark { font-family: var(--font-head); font-weight: 700; font-size: 1.55rem; line-height: 1; color: var(--forest); letter-spacing: -.6px; }
.wordmark span { color: var(--gold-deep); }
.status { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--head-sub); margin-top: .2rem; min-width: 0; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: #2E9E57; }
.status.closed .dot { background: var(--chili); }
.shop-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
  font-family: var(--font-shop); font-size: 1.02rem; color: var(--forest); letter-spacing: .2px; line-height: 1.25; }
.open-tag { flex: none; display: inline-flex; align-items: center; gap: .3rem; background: var(--brand-soft); color: var(--brand-text);
  border-radius: 999px; padding: 0 .5rem; font-size: .78rem; font-weight: 600; }
.status.closed .open-tag { background: var(--chili-soft); color: var(--chili); }
.open-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.head-search { grid-area: search; position: relative; }
.head-search svg { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.head-search input { margin: 0; height: 48px; padding-left: 2.8rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-size: 1rem; }
.head-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(74,26,107,.15); }
.head-actions { grid-area: actions; display: flex; align-items: center; gap: .35rem; }
.icon-btn { min-height: 44px; padding: .35rem .75rem; border-radius: 12px; font-size: .92rem; gap: .45rem; }
.lang-btn { min-height: 44px; min-width: 44px; padding: .35rem .6rem; border-radius: 12px; font-weight: 700; font-size: .9rem;
  border: 1.5px solid var(--line) !important; color: var(--brand-text) !important; }
.topbar .cart-btn { position: relative; background: var(--brand); color: #fff; border-radius: 12px; min-height: 44px; padding: .35rem .9rem; gap: .45rem; }
.topbar .cart-btn:hover { background: var(--brand-strong); }
.badge-count { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; border-radius: 11px; padding: 0 6px;
  background: var(--gold-deep); color: #fff; font-size: .78rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--head-bg); }

.store-main { padding-top: 1.25rem; }

@media (max-width: 760px) {
  .topbar .head-grid { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand actions" "search search"; padding-block: .6rem .75rem; }
  .hide-mobile { display: none !important; }
  .brand-logo { width: 44px; height: 44px; }
  .wordmark { font-size: 1.4rem; }
  .cart-label { display: none; }
  .topbar .cart-btn { padding: .35rem .7rem; }
  .head-search input { height: 46px; }
}

.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600;
  padding: .1rem .55rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-text); }
.pill.closed, .pill.danger { background: var(--chili-soft); color: var(--chili); }
.pill.warn { background: var(--turmeric-soft); color: var(--turmeric-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.card { background: var(--card); border-radius: var(--radius-m); box-shadow: var(--shadow); padding: 1rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: .5rem; }

/* ---------- login popup brand ---------- */
.auth-brand { display: flex; align-items: center; gap: .75rem; background: var(--forest); border-radius: var(--radius-s); padding: .6rem .8rem; margin-bottom: 1rem; }
.auth-brand img { width: 44px; height: 44px; border-radius: 11px; box-shadow: 0 0 0 1px rgba(255,255,255,.2); }
.auth-brand b { display: block; font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; color: var(--cream); line-height: 1.1; }
.auth-brand span { font-size: .85rem; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

/* ---------- shop signboard ---------- */
.signboard { text-align: center; padding: .4rem 0 1.25rem; }
.sb-ornament { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: .35rem; }
.sb-ornament span { height: 2px; width: 56px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--gold)); }
.sb-ornament span:last-child { background: linear-gradient(90deg, var(--gold), transparent); }
.sb-ornament i { width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); border-radius: 2px; }
.sb-name { font-family: var(--font-shop); font-weight: 400; font-size: clamp(1.9rem, 6.4vw, 2.9rem); line-height: 1.05;
  color: var(--forest); letter-spacing: .3px; margin: 0; text-wrap: balance;
  text-shadow: 0 1px 0 #fff, 0 2px 0 rgba(242, 126, 120, .35); }
.sb-meta { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 0; color: var(--muted); font-size: .95rem; }
.open-tag.is-closed { background: var(--chili-soft); color: var(--chili); }

/* ---------- notice ribbon ---------- */
.notice { display: flex; gap: .6rem; align-items: flex-start; background: var(--turmeric-soft); border: 1px solid #F8CFC9; color: var(--turmeric-ink);
  border-radius: var(--radius-m); padding: .7rem 1rem; margin-bottom: 1rem; font-weight: 500; white-space: pre-line; }
.notice svg { flex: none; margin-top: 2px; color: var(--gold-deep); }

/* ---------- hero: the tagline's home, styled like the logo ---------- */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, 1fr); gap: 2rem; align-items: center;
  background: linear-gradient(135deg, #4A1868 0%, #3A1155 55%, #2A0A3F 100%); color: #fff; border-radius: 20px; padding: 1.75rem 2rem; margin-bottom: 2rem; overflow: hidden; }
/* speed lines, as in the logo */
.hero::before { content: ""; position: absolute; left: 44%; bottom: 26px; width: 170px; height: 85px; opacity: .2; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 110'%3E%3Cg fill='%23F27E78' transform='skewX(-14)'%3E%3Crect x='70' y='4' width='150' height='16' rx='8'/%3E%3Crect x='40' y='34' width='190' height='16' rx='8'/%3E%3Crect x='70' y='64' width='160' height='16' rx='8'/%3E%3Crect x='110' y='94' width='110' height='16' rx='8'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain; }
.hero-shop { display: none !important; }
.hero-shop-old { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; font-size: .9rem; color: #E4D8EE; margin: 0 0 .5rem; position: relative; }
.hero-shop .open-tag { background: rgba(255,255,255,.12); color: #CFEAD3; }
.hero.closed .hero-shop .open-tag { background: rgba(240,122,108,.2); color: #FFC9C1; }
.hero-tag { position: relative; font-family: var(--font-head); font-weight: 700; letter-spacing: -.01em; word-spacing: .04em; font-size: clamp(1.8rem, 3.2vw, 2.4rem); line-height: 1.12; color: var(--cream); margin: 0 0 .5rem; max-width: 22ch; }
.hero-sub { position: relative; color: #DDD2E8; max-width: 46ch; margin: 0 0 1rem; }
/* tagline always on one line: font size follows the banner's width */
.hero-main { container-type: inline-size; min-width: 0; }
@supports (font-size: 1cqi) {
  .hero-tag, .hero .hero-tag { white-space: nowrap; max-width: none; font-size: min(2.1rem, 6.2cqi); }   /* JS then shrinks it to fit */
}
.hero-cta { position: relative; background: var(--gold); color: #2E0C45; font-weight: 700; min-height: 44px; padding: .45rem 1.2rem; border-radius: 12px; }
.hero-cta:hover { background: #F59690; }
.hero-perks { list-style: none; margin: 0; padding: .4rem 1rem; display: grid; gap: 0; background: rgba(255,255,255,.07);
  border: 1px solid rgba(242,126,120,.35); border-radius: 14px; position: relative; }
.hero-perks li { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; }
.hero-perks li + li { border-top: 1px solid rgba(255,255,255,.12); }
.hero-perks .perk-ico { width: 38px; height: 38px; border-radius: 10px; background: rgba(242,126,120,.18); color: var(--gold); display: grid; place-items: center; flex: none; }
.hero-perks b { display: block; color: var(--cream); font-size: .98rem; line-height: 1.2; }
.hero-perks small { color: #D3C6DF; font-size: .82rem; }

/* phones: a slim banner, so products show on the first screen */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: .75rem; padding: 1rem 1.1rem 1.05rem; border-radius: 16px; margin-bottom: 1.5rem; }
  .hero::before { display: none; }   /* keep the small phone banner clean */
  .hero-sub, .hero-cta { display: none; }   /* shop name and status are already in the navbar */
  .hero-tag { font-size: 1.4rem; margin: 0; max-width: none; }
  .hero-perks { display: flex; flex-wrap: nowrap; gap: .35rem; padding: 0; background: none; border: 0; overflow-x: auto; scrollbar-width: none; }
  .hero-perks::-webkit-scrollbar { display: none; }
  .hero-perks li { flex: none; padding: .2rem .55rem .2rem .25rem; gap: .3rem; background: rgba(255,255,255,.08); border-radius: 999px; }
  .hero-perks li + li { border-top: 0; }
  .hero-perks .perk-ico { width: 24px; height: 24px; border-radius: 50%; }
  .hero-perks .perk-ico svg { width: 14px; height: 14px; }
  .hero-perks b { font-size: .78rem; font-weight: 600; white-space: nowrap; }
  .hero-perks small { display: none; }
}

/* ---------- categories ---------- */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0 0 .75rem; }
.sec-head h2 { font-size: 1.2rem; font-weight: 700; color: var(--forest); }
.see-all { background: none; color: var(--brand-text); min-height: 32px; padding: 0 .25rem; font-size: .92rem; }
.see-all:hover { background: none; text-decoration: underline; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 1rem .75rem; margin-bottom: 2rem; }
.cat-tile { background: none; color: var(--ink); padding: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .4rem;
  font-weight: 500; font-size: .85rem; line-height: 1.2; text-align: center; border-radius: 12px; }
.cat-tile:hover { background: none; }
.cat-tile:hover .cat-img { outline: 2px solid var(--brand); }
.cat-img { width: 100%; aspect-ratio: 1; border-radius: 18px; background: var(--tile); display: grid; place-items: center; overflow: hidden; font-size: 2.1rem; }
.cat-img img { width: 100%; height: 100%; object-fit: contain; padding: 10%; }
.cat-img .letter { font-family: var(--font-head); font-weight: 700; color: var(--brand-text); }

.chips { display: flex; gap: .5rem; overflow-x: auto; padding: 0 0 .9rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  padding: .3rem .9rem; min-height: 36px; font-weight: 500; }
.chip:hover { background: var(--brand-soft); }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

/* ---------- product rows & grid ---------- */
.shelf { margin-bottom: 1.75rem; }
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 158px; gap: .65rem; overflow-x: auto;
  scroll-snap-type: x proximity; padding-bottom: .4rem; scrollbar-width: thin; }
.scroller > * { scroll-snap-align: start; }
@media (min-width: 900px) { .scroller { grid-auto-columns: 176px; } .cat-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .65rem; }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); } }
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.list-head h2 { font-size: 1.2rem; font-weight: 700; color: var(--forest); }
.page-end { height: 7rem; }

.product { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .5rem;
  display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.p-img { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--tile); overflow: hidden;
  display: grid; place-items: center; font-size: 2.8rem; margin-bottom: .35rem; }
.p-img img { width: 100%; height: 100%; object-fit: contain; padding: 6%; }
.p-img .letter { font-family: var(--font-head); font-weight: 700; color: var(--brand-text); }
.badge { position: absolute; top: 6px; left: 6px; background: var(--gold-deep); color: #fff; font-size: .75rem; font-weight: 700;
  padding: .05rem .45rem; border-radius: 6px; }
.few { position: absolute; bottom: 6px; left: 6px; background: var(--card); color: var(--chili); font-size: .72rem; font-weight: 600;
  padding: .05rem .45rem; border-radius: 6px; }
.product.out .p-img img, .product.out .p-img .letter { opacity: .4; filter: grayscale(1); }
.product.out .p-img::after { content: "Out of stock"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(24,34,29,.82); color: #fff; font-size: .8rem; font-weight: 600; padding: .2rem .6rem; border-radius: 6px; white-space: nowrap; }
.p-unit { font-size: .8rem; color: var(--muted); }
.p-name { font-weight: 600; font-size: .95rem; line-height: 1.25; min-height: 2.5em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: .4rem; margin-top: auto; padding-top: .35rem; }
.p-price { line-height: 1.15; }
.p-price .now { font-weight: 700; font-size: 1rem; display: block; }
.p-price .mrp { color: var(--muted); text-decoration: line-through; font-size: .8rem; }
.add-btn { background: var(--card); color: var(--brand-text); border: 1.5px solid var(--brand); min-height: 34px; min-width: 70px; padding: 0 .6rem; border-radius: 9px; font-size: .9rem; }
.add-btn:hover { background: var(--brand-soft); }
.stepper { display: flex; align-items: center; background: var(--brand); color: var(--on-brand); border-radius: 9px; min-height: 34px; min-width: 70px; }
.stepper button { background: transparent; min-height: 34px; padding: 0 .5rem; font-size: 1.1rem; border-radius: 9px; }
.stepper button:hover { background: rgba(0,0,0,.15); }
.stepper span { font-weight: 700; flex: 1; text-align: center; font-size: .92rem; }

/* product photos usually have white backgrounds: blend them into the tile */
.p-img img, .cat-img img, .thumbs img { mix-blend-mode: multiply; }

/* loading placeholders */
.skel { background: var(--tile); border-radius: var(--radius-m); }
@media (prefers-reduced-motion: no-preference) { .skel { animation: pulse 1.2s ease-in-out infinite alternate; } }
@keyframes pulse { from { opacity: 1; } to { opacity: .55; } }

/* ---------- bottom cart bar ---------- */
.cartbar { position: fixed; left: 0; right: 0; bottom: var(--nav-h); z-index: 30;
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.cartbar button { pointer-events: auto; width: 100%; max-width: 560px; margin: 0 auto; display: flex; justify-content: space-between;
  min-height: 60px; border-radius: 16px; padding: .5rem .9rem; box-shadow: 0 8px 22px rgba(30,138,76,.3); background: var(--brand); }
.cart-left { display: flex; align-items: center; gap: .7rem; text-align: left; line-height: 1.2; }
.cart-left small { display: block; font-weight: 400; opacity: .9; }
.thumbs { display: flex; }
.thumbs span { width: 34px; height: 34px; border-radius: 10px; background: #fff; border: 2px solid var(--brand); margin-left: -10px;
  display: grid; place-items: center; overflow: hidden; font-size: 1.05rem; color: var(--brand-text); font-family: var(--font-head); font-weight: 700; }
.thumbs span:first-child { margin-left: 0; }
.thumbs img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.cart-right { display: flex; align-items: center; gap: .25rem; }

/* ---------- dialogs ---------- */
dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: min(560px, 100vw); width: 100%; max-height: 100%; }
dialog::backdrop { background: rgba(10, 20, 15, .55); }
.sheet { background: var(--card); border-radius: var(--radius-m); padding: 1.25rem; max-height: 90vh; overflow-y: auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.close-x { background: transparent; color: var(--muted); font-size: 1.5rem; min-height: 36px; padding: 0 .5rem; }
.close-x:hover { background: var(--brand-soft); }
@media (max-width: 600px) {
  dialog { margin: auto 0 0; max-width: 100vw; }
  .sheet { border-radius: 18px 18px 0 0; padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- the bill (parchi) ---------- */
.bill { background: var(--bg); padding: 1rem 1rem 1.6rem; position: relative; margin-bottom: 1.25rem; border-radius: var(--radius-s) var(--radius-s) 0 0; }
.bill::after { content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 10px;
  background: linear-gradient(-45deg, transparent 6px, var(--bg) 0) 0 0 / 14px 10px,
              linear-gradient(45deg, transparent 6px, var(--bg) 0) 0 0 / 14px 10px; background-repeat: repeat-x; }
.bill-shop { text-align: center; font-family: var(--font-shop); font-weight: 400; font-size: 1.55rem; color: var(--forest); letter-spacing: .3px; }
.bill-meta { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.bill hr { border: 0; border-top: 1.5px dashed var(--line); margin: .6rem 0; }
.bill-row { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .35rem 0; }
.bill-row .q { display: flex; align-items: center; gap: .1rem; }
.bill-row .q button { min-height: 30px; padding: 0 .55rem; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.bill-row .q span { min-width: 1.8rem; text-align: center; font-weight: 600; }
.bill-sum { display: flex; justify-content: space-between; padding: .15rem 0; }
.bill-total { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; }

.pay-options { display: grid; gap: .5rem; margin-bottom: 1rem; }
.pay-opt { display: flex; gap: .75rem; align-items: flex-start; border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: .7rem .8rem; margin: 0; cursor: pointer; }
.pay-opt input { width: auto; margin: .3rem 0 0; }
.pay-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.tabs { display: flex; gap: .25rem; background: var(--tile); padding: .25rem; border-radius: var(--radius-s); margin-bottom: 1rem; }
.tabs button { flex: 1; background: transparent; color: var(--muted); min-height: 38px; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- order tracking ---------- */
.order { margin-bottom: 1rem; }
.order-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: .5rem; }
.track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: .75rem 0 .25rem; }
.track span { height: 6px; border-radius: 3px; background: var(--line); }
.track span.done { background: var(--brand); }
.track-labels { display: grid; grid-template-columns: repeat(5, 1fr); font-size: .72rem; color: var(--muted); gap: 4px; }
.items-list { font-size: .92rem; color: var(--muted); margin: .5rem 0; }

/* ---------- addresses ---------- */
.field-label { font-weight: 500; font-size: .92rem; margin-bottom: .4rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label-chips { display: flex; gap: .4rem; margin-bottom: .5rem; }
.label-chips .chip { min-height: 34px; }
#newAddrBox { margin-bottom: 1rem; }
#addrPicker:empty { display: none; }
.addr-opt .addr-text { display: block; font-size: .9rem; color: var(--muted); white-space: pre-line; }
.addr-item { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .75rem .85rem; margin-bottom: .6rem; }
.addr-item .top { display: flex; align-items: center; gap: .5rem; margin-bottom: .2rem; }
.addr-item p { margin: 0 0 .5rem; color: var(--muted); white-space: pre-line; font-size: .92rem; }
.addr-item .acts { display: flex; gap: .4rem; flex-wrap: wrap; }
.addr-item.is-default { border-color: var(--brand); background: var(--brand-soft); }
.addr-item.is-default .pill, .pay-opt:has(input:checked) .pill { background: #fff; }
.addr-item.is-default .btn-ghost { background: #fff; }

/* ---------- footer ---------- */
.site-foot { margin-top: 2.5rem; border-top: 1px solid var(--line); padding: 1.75rem 0 1rem; display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto; gap: 1.25rem; align-items: center; }
.site-foot img { width: 76px; height: 76px; }
.site-foot .ft-tag { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; color: var(--forest); line-height: 1.3; }
.site-foot .ft-shop { font-size: .9rem; color: var(--muted); }
.site-foot .ft-acts { display: flex; gap: .5rem; flex-wrap: wrap; }
.site-foot .ft-copy { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); }
@media (max-width: 640px) { .site-foot { grid-template-columns: auto minmax(0, 1fr); } .site-foot .ft-acts { grid-column: 1 / -1; } }

/* ---------- bottom navigation (phones) ---------- */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  :root { --nav-h: 64px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bottom-nav button { background: none; color: var(--muted); flex-direction: column; gap: 2px; min-height: var(--nav-h);
    font-size: .74rem; font-weight: 600; border-radius: 0; padding: .3rem 0; }
  .bottom-nav button:hover { background: none; color: var(--brand-text); }
  .bottom-nav button[aria-current="page"] { color: var(--brand-text); }
  .bottom-nav button[aria-current="page"] svg { background: var(--brand-soft); border-radius: 10px; padding: 3px 12px; width: 46px; box-sizing: content-box; height: 22px; }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- install card, offline notice ---------- */
.install-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: .75rem;
  background: var(--card); border: 1.5px solid var(--gold); border-radius: var(--radius-m); padding: .7rem .5rem .7rem .8rem; margin-bottom: 1rem; }
.install-card img { border-radius: 12px; }
.install-card b { display: block; font-size: 1rem; }
.install-card span { display: block; font-size: .85rem; line-height: 1.35; color: var(--muted); }
.install-card .close-x { min-height: 36px; }
.offline { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom, 0px)); z-index: 60;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 999px; font-size: .9rem; font-weight: 500; width: max-content; max-width: calc(100vw - 2rem); text-align: center; }
.ios-steps { padding-left: 1.3rem; margin: 0 0 1.25rem; display: grid; gap: .75rem; }
.ios-steps svg { vertical-align: -4px; color: #0A84FF; }

/* bottom sheets: grab handle and swipe down to close */
.grab { display: none; }
@media (max-width: 600px) {
  .grab { display: block; width: 44px; height: 5px; border-radius: 3px; background: #D8CFE2; margin: -.5rem auto .75rem; }
  .sheet { overscroll-behavior: contain; transition: transform .2s ease; }
  dialog[open] .sheet { animation: sheetUp .22s ease-out; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { dialog[open] .sheet { animation: none; } .sheet { transition: none; } }

/* bigger touch targets on phones */
@media (max-width: 760px) {
  .add-btn, .stepper { min-height: 40px; min-width: 76px; }
  .stepper button { min-height: 40px; padding: 0 .65rem; }
  .chip { min-height: 40px; }
  .bill-row .q button { min-height: 36px; padding: 0 .7rem; }
  .p-name { font-size: 1rem; }
}

/* opened from the home screen (installed app) */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}

/* ---------- my profile ---------- */
.pf-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.avatar { width: 60px; height: 60px; border-radius: 50%; background: var(--forest); color: var(--gold); flex: none;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 1.7rem; padding-top: 3px; }
.pf-head h3 { font-size: 1.25rem; }
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1rem; }
.pf-stats .k { font-size: .8rem; color: var(--muted); }
.pf-stats .v { font-weight: 700; font-size: 1.1rem; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.pf-links { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.pf-links > * { padding-inline: .5rem; font-size: .92rem; }
@media (max-width: 420px) { .pf-stats .v { font-size: 1rem; } .pf-stats .card { padding: .75rem; } }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 1rem); transform: translate(-50%, -150%);
  background: var(--ink); color: var(--bg); padding: .7rem 1.1rem; border-radius: var(--radius-s); z-index: 100;
  max-width: calc(100vw - 2rem); transition: transform .25s ease; font-weight: 500; }
#toast.show { transform: translate(-50%, 0); }
#toast.error { background: var(--chili); color: #fff; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

.setup-warning { background: var(--turmeric-soft); border: 2px solid var(--turmeric); border-radius: var(--radius-m); padding: 1.25rem; margin: 2rem auto; max-width: 560px; }
