@font-face {
  font-family: 'Google Sans Local';
  src: url('/assets/fonts/GoogleSans-VariableFont_GRAD-opsz-wght.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --background: #e7e4e1;
  --foreground: #0f1115;
  --card: #fdfdfd;
  --card-foreground: #12151d;
  --primary: #2a51ff;
  --primary-foreground: #ffffff;
  --secondary: #c3d5f4;
  --secondary-foreground: #0c1220;
  --accent: #d4e0ff;
  --muted: #f4f0e5;
  --muted-foreground: #525252;
  --destructive: #ea3d3e;
  --border: #d9ddeb;
  --ring: #2a51ff;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(26, 26, 26, 0.08);
  --success: #16a34a;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: 'Google Sans Local', ui-sans-serif, system-ui, sans-serif;
  color: var(--foreground);
  background:
    radial-gradient(circle at 10% -10%, #ffffff 0, transparent 50%),
    radial-gradient(circle at 90% 0%, #dce6ff 0, transparent 40%),
    linear-gradient(180deg, #ece8e4 0%, #e7e4e1 100%);
  letter-spacing: -0.015em;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: #f3f4f6;
}

.site-shell {
  min-height: 100vh;
}

.ai-back {
  background-color: #faecff;

  background-image:
    linear-gradient(rgba(250, 236, 255, 0.4), rgba(250, 236, 255, 0.4)),
    url('/images/ai-back.png');
  background-repeat: no-repeat;
  background-position: right top;

  background-size: 560px;
  /* регулируй размер */
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(253, 253, 253, 0.85);
  border-bottom: 1px solid rgba(217, 221, 235, 0.8);
}

.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.brand img {
  width: 32px;
  height: 32px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.nav a {
  text-decoration: none;
  color: var(--card-foreground);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  transition: background .15s ease;
}

.nav a:hover {
  background: var(--accent);
}

.container {
  max-width: 1160px;
  margin: 32px auto;
  padding: 0 20px 40px;
}

.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
  animation: card-enter .28s ease both;
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  line-height: 1.2;
}

p {
  margin: 0 0 10px;
  color: #3e4452;
}

a {
  color: #1740db;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
}

th,
td {
  border-bottom: 1px solid #e9ecf4;
  text-align: left;
  padding: 12px 14px;
  vertical-align: top;
}

th {
  font-size: 13px;
  color: #556077;
  font-weight: 650;
  background: #f8faff;
  white-space: nowrap;
}

label {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: #3e4452;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d4d9e6;
  background: #fff;
  color: #12151d;
  border-radius: 12px;
  padding: 11px 14px;
  margin-top: 4px;
  margin-bottom: 14px;
  outline: none;
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(42, 81, 255, 0.18);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin: 0;
  padding: 0;
  border-radius: 6px;
  vertical-align: middle;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 12px;
  padding: 12px 20px;
  background: var(--primary);
  color: var(--primary-foreground);
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(42, 81, 255, 0.22);
}

button,
.btn,
.tab-btn,
.btn-add-cart,
.product-qty-btn,
.cart-qty-btn {
  touch-action: manipulation;
}

.btn.secondary,
button.secondary {
  background: #fff;
  color: #20263a;
  border: 1px solid #cfd5e6;
}

.row {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.inline {
  display: inline;
}

/* ── Toggle Switch (admin) ── */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  margin: 0;
  padding: 0;
}

.toggle-slider {
  width: 40px;
  height: 22px;
  background: #d4d9e6;
  border-radius: 11px;
  position: relative;
  transition: background .2s ease;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked+.toggle-slider::after {
  transform: translateX(18px);
}

.error {
  color: #b42318;
  margin: 6px 0;
}

.success {
  color: #14532d;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
  align-items: center;
}

.logo-lg {
  max-width: 220px;
  width: 100%;
  opacity: .92;
}

/* ── WebApp Shell ── */
.webapp-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px;
  padding-bottom: 80px;
}

/* ── Tab Navigation ── */
.tabs {
  display: flex;
  gap: 0;
  background: var(--muted);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.tab-btn {
  flex: 1;
  padding: 10px 8px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  position: relative;
  box-shadow: none;
}

.tab-btn:hover {
  transform: none;
  box-shadow: none;
  color: var(--foreground);
}

.tab-btn.active {
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  line-height: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Category Filter (wrapper) ── */
.category-filter-wrap {
  margin-bottom: 12px;
}

/* ── Category Slider Row ── */
.category-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
}

.category-filter::-webkit-scrollbar {
  display: none;
}

/* ── Subcategory row ── */
.subcategory-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-top: 6px;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  animation: subcats-enter .25s ease both;
}

.subcategory-filter::-webkit-scrollbar {
  display: none;
}

@keyframes subcats-enter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Category Chip ── */
.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  box-shadow: none;
}

.category-chip:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--primary);
  color: var(--primary);
}

.category-chip.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

/* Dropdown arrow for parent categories with children */
.chip-arrow {
  font-size: 10px;
  margin-left: 2px;
  transition: transform .2s ease;
  display: inline-block;
}

.category-chip.active .chip-arrow {
  transform: rotate(180deg);
}

/* ── Scroll Hint (circle arrow icon) ── */
.scroll-hint-wrap {
  position: relative;
}

.scroll-hint {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 6px;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: auto;
  background: linear-gradient(90deg, transparent 0%, var(--background) 60%);
  opacity: 1;
  transition: opacity .3s ease;
  z-index: 2;
}

.scroll-hint.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.scroll-hint-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(42, 81, 255, 0.3);
  animation: hint-pulse 2s ease-in-out infinite;
}

