:root {
  --bg: #08080f;
  --bg2: #10101a;
  --card: rgba(255, 255, 255, 0.045);
  --card-solid: #141422;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f4fb;
  --muted: #9898b0;
  --accent: #8b5cf6;
  --accent2: #22d3ee;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 72px;
  --font: "Manrope", system-ui, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  margin: 0; padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
}
body {
  margin: 0; padding: 0;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  position: relative;
}
button, input, textarea, select { font: inherit; color: inherit; max-width: 100%; }
button { cursor: pointer; border: 0; background: none; }
input, textarea, select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  color: var(--text);
  /* 16px prevents iOS zoom that can cause horizontal overflow */
  font-size: 16px;
}
input[type="datetime-local"],
input[type="date"],
input[type="time"],
input[type="number"] {
  min-width: 0;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #9898b0 50%),
    linear-gradient(135deg, #9898b0 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 3px), calc(100% - 12px) calc(50% + 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
select option, select optgroup {
  background: #141422;
  color: #f4f4fb;
}
input:focus, textarea:focus, select:focus { border-color: rgba(139,92,246,0.6); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }

#app {
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
}

.bg-orbs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orb {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.35;
  animation: float 12s ease-in-out infinite;
}
.orb-a { width: 260px; height: 260px; background: #7c3aed; top: -40px; left: -40px; }
.orb-b { width: 220px; height: 220px; background: #0891b2; right: -50px; top: 30%; animation-delay: -4s; }
.orb-c { width: 280px; height: 280px; background: #db2777; bottom: 10%; left: 20%; animation-delay: -7s; opacity: 0.2; }
@keyframes float {
  0%, 100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(20px, -24px, 0) scale(1.08); }
}

.topbar, .view, .tabbar, .search-bar, .sheet, .toast-wrap, .loader { position: relative; z-index: 1; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + var(--safe-t)) 16px 8px;
  position: sticky; top: 0; backdrop-filter: blur(16px);
  background: linear-gradient(180deg, rgba(8,8,15,0.92), rgba(8,8,15,0.55) 70%, transparent);
  z-index: 5;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 14px;
  object-fit: cover; display: block;
  box-shadow: 0 8px 24px rgba(139,92,246,0.35);
  border: 1px solid rgba(255,255,255,0.1);
  background: #0b0b12;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 24px rgba(139,92,246,0.35);
}
.hero-logo {
  width: 56px; height: 56px; border-radius: 16px; object-fit: cover;
  margin-bottom: 12px; box-shadow: 0 10px 28px rgba(139,92,246,0.35);
  border: 1px solid rgba(255,255,255,0.12);
}
.upload-preview {
  width: 96px; height: 96px; border-radius: 16px; object-fit: cover;
  border: 1px solid var(--line); background: rgba(255,255,255,0.04);
  display: block; margin-top: 8px;
}
.upload-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.channel-check-ok { color: #6ee7b7; font-size: 12px; font-weight: 700; }
.channel-check-err { color: #fda4af; font-size: 12px; font-weight: 600; line-height: 1.35; }
.brand-title { font-weight: 800; letter-spacing: -0.02em; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--text);
  transition: transform .15s ease, background .2s;
}
.icon-btn:active { transform: scale(0.94); }

.search-bar { padding: 0 16px 10px; }
.search-bar.hidden { display: none; }
.search-hint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 0 12px; padding: 10px 12px; border-radius: 14px;
  background: rgba(139,92,246,0.12); border: 1px solid rgba(139,92,246,0.25);
  font-size: 13px;
}
.taste-chip {
  background: rgba(34,211,238,0.08) !important;
  border-color: rgba(34,211,238,0.22) !important;
  color: #a5f3fc !important;
}

/* ---- Smooth swipe carousels (no buttons, no page overflow) ---- */
.carousel-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 0 10px;
  overflow: hidden;
}
.carousel {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  touch-action: pan-x pan-y;
  padding: 4px 2px 12px;
  margin: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.carousel::-webkit-scrollbar { display: none; width: 0; height: 0; }
.carousel.is-dragging {
  scroll-behavior: auto;
  user-select: none;
  cursor: grabbing;
}
.carousel > * {
  flex: 0 0 auto;
  scroll-snap-align: center;
  scroll-snap-stop: normal;
  max-width: none;
}
/* first/last: slight edge padding feel without page overflow */
.carousel::before,
.carousel::after {
  content: "";
  flex: 0 0 1px;
}

.carousel .cat-card {
  width: 150px;
  min-height: 104px;
}
.carousel.chips {
  gap: 8px;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}
.carousel.chips .filter-chip {
  scroll-snap-align: start;
}
.carousel .campaign-card {
  width: min(300px, 82vw);
  min-height: 120px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}
.carousel .product-card-h {
  width: min(270px, 80vw);
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: left;
}
.carousel .product-card-h .p-thumb {
  width: 56px;
  height: 56px;
}
.carousel .product-card-h .p-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view {
  padding: 4px 16px 24px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeOutSoft {
  to { opacity: 0; transform: translateY(6px) scale(0.99); }
}
.view.swap,
.view.view-enter { animation: fadeUp .38s cubic-bezier(.2,.8,.2,1) both; }
.view.view-leave { animation: fadeOutSoft .12s ease both; }

.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 20px;
  background: linear-gradient(135deg, rgba(139,92,246,0.28), rgba(34,211,238,0.12) 55%, rgba(255,255,255,0.03));
  border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 18px;
  animation: heroIn .55s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes heroIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.hero-glow {
  position: absolute; inset: -40% -20% auto auto; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(251,191,36,0.28), transparent 65%);
  pointer-events: none; animation: float 10s ease-in-out infinite;
}
.hero h1 { margin: 0 0 8px; font-size: 24px; line-height: 1.15; letter-spacing: -0.03em; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; max-width: 28ch; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-cta {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; margin-top: 16px;
}
.hero-cta .btn { width: 100%; padding: 12px 10px; font-size: 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.08);
}

.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 18px 0 12px;
}
.section-head h2 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.section-hint { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.link-btn { color: var(--accent2); font-weight: 600; font-size: 13px; }

.cat-card {
  position: relative; overflow: hidden; border-radius: 18px; padding: 14px 16px;
  min-height: 88px; text-align: left;
  background: var(--card); border: 1px solid var(--line);
  transition: transform .18s ease, border-color .2s, background .2s;
}
.cat-card:active { transform: scale(0.97); }
.cat-card .emoji { font-size: 22px; display: block; margin-bottom: 8px; }
.cat-card .title { font-weight: 700; font-size: 13px; line-height: 1.25; }
.cat-card::after {
  content: ""; position: absolute; inset: auto -20% -40% auto; width: 90px; height: 90px;
  border-radius: 50%; background: var(--cat-color, var(--accent)); opacity: 0.22; filter: blur(8px);
  pointer-events: none;
}

.campaign-card {
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(145deg, rgba(251,191,36,0.16), rgba(139,92,246,0.12));
  border: 1px solid rgba(251,191,36,0.25);
  text-align: left;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  transition: transform .18s ease, border-color .2s, box-shadow .2s;
  color: inherit;
}
.campaign-card:active { transform: scale(0.98); }
.campaign-card::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 4px;
  background: linear-gradient(180deg, #fbbf24, #f97316);
  opacity: 0.9;
}
.campaign-card.theme-hot {
  background:
    radial-gradient(140px 90px at 100% 0%, rgba(249,115,22,0.28), transparent 60%),
    linear-gradient(145deg, rgba(251,113,133,0.16), rgba(249,115,22,0.1));
  border-color: rgba(249,115,22,0.35);
}
.campaign-card.theme-ice {
  background:
    radial-gradient(140px 90px at 100% 0%, rgba(34,211,238,0.28), transparent 60%),
    linear-gradient(145deg, rgba(56,189,248,0.16), rgba(139,92,246,0.1));
  border-color: rgba(34,211,238,0.3);
}
.campaign-card.theme-ice::before {
  background: linear-gradient(180deg, #22d3ee, #8b5cf6);
}
.campaign-card.theme-violet {
  background:
    radial-gradient(140px 90px at 100% 0%, rgba(139,92,246,0.3), transparent 60%),
    linear-gradient(145deg, rgba(139,92,246,0.18), rgba(255,255,255,0.03));
  border-color: rgba(167,139,250,0.3);
}
.campaign-card.theme-mint {
  background:
    radial-gradient(140px 90px at 100% 0%, rgba(52,211,153,0.25), transparent 60%),
    linear-gradient(145deg, rgba(52,211,153,0.14), rgba(34,211,238,0.08));
  border-color: rgba(52,211,153,0.3);
}
.campaign-card.theme-mint::before {
  background: linear-gradient(180deg, #34d399, #22d3ee);
}
.campaign-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.campaign-timer {
  font-size: 11px; font-weight: 700; color: #fde68a;
  white-space: nowrap;
}
/* NOT .badge — that class is cart counter (absolute) */
.sale-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(251,191,36,0.22);
  color: #fde68a;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: badgePulse 2.4s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251,191,36,0.25); }
  50% { box-shadow: 0 0 0 6px rgba(251,191,36,0); }
}
.campaign-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.25;
  word-break: break-word;
}
.campaign-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.campaign-cta {
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  color: #fde68a;
  letter-spacing: 0.01em;
}
.campaign-card.theme-ice .campaign-cta,
.campaign-card.theme-ice .campaign-timer { color: #a5f3fc; }
.campaign-card.theme-ice .sale-badge {
  background: rgba(34,211,238,0.18);
  color: #a5f3fc;
}

.campaign-filter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 16px; margin-bottom: 12px;
  background:
    linear-gradient(135deg, rgba(249,115,22,0.16), rgba(139,92,246,0.12));
  border: 1px solid rgba(251,191,36,0.28);
  animation: fadeUp .35s ease both;
}
.campaign-filter-title {
  font-weight: 800; font-size: 14px; letter-spacing: -0.02em;
}

.product-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.product-card {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  transition: transform .15s ease, border-color .2s, box-shadow .2s;
  animation: cardIn .4s ease both;
  width: 100%;
  cursor: pointer;
}
.product-card:active { transform: scale(0.985); }
.product-card.has-sale {
  border-color: rgba(251,191,36,0.28);
  box-shadow: 0 0 0 1px rgba(251,191,36,0.06);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.product-card:nth-child(1) { animation-delay: .02s; }
.product-card:nth-child(2) { animation-delay: .05s; }
.product-card:nth-child(3) { animation-delay: .08s; }
.product-card:nth-child(4) { animation-delay: .11s; }
.product-card:nth-child(5) { animation-delay: .14s; }
.product-card:nth-child(6) { animation-delay: .17s; }
.product-card:nth-child(7) { animation-delay: .2s; }
.product-card:nth-child(8) { animation-delay: .23s; }
.p-thumb {
  position: relative;
  width: 72px; height: 72px; border-radius: 16px;
  display: grid; place-items: center; font-size: 28px;
  background: linear-gradient(145deg, rgba(139,92,246,0.25), rgba(34,211,238,0.12));
  border: 1px solid var(--line);
  overflow: hidden; flex-shrink: 0;
}
.p-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.product-card:active .p-thumb img,
.product-card-h:active .p-thumb img { transform: scale(1.06); }
.p-thumb .p-emoji { line-height: 1; }
.p-thumb.lg { width: 120px; height: 120px; border-radius: 20px; margin-bottom: 12px; }
.thumb-sale {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  padding: 3px 7px; border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff; font-size: 10px; font-weight: 800;
  box-shadow: 0 6px 14px rgba(239,68,68,0.35);
  line-height: 1.2;
}
.p-info { min-width: 0; }
.p-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  justify-content: center;
}
.p-brand { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.p-name { font-weight: 700; font-size: 15px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.p-price { font-weight: 800; font-size: 15px; white-space: nowrap; }
.p-price .old { color: var(--muted); font-weight: 600; font-size: 12px; text-decoration: line-through; margin-right: 6px; }
.p-price .sale { color: #fde68a; }
.btn-quick-add {
  width: 34px; height: 34px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 800; line-height: 1; color: white;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  box-shadow: 0 8px 18px rgba(139,92,246,0.35);
  transition: transform .15s ease;
}
.btn-quick-add:active,
.btn-quick-add.pop { transform: scale(1.12); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.tag {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 999px;
  background: rgba(139,92,246,0.18); color: #ddd6fe;
}
.tag.stock-out { background: rgba(251,113,133,0.15); color: #fda4af; }
.tag.stock-ok { background: rgba(52,211,153,0.12); color: #6ee7b7; }
.tag.tag-sale { background: rgba(251,191,36,0.18); color: #fde68a; }


.filter-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: all .18s ease;
}
.filter-chip.active {
  color: white; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  box-shadow: 0 8px 20px rgba(139,92,246,0.3);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px; border-radius: 16px; font-weight: 700; font-size: 14px;
  transition: transform .15s ease, opacity .2s, filter .2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white; box-shadow: 0 12px 28px rgba(139,92,246,0.35);
  width: 100%;
}
.btn-shimmer {
  position: relative; overflow: hidden;
}
.btn-shimmer::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,0.28) 48%, transparent 70%);
  transform: translateX(-130%);
  animation: btnShine 2.8s ease-in-out infinite;
}
@keyframes btnShine {
  0%, 55% { transform: translateX(-130%); }
  85%, 100% { transform: translateX(130%); }
}
.btn-secondary {
  background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--text); width: 100%;
}
.btn-ghost { color: var(--muted); padding: 8px 10px; }
.btn-danger { background: rgba(251,113,133,0.15); color: #fda4af; border: 1px solid rgba(251,113,133,0.25); width: 100%; }
.btn-sm { padding: 8px 12px; border-radius: 12px; font-size: 12px; width: auto; }
.btn-icon {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line); font-weight: 700;
}

.qty {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.25); border-radius: 14px; padding: 4px;
  border: 1px solid var(--line);
}
.qty span { min-width: 18px; text-align: center; font-weight: 700; }

.cart-item, .order-card, .admin-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 14px; margin-bottom: 10px; animation: cardIn .35s ease both;
}
.cart-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; max-width: 100%; min-width: 0; }
.cart-row > * { min-width: 0; }
.cart-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.summary {
  margin-top: 14px; padding: 16px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
}
.summary-row { display: flex; justify-content: space-between; margin: 6px 0; color: var(--muted); font-size: 14px; }
.summary-row.total { color: var(--text); font-weight: 800; font-size: 17px; margin-top: 10px; }
.field { margin-bottom: 12px; min-width: 0; max-width: 100%; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; word-break: break-word; }
.segment {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; width: 100%;
}
.seg-btn {
  padding: 12px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.03); font-weight: 700; font-size: 13px; color: var(--muted);
}
.seg-btn.active {
  color: white; border-color: transparent;
  background: linear-gradient(135deg, rgba(139,92,246,0.9), rgba(34,211,238,0.55));
}

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.status-new { background: rgba(251,191,36,0.15); color: #fde68a; }
.status-accepted, .status-delivering { background: rgba(56,189,248,0.15); color: #7dd3fc; }
.status-completed { background: rgba(52,211,153,0.15); color: #6ee7b7; }
.status-cancelled, .status-rejected { background: rgba(251,113,133,0.15); color: #fda4af; }

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 20px; margin-top: 12px;
}
.empty .big { font-size: 40px; margin-bottom: 10px; }
.empty h3 { margin: 0 0 6px; color: var(--text); }

.tabbar {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b));
  min-height: var(--tab-h); z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 2px; padding: 6px;
  background: rgba(16,16,26,0.92); border: 1px solid var(--line);
  border-radius: 22px; backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
.tabbar:has(#tab-admin:not(.hidden)) {
  grid-template-columns: repeat(6, 1fr);
}
.tab {
  position: relative; border-radius: 18px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10px; font-weight: 600; transition: color .2s, background .2s, transform .15s;
}
.tab-icon { font-size: 16px; line-height: 1; }
.tab.active {
  color: white;
  background: linear-gradient(180deg, rgba(139,92,246,0.28), rgba(139,92,246,0.08));
}
.tab:active { transform: scale(0.96); }
.tab.hidden { display: none; }
.badge {
  position: absolute; top: 4px; right: 14px; min-width: 18px; height: 18px;
  border-radius: 999px; background: #f43f5e; color: white;
  font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 4px;
  box-shadow: 0 0 0 2px rgba(16,16,26,0.9);
  animation: pop .3s ease;
}
.badge.hidden { display: none; }
.badge.badge-pulse {
  animation: pop .35s ease, badgeGlow .9s ease;
}
@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes badgeGlow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16,16,26,0.9); }
  40% { box-shadow: 0 0 0 2px rgba(16,16,26,0.9), 0 0 0 8px rgba(244,63,94,0.25); }
}
.fly-dot {
  position: fixed; z-index: 120; width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #22d3ee);
  pointer-events: none;
  transition: transform .48s cubic-bezier(.2,.8,.2,1), opacity .48s ease;
  box-shadow: 0 0 16px rgba(139,92,246,0.7);
}

