@font-face {
  font-family: "Peyda";
  src: url("/fonts/PeydaWebFaNum-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Peyda";
  src: url("/fonts/PeydaWebFaNum-Medium.woff2") format("woff2");
  font-weight: 500 600;
  font-display: swap;
}
@font-face {
  font-family: "Peyda";
  src: url("/fonts/PeydaWebFaNum-Bold.woff2") format("woff2");
  font-weight: 700 900;
  font-display: swap;
}
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f3f7);
  --text: var(--tg-theme-text-color, #1c1c1e);
  --hint: var(--tg-theme-hint-color, #626a75);
  --link: var(--tg-theme-link-color, #2481cc);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --section: var(--tg-theme-section-bg-color, var(--bg));
  --danger: var(--tg-theme-destructive-text-color, #e53935);
  --accent-orange: #f8a917;
  --opt-border: color-mix(in srgb, var(--text) 13%, transparent);
  --pastel-page: var(--bg2);
  --pastel-card: var(--section);
  --pastel-chip: color-mix(in srgb, var(--btn) 8%, var(--bg));
  --pastel-opt: var(--bg);
  --pastel-opt-selected: color-mix(in srgb, var(--btn) 10%, var(--bg));
  --action-text: color-mix(in srgb, var(--link) 80%, var(--text));
  --shop-width: 1080px;
  --radius: 14px;
  --bottom-nav-h: 64px;
  --main-btn-h: 56px;
  --product-actions-h: 66px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --chrome-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg2); scrollbar-color: var(--opt-border) var(--bg2); }
body {
  font-family: "Peyda", Tahoma, system-ui, sans-serif;
  background: var(--pastel-page);
  color: var(--text);
  font-size: 15px;
  padding-bottom: calc(var(--chrome-bottom) + var(--main-btn-h));
  -webkit-font-smoothing: antialiased;
  max-width: var(--shop-width);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  line-height: 1.6;
}
body.drawer-open { overflow: hidden; }
button, input, textarea { font-family: inherit; font-size: inherit; }
button { touch-action: manipulation; }
input, textarea { caret-color: var(--btn); }
::selection { background: var(--btn); color: var(--btn-text); }
:where(button, a, input, textarea):focus-visible { outline: 2px solid var(--btn); outline-offset: 3px; }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.muted { color: var(--hint); font-size: 13px; }

.topbar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 14px 16px 10px; border-bottom: 1px solid var(--opt-border); }
.topbar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.menu-drawer-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--opt-border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.menu-drawer-btn:focus-visible { outline: 2px solid var(--btn); outline-offset: 2px; }
.menu-drawer-icon { width: 20px; height: 20px; }
.topbar h1 { margin: 0; flex: 0 1 auto; max-width: 42%; font-size: 17px; font-weight: 700; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { display: block; position: relative; flex: 1 1 auto; margin: 0; min-width: 0; }
.search-icon { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--hint); pointer-events: none; }
.search input {
  width: 100%;
  border: 1px solid transparent;
  background: var(--bg2);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 40px 9px 12px;
  min-height: 44px;
  font-size: 16px;
}
.search input:focus { border-color: var(--btn); }
.search input::placeholder { color: var(--hint); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid transparent;
  padding: 9px 14px;
  border-radius: 99px;
  background: var(--bg2);
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  min-height: 40px;
}
.chip.child { background: transparent; border-color: var(--opt-border); }
.chip.active { background: var(--btn); color: var(--btn-text); box-shadow: none; }

.view { padding: 16px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.card {
  background: var(--pastel-card);
  border-radius: var(--radius);
  padding: 8px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid transparent;
  transition: border-color 160ms ease;
}
.product-open { display: block; width: 100%; border: 0; padding: 0; border-radius: 10px; background: var(--bg2); cursor: pointer; overflow: hidden; }
.card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--bg2); }
.card .name { font-weight: 700; font-size: 14px; margin: 9px 2px 5px; line-height: 1.5; min-height: 3em; text-align: center; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.card .price { margin: 0 2px 10px; text-align: center; font-size: 15px; }
.price { color: var(--text); font-weight: 800; font-size: 14px; }
.price small { font-weight: 400; color: var(--hint); font-size: 12px; }
.badge { position: absolute; top: 13px; left: 13px; min-width: 25px; height: 25px; padding: 0 7px; border-radius: 13px; background: var(--accent-orange); color: #1c1c1e; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.card .actions { margin-top: auto; display: flex; gap: 6px; }
.btn-primary, .btn-secondary { border: 0; border-radius: 10px; padding: 10px 12px; min-height: 44px; line-height: 1.5; font-weight: 700; cursor: pointer; flex: 1; transition: background-color 140ms ease, opacity 140ms ease; }
.card .btn-primary { background: var(--btn); color: var(--btn-text); font-size: 14px; min-height: 42px; padding-block: 9px; }
.card.sold-out .btn-primary { background: var(--bg2); color: var(--hint); opacity: 1; }
.btn-primary { background: var(--btn); color: var(--btn-text); }
.btn-secondary { background: var(--bg2); color: var(--link); }
.btn-minus { flex: 0 0 42px; display: grid; place-items: center; padding: 0; background: color-mix(in srgb, var(--danger) 12%, var(--bg)); color: var(--danger); border: 0; border-radius: 10px; font-size: 22px; line-height: 1; font-weight: 500; cursor: pointer; }

.section-head { display: flex; justify-content: space-between; align-items: center; }
h2 { font-size: 17px; margin: 4px 2px 12px; }
.link { background: none; border: 0; color: var(--link); cursor: pointer; font-weight: 700; }
.cart-list { background: var(--pastel-card); border-radius: var(--radius); overflow: hidden; border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, var(--hint)) 18%, transparent); }
.cart-item { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 12px; border-bottom: 1px solid var(--opt-border); }
.cart-item:last-child { border-bottom: 0; }
.cart-item img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .info b { display: block; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 10px; padding: 3px; }
.stepper button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 8px; background: var(--section); color: var(--text); font-size: 22px; line-height: 1; font-weight: 500; cursor: pointer; }
.stepper span { min-width: 20px; text-align: center; font-weight: 800; }
.total-row { display: flex; justify-content: space-between; align-items: center; background: var(--section); border-radius: var(--radius); padding: 14px; margin-top: 10px; }
.total-row b { font-size: 16px; }

