:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #15181e;
  --muted: #69707d;
  --line: #e3e6eb;
  --accent: #0f8b8d;
  --accent-strong: #0a686a;
  --warning: #ffb703;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
}

body.cart-is-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
}

.icon-button {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -3px;
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  color: #111;
  font-size: 12px;
  font-weight: 800;
  background: var(--warning);
  border-radius: 999px;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 92px;
}

.hero {
  min-height: 440px;
  display: flex;
  align-items: flex-end;
  margin: 16px -16px 0;
  padding: 24px 16px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(8, 13, 18, 0.14), rgba(8, 13, 18, 0.88)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1400&q=80")
      center / cover;
}

.hero-copy {
  max-width: 560px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #8be0d7;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 9vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0;
}

.hero p {
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.45;
}

.primary-action,
.lead-form button,
.admin-form button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
}

.quick-filters {
  display: grid;
  grid-auto-columns: max-content;
  grid-auto-flow: column;
  gap: 8px;
  margin: 18px -16px 0;
  padding: 0 16px 6px;
  overflow-x: auto;
}

.filter {
  min-height: 40px;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.filter.is-active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.filter span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  margin-left: 4px;
  padding: 0 5px;
  color: var(--ink);
  font-size: 12px;
  background: var(--warning);
  border-radius: 999px;
}

.search-panel {
  position: relative;
  margin-top: 12px;
}