/* lock page scroll under open bottom sheet — prevents Telegram Mini App swipe-close */
body.sheet-open {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}
body.sheet-open #app {
  overflow: hidden;
  overscroll-behavior: none;
}

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 40;
  backdrop-filter: blur(4px);
  touch-action: none;
  overscroll-behavior: none;
  will-change: opacity;
  opacity: 1;
}
.sheet-backdrop.hidden, .sheet.hidden, .loader.hidden, .hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 100vw;
  z-index: 50;
  max-height: min(92dvh, 100%);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  background: #12121d;
  border-radius: 28px 28px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 0 14px calc(20px + var(--safe-b));
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
  /* open/close transforms are driven by JS — no permanent CSS animation
     (re-running sheetUp after drag caused the “jump up then vanish” glitch) */
  transform: translateY(0);
  opacity: 1;
  will-change: transform;
  backface-visibility: hidden;
}
.sheet.sheet-dragging {
  transition: none !important;
  opacity: 1 !important;
}
.sheet.sheet-closing {
  pointer-events: none;
  opacity: 1 !important;
  overflow: hidden;
}
.sheet.sheet-opening {
  pointer-events: none;
}
.sheet-handle {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 28px;
  margin: 0 0 8px;
  padding: 12px 0 8px;
  background: linear-gradient(#12121d 70%, transparent);
  touch-action: none;
  cursor: grab;
}
.sheet-handle span {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  pointer-events: none;
}
.sheet-body { min-width: 0; }
.sheet-title { font-size: 20px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.02em; }
.sheet-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; line-height: 1.4; }