.form { background: var(--pastel-card); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 12px; border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, var(--hint)) 18%, transparent); }
.form label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text); }
.form input, .form textarea { border: 1px solid var(--opt-border); background: var(--bg); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 16px; min-height: 44px; resize: vertical; }
.form input:focus, .form textarea:focus { border-color: var(--btn); }
.form .invalid { border-color: var(--danger); }
.hint { color: var(--hint); font-size: 13px; line-height: 1.8; padding: 0 4px; }
.hint.error { color: var(--danger); }

.done { text-align: center; padding: 10px 4px; }
.done-icon { font-size: 56px; }
.pay-card { background: linear-gradient(135deg, #2b5876, #4e4376); color: #fff; border-radius: 18px; padding: 18px; margin: 14px 0; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.pay-card .amount { font-size: 20px; font-weight: 800; }
.pay-card .card-no { font-size: 22px; letter-spacing: 2px; margin: 14px 0 6px; font-family: ui-monospace, monospace; }
.pay-card .holder { opacity: .9; margin-bottom: 12px; }
.pay-card .btn-secondary { background: rgba(255,255,255,.2); color: #fff; }
.step { font-size: 15px; line-height: 1.9; }

.side-drawer {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}
.side-drawer.open { pointer-events: auto; }
.side-drawer-overlay {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0);
  cursor: pointer;
  transition: background 0.22s ease;
}
.side-drawer.open .side-drawer-overlay { background: rgba(0, 0, 0, 0.42); }
.side-drawer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(88vw, 320px);
  max-width: 100%;
  background: var(--pastel-page);
  color: var(--text);
  border-inline-start: 1px solid var(--opt-border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s ease;
  outline: none;
}
.side-drawer.open .side-drawer-panel { transform: translateX(0); }
.side-drawer-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--opt-border);
  background: var(--section);
  flex-shrink: 0;
}
.side-drawer-tab {
  flex: 1;
  border: 1px solid var(--opt-border);
  border-radius: 10px;
  padding: 10px 8px;
  background: var(--pastel-chip);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.side-drawer-tab.active {
  background: var(--btn);
  color: var(--btn-text);
  border-color: transparent;
}
.side-drawer-tab:focus-visible { outline: 2px solid var(--btn); outline-offset: 2px; }
.side-drawer-panel-body {
  flex: 1;
  overflow: auto;
  padding: 8px 0 calc(8px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.drawer-menu-list { list-style: none; margin: 0; padding: 0; }
.drawer-menu-item { margin: 0; }
.drawer-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--opt-border);
  background: transparent;
  color: var(--text);
  padding: 14px 16px;
  font-weight: 700;
  font-size: 15px;
  text-align: start;
  cursor: pointer;
}
.drawer-menu-link.active { color: var(--link); background: var(--pastel-card); }
.drawer-menu-link:focus-visible { outline: 2px solid var(--btn); outline-offset: -2px; }
.drawer-menu-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--hint);
}
.drawer-menu-link.active .drawer-menu-icon { color: var(--link); }
.drawer-menu-badge {
  margin-inline-start: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--accent-orange);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.drawer-cat-list { list-style: none; margin: 0; padding: 0; }
