:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --text: #1a2332;
  --text-muted: #5c6b82;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #4ed071;
  --accent-hover: #36b85d;
  --accent-soft: rgba(78, 208, 113, 0.14);
  --nav-bg: rgba(255, 255, 255, 0.92);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --hero-gradient: linear-gradient(135deg, #e8f5ec, var(--bg));
  --hero-media-bg: #6a9f78;
  --img-placeholder: #eef2f7;
  --ticker-bg: #f8f8f8;
  --ticker-border: #1a1a1a;
  --ticker-text: #0a0a0a;
  --modal-backdrop: rgba(15, 23, 42, 0.35);
  --input-autofill-bg: #f8fafc;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --font: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --hero-height-min: 200px;
  --hero-height-pref: 30vw;
  --hero-height-max: 480px;
  --layout-max: min(1680px, calc(100vw - 40px));
  --layout-gutter: clamp(12px, 3.2vw, 20px);
  --touch-min: 44px;
  --nav-height: 52px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1419;
  --bg-elevated: #1a2332;
  --text: #e8edf4;
  --text-muted: #94a3b8;
  --border: #2d3a4d;
  --border-strong: #3d4f66;
  --accent: #4ed071;
  --accent-hover: #5ee081;
  --accent-soft: rgba(78, 208, 113, 0.2);
  --nav-bg: rgba(26, 35, 50, 0.92);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
  --hero-gradient: linear-gradient(135deg, #1a2e24, var(--bg));
  --hero-media-bg: #2d4a3a;
  --img-placeholder: #243044;
  --ticker-bg: #141820;
  --ticker-border: #4ed071;
  --ticker-text: #e8edf4;
  --modal-backdrop: rgba(0, 0, 0, 0.55);
  --input-autofill-bg: #243044;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-top: var(--safe-top);
  padding-bottom: calc(16px + var(--safe-bottom));
}

body > main {
  flex: 1 0 auto;
}

.site-hero {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  height: clamp(var(--hero-height-min), var(--hero-height-pref), var(--hero-height-max));
  overflow: hidden;
  background: var(--hero-gradient);
  line-height: 0;
}

.site-hero__media {
  position: absolute;
  inset: 0;
  background: var(--hero-media-bg);
}

.site-hero picture {
  display: block;
  width: 100%;
  height: 100%;
}

.site-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}

.site-hero__ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  background: var(--ticker-bg);
  border-top: 3px solid var(--ticker-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 -2px 0 #000;
  overflow: hidden;
  padding: 10px 0;
}

.site-hero__ticker-track {
  display: flex;
  width: max-content;
  animation: site-hero-ticker 22s linear infinite;
  will-change: transform;
}

.site-hero__ticker-chunk {
  flex-shrink: 0;
  font-family: "Press Start 2P", ui-monospace, monospace;
  font-size: clamp(9px, 1.8vw, 12px);
  line-height: 1.6;
  letter-spacing: 0.08em;
  color: var(--ticker-text);
  white-space: nowrap;
  padding-right: 2rem;
  text-transform: uppercase;
  image-rendering: pixelated;
}

@keyframes site-hero-ticker {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-hero__ticker-track {
    animation: none;
    justify-content: center;
    width: 100%;
  }
  .site-hero__ticker-chunk[aria-hidden="true"] {
    display: none;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Шапка */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.top-nav__inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 12px var(--layout-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg);
  border-color: var(--border);
  text-decoration: none;
}

.top-nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Переключатель темы */
.theme-switch {
  display: inline-flex;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  vertical-align: middle;
  -webkit-tap-highlight-color: transparent;
}

.theme-switch:focus-visible .theme-switch__track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-switch__track {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  justify-items: center;
  width: 56px;
  height: 30px;
  padding: 3px;
  box-sizing: border-box;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-switch:hover .theme-switch__track {
  border-color: var(--border-strong);
}

.theme-switch[aria-pressed="true"] .theme-switch__track {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--bg));
}

