/* ---------- brand + top bar ---------- */
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; min-width: 0; }
.brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; box-shadow: var(--shadow-1); }
.brand-word { font-family: var(--font-display); font-weight: 850; font-size: 21px; letter-spacing: -.02em; }
.brand-word .g { color: var(--green-700); }
.brand-word .o { color: var(--orange-600); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.hello { font-size: 13px; color: var(--muted); font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); background: var(--surface-2); text-decoration: none; }
.cart-btn:hover { background: var(--green-50); color: var(--green-700); }
.cart-badge {
  position: absolute; top: -2px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--orange-600); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff;
}
.cart-badge[hidden] { display: none; }
@media (max-width: 380px) { .brand-word { display: none; } .hello { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-pill); border: 1px solid transparent;
  font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; transition: background .15s, transform .08s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn-lg { min-height: 52px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--green-700); color: #fff; box-shadow: 0 6px 14px -8px rgba(14, 122, 61, .8); }
.btn-primary:hover { background: var(--green-800); }
.btn-accent { background: var(--orange-500); color: #1d0f02; box-shadow: 0 6px 14px -8px rgba(227, 106, 12, .9); }
.btn-accent:hover { background: var(--orange-400); }
.btn-ghost { background: transparent; color: var(--green-800); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--green-50); }
.btn-soft { background: var(--green-50); color: var(--green-800); }
.btn-soft:hover { background: var(--green-100); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: #f0c7c8; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--bad); font-size: 13px; font-weight: 600; text-decoration: underline; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink-2); flex: none; text-decoration: none; }
.icon-btn:hover { background: var(--green-50); color: var(--green-700); }
.grow { flex: 1; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-ghost .spinner, .btn-soft .spinner { border-color: var(--line-2); border-top-color: var(--green-700); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- page head, cards, sections ---------- */
.page-head { display: flex; align-items: center; gap: 12px; }
.page-head-text { min-width: 0; flex: 1; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-1); }
.card-title { font-size: 16px; margin-bottom: 12px; }
.card-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.card-title-row .card-title { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section-head a { font-weight: 700; font-size: 14px; text-decoration: none; }
.label-head { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.field label, .field > legend, .field > .label { font-weight: 650; font-size: 14px; color: var(--ink-2); }
.req { color: var(--bad); }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .search-box input, select {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1.5px solid var(--line-2); border-radius: var(--r-sm);
  background: #fff; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
.field input[type=file] { min-height: 0; padding: 10px; font-size: 14px; }
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 4px rgba(34, 166, 80, .16); }
.field.has-error input, .field.has-error select, .field.has-error textarea, input[aria-invalid=true] { border-color: var(--bad) !important; background: #fffafa; }
.hint { font-size: 13px; color: var(--muted); }
.err { font-size: 13px; color: var(--bad); font-weight: 600; display: flex; gap: 6px; }
.err::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--bad); color: #fff; font-size: 11px; flex: none; margin-top: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--green-700); margin-top: 1px; flex: none; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px !important; }
.pw-toggle { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); border-radius: 50%; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; }
.seg-opt span { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: var(--r-pill); border: 1.5px solid var(--line-2); font-weight: 650; font-size: 14px; background: #fff; }
.seg-opt input:checked + span { border-color: var(--green-700); background: var(--green-50); color: var(--green-800); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--orange-500); outline-offset: 2px; }

/* chips & tabs */
.chips-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 1px 4px; }
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 36px; padding: 0 12px;
  border-radius: var(--r-pill); border: 1px solid var(--line-2); background: #fff; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.chip .i { width: 16px; height: 16px; color: var(--green-600); }
.chip:hover { border-color: var(--green-600); background: var(--green-50); }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-pill); }
.tab {
  flex: 1; min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: transparent;
  font-weight: 700; font-size: 14px; color: var(--muted); text-decoration: none; display: grid; place-items: center; white-space: nowrap;
}
.tab.active { background: #fff; color: var(--green-800); box-shadow: var(--shadow-1); }

/* steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.steps li::after { content: ""; flex: 1; height: 2px; background: var(--line-2); border-radius: 2px; }
.steps li:last-child::after { display: none; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; font-weight: 800; flex: none; }
.steps .dot .i { width: 15px; height: 15px; stroke-width: 3; }
.steps li.now { color: var(--green-800); }
.steps li.now .dot { background: var(--green-700); color: #fff; box-shadow: 0 0 0 4px var(--green-100); }
.steps li.done .dot { background: var(--green-100); color: var(--green-700); }
.steps li.done::after { background: var(--green-500); }

/* summary list */
.summary { margin: 0; display: flex; flex-direction: column; }
.summary > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.summary .total { border-bottom: 0; padding-top: 12px; font-size: 17px; }
.summary .total dt { color: var(--ink); font-weight: 750; }
.summary .total dd { color: var(--green-800); font-weight: 850; }

/* alerts, pills, badges */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; border: 1px solid; }
.alert .i { margin-top: 1px; }
.alert-error { background: var(--bad-50); border-color: #f2c4c5; color: #7d1418; }
.alert-success { background: var(--green-50); border-color: var(--green-100); color: var(--green-900); }
.alert-info { background: var(--info-50); border-color: #d3e0fb; color: #183f8a; }
.form-alert:empty { display: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 750; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--green-50); color: var(--green-800); }
.pill-live { background: var(--orange-50); color: var(--orange-700); }
.pill-live::before { animation: pulse 1.4s infinite; }
.pill-bad { background: var(--bad-50); color: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
.demo-badge { position: absolute; left: 8px; top: 8px; background: rgba(21, 33, 26, .78); color: #fff; font-size: 10.5px; font-weight: 750; padding: 3px 8px; border-radius: var(--r-pill); letter-spacing: .02em; }
.demo-badge.inline { position: static; display: inline-block; background: var(--surface-2); color: var(--ink-2); }
.concept-badge { display: inline-block; font-size: 10.5px; text-transform: none; letter-spacing: 0; font-weight: 750; padding: 2px 8px; border-radius: var(--r-pill); background: var(--orange-100); color: var(--orange-700); vertical-align: middle; }

.demo-box { border: 1.5px dashed var(--line-2); border-radius: var(--r-sm); padding: 10px 14px; background: #fbfcf9; font-size: 14px; }
.demo-box summary { cursor: pointer; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 8px; min-height: 32px; }
.demo-box summary .i { width: 18px; height: 18px; color: var(--orange-600); }
.demo-box label { display: block; font-weight: 650; margin: 8px 0 6px; }
.demo-box select { min-height: 44px; }
.demo-box .hint { margin-top: 6px; }

/* sticky call-to-action above the bottom nav */
.sticky-cta {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 20;
  display: flex; gap: 10px; padding: 10px; margin: 0 -6px; border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); box-shadow: var(--shadow-2); border: 1px solid var(--line);
}

/* empty state */
.empty { text-align: center; padding: 36px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--orange-50); color: var(--orange-600); }
.empty-ico .i { width: 30px; height: 30px; }
.empty p { color: var(--muted); max-width: 32ch; }

/* images */
.img-fallback { display: grid; place-items: center; background: linear-gradient(135deg, var(--green-50), var(--orange-50)); color: var(--green-600); }

/* ---------- product + store cards ---------- */
.p-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .p-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .p-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1100px) { .p-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.p-card { position: relative; background: var(--surface); border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow-1); transition: box-shadow .2s, transform .2s; }
.p-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.p-link { display: block; color: inherit; text-decoration: none; }
.p-media { position: relative; aspect-ratio: 1 / .82; background: var(--surface-2); }
.p-img { width: 100%; height: 100%; object-fit: cover; }
.p-media .img-fallback { width: 100%; height: 100%; }
.p-type { position: absolute; left: 8px; top: 8px; font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: var(--r-pill); letter-spacing: .03em; }
.p-type.food { background: var(--orange-500); color: #1d0f02; }
.p-type.item { background: var(--green-700); color: #fff; }
.p-off { position: absolute; inset: auto 0 0; background: rgba(21, 33, 26, .78); color: #fff; font-size: 12px; font-weight: 750; text-align: center; padding: 5px; }
.is-off .p-img { filter: grayscale(.8); opacity: .75; }
.p-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.p-name { font-size: 14px; font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.p-store { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; padding-right: 40px; }
.p-price { font-weight: 850; color: var(--orange-700); font-size: 15.5px; }
.p-rate { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); font-weight: 600; }
.p-rate .i, .s-meta .i, .detail-meta .i { width: 14px; height: 14px; fill: var(--orange-500); stroke: var(--orange-500); }
.p-add {
  position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--green-700); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 10px -4px rgba(14, 122, 61, .8); font-weight: 800;
}
.p-add .i { width: 20px; height: 20px; stroke-width: 2.6; }
.p-add.has-qty { background: var(--orange-500); color: #1d0f02; }
.p-add.bump { animation: bump .3s; }
@keyframes bump { 50% { transform: scale(1.18); } }

.h-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 72%); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 8px; scrollbar-width: thin; }
@media (min-width: 640px) { .h-scroll { grid-auto-columns: 260px; } }
.h-scroll > * { scroll-snap-align: start; }
.s-card { display: block; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow-1); }
.s-card:hover { box-shadow: var(--shadow-2); }
.s-media { position: relative; aspect-ratio: 16 / 8; background: var(--surface-2); }
.s-img, .s-media .img-fallback { width: 100%; height: 100%; object-fit: cover; }
.s-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.s-body p { font-size: 12.5px; color: var(--muted); }
.s-meta { display: flex; align-items: center; gap: 4px; }

/* stepper */
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; }
.stepper output { min-width: 32px; text-align: center; font-weight: 800; }
.stepper .icon-btn { background: #fff; width: 40px; height: 40px; box-shadow: var(--shadow-1); }
.stepper.sm .icon-btn { width: 36px; height: 36px; }
.stepper.sm .i { width: 18px; height: 18px; }

/* dialog */
.dlg { padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.dlg p { color: var(--muted); }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* lazy-loaded photos: shimmer until the image arrives, then fade in */
img[data-fallback] { transition: opacity .3s ease; }
img.img-wait { opacity: 0; }
.p-media, .s-media, .detail-media { background: linear-gradient(100deg, var(--surface-2) 30%, #fff 50%, var(--surface-2) 70%) 0 0 / 300% 100%; animation: img-shimmer 1.3s linear infinite; }
.p-media:has(img:not(.img-wait)), .p-media:has(.img-fallback), .s-media:has(img:not(.img-wait)), .s-media:has(.img-fallback), .detail-media:has(img:not(.img-wait)) { animation: none; background: var(--surface-2); }
@keyframes img-shimmer { to { background-position: -300% 0; } }
@media (prefers-reduced-motion: reduce) { .p-media, .s-media, .detail-media { animation: none; } img[data-fallback] { transition: none; } }

.p-badges { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.p-badge { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: var(--r-pill); letter-spacing: .02em; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.p-badge.featured { background: #1d4ed8; color: #fff; }
.p-badge.new { background: #fff; color: var(--green-700); border: 1px solid var(--green-700); }
.p-badge.popular { background: var(--orange-500); color: #1d0f02; }
.p-rate small { font-weight: 500; }
.p-rate.is-new { font-size: 11px; font-weight: 600; }
.p-sold { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); font-weight: 600; }