@keyframes hint-pulse {

  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(3px);
  }
}

/* ── Product Grid ── */
.webapp-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}

.product-card:active {
  transform: scale(0.98);
}

.product-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #f0f2f5;
  display: block;
}

.product-image-carousel {
  flex-shrink: 0;
  overflow: hidden;
  background: #f0f2f5;
}

.product-image-carousel.has-slides {
  cursor: grab;
  border-radius: var(--radius);
}

.product-image-carousel.has-slides:active {
  cursor: grabbing;
}

.product-image-track {
  display: flex;
  touch-action: pan-y;
  will-change: transform;
}

.product-image-slide {
  width: 100%;
  height: 160px;
  object-fit: cover;
  flex: 0 0 100%;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.product-image-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 10px;
}

.product-image-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  border: 0;
  background: color-mix(in oklab, var(--foreground) 20%, transparent);
  padding: 0;
  cursor: pointer;
}

.product-image-dot.active {
  width: 16px;
  background: var(--primary);
}

.product-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 12px;
}

.product-info h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.product-title-link {
  color: inherit;
  text-decoration: none;
}

.product-title-link:hover {
  text-decoration: underline;
}

.product-card-highlight {
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 35%, transparent);
}

.product-info .product-desc {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.product-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--foreground);
}

.btn-add-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  font-weight: 400;
  cursor: pointer;
  padding: 0;
  transition: transform .1s ease, box-shadow .1s ease;
  box-shadow: none;
  line-height: 1;
}

.btn-add-cart:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(42, 81, 255, 0.3);
}

.catalog-search {
  position: relative;
  margin: 0 0 12px 0;
}

.catalog-search-input-wrap {
  position: relative;
}

.catalog-search input {
  width: 100%;
  padding-right: 38px;
  margin-bottom: 0;
}

.catalog-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.catalog-search-clear:hover {
  transform: translateY(-50%);
  box-shadow: none;
  background: var(--muted);
}

.catalog-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 12;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
  overflow: hidden;
}

.catalog-search-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.catalog-search-item:last-child {
  border-bottom: 0;
}

.catalog-search-item:hover {
  background: var(--muted);
}

.catalog-search-empty {
  padding: 12px;
  color: var(--muted-foreground);
  font-size: 13px;
}

mark {
  background: color-mix(in oklab, var(--primary) 16%, transparent);
  color: inherit;
  border-radius: 4px;
  padding: 0 2px;
}