.toast-wrap {
  position: fixed; top: calc(12px + var(--safe-t)); left: 16px; right: 16px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: none; padding: 12px 14px; border-radius: 14px; font-size: 13px; font-weight: 600;
  background: rgba(20,20,34,0.95); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: toastIn .25s ease;
}
.toast.ok { border-color: rgba(52,211,153,0.35); }
.toast.err { border-color: rgba(251,113,133,0.4); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}

.loader {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(8,8,15,0.35); backdrop-filter: blur(2px);
}
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.1); border-top-color: var(--accent2);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat {
  padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
}
.stat .n { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 4px; }

.admin-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 14px; padding: 0;
}
.admin-tabs .filter-chip { white-space: nowrap; }

.admin-card .p-thumb { border-radius: 14px; }

/* Admin products list — clean layout, no crushed text */
.admin-product-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-product-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}
.admin-product-thumb {
  width: 56px !important;
  height: 56px !important;
  flex-shrink: 0;
}
.admin-product-info {
  flex: 1;
  min-width: 0;
}
.admin-product-cat {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 3px;
  line-height: 1.3;
  /* no uppercase — long Russian category names break otherwise */
  word-break: break-word;
}
.admin-product-title {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.3;
  word-break: break-word;
  white-space: normal;
}
.admin-product-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.35;
  word-break: break-word;
}
.admin-product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-product-actions .btn-sm {
  flex: 1 1 auto;
  min-width: 110px;
  width: auto;
}

