:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --surface: #ffffff;
  --surface-2: #eef4f3;
  --text: #151817;
  --muted: #69736f;
  --line: #dfe7e3;
  --accent: #1b8aa0;
  --accent-dark: #0d6176;
  --mint: #dff1ea;
  --blue-soft: #e7f2fb;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(17, 34, 38, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 12px 16px;
  background: rgba(247, 248, 246, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  background: var(--text);
  color: #fff;
  border-radius: 9px;
  font-size: 18px;
}

.icon-cart {
  position: relative;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--text);
  color: #fff;
}

.icon-cart::before {
  content: "";
  position: absolute;
  inset: 12px 10px 10px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 2px 2px 6px 6px;
}

.icon-cart::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 15px;
  width: 10px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.icon-cart span {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  min-width: 23px;
  height: 23px;
  place-items: center;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.hero {
  display: flex;
  align-items: flex-end;
  min-height: 118px;
  padding: 18px 16px 14px;
  background:
    linear-gradient(135deg, rgba(223, 241, 234, 0.9), rgba(231, 242, 251, 0.95)),
    var(--surface);
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(26px, 6.2vw, 42px);
  line-height: 1.06;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 560px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.eyebrow,
.note,
.form-state,
.product-meta,
.card-brand,
.content-head p {
  color: var(--muted);
}

.form-state.error {
  color: var(--danger);
}

.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.catalog-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.mobile-controls {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.sort-row {
  display: flex;
  justify-content: flex-end;
}

.sort-row select {
  width: min(210px, 62vw);
  min-height: 38px;
  font-size: 13px;
}

.section-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab,
.filter-button,
.ghost,
.primary,
.secondary,
.telegram-link,
.size-chip,
.modal-close {
  border: 0;
  border-radius: 10px;
}

.tab {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}

.tab.active {
  background: var(--text);
  color: #fff;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 138, 160, 0.14);
}

.filter-button,
.secondary {
  min-height: 44px;
  padding: 0 14px;
  background: var(--blue-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.filters {
  position: sticky;
  top: 82px;
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.panel-head,
.content-head,
.summary > div:not(.promo-field) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2,
h3,
p {
  margin: 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ghost {
  min-height: 36px;
  padding: 0 8px;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 800;
}

.toggle-row {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.toggle-row label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 750;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 132px;
  overflow: auto;
  padding: 2px 0;
}

.multi-filter {
  position: relative;
}

.multi-filter summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.multi-filter summary::-webkit-details-marker {
  display: none;
}

.multi-filter summary::after {
  content: "⌄";
  color: var(--muted);
}

.filter-menu {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.filter-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.choice input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.compact-list .choice {
  min-width: 52px;
  justify-content: center;
}

.apply-filters {
  margin-top: 16px;
}

.muted-small {
  color: var(--muted);
  font-size: 13px;
}

.note {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.4;
}

.content {
  min-width: 0;
}

.content-head {
  margin-bottom: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 14px 10px;
}

.card {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 0;
  background: var(--surface);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  overflow: hidden;
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card-image {
  display: grid;
  min-height: 0;
  aspect-ratio: 1 / 1.2;
  place-items: center;
  background: #f6f7f5;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-body {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0 2px 4px;
}

.card-brand {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title {
  display: -webkit-box;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  padding: 3px 7px;
  background: #ef4b24;
  border-radius: 0;
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.card-price {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.1;
}

.price-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.old-price {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: line-through;
}

.delivery-note {
  margin: -1px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.catalog-sizes {
  position: relative;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
}

.catalog-sizes::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 34px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--surface));
  pointer-events: none;
}

.size-chip {
  flex: 0 0 auto;
  min-width: 42px;
  min-height: 34px;
  padding: 6px 9px;
  background: var(--surface-2);
  color: var(--text);
}

.size-chip.selected,
.size-chip:hover {
  background: var(--accent);
  color: #fff;
}

.size-chip.sold-out {
  cursor: not-allowed;
  color: #9aa29e;
  background: #f2f3f1;
  text-decoration: line-through;
}

.size-chip.sold-out:hover {
  color: #9aa29e;
  background: #f2f3f1;
}

.primary,
.telegram-link {
  display: grid;
  width: 100%;
  min-height: 46px;
  place-items: center;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
  text-decoration: none;
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.modal {
  position: fixed;
  inset: 0;
  width: min(980px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: auto;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(11, 14, 12, 0.48);
}

.modal-close {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  z-index: 5;
  display: grid;
  width: 38px;
  height: 38px;
  margin: 10px 10px -48px auto;
  place-items: center;
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 24px;
}

.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.86fr);
  background: var(--surface);
}

.product-carousel {
  position: relative;
  overflow: hidden;
  background: #f7f8f7;
}

.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  display: grid;
  flex: 0 0 100%;
  margin: 0;
  place-items: center;
  scroll-snap-align: start;
  background: #f7f8f7;
}

.carousel-slide img {
  width: 100%;
  height: min(58vh, 620px);
  object-fit: contain;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(11, 14, 12, 0.08);
  font-size: 23px;
  line-height: 1;
  transform: translateY(-50%);
}

.carousel-prev {
  left: 12px;
}

.carousel-next {
  right: 12px;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 14px;
  background: #f7f8f7;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  min-height: 7px;
  padding: 0;
  border-radius: 999px;
  background: rgba(18, 25, 23, 0.24);
  pointer-events: auto;
}

.carousel-dot.active {
  background: var(--text);
}

.size-block {
  display: grid;
  gap: 10px;
}

.size-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.size-head h3 {
  font-size: 15px;
}

.product-size-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.product-size-grid .size-chip {
  width: 100%;
  min-height: 44px;
}

.detail-info {
  display: grid;
  align-content: start;
  gap: 13px;
  padding: 28px 28px 30px;
}

.detail-info h2 {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.18;
  letter-spacing: 0;
}

.cart-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1px;
  background: var(--line);
}

.size-chart-modal {
  width: min(620px, calc(100vw - 20px));
}

.size-chart-view {
  background: var(--surface);
}

.size-chart-content {
  display: grid;
  gap: 14px;
  padding: 28px;
}

.size-chart-content h2 {
  font-size: 24px;
  line-height: 1.18;
}

.size-chart-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.size-chart-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 14px;
}

.size-chart-table th,
.size-chart-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.size-chart-table th {
  background: var(--surface-2);
  font-weight: 850;
}

.size-chart-table tr:last-child td {
  border-bottom: 0;
}

.cart-main,
.checkout {
  background: var(--surface);
  padding: 24px;
}

.cart-items {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 12px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.cart-product {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.cart-item img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  background: var(--surface-2);
  border-radius: 10px;
}

.cart-item-title {
  display: block;
  font-weight: 850;
}

.cart-price {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.cart-price strong {
  font-size: 16px;
}

.remove {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.remove:hover {
  background: #f7e8e6;
  color: var(--danger);
}

.checkout {
  display: grid;
  align-content: start;
}

.summary {
  display: grid;
  gap: 10px;
  margin: 18px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.text-button {
  width: fit-content;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 800;
}

.promo-field {
  display: grid;
  gap: 8px;
}

.promo-field .field {
  margin-top: 0;
}

.promo-field .secondary {
  width: 100%;
}

.promo-message {
  color: var(--muted);
  font-size: 13px;
}

.promo-message.error {
  color: var(--danger);
}

.summary-total {
  font-size: 18px;
}

.summary-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.order-result {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 12px;
}

.order-result > strong {
  font-size: 18px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.page-button {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.page-button.active {
  background: var(--text);
  color: #fff;
}

.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 60;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  background: var(--text);
  color: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-weight: 850;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.admin-link {
  color: var(--accent-dark);
  font-weight: 850;
  text-decoration: none;
}

.admin-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.admin-panel {
  display: grid;
  gap: 16px;
}

.admin-auth,
.admin-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.order-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 230px);
  overflow: auto;
  padding-right: 2px;
}

.order-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.order-row.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 138, 160, 0.1);
}

.order-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.order-detail {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.order-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-section {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.admin-items {
  display: grid;
  gap: 10px;
}

.admin-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.admin-item img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  background: var(--surface-2);
  border-radius: 10px;
}

.admin-item h4 {
  margin: 0 0 6px;
}

.admin-item a {
  color: var(--accent-dark);
  font-weight: 850;
}

.empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

@media (max-width: 860px) {
  .hero {
    min-height: 104px;
    padding: 14px 16px 12px;
  }

  .catalog-shell {
    grid-template-columns: 1fr;
    padding-top: 12px;
  }

  .filters {
    position: fixed;
    inset: auto 10px 10px;
    z-index: 30;
    max-height: 78vh;
    overflow: auto;
    box-shadow: var(--shadow);
    transform: translateY(calc(100% + 20px));
    transition: transform 180ms ease;
  }

  .filters.open {
    transform: translateY(0);
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 7px;
  }

  .card-image {
    min-height: auto;
  }

  .product-detail,
  .cart-view {
    grid-template-columns: 1fr;
  }

  .product-modal,
  .cart-modal {
    width: min(680px, 100vw);
    max-height: 100vh;
    max-height: 100dvh;
    margin: auto auto 0;
    border-radius: 16px 16px 0 0;
  }

  .size-chart-modal {
    width: min(620px, calc(100vw - 24px));
    max-height: min(82vh, 680px);
    max-height: min(82dvh, 680px);
    margin: auto;
    border-radius: 14px;
  }

  .admin-auth,
  .admin-tools,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .order-detail {
    order: -1;
  }

  .order-list {
    max-height: 42vh;
  }

  .product-carousel {
    max-height: none;
  }

  .carousel-slide img {
    height: clamp(260px, 45vh, 410px);
    aspect-ratio: auto;
  }

  .carousel-nav {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.6);
    font-size: 20px;
  }
}

@media (max-width: 420px) {
  .hero h1 {
    font-size: 28px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  .grid {
    gap: 15px 6px;
  }

  .card {
    padding: 0;
  }

  .card-title {
    min-height: 36px;
    font-size: 13px;
  }

  .card-price {
    font-size: 16px;
  }

  .card-brand,
  .catalog-sizes {
    font-size: 12px;
  }

  .badges {
    gap: 4px;
  }

  .badge {
    font-size: 10px;
  }

  .price-stack {
    gap: 6px;
  }

  .old-price {
    font-size: 12px;
  }

  .modal-close {
    width: 36px;
    height: 36px;
    margin: 8px 8px -44px auto;
  }

  .carousel-slide img {
    height: clamp(230px, 40vh, 350px);
  }

  .carousel-dots {
    padding: 8px 0 12px;
  }

  .detail-info h2 {
    font-size: 21px;
  }

  .detail-info,
  .size-chart-content,
  .cart-main,
  .checkout {
    padding: 20px 16px;
  }

  .cart-item {
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  .cart-product {
    grid-template-columns: 64px minmax(0, 1fr);
  }

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

  .remove {
    justify-self: end;
  }

  .pagination {
    justify-content: stretch;
  }

  .page-button {
    flex: 1 1 40px;
  }

  .toast {
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
}