.drawer-cat-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--opt-border);
  background: var(--pastel-card);
}
.drawer-cat-row.child { background: var(--pastel-page); }
.drawer-cat-open {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 10px 12px 14px;
  font-weight: 700;
  font-size: 14px;
  text-align: start;
  cursor: pointer;
}
.drawer-cat-open:focus-visible { outline: 2px solid var(--btn); outline-offset: -2px; }
.drawer-cat-open.active { color: var(--btn); }
.drawer-cat-open span { min-width: 0; white-space: normal; line-height: 1.35; }
.drawer-cat-toggle {
  flex: 0 0 auto;
  width: 44px;
  border: 0;
  border-inline-start: 1px solid var(--opt-border);
  background: transparent;
  color: var(--hint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.drawer-cat-toggle:focus-visible { outline: 2px solid var(--btn); outline-offset: -2px; }
.drawer-cat-toggle svg { width: 20px; height: 20px; transition: transform 0.2s ease; }
.drawer-cat-toggle.expanded svg { transform: rotate(-90deg); }
.drawer-cat-toggle.placeholder { visibility: hidden; pointer-events: none; }
.drawer-cat-children { list-style: none; margin: 0; padding: 0; }
.drawer-cat-children.hidden { display: none !important; }
.drawer-cat-empty { padding: 20px 16px; color: var(--hint); font-size: 14px; }

.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.sheet-body { position: absolute; bottom: 0; left: 0; right: 0; background: var(--bg); border-radius: 18px 18px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); animation: up .2s ease; max-height: 85vh; overflow: auto; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.sheet-head img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; }
.sheet-head h3 { margin: 0 0 4px; font-size: 16px; }
.opt-group { margin: 12px 0; }
.opt-group .opt-title { font-size: 13px; color: var(--hint); margin-bottom: 6px; }
.opt-values { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  border: 1px solid var(--opt-border);
  background: var(--pastel-opt);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
}
.opt.selected {
  border-color: var(--btn);
  background: var(--pastel-opt-selected);
  color: var(--action-text);
  font-weight: 700;
}
.sheet-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }

.fallback-main {
  position: fixed;
  bottom: var(--chrome-bottom);
  left: 0; right: 0; z-index: 10;
  border: 0; background: var(--btn); color: var(--btn-text);
  font-weight: 800; font-size: 16px; padding: 14px 16px; cursor: pointer;
  width: 100%; max-width: var(--shop-width); margin-inline: auto;
  min-height: var(--main-btn-h);
  font-family: inherit; line-height: 1.3; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.fallback-main:active:not(:disabled) { filter: brightness(0.92); }
.fallback-main:disabled { opacity: 0.6; cursor: progress; }
.fallback-main[aria-busy="true"]::after {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-inline-start: 10px; vertical-align: -2px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: fallback-main-spin 0.8s linear infinite;
}
@keyframes fallback-main-spin { to { transform: rotate(360deg); } }
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0; z-index: 12;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: var(--section);
  border-top: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  padding-bottom: var(--safe-bottom);
  min-height: var(--bottom-nav-h);
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  max-width: var(--shop-width);
  margin-inline: auto;
}
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px 8px;
  border: 0;
  background: transparent;
  color: var(--hint);
  cursor: pointer;
  min-width: 0;
}
.nav-tab.active { color: var(--link); }
.nav-tab.active .nav-label { font-weight: 700; }
.nav-tab { margin: 4px 2px; }
.nav-icon { width: 22px; height: 22px; }
.nav-icon-wrap { position: relative; display: inline-flex; }
.nav-badge {
  position: absolute;
  top: -6px;
  left: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.nav-badge.hidden { display: none !important; }
.nav-label { font-size: 11px; font-weight: 500; text-align: center; line-height: 1.4; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.category-card {
  background: var(--pastel-card);
  border-radius: var(--radius);
  padding: 20px 14px;
  min-height: 76px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.45;
  border: 1px solid var(--opt-border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  word-break: break-word;
}
.category-card.child { font-size: 15px; font-weight: 700; }

.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 4px 2px; }
.profile-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--bg2); flex-shrink: 0; }
.profile-photo.fallback { display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; color: var(--text); text-transform: uppercase; }
.profile-photo.hidden + .profile-photo.fallback { display: flex; }
.profile-photo:not(.hidden) + .profile-photo.fallback { display: none; }
.profile-name { font-size: 17px; font-weight: 800; }
.profile-form .btn-primary { margin-top: 4px; }