.prod-pick-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,0.2);
  padding: 6px;
}
.prod-pick-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 8px;
  border-radius: 12px;
  cursor: pointer;
}
.prod-pick-row:hover { background: rgba(255,255,255,0.04); }
.prod-pick-row input { width: auto; margin-top: 3px; flex-shrink: 0; }
.prod-pick-info { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.prod-pick-info b { font-size: 13px; font-weight: 700; }


.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 100%;
}
/* always stack narrow / datetime-heavy rows */
.form-row.stack-mobile,
.form-row.form-stack {
  grid-template-columns: 1fr;
}
.stack { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 100%; }
.muted { color: var(--muted); font-size: 13px; }
.price-lg { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; margin: 8px 0 14px; word-break: break-word; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

.product-sheet { animation: fadeUp .3s ease both; }
.product-sheet-thumb {
  margin: 0 auto 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.deal-banner {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin: 0 0 12px; padding: 10px 12px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(249,115,22,0.2), rgba(251,191,36,0.12));
  border: 1px solid rgba(251,191,36,0.3);
  color: #fde68a; font-size: 13px; font-weight: 800;
  animation: dealIn .45s cubic-bezier(.2,1.2,.3,1) both;
}
@keyframes dealIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: none; }
}
.fact-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin: 0 0 14px;
}
.fact-cell {
  padding: 10px 12px; border-radius: 14px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--line);
  min-width: 0;
}
.fact-cell span {
  display: block; color: var(--muted); font-size: 11px; font-weight: 600; margin-bottom: 3px;
}
.fact-cell b {
  font-size: 13px; font-weight: 800; word-break: break-word;
}
.qty-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 14px; padding: 10px 12px; border-radius: 14px;
  background: rgba(0,0,0,0.2); border: 1px solid var(--line);
}
.cart-hint {
  text-align: center; margin: 10px 0 0; font-size: 12px;
}