/* ── Product Card Qty Controls (on catalog cards) ── */
.product-qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
  transition: background .15s ease;
}

.product-qty-btn:hover {
  transform: none;
  box-shadow: none;
  background: var(--muted);
}

.product-qty-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  color: var(--primary);
}

/* ── Cart Items ── */
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f2f5;
}

.cart-item:last-child {
  border-bottom: 0;
}

.cart-item-image {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: #f0f2f5;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 13px;
  color: var(--muted-foreground);
}

.cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-qty-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
}

.cart-qty-btn:hover {
  transform: none;
  box-shadow: none;
  background: var(--muted);
}

.cart-qty-value {
  font-size: 14px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 8px;
  margin-top: 4px;
  border-top: 2px solid var(--foreground);
}

.cart-total-label {
  font-size: 16px;
  font-weight: 600;
}

.cart-total-value {
  font-size: 20px;
  font-weight: 700;
}

.cart-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted-foreground);
}

.cart-empty-icon {
  font-size: 40px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ── Order Cards ── */
.order-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--card);
}

.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.order-id {
  font-weight: 700;
  font-size: 15px;
}

.order-date {
  font-size: 12px;
  color: var(--muted-foreground);
}

.order-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.order-amount {
  font-size: 16px;
  font-weight: 700;
}

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-new {
  background: #dbeafe;
  color: #1e40af;
}

.badge-accepted {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-preparing {
  background: #fef3c7;
  color: #92400e;
}

.badge-sent {
  background: #fce7f3;
  color: #9d174d;
}

.badge-delivered {
  background: #d1fae5;
  color: #065f46;
}

.badge-completed {
  background: #dcfce7;
  color: #166534;
}

.badge-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* ── Shop Header ── */
.shop-header {
  text-align: center;
  padding: 8px 0 12px 0;
}

.shop-header h1 {
  font-size: 22px;
  margin: 0 0 2px;
}

.shop-subtitle {
  font-size: 13px;
  color: var(--muted-foreground);
  margin: 0;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-foreground);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 14px;
  color: var(--muted-foreground);
}

/* ── Checkout ── */
.checkout-section {
  padding-top: 20px;
}

.btn-checkout {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 14px;
  margin-top: 8px;
}

/* ── Toast / Notification ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--foreground);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  opacity: 0;
  transition: all .3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Desktop WebApp layout ── */
@media (min-width: 768px) {
  .tabs {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .shop-header h1 {
    font-size: 28px;
  }

  .webapp-grid {
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .product-image {
    height: 200px;
  }

  .product-image-slide {
    height: 200px;
  }

  .product-info {
    padding: 14px;
  }

  .product-info h3 {
    font-size: 15px;
  }

  .product-price {
    font-size: 17px;
  }

  .btn-add-cart {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }

  .product-qty-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .product-qty-value {
    font-size: 15px;
    min-width: 22px;
  }

  #panel-cart .card,
  #checkout-form {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }

  .cart-item-image {
    width: 64px;
    height: 64px;
  }

  .order-card {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }

  .empty-state {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }

  .category-filter,
  .subcategory-filter {
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 0;
    gap: 8px;
  }

  .category-filter-wrap {
    margin-bottom: 16px;
  }

  .scroll-hint {
    display: none;
  }
}

.product-page-card {
  max-width: 720px;
  margin: 0 auto;
}

.product-page-carousel .product-image-slide {
  height: min(62vw, 340px);
  object-fit: contain;
  /*background: #f5f7fb;*/
}

.product-page-price {
  font-size: 22px;
  font-weight: 700;
}

.product-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-bottom: 8px;
  font-size: 14px;
}

/* ── Mobile-first adjustments ── */
@media (max-width: 767px) {
  .webapp-shell {
    padding: 12px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 40px);
    padding-bottom: 80px;
  }

  .ai-back {
    background-image:
      linear-gradient(rgba(250, 236, 255, 0.6), rgba(250, 236, 255, 0.6)),
      url('/images/ai-back.png');

    background-position: right -40px top;
    background-size: 360px;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}