.toast {
  position: fixed;
  bottom: calc(var(--chrome-bottom) + var(--main-btn-h) + 8px);
  left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 30;
  font-size: 14px; max-width: 90%; text-align: center;
}
.loading { grid-column: 1 / -1; text-align: center; color: var(--hint); padding: 40px; }
.sentinel { min-height: 28px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--bg2); border-top-color: var(--btn); border-radius: 50%; animation: spin .7s linear infinite; margin: 12px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Small spinner inside a busy button (withLoading in app.js). */
.spinner.spinner-inline { width: 16px; height: 16px; margin: 0 auto; display: inline-block; vertical-align: middle; border-color: currentColor; border-top-color: transparent; }
button.is-loading, button[aria-busy="true"] { cursor: progress; }
.more-btn { display: block; margin: 8px auto 0; border: 0; background: var(--section); color: var(--link); font-weight: 700; padding: 10px 16px; border-radius: 10px; cursor: pointer; }
.product-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--link);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.product-skeleton { padding: 4px 0 16px; }
.product-sk-hero { width: 100%; aspect-ratio: 1; border-radius: var(--radius); margin-bottom: 12px; }
#view-product.view {
  padding-bottom: calc(var(--product-actions-h) + var(--chrome-bottom) + 12px);
}
.product-body { padding-bottom: 0; }
.product-gallery {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; margin: 0 -4px 12px; padding: 0 4px 4px;
}
.product-gallery img {
  flex: 0 0 88%; max-width: 88%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--radius); scroll-snap-align: center; background: var(--bg2);
}
.product-gallery img:only-child { flex-basis: 100%; max-width: 100%; }
.product-info { min-width: 0; background: var(--section); border-radius: var(--radius); padding: 16px; }
.product-name { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.product-price { margin-bottom: 8px; }
.product-desc { font-size: 14px; line-height: 1.85; margin-bottom: 12px; white-space: pre-wrap; }
.product-actions {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 11;
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 10px 12px;
  bottom: var(--chrome-bottom);
  background: var(--bg);
  border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
  max-width: var(--shop-width);
  margin-inline: auto;
}
.product-actions .btn-primary { flex: 1; }
.related-section h3 { font-size: 16px; margin: 0 0 10px; }
.related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.related-grid .card .actions { display: none; }
.card.skeleton { pointer-events: none; }
.sk-img, .sk-line { background: linear-gradient(90deg, var(--bg2), var(--section), var(--bg2)); background-size: 200% 100%; animation: shimmer 1.1s infinite; border-radius: 10px; }
.sk-img { width: 100%; aspect-ratio: 1; }
.sk-line { height: 12px; margin: 8px 2px 0; }
.sk-line.short { width: 55%; margin-bottom: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* stock / variants */
.card.sold-out img { filter: grayscale(.8); opacity: .6; }
.ribbon { position: absolute; top: 14px; right: 14px; z-index: 1; background: var(--danger); color: #fff; font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 8px; }
.btn-primary:disabled { opacity: .45; cursor: default; }
.opt { display: inline-flex; align-items: center; gap: 6px; }
.opt img { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; }
.opt.disabled { opacity: .4; text-decoration: line-through; }
.stepper button:disabled { opacity: .35; cursor: default; }
.stock-note { color: var(--accent-orange); font-size: 13px; font-weight: 700; min-height: 18px; margin-top: 4px; }
.sheet-head img { transition: opacity .15s; }

.wallet-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--section); }
.wallet-section h3 { font-size: 16px; margin: 0 0 8px; }
.wallet-balance { font-size: 18px; font-weight: 800; margin: 0 0 10px; }
.wallet-tx-list { display: flex; flex-direction: column; gap: 8px; }
.wallet-tx { background: var(--section); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.wallet-tx .muted { font-size: 12px; }
.wallet-pay { margin: 12px 0; padding: 12px; background: var(--section); border-radius: 12px; }
.wallet-pay-option { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 600; }
.split-breakdown { margin-top: 8px; padding: 8px 10px; background: var(--bg2); border-radius: 8px; }
.split-breakdown .row { display: flex; justify-content: space-between; gap: 8px; margin: 4px 0; }

.checkout-block { margin-top: 12px; }
.checkout-sub { font-size: 15px; margin: 0 0 8px; }
.search-select { position: relative; }
.search-select-input {
  width: 100%; border: 1px solid transparent; background: var(--bg2); color: var(--text);
  border-radius: 10px; padding: 10px 36px 10px 12px; outline: none;
  font: inherit; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238e8e93' d='M1 1.5 6 6.5 11 1.5' stroke='%238e8e93' stroke-width='1.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  min-height: 44px; font-size: 16px;
  background-repeat: no-repeat;
  background-position: left 12px center;
}
.search-select-input:disabled { opacity: 0.55; cursor: default; }
.search-select.invalid .search-select-input { border-color: var(--danger); }
.search-select-list {
  position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 4px);
  max-height: min(200px, 40vh); overflow: auto; margin: 0; padding: 4px 0; list-style: none;
  background: var(--section); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  -webkit-overflow-scrolling: touch;
}
.search-select-list li { padding: 8px 12px; cursor: pointer; }
.search-select-list li:hover, .search-select-list li:focus { background: var(--bg2); }
.search-select-empty { cursor: default; color: var(--hint); font-size: 13px; }
.search-select-empty:hover { background: transparent; }
.discount-row { display: flex; gap: 8px; margin-top: 6px; }
.discount-row input { flex: 1; border: 1px solid transparent; background: var(--bg2); border-radius: 10px; padding: 10px 12px; }
.shipping-methods { display: flex; flex-direction: column; gap: 8px; }
.ship-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  background: var(--section); border-radius: 12px; cursor: pointer;
  box-shadow: inset 0 0 0 1.5px transparent;
}
.ship-option.selected { box-shadow: inset 0 0 0 1.5px var(--btn); }
.ship-option input { margin-top: 4px; }
.form label.ship-option { flex-direction: row; }
.form input[type="radio"], .form input[type="checkbox"] { min-height: auto; padding: 0; accent-color: var(--btn); }
.breakdown {
  background: var(--section); border-radius: var(--radius); padding: 12px 14px; margin-top: 10px;
  font-size: 14px; line-height: 1.9;
}
.breakdown .row { display: flex; justify-content: space-between; gap: 8px; }
.breakdown .row.total { font-weight: 800; font-size: 15px; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--bg2); }