.theme-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.theme-switch[aria-pressed="true"] .theme-switch__thumb {
  transform: translateX(26px);
}

.theme-switch__icon {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  opacity: 0.38;
  background-color: var(--text-muted);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  transition: opacity 0.15s ease, background-color 0.15s ease;
  pointer-events: none;
}

.theme-switch__icon--sun {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM4.22 4.22l1.42 1.42L3.64 5.64 4.22 4.22zm14.14 14.14 1.42 1.42 1.42-1.42-1.42-1.42zm0-11.8 1.42-1.42 1.42 1.42-1.42 1.42zM5.64 18.36l1.42 1.42 1.42-1.42-1.42-1.42zM1 11h3v2H1v-2zm19 0h3v2h-3v-2z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM4.22 4.22l1.42 1.42L3.64 5.64 4.22 4.22zm14.14 14.14 1.42 1.42 1.42-1.42-1.42-1.42zm0-11.8 1.42-1.42 1.42 1.42-1.42 1.42zM5.64 18.36l1.42 1.42 1.42-1.42-1.42-1.42zM1 11h3v2H1v-2zm19 0h3v2h-3v-2z'/%3E%3C/svg%3E");
}

.theme-switch__icon--moon {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M10 2a8 8 0 1 0 8 8 7 7 0 0 1-8-8z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M10 2a8 8 0 1 0 8 8 7 7 0 0 1-8-8z'/%3E%3C/svg%3E");
}

.theme-switch[aria-pressed="false"] .theme-switch__icon--sun {
  opacity: 1;
  background-color: var(--accent-hover);
}

.theme-switch[aria-pressed="true"] .theme-switch__icon--moon {
  opacity: 1;
  background-color: var(--accent);
}

/* Подвал */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.site-footer__inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 20px 20px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-footer__copy {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.site-footer__nav a {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer__nav .site-footer__inactive {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.55;
  cursor: default;
  user-select: none;
}

.site-footer__nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.container {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 24px var(--layout-gutter) 40px;
  width: 100%;
  box-sizing: border-box;
}

/* Хлебные крошки и заголовок над сеткой — верх совпадает с первой карточкой фильтров */
.catalog-page-head {
  margin-bottom: 18px;
}

.catalog-page-head .breadcrumb {
  margin-bottom: 8px;
}

.catalog-page-title {
  margin: 0;
}

/* Сетка каталога: товары слева, фильтры справа */
.catalog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  gap: 28px;
  align-items: start;
}

.catalog-main {
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}

/* Фильтры каталога */
.catalog-filters-drawer {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  position: relative;
}

.catalog-filters-drawer__backdrop {
  display: none;
}

.catalog-filters-drawer__head {
  display: none;
}

.catalog-filters-drawer__panel {
  position: static;
  width: 100%;
  max-height: none;
  background: transparent;
  border: none;
  box-shadow: none;
  display: block;
}

.catalog-filters-drawer__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
}

.catalog-filters-drawer__close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.catalog-filters-drawer__close:hover {
  background: var(--accent-soft);
  color: var(--text);
}

body.filters-drawer-open {
  overflow: hidden;
}

.catalog-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + var(--safe-top));
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 56px - var(--safe-top) - 28px);
  min-height: 0;
  align-self: start;
}

.catalog-sidebar > .card,
.catalog-sidebar .catalog-sidebar__card {
  margin-bottom: 0;
}

.catalog-sidebar__card {
  padding: 18px 18px 16px;
}