.carousel .product-card-h {
  transition: transform .18s ease, border-color .2s, box-shadow .2s;
}
.carousel .product-card-h:active { transform: scale(0.98); }
.carousel .product-card-h.is-sale {
  border-color: rgba(251,191,36,0.3);
  background:
    linear-gradient(145deg, rgba(251,191,36,0.08), rgba(255,255,255,0.03));
}
.carousel .product-card-h.is-popular {
  border-color: rgba(251,113,133,0.28);
  background:
    linear-gradient(145deg, rgba(251,113,133,0.08), rgba(139,92,246,0.06));
}
.thumb-rank {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; display: grid; place-items: center;
  font-size: 10px; font-weight: 800; color: #1c1917;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 4px 12px rgba(245,158,11,0.4);
}
.p-sold {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fda4af;
  letter-spacing: 0.01em;
}

.segment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  width: 100%;
}
.seg-btn {
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
  padding: 10px 8px;
  font-size: 12px;
}

.gv-admin-prize {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  width: 100%;
}
.gv-admin-prize input { min-width: 0; }

.upload-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  max-width: 100%;
}

/* ---- Responsive: no horizontal scroll ---- */
@media (max-width: 420px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat .n { font-size: 18px; }
  .hero h1 { font-size: 20px; }
  .sheet-title { font-size: 18px; }
  .tab span:not(.tab-icon) { font-size: 9px; }
  .tabbar { left: 8px; right: 8px; }
  .view { padding-left: 12px; padding-right: 12px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .search-bar { padding-left: 12px; padding-right: 12px; }
  .product-card {
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }
  .p-thumb { width: 64px; height: 64px; }
  .hero-cta { grid-template-columns: 1fr; }
  .segment { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr; }
  .brand-title { font-size: 15px; }
}

.ripple {
  position: relative; overflow: hidden;
}

/* ---- Giveaways ---- */
.gv-card {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 16px; margin-bottom: 12px;
  width: 100%;
  background:
    radial-gradient(120px 80px at 100% 0%, rgba(251,191,36,0.22), transparent 60%),
    linear-gradient(145deg, rgba(139,92,246,0.2), rgba(255,255,255,0.03));
  border: 1px solid rgba(251,191,36,0.22);
  animation: cardIn .4s ease both;
  text-align: left;
}
.carousel .gv-card {
  width: min(280px, 82vw);
  margin-bottom: 0;
  min-height: 120px;
}
.gv-card.joined {
  border-color: rgba(52,211,153,0.4);
  box-shadow: 0 0 0 1px rgba(52,211,153,0.15), 0 12px 30px rgba(52,211,153,0.08);
}
.gv-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800;
  background: rgba(251,191,36,0.18); color: #fde68a;
}
.gv-badge.live {
  background: rgba(244,63,94,0.18); color: #fda4af;
  animation: pulse 1.6s ease infinite;
}
.gv-badge.done { background: rgba(148,163,184,0.15); color: #cbd5e1; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244,63,94,0.35); }
  50% { box-shadow: 0 0 0 8px rgba(244,63,94,0); }
}
.gv-title { font-size: 18px; font-weight: 800; margin: 10px 0 6px; letter-spacing: -0.02em; }
.gv-meta { color: var(--muted); font-size: 12px; line-height: 1.45; }
.prize-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.prize-row {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 14px;
  background: rgba(0,0,0,0.22); border: 1px solid var(--line);
}
.prize-place {
  width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1c1917;
}
.prize-place.p2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); }
.prize-place.p3 { background: linear-gradient(135deg, #fdba74, #c2410c); color: white; }
.channel-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.channel-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 16px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  transition: border-color .2s, transform .15s;
}
.channel-row.ok { border-color: rgba(52,211,153,0.4); }
.channel-row .name { font-weight: 700; }
.channel-row .status { font-size: 12px; font-weight: 700; }
.channel-row .status.yes { color: #6ee7b7; }
.channel-row .status.no { color: #fda4af; }

.participate-btn {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #f59e0b, #ec4899 55%, #8b5cf6);
  box-shadow: 0 14px 34px rgba(236,72,153,0.35);
}
.participate-btn.success {
  background: linear-gradient(135deg, #34d399, #10b981);
  box-shadow: 0 14px 34px rgba(16,185,129,0.35);
}
.participate-btn .shine {
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: shine 2.4s ease infinite;
}
@keyframes shine {
  0% { transform: translateX(-120%); }
  40%, 100% { transform: translateX(120%); }
}

.confetti-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden;
}
.confetti {
  position: absolute; top: -10px; width: 8px; height: 12px; border-radius: 2px;
  animation: confettiFall linear forwards;
  opacity: 0.95;
}
@keyframes confettiFall {
  0% { transform: translate3d(0,0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--dx), 110vh, 0) rotate(720deg); opacity: 0.85; }
}

.join-burst {
  width: 96px; height: 96px; margin: 8px auto 16px; border-radius: 28px;
  display: grid; place-items: center; font-size: 42px;
  background: linear-gradient(135deg, rgba(251,191,36,0.35), rgba(236,72,153,0.25));
  animation: burstPop .55s cubic-bezier(.2,1.4,.3,1);
  box-shadow: 0 0 0 0 rgba(251,191,36,0.4);
}
@keyframes burstPop {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

.countdown {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0;
}
.countdown .cell {
  text-align: center; padding: 8px 4px; border-radius: 12px;
  background: rgba(0,0,0,0.28); border: 1px solid var(--line);
}
.countdown .n { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.countdown .l { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* prize row defined in responsive block above */