.order-filters { margin: 0 0 12px; }
.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  background: var(--pastel-card);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, var(--hint)) 22%, transparent);
}
.order-open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.order-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.order-no { display: block; font-size: 15px; font-weight: 800; }
.order-date { color: var(--hint); font-size: 12px; margin-top: 2px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 48%;
  padding: 4px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
  color: var(--text);
  background: var(--section);
  border: 1px solid color-mix(in srgb, var(--hint) 28%, transparent);
}
.status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--badge-dot, var(--hint));
  flex: 0 0 auto;
}
.status-badge[data-tone="pending"] { --badge-dot: #d97706; background: color-mix(in srgb, #f59e0b 20%, var(--section)); }
.status-badge[data-tone="review"] { --badge-dot: #ea580c; background: color-mix(in srgb, #fb923c 22%, var(--section)); }
.status-badge[data-tone="confirmed"] { --badge-dot: #0f766e; background: color-mix(in srgb, #14b8a6 20%, var(--section)); }
.status-badge[data-tone="processing"] { --badge-dot: #2563eb; background: color-mix(in srgb, #60a5fa 22%, var(--section)); }
.status-badge[data-tone="shipped"] { --badge-dot: #4f46e5; background: color-mix(in srgb, #818cf8 22%, var(--section)); }
.status-badge[data-tone="delivered"] { --badge-dot: #15803d; background: color-mix(in srgb, #4ade80 22%, var(--section)); }
.status-badge[data-tone="cancelled"] { --badge-dot: #57534e; background: color-mix(in srgb, var(--hint) 18%, var(--section)); }
.status-badge[data-tone="rejected"] { --badge-dot: #dc2626; background: color-mix(in srgb, #f87171 22%, var(--section)); }
.status-badge[data-tone="expired"] { --badge-dot: #78716c; background: color-mix(in srgb, var(--hint) 16%, var(--section)); }
.order-thumbs { display: flex; align-items: center; gap: 6px; margin-top: 10px; min-height: 36px; }
.order-thumbs img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: var(--bg2); }
.order-more, .order-count { color: var(--hint); font-size: 12px; font-weight: 700; }
.order-count { margin-inline-start: auto; }
.order-card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.order-total { font-size: 15px; font-weight: 800; }
.order-track { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.order-track-code { font-weight: 800; direction: ltr; unicode-bidi: isolate; }
.order-copy, .order-track-link {
  min-height: 36px;
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.order-track-link { background: var(--bg2); color: var(--link); }
.order-card.skeleton { pointer-events: none; }
.order-sk-thumbs { display: flex; gap: 6px; margin-top: 10px; }
.sk-thumb { width: 36px; height: 36px; border-radius: 8px; background: linear-gradient(90deg, var(--bg2), var(--section), var(--bg2)); background-size: 200% 100%; animation: shimmer 1.1s infinite; }
.orders-empty { text-align: center; padding: 28px 12px 12px; }
.orders-empty-icon { font-size: 40px; margin-bottom: 8px; }
.orders-empty p { margin: 0 0 14px; color: var(--hint); line-height: 1.7; }
.orders-empty .btn-primary, .orders-empty .btn-secondary { display: inline-block; min-width: 160px; flex: none; }
.order-more-btn { width: 100%; }
#view-order.view { padding-bottom: calc(var(--chrome-bottom) + 20px); }
.order-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.order-section {
  background: var(--pastel-card);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, var(--hint)) 18%, transparent);
}
.order-section h3 { margin: 0 0 8px; font-size: 14px; }
.order-line { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--hint) 18%, transparent); }
.order-line:last-child { border-bottom: 0; }
.order-line img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--bg2); flex: 0 0 auto; }
.order-line .info { flex: 1; min-width: 0; }
.order-line .info b { display: block; font-size: 14px; }
.order-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 14px; }
.order-row.total { font-weight: 800; margin-top: 4px; padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--hint) 20%, transparent); }
.order-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.order-timeline li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.order-pay .pay-card { margin: 8px 0; }
.order-pay .form { margin-top: 8px; }
@media (max-width: 360px) {
  .status-badge { max-width: 54%; font-size: 10px; }
  .order-no { font-size: 14px; }
}

/* Keep the same compact storefront inside Telegram, with a bounded canvas on desktop. */
@media (max-width: 599px) {
  .topbar { padding: 10px 12px 8px; }
  .topbar-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; margin-bottom: 10px; }
  .menu-drawer-btn { width: 40px; height: 40px; }
  .topbar h1 { max-width: none; font-size: 16px; }
  .search { grid-column: 1 / -1; }
  .view { padding: 14px 12px; }
  .card .name { font-size: 14px; }
  .card .price { font-size: 15px; }
  .card .btn-primary { padding-inline: 6px; }
  .cart-item .info { flex-basis: calc(100% - 78px); }
  .cart-item .stepper { margin-inline-start: auto; }
}
@media (min-width: 560px) {
  .grid, .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet-body { max-width: 560px; margin-inline: auto; }
}
@media (min-width: 800px) {
  .topbar { padding: 20px 24px 12px; }
  .topbar-row { margin-bottom: 16px; }
  .search { flex: 0 1 360px; margin-inline-start: auto; }
  .view { padding: 24px; }
  .grid { gap: 20px 16px; }
  .card { padding: 10px; }
  .card .name { margin-top: 12px; }
  .bottom-nav { padding-inline: 16px; }
  .nav-tab { flex-direction: row; gap: 8px; padding: 12px 8px; margin: 6px 4px; }
  .nav-label { font-size: 13px; }
  .product-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .product-gallery { margin: 0; padding: 0 0 8px; }
  .product-actions { position: static; padding: 18px 0 0; margin-top: 20px; box-shadow: none; }
  .product-name { font-size: 23px; line-height: 1.65; }
  .product-desc { margin-top: 16px; }
  .related-section { grid-column: 1 / -1; margin-top: 12px; }
  .related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #view-cart, #view-form, #view-profile, #view-orders, #view-order, #view-wallet-topup, #view-done { max-width: 720px; margin-inline: auto; }
  #view-product.view { padding-bottom: 24px; }
}
@media (min-width: 1000px) {
  #grid, .category-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (hover: hover) and (pointer: fine) {
  .chip:not(.active):hover, .opt:not(.selected):not(.disabled):hover { background: var(--pastel-chip); }
  .card:hover { border-color: color-mix(in srgb, var(--text) 25%, transparent); }
  .btn-primary:not(:disabled):hover { background: color-mix(in srgb, var(--btn) 90%, var(--text)); }
  .nav-tab:not(.active):hover, .menu-drawer-btn:hover, .btn-minus:hover { background: var(--bg2); }
}
.btn-primary:not(:disabled):active, .opt:not(.disabled):active { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* "Added to cart" bottom sheet (cartAdded.js). Ends above the bottom nav so the nav stays visible and tappable. */
.cart-added { position: fixed; inset: 0 0 var(--chrome-bottom) 0; z-index: 20; }
body:has(#fallbackMain:not(.hidden)) .cart-added { bottom: calc(var(--chrome-bottom) + var(--main-btn-h)); }
.ca-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.35); transition: opacity .18s ease; }
.ca-body {
  position: absolute; bottom: 0; left: 0; right: 0;
  max-width: 560px; margin-inline: auto;
  background: var(--bg); color: var(--text);
  border-radius: 18px 18px 0 0;
  padding: 10px 14px 14px;
  box-shadow: 0 -6px 24px rgba(0,0,0,.18);
  touch-action: none; user-select: none; -webkit-user-select: none;
  outline: none;
  animation: up .2s ease;
  transition: transform .18s ease;
}
.cart-added.closing .ca-body { transform: translateY(100%); }
.cart-added.closing .ca-backdrop { opacity: 0; }
.ca-grip { width: 40px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text) 22%, transparent); margin: 0 auto 10px; }
.ca-title { margin: 0 0 12px; font-size: 16px; font-weight: 800; color: #15803d; }
.cart-added.is-error .ca-title { color: var(--danger); }
.ca-product { display: flex; gap: 12px; align-items: center; }
.ca-product img { width: 64px; height: 64px; flex: none; border-radius: 12px; object-fit: cover; background: var(--bg2); }
.ca-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ca-name { font-size: 14px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ca-message { margin: 10px 0 0; font-size: 14px; line-height: 1.7; }
.ca-totals { margin-top: 12px; padding: 8px 12px; border-radius: 10px; background: var(--bg2); color: var(--hint); font-size: 13px; text-align: center; }
.ca-actions { display: flex; gap: 10px; margin-top: 12px; }
.ca-actions .hidden { display: none !important; }
.opt-group.needs-choice { outline: 2px solid var(--danger); outline-offset: 4px; border-radius: 12px; animation: ca-shake .4s ease; }
@keyframes ca-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) {
  .ca-body, .ca-backdrop { animation: none; transition: none; }
  .opt-group.needs-choice { animation: none; }
}