.catalog-sidebar__grow {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.catalog-sidebar__card-scroll {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.catalog-sidebar__card-scroll .filter-aside__title {
  flex-shrink: 0;
}

.catalog-sidebar__scroll-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding-right: 2px;
}

.catalog-sidebar__card-brand {
  flex: 0 1 auto;
  max-height: min(42%, 360px);
}

.catalog-sidebar__card-filters {
  flex: 1 1 auto;
  min-height: 120px;
}

.catalog-sidebar__apply {
  flex-shrink: 0;
  margin-bottom: 0;
}

.filter-aside__title {
  margin: 0 0 12px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-aside__hint {
  margin: 0 0 10px;
  font-size: 0.8125rem;
}

.filter-aside__field {
  margin-bottom: 10px;
}

.filter-aside__field:last-child {
  margin-bottom: 0;
}

.filter-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.filter-check:last-of-type {
  border-bottom: none;
}

.filter-check input {
  width: 1rem;
  height: 1rem;
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.filter-check span {
  color: var(--text);
  line-height: 1.35;
}

.catalog-toolbar {
  margin-bottom: 12px;
}

.catalog-toolbar.card {
  padding: 12px 14px;
  box-shadow: none;
}

[data-theme="dark"] .catalog-toolbar.card {
  background: var(--bg-elevated);
  border-color: var(--border);
}

[data-theme="dark"] .catalog-toolbar .search-pill {
  background: rgba(15, 20, 25, 0.45);
  border-color: var(--border-strong);
}

.catalog-toolbar__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 18px;
}

.catalog-toolbar__filters-btn {
  flex-shrink: 0;
  min-height: 42px;
  padding: 0 14px;
  white-space: nowrap;
  gap: 6px;
}

.catalog-toolbar__filters-btn::before {
  content: "";
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-color: currentColor;
  opacity: 0.75;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4 6h16v2H4V6zm3 5h10v2H7v-2zm4 5h2v2h-2v-2z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4 6h16v2H4V6zm3 5h10v2H7v-2zm4 5h2v2h-2v-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.catalog-toolbar__search {
  min-width: 0;
}

.catalog-toolbar__search .search-pill {
  width: 100%;
  max-width: 100%;
}

.catalog-toolbar__sort {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.catalog-toolbar__sort-label {
  margin: 0;
  font-size: 0.8125rem;
  white-space: nowrap;
  line-height: 1;
}

.catalog-toolbar .search-pill {
  min-height: 42px;
}

.catalog-toolbar .segmented {
  min-height: 42px;
  align-items: center;
}

.catalog-toolbar .segmented button {
  padding: 6px 11px;
  font-size: 0.75rem;
}

.segmented--scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.segmented--scroll::-webkit-scrollbar {
  display: none;
}

.pager-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pager-bar__info {
  margin: 0;
  flex: 1 1 140px;
}

.pager-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-group--flush {
  margin-bottom: 0;
}

@media (min-width: 921px) {
  .catalog-filters-drawer {
    display: block;
  }

  .catalog-toolbar__filters-btn.btn {
    display: none;
  }

  .catalog-toolbar__search {
    grid-column: 1;
  }

  .catalog-toolbar__sort {
    grid-column: 2;
  }
}

@media (max-width: 920px) {
  .catalog-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .catalog-main {
    grid-column: 1;
    grid-row: 1;
  }

  .catalog-filters-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 75;
    grid-column: auto;
    grid-row: auto;
    pointer-events: none;
  }

  .catalog-filters-drawer.is-open {
    display: block;
    pointer-events: auto;
  }

  .catalog-filters-drawer__backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: var(--modal-backdrop);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .catalog-filters-drawer.is-open .catalog-filters-drawer__backdrop {
    opacity: 1;
  }

  .catalog-filters-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
  }

  .catalog-filters-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 100%);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
  }

  .catalog-filters-drawer.is-open .catalog-filters-drawer__panel {
    transform: translateX(0);
  }

  .catalog-filters-drawer .catalog-sidebar {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px calc(12px + var(--safe-bottom));
    position: static;
    max-height: none;
    gap: 10px;
  }

  .catalog-filters-drawer .catalog-sidebar__grow {
    flex: 0 1 auto;
    overflow: visible;
  }

  .catalog-filters-drawer .catalog-sidebar__scroll-inner {
    max-height: min(36vh, 280px);
  }

  .catalog-filters-drawer .catalog-sidebar__apply {
    flex-shrink: 0;
    margin-top: 4px;
    min-height: var(--touch-min);
    box-shadow: var(--shadow-md);
  }

  .catalog-toolbar__filters-btn.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .catalog-toolbar__row {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 8px 10px;
    align-items: center;
  }

  .catalog-toolbar__filters-btn {
    grid-column: 1;
    grid-row: 1;
  }

  .catalog-toolbar__search {
    grid-column: 2;
    grid-row: 1;
  }

  .catalog-toolbar__sort {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .catalog-toolbar__sort-label {
    margin-bottom: 6px;
  }

  .catalog-toolbar__sort .segmented {
    width: 100%;
  }
}

/* Карточки */
.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 16px;
}