.search-panel input {
  min-height: 50px;
  width: 100%;
  padding: 0 48px 0 14px;
  color: var(--ink);
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-panel button {
  position: absolute;
  top: 5px;
  right: 6px;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  background: #f3f5f7;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 12px;
}

.muted,
.product-text,
.checkout-panel p {
  color: var(--muted);
}

.muted {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.product-grid:empty::before {
  display: block;
  padding: 18px;
  color: var(--muted);
  content: "Товары не найдены";
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.product-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  min-height: 150px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.product-card.is-hidden {
  display: none;
}

.product-media {
  min-height: 128px;
  border-radius: 7px;
  background-color: #e7edf1;
  background-position: center;
  background-size: cover;
}

.product-media.phone {
  background-image: url("https://images.unsplash.com/photo-1598327105666-5b89351aff97?auto=format&fit=crop&w=600&q=80");
}

.product-media.laptop {
  background-image: url("https://images.unsplash.com/photo-1496181133206-80ce9b88a853?auto=format&fit=crop&w=600&q=80");
}

.product-media.buds {
  background-image: url("https://images.unsplash.com/photo-1606220945770-b5b6c2c55bf1?auto=format&fit=crop&w=600&q=80");
}

.product-media.watch {
  background-image: url("https://images.unsplash.com/photo-1523275335684-37898b6baf30?auto=format&fit=crop&w=600&q=80");
}

.product-media.speaker {
  background-image: url("https://images.unsplash.com/photo-1545454675-3531b543be5d?auto=format&fit=crop&w=600&q=80");
}

.product-media.camera {
  background-image: url("https://images.unsplash.com/photo-1557324232-b8917d3c3dcb?auto=format&fit=crop&w=600&q=80");
}

.product-body {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.favorite-button {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #9b1c1c;
  font-size: 24px;
  line-height: 1;
  background: #fff7f7;
  border: 1px solid #ffd0d0;
  border-radius: 50%;
}

.favorite-button.is-active {
  color: #fff;
  background: #e11d48;
  border-color: #e11d48;
}

.category {
  margin-bottom: 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.product-text {
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.35;
}

.stock-badge {
  display: inline-flex;
  width: max-content;
  min-height: 24px;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
}

.stock-badge.in-stock {
  color: #0b6b3a;
  background: #e7f7ee;
}

.stock-badge.out-stock {
  color: #9b1c1c;
  background: #fff1f1;
}

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

.add-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  background: var(--accent);
  border: 0;
  border-radius: 50%;
}

.add-button:disabled {
  color: #8b929c;
  background: #e6e9ee;
}

.checkout-panel {
  display: grid;
  gap: 18px;
  margin-top: 24px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-panel {
  margin-top: 24px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.section-head.compact {
  padding: 0 0 14px;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.photo-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stock-create {
  grid-auto-flow: column;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 48px;
}

.stock-create input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--accent);
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.lead-form input {
  min-height: 48px;
  width: 100%;
  padding: 0 14px;
  color: var(--ink);
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-form textarea {
  min-height: 88px;
  padding-top: 12px;
  resize: vertical;
}

.photo-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.photo-button {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius);
}

.photo-button.secondary {
  color: var(--ink);
  background: #f3f5f7;
  border: 1px solid var(--line);
}

.photo-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.photo-icon {
  font-size: 20px;
}

.photo-preview {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.photo-preview.is-hidden {
  display: none;
}

.photo-preview img {
  width: 88px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 7px;
  background: #e7edf1;
}

.photo-preview button {
  min-height: 40px;
  color: #9b1c1c;
  font-weight: 800;
  background: #fff1f1;
  border: 1px solid #ffd0d0;
  border-radius: var(--radius);
}

.field-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.bulk-tools {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.bulk-tools input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.bulk-tools button {
  min-height: 44px;
  padding: 0 12px;
  color: #fff;
  font-weight: 800;
  background: var(--ink);
  border: 0;
  border-radius: var(--radius);
}

.bulk-tools button + button {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.admin-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.admin-item strong,
.admin-item span {
  display: block;
}

.admin-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.quick-price,
.stock-toggle {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quick-price input {
  min-height: 42px;
  width: 100%;
  padding: 0 10px;
  color: var(--ink);
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stock-toggle {
  grid-auto-flow: column;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.stock-toggle input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--accent);
}

.stock-toggle span {
  margin-top: 0;
}

.delete-button {
  min-height: 38px;
  padding: 0 12px;
  color: #9b1c1c;
  font-weight: 800;
  background: #fff1f1;
  border: 1px solid #ffd0d0;
  border-radius: var(--radius);
}

.orders-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.order-board {
  display: grid;
  grid-auto-columns: minmax(260px, 82vw);
  grid-auto-flow: column;
  gap: 12px;
  margin: 14px -18px 0;
  padding: 0 18px 8px;
  overflow-x: auto;
}

.order-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 260px;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.order-column-head,
.order-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-column-head h3 {
  margin-bottom: 0;
  font-size: 15px;
}

.order-column-head span {
  display: grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.order-column-list {
  display: grid;
  gap: 10px;
}

.order-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.order-card-head span,
.order-empty {
  color: var(--muted);
  font-size: 12px;
}

.order-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.order-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-card select {
  min-height: 40px;
  width: 100%;
  padding: 0 10px;
  color: var(--ink);
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.order-empty {
  margin-bottom: 0;
  padding: 12px;
  text-align: center;
}

.lead-form {
  display: grid;
  gap: 10px;
}

.bottom-nav {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 440px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.bottom-nav a,
.bottom-nav button {
  display: grid;
  min-height: 52px;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  background: transparent;
  border: 0;
}

.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  pointer-events: none;
  visibility: hidden;
}

.cart-drawer.is-open {
  pointer-events: auto;
  visibility: visible;
}

.cart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 13, 18, 0.5);
  opacity: 0;
  transition: opacity 180ms ease;
}

.cart-drawer.is-open .cart-backdrop {
  opacity: 1;
}

.cart-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto;
  width: 100%;
  max-height: 86vh;
  padding: 16px;
  background: var(--surface);
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -16px 36px rgba(0, 0, 0, 0.24);
  transform: translateY(100%);
  transition: transform 220ms ease;
}

.cart-drawer.is-open .cart-panel {
  transform: translateY(0);
}

.cart-header,
.cart-total,
.cart-item,
.qty-controls {
  display: flex;
  align-items: center;
}

.cart-header {
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.close-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  background: #f3f5f7;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.cart-empty {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 180px;
  text-align: center;
}

.cart-empty.is-hidden {
  display: none;
}

.cart-empty p {
  margin-bottom: 0;
  color: var(--muted);
}

.cart-list {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 12px 0;
}

.cart-item {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.cart-item-title {
  margin-bottom: 4px;
  font-weight: 800;
}

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

.qty-controls {
  flex: 0 0 auto;
  gap: 8px;
}

.qty-controls button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  background: #f3f5f7;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.qty-controls span {
  min-width: 20px;
  text-align: center;
  font-weight: 800;
}

.cart-summary {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.cart-customer {
  display: grid;
  gap: 8px;
}

.cart-customer input {
  min-height: 44px;
  width: 100%;
  padding: 0 12px;
  color: var(--ink);
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.cart-total {
  justify-content: space-between;
  gap: 16px;
  font-size: 18px;
}

.checkout-button {
  min-height: 50px;
  color: #fff;
  font-weight: 800;
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
}

.checkout-button:disabled {
  color: #8b929c;
  background: #e6e9ee;
}

@media (min-width: 700px) {
  .topbar {
    padding-right: calc((100vw - 960px) / 2 + 16px);
    padding-left: calc((100vw - 960px) / 2 + 16px);
  }

  .hero {
    min-height: 520px;
    margin-right: 0;
    margin-left: 0;
    border-radius: var(--radius);
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .checkout-panel {
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
  }

  .admin-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-form .full-field,
  .admin-form button {
    grid-column: 1 / -1;
  }

  .bulk-tools {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  .bulk-tools .field-note {
    grid-column: 1 / -1;
  }

  .admin-item {
    grid-template-columns: minmax(0, 1fr) 130px 120px auto;
    align-items: center;
  }

  .order-board {
    grid-template-columns: repeat(5, minmax(180px, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: initial;
    margin-right: 0;
    margin-left: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .cart-drawer {
    align-items: stretch;
    justify-items: end;
  }

  .cart-panel {
    max-width: 420px;
    max-height: none;
    height: 100%;
    border-radius: 0;
    transform: translateX(100%);
  }

  .cart-drawer.is-open .cart-panel {
    transform: translateX(0);
  }
}