.card--pad-lg {
  padding: 28px;
}

h1 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  line-height: 1.2;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Главная: компактный блок приветствия */
.intro__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.intro__text {
  margin: 0;
  max-width: 560px;
}

.login-kicker {
  margin: 0 0 4px;
  font-size: 0.8125rem;
}

/* Админка: static/css/admin.css */

.page-head {
  margin-bottom: 8px;
}

.page-title {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-subtitle {
  margin: 0;
  max-width: 560px;
}

.search-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  max-width: 400px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-pill:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-pill__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.65;
  background-color: var(--text-muted);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.25' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3-3'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.25' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3-3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.search-pill:focus-within .search-pill__icon {
  opacity: 0.9;
  background-color: var(--accent);
}

.search-pill input[type="search"] {
  flex: 1;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 10px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-pill input[type="search"]::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.search-pill input[type="search"]::-webkit-search-decoration,
.search-pill input[type="search"]::-webkit-search-results-button,
.search-pill input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

/* Сегменты сортировки */
.segmented {
  display: inline-flex;
  background: var(--bg);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  gap: 2px;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Сетка товаров: компактные карточки, 4 колонки на широком экране */
.grid-products {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .grid-products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid-products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (max-width: 400px) {
  .grid-products {
    grid-template-columns: minmax(0, 1fr);
  }
}

.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}

.product-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.product-card > a {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  flex: 1 1 auto;
}

.product-card__img {
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: var(--img-placeholder);
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}

.product-card__body {
  padding: 10px 12px 6px;
}

.product-card__title {
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.35;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__actions {
  padding: 2px 10px 10px;
  margin-top: auto;
}

.product-card__actions .btn {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  font-size: 0.8125rem;
  min-height: 32px;
  border-radius: 8px;
}

.product-card__price {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg);
}

.btn-block {
  width: 100%;
}

/* Формы */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input:not([type]),
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.9375rem;
  font-family: inherit;
  background: var(--bg-elevated);
  color: var(--text);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* Поиск в каталоге */
.search-pill input[type="search"] {
  width: auto;
  padding: 10px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Автозаполнение в модалках: тот же размер и рамка, что у остальных полей */
.modal .form-group input:-webkit-autofill,
.modal .form-group input:-webkit-autofill:hover,
.modal .form-group input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--input-autofill-bg) inset;
  transition: background-color 99999s ease-out;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

/* Списки в модалках */
.settings-list {
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row__label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.settings-row__value {
  font-weight: 500;
  text-align: right;
  font-size: 0.875rem;
}

/* Модалка */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

/* Модалка заявки */
.cart-modal__dialog {
  max-width: 560px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg-elevated) 100%);
}

.cart-modal__head h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.cart-modal__subtitle {
  margin: 4px 0 0;
  font-size: 0.8125rem;
}

.cart-modal__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.cart-modal__close:hover {
  background: var(--bg);
  color: var(--text);
}

.cart-modal__items {
  padding: 12px 16px;
  overflow-y: auto;
  max-height: min(42vh, 360px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-modal__empty {
  padding: 32px 24px;
  text-align: center;
}

.cart-modal__empty-title {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 1rem;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.cart-item__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item__unit {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cart-item__controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.cart-qty {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.cart-qty__btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s;
}

.cart-qty__btn:hover {
  background: var(--accent-soft);
}

.cart-qty__val {
  min-width: 28px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.cart-item__sum {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.cart-item__remove {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.cart-item__remove:hover {
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
}

.cart-modal__footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.cart-modal__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.cart-modal__total-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.cart-modal__total-value {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.cart-modal__form-wrap {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
}

.cart-modal__section-title {
  margin: 0 0 14px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.cart-modal__form .form-group {
  margin-bottom: 12px;
}

.cart-modal__form .form-group:last-of-type {
  margin-bottom: 16px;
}

.cart-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cart-modal__actions .btn-primary {
  flex: 1;
  min-width: 140px;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.consent-check input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.consent-check span {
  color: var(--text);
}

.consent-check a {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.cart-modal-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .cart-item {
    grid-template-columns: 1fr;
  }

  .cart-item__controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
}

/* Таблицы админки */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data th,
table.data td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg);
}

table.data tr:hover td {
  background: var(--accent-soft);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.flex {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mt-1 {
  margin-top: 8px;
}
.mt-2 {
  margin-top: 16px;
}
.mb-2 {
  margin-bottom: 16px;
}

.breadcrumb {
  font-size: 0.875rem;
  line-height: 1.45;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Админка: вкладки (без inline-стилей в HTML) */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tabs button {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
}

.tabs button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.tabs button.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

code {
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
}

/* Адаптив */
@media (max-width: 768px) {
  input[type="text"],
  input:not([type]),
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  select,
  textarea,
  .search-pill input[type="search"] {
    font-size: 16px;
  }
}

@media (max-width: 720px) {
  .top-nav__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px 10px;
    padding: 10px var(--layout-gutter);
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    font-size: 1rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-nav__actions {
    grid-column: 2;
    grid-row: 1;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding-bottom: 2px;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .top-nav__actions .btn-primary {
    padding: 10px 14px;
    white-space: nowrap;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px var(--layout-gutter) calc(22px + var(--safe-bottom));
  }

  .site-footer__nav {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  .pager-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .pager-bar__actions {
    width: 100%;
  }

  .pager-bar__actions .btn {
    flex: 1 1 0;
    min-height: var(--touch-min);
  }

  .card {
    padding: 16px;
  }

  .card--pad-lg {
    padding: 20px 16px;
  }
}

@media (max-width: 640px) {
  :root {
    --hero-height-min: 130px;
    --hero-height-pref: 36vw;
    --hero-height-max: 260px;
  }

  .container {
    padding: 16px var(--layout-gutter) calc(28px + var(--safe-bottom));
  }

  .search-pill {
    max-width: none;
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal,
  .cart-modal__dialog {
    max-width: none;
    width: 100%;
    max-height: min(92dvh, 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: 0;
  }

  .cart-modal__head,
  .cart-modal__body,
  .cart-modal__footer,
  .cart-modal__form-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .cart-modal__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .cart-modal__actions .btn {
    width: 100%;
    min-height: var(--touch-min);
  }

  .cart-modal__actions .btn-primary {
    min-width: 0;
  }

  .toast {
    left: var(--layout-gutter);
    right: var(--layout-gutter);
    transform: none;
    bottom: calc(16px + var(--safe-bottom));
    text-align: center;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (pointer: coarse) {
  .btn {
    min-height: var(--touch-min);
  }

  .nav-links a {
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
  }

  .segmented button {
    min-height: 40px;
  }

  .filter-check {
    padding: 12px 0;
    min-height: var(--touch-min);
    align-items: center;
  }

  .filter-check input {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0;
  }

  .cart-qty__btn {
    width: 40px;
    height: 40px;
  }

  .cart-item__remove {
    width: 40px;
    height: 40px;
  }

  .product-card__actions .btn {
    min-height: 40px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
