/* Theme tokens: /theme.css (generated from config/theme.json) */

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}

html.page-loading .toolbar,
html.page-loading main,
html.page-loading .footer {
  opacity: 0;
}

html.page-ready .toolbar,
html.page-ready main,
html.page-ready .footer {
  opacity: 1;
  transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

html.page-leaving .toolbar,
html.page-leaving main,
html.page-leaving .footer {
  opacity: 0;
  transition: opacity 0.24s ease;
}

@media (prefers-reduced-motion: reduce) {
  html.page-loading .toolbar,
  html.page-loading main,
  html.page-loading .footer,
  html.page-leaving .toolbar,
  html.page-leaving main,
  html.page-leaving .footer {
    opacity: 1 !important;
    transition: none !important;
  }
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

.icon { width: 22px; height: 22px; }

/* Focus */
:focus {
  outline: none;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
summary:focus-visible,
.toolbar__brand:focus-visible,
.toolbar__icon-btn:focus-visible,
.admin-tab:focus-visible,
.subcategory-link:focus-visible,
.custom-select__trigger:focus-visible,
.custom-select__option:focus-visible,
.icon-picker__btn:focus-visible,
.icon-picker__nav-btn:focus-visible,
.quantity-picker__btn:focus-visible,
.password-field__toggle:focus-visible,
.size-row__remove:focus-visible,
.basket-line__remove:focus-visible,
.auth-page__logo:focus-visible,
.size-option:focus-visible,
.item-related__nav-btn:focus-visible,
.item-info__category:focus-visible,
.search-result:focus-visible,
.footer__link:focus-visible,
.inv-card:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="option"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}

.admin-table thead th.admin-table__sortable:focus-visible {
  outline: none;
  border-radius: 0;
  box-shadow: inset 0 0 0 2px var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-alt));
}

.admin-table thead th.admin-table__sortable:first-child:focus-visible {
  border-radius: 12px 0 0 0;
}

.admin-table thead th.admin-table__sortable:last-child:focus-visible {
  border-radius: 0 12px 0 0;
}

.admin-table tbody tr.order-row:focus-visible {
  outline: none;
  box-shadow: none;
}

.order-row:focus-visible td {
  border-radius: 0;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  box-shadow:
    inset 0 2px 0 0 var(--primary),
    inset 0 -2px 0 0 var(--primary);
}

.order-row:focus-visible td:first-child {
  border-radius: 8px 0 0 8px;
  box-shadow:
    inset 2px 0 0 0 var(--primary),
    inset 0 2px 0 0 var(--primary),
    inset 0 -2px 0 0 var(--primary);
}

.order-row:focus-visible td:last-child {
  border-radius: 0 8px 8px 0;
  box-shadow:
    inset -2px 0 0 0 var(--primary),
    inset 0 2px 0 0 var(--primary),
    inset 0 -2px 0 0 var(--primary);
}

.table-wrap .btn:focus-visible {
  box-shadow: 0 0 0 2px var(--primary);
}

/* Focus: overflow-hidden cards */
.category-card:focus-visible,
.item-card:focus-visible,
.item-gallery__thumb:focus-visible,
.inv-card:focus-visible {
  outline: none;
  overflow: visible;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}

.item-gallery__thumb:focus-visible {
  border-color: var(--primary);
}

/* Focus: round when radius is missing */
a:focus-visible:not([class]),
.footer a:focus-visible,
.footer__link:focus-visible,
p a:focus-visible,
li a:focus-visible,
.modal__subtitle a:focus-visible,
.confirm-dialog__message a:focus-visible,
.basket-line__title:focus-visible,
.admin-tab:focus-visible,
button:focus-visible:not([class]) {
  border-radius: 10px;
}

.toolbar__brand:focus-visible,
.auth-page__logo:focus-visible {
  border-radius: 12px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.form input:focus,
.form textarea:focus,
.form select:focus,
.input:focus,
.toolbar__search-form input:focus,
.toolbar__search-form input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent);
}

.phone-field:focus-within {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent);
}

.custom-select.is-open .custom-select__trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 28%, transparent);
}

img:focus,
img:focus-visible {
  outline: none;
}

a, button, .btn, .toolbar__icon-btn, .category-card, .item-card, .admin-tab,
.custom-select__trigger, .subcategory-link, .icon-picker__btn, .quantity-picker__btn {
  -webkit-tap-highlight-color: color-mix(in srgb, var(--primary) 22%, transparent);
}

/* Toolbar */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--toolbar-bg);
  color: var(--toolbar-text);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--card-shadow);
}

.toolbar--with-search {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand icons"
    "search search";
  align-items: center;
  gap: 10px 12px;
}

.toolbar--with-search .toolbar__brand { grid-area: brand; }
.toolbar--with-search .toolbar__icons {
  grid-area: icons;
  display: flex;
  align-items: center;
  gap: 4px;
}
.toolbar--with-search .toolbar__search {
  grid-area: search;
  width: 100%;
  min-width: 0;
}

@media (max-width: 820px) {
  .toolbar--with-search {
    padding: 10px 16px;
  }
}

@media (min-width: 821px) {
  .toolbar--with-search {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand search icons";
    gap: 12px;
  }

  .toolbar--with-search .toolbar__search {
    justify-self: end;
    width: auto;
    max-width: 100%;
  }
}

.toolbar__brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  text-decoration: none;
}
.toolbar__logo {
  display: block;
  height: 52px;
  width: auto;
  max-width: min(300px, 60vw);
  object-fit: contain;
  transition: opacity 0.15s;
}
.toolbar__brand:hover .toolbar__logo { opacity: 0.88; }

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

.toolbar__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--toolbar-text);
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.toolbar__icon-btn:hover { background: var(--surface-alt); color: var(--primary); }

.toolbar__basket-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

#theme-toggle .icon { display: none; width: 22px; height: 22px; flex-shrink: 0; }
html[data-theme="light"] #theme-toggle .icon--sun { display: inline-block; }
html[data-theme="dark"] #theme-toggle .icon--moon { display: inline-block; }
html[data-theme="auto"] #theme-toggle .icon--auto { display: inline-block; }
#theme-toggle .icon[hidden] { display: none !important; }

.toolbar__search { display: flex; align-items: center; min-width: 0; }

.toolbar__search-toggle { flex-shrink: 0; }

.toolbar--with-search .toolbar__search-toggle {
  display: none;
}

.toolbar--with-search .toolbar__search-field {
  width: 100%;
  max-width: none;
  opacity: 1;
  visibility: visible;
  overflow: visible;
  pointer-events: auto;
  transform: none;
}

.toolbar--with-search .toolbar__search-form input {
  opacity: 1;
  transform: none;
}

@media (min-width: 821px) {
  .toolbar--with-search .toolbar__search-toggle {
    display: inline-flex;
  }

  .toolbar--with-search .toolbar__search-field {
    width: min(420px, 62vw);
    max-width: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    pointer-events: none;
    transform: translateX(12px);
    transition:
      max-width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.28s ease,
      transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0.36s;
  }

  .toolbar--with-search .toolbar__search-form input {
    opacity: 0;
    transform: scale(0.96);
    transition:
      opacity 0.22s ease,
      transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
      border-color 0.15s,
      box-shadow 0.15s;
  }

  .toolbar--with-search .toolbar__search.is-open .toolbar__search-field {
    max-width: min(420px, 62vw);
    opacity: 1;
    visibility: visible;
    overflow: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition:
      max-width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.28s ease 0.05s,
      transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s;
  }

  .toolbar--with-search .toolbar__search.is-open .toolbar__search-form input {
    opacity: 1;
    transform: scale(1);
    transition:
      opacity 0.24s ease 0.08s,
      transform 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.06s,
      border-color 0.15s,
      box-shadow 0.15s;
  }
}

.toolbar__search-field {
  position: relative;
  width: min(420px, 62vw);
  max-width: 0;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
  flex-shrink: 0;
  transform: translateX(12px);
  transition:
    max-width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease,
    transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.36s;
}
.toolbar__search.is-open .toolbar__search-field {
  max-width: min(420px, 62vw);
  opacity: 1;
  visibility: visible;
  overflow: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition:
    max-width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease 0.05s,
    transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s;
}
.toolbar__search-form { width: 100%; min-width: 0; }
.toolbar__search-form input {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
  opacity: 0;
  transform: scale(0.96);
  transform-origin: right center;
  transition:
    opacity 0.22s ease,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.15s,
    box-shadow 0.15s;
}
.toolbar__search.is-open .toolbar__search-form input {
  opacity: 1;
  transform: scale(1);
  transition:
    opacity 0.24s ease 0.08s,
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1) 0.06s,
    border-color 0.15s,
    box-shadow 0.15s;
}
.toolbar__search-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 28%, transparent);
}
.toolbar__search-form input:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 28%, transparent);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  box-sizing: border-box;
  max-height: min(420px, 60vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px var(--card-shadow);
  z-index: 60;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top center;
  pointer-events: none;
  visibility: hidden;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-muted) 55%, var(--border)) transparent;
  transition:
    opacity 0.22s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.22s;
}

.search-dropdown::-webkit-scrollbar {
  width: 8px;
}

.search-dropdown::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 6px;
}

.search-dropdown::-webkit-scrollbar-thumb {
  background-color: color-mix(in srgb, var(--text-muted) 42%, var(--border));
  border-radius: 999px;
  border: 2px solid var(--surface);
  background-clip: padding-box;
}

.search-dropdown::-webkit-scrollbar-thumb:hover {
  background-color: color-mix(in srgb, var(--text-muted) 62%, var(--border));
}
.search-dropdown.search-dropdown--show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity 0.24s ease 0.04s,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1) 0.02s,
    visibility 0s;
}
.search-dropdown__results { padding: 6px; }
.search-dropdown__message {
  padding: 14px 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s;
  min-width: 0;
}
.search-result:hover,
.search-result.is-active { background: var(--surface-alt); color: var(--text); }
.search-result__thumb {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-muted);
}
.search-result__thumb img { width: 100%; height: 100%; object-fit: cover; }
.search-result__body {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.search-result__title {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result__meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result__type {
  flex: 0 0 auto;
  margin-left: 12px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-muted);
  white-space: nowrap;
}
.search-result__type--category,
.search-result__type--subcategory { background: rgba(35, 66, 137, 0.12); color: var(--accent); }
.search-result__type--item { background: rgba(0, 209, 36, 0.12); color: var(--success); }

/* Layout */

.page {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.page--narrow { max-width: 640px; }

.page--legal {
  width: 100%;
  max-width: 1200px;
  padding-inline: clamp(16px, 4vw, 32px);
}

.page--legal .content-card {
  width: 100%;
  padding: clamp(24px, 3vw, 40px);
}

.page--legal .section-title {
  margin-bottom: 20px;
}

.page--auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 16px;
}

.auth-page__above {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.auth-page__below {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
}

.page--auth-compact {
  justify-content: flex-start;
  padding-top: 16px;
}

.page--auth-compact .auth-page__above {
  flex: 0 0 auto;
  padding-bottom: 20px;
}

.page--auth-compact .auth-page__below {
  display: none;
}

.auth-page__logo {
  display: inline-flex;
  flex-shrink: 0;
  min-height: 0;
  line-height: 0;
  text-decoration: none;
  padding: 6px 12px;
  transition: padding 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-page__logo--comfortable {
  padding: 12px 20px;
}

.auth-page__logo--small {
  padding: 14px 22px;
}

.auth-page__above--comfortable-logo {
  padding-top: 16px;
  padding-bottom: 22px;
}

.auth-page__above--small-logo {
  padding-top: 14px;
  padding-bottom: 18px;
}

.auth-page__logo-img {
  display: block;
  height: 72px;
  width: auto;
  max-width: min(360px, 78vw);
  max-height: 120px;
  object-fit: contain;
  transition:
    height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.15s;
}

.auth-page__logo-img--no-transition {
  transition: none !important;
}

.auth-page__logo:hover .auth-page__logo-img {
  opacity: 0.88;
}

.page--auth .auth-card {
  flex-shrink: 0;
  width: 100%;
  position: relative;
  z-index: 2;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 16px;
}

.empty-note { color: var(--text-muted); padding: 24px 0; }

/* Home: categories (1/3) + most viewed (2/3) */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
}
@media (max-width: 800px) {
  .home-layout { grid-template-columns: 1fr; }
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  height: 100%;
  min-height: 100%;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 6px var(--card-shadow);
  transition: transform 0.15s, border-color 0.15s;
}
.category-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.category-card__name {
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  min-height: calc(2 * 1.35em);
}
.category-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}
.category-card__count {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.category-card__icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: var(--accent);
  opacity: 0.88;
  pointer-events: none;
}
.category-card__icon-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.category-card:hover .category-card__icon { color: var(--primary); opacity: 1; }

.icon-picker {
  border: none;
  margin: 0;
  padding: 0;
}
.icon-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.icon-picker__legend {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  padding: 0;
  margin: 0;
}
.icon-picker__nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.icon-picker__nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.icon-picker__nav-btn svg {
  width: 18px;
  height: 18px;
}
.icon-picker__nav-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}
.icon-picker__nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.icon-picker__page {
  min-width: 3.2rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.icon-picker__grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}
@media (max-width: 540px) {
  .icon-picker__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.icon-picker__btn[hidden] { display: none !important; }
.icon-picker__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.12s;
}
.icon-picker__btn svg {
  width: 22px;
  height: 22px;
}
.icon-picker__btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--surface-alt);
}
.icon-picker__btn.is-selected {
  border-color: var(--primary);
  background: var(--surface-alt);
  color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 209, 36, 0.18);
}

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

.item-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 6px var(--card-shadow);
  transition: transform 0.15s, border-color 0.15s;
}
.item-card:hover { transform: translateY(-2px); border-color: var(--primary); }

.item-card__image {
  aspect-ratio: 1;
  background: var(--surface-alt);
  overflow: hidden;
  border-radius: 13px 13px 0 0;
}
.item-card__image img { width: 100%; height: 100%; object-fit: cover; }

.item-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.item-card__placeholder svg { width: 40%; height: 40%; max-width: 96px; }
.item-card__placeholder--large { aspect-ratio: 1; background: var(--surface-alt); border-radius: 14px; }

.item-card__title {
  --item-title-base-size: 0.95rem;
  --item-title-min-size: 0.72rem;
  --item-title-leading: 1.35;
  --item-title-lines: 2;
  --item-title-padding-block: 24px;
  margin: 0;
  padding: 12px 14px;
  font-size: var(--item-title-fit-size, var(--item-title-base-size));
  font-weight: 600;
  line-height: var(--item-title-leading);
  min-height: calc(var(--item-title-padding-block) + var(--item-title-base-size) * var(--item-title-leading) * var(--item-title-lines));
  max-height: calc(var(--item-title-padding-block) + var(--item-title-base-size) * var(--item-title-leading) * var(--item-title-lines));
  overflow: hidden;
  color: var(--text);
  word-break: break-word;
}

.item-card__title--clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-overflow: ellipsis;
}

.category-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
}
@media (max-width: 700px) {
  .category-layout { grid-template-columns: 1fr; }
}

.sidebar-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 16px 0 8px; }

.subcategory-list { display: flex; flex-direction: column; gap: 4px; }
.subcategory-link {
  padding: 9px 14px;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
}
.subcategory-link:hover { background: var(--surface-alt); color: var(--text); }
.subcategory-link.is-active { background: var(--primary); color: var(--primary-contrast); font-weight: 600; }
.subcategory-link:focus-visible:not(.is-active) {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary);
  background: var(--surface-alt);
}

.page.item-page {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.item-layout {
  display: grid;
  grid-template-columns: minmax(min(100%, 380px), 580px) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 48px);
  align-items: stretch;
  width: 100%;
}

.item-gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 580px;
}

.item-gallery__main {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: zoom-in;
}

.item-gallery__viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1;
  max-height: min(580px, 72vw);
  background: var(--surface);
}

.item-gallery__viewport > .gallery-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  background: var(--surface);
}

.item-gallery__main img {
  width: 100%;
  aspect-ratio: 1;
  max-height: min(580px, 72vw);
  object-fit: contain;
  background: var(--surface);
}

.item-gallery__thumbs {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.item-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
}

.item-details__content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 4px 8px;
  scrollbar-width: thin;
}

.item-details__purchase {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 800px) {
  .item-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .item-gallery {
    max-width: min(520px, 100%);
    margin-inline: auto;
  }

  .item-gallery__main img {
    max-height: min(520px, 88vw);
  }

  .item-gallery__viewport {
    max-height: min(520px, 88vw);
  }

  .item-details {
    min-height: 0;
  }

  .item-details__content {
    overflow: visible;
    padding-bottom: 0;
  }

  .item-details__purchase {
    margin-top: 0;
    padding-top: 20px;
    border-top: none;
  }
}
.item-gallery__thumb {
  width: 88px;
  height: 88px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
}
.item-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}
.item-gallery__thumb.is-active { border-color: var(--primary); }

.item-info__category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--surface-alt);
  color: var(--accent);
  margin-bottom: 12px;
  text-decoration: none;
  line-height: 1.2;
}
.item-info__category:hover {
  color: var(--accent-hover);
  background: var(--surface);
}
.item-info__category-icon {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.item-info__title { font-size: 2rem; margin: 0 0 16px; line-height: 1.2; }
.item-info__desc-title { font-size: 1rem; color: var(--text-muted); margin: 0 0 6px; }
.item-info__description { margin: 0; white-space: pre-line; }

.item-size-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
}
.item-size-picker__label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}
.size-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.size-option {
  min-height: var(--control-height);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.size-option:hover {
  border-color: var(--primary);
}
.size-option.is-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-contrast);
}

.item-info__actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: nowrap;
}
.item-info__actions .quantity-picker { align-self: stretch; flex-shrink: 0; }
.item-info__actions .btn { flex: 1 1 auto; min-width: 0; }

.add-to-basket__state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}
.add-to-basket__state--added { display: none; }
.add-to-basket--added .add-to-basket__state--default { display: none; }
.add-to-basket--added .add-to-basket__state--added { display: inline-flex; }
.add-to-basket--added.btn--primary {
  background: var(--success);
  color: var(--primary-contrast);
}
.add-to-basket--added.btn--primary:hover {
  background: var(--success);
  filter: brightness(1.06);
  color: var(--primary-contrast);
}

.item-related {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.item-related__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.item-related__header .section-title {
  margin-bottom: 0;
}

.item-related__nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.item-related__nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.item-related__nav-btn svg {
  width: 18px;
  height: 18px;
}

.item-related__nav-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.item-related__nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.item-related__grid--loading {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 540px) {
  .item-info__actions { flex-wrap: wrap; }
  .item-info__actions .btn { flex: 1 1 100%; }
}

.quantity-picker {
  display: inline-flex;
  align-items: stretch;
  min-height: var(--control-height);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  box-sizing: border-box;
}
.quantity-picker__btn {
  width: 38px;
  border: none;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}
.quantity-picker__btn:hover { background: var(--primary); color: var(--primary-contrast); }
.quantity-picker input {
  width: 56px;
  border: none;
  text-align: center;
  font-size: 1rem;
  background: var(--input-bg);
  color: var(--text);
  appearance: textfield;
  -moz-appearance: textfield;
}
.quantity-picker input::-webkit-outer-spin-button,
.quantity-picker input::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}
.quantity-picker input:focus { outline: none; }
.quantity-picker:focus-within {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent);
}
.quantity-picker--small .quantity-picker__btn { width: 30px; font-size: 1rem; }
.quantity-picker--small input { width: 44px; font-size: 0.9rem; }

:root { --control-height: 42px; }

.control-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}
.control-row > .input,
.control-row > select.input,
.control-row > .custom-select,
.control-row > .btn,
.control-row > a.btn {
  flex: 1 1 0;
  min-width: 0;
}
.control-row > .custom-select { display: flex; }
.control-row > .custom-select .custom-select__trigger { flex: 1; }

.btn-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-row .btn,
.btn-row > a.btn,
.btn-row > form {
  flex: 1 1 0;
  min-width: max-content;
}
.btn-row > form { display: flex; margin: 0; }
.btn-row > form .btn { width: 100%; }

.btn-row.btn-row--stacked {
  flex-direction: column;
}
.btn-row.btn-row--stacked > .btn,
.btn-row.btn-row--stacked > a.btn,
.btn-row.btn-row--stacked > form {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.modal__actions.btn-row,
.modal__actions--split > .btn-row,
.modal__actions--split > div.btn-row {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: stretch;
}

.modal__actions.btn-row.btn-row--stacked,
.modal__actions--split > .btn-row.btn-row--stacked,
.modal__actions--split > div.btn-row.btn-row--stacked {
  flex-direction: column;
}

.modal__actions.btn-row .btn,
.modal__actions.btn-row > a.btn,
.modal__actions--split > .btn-row .btn,
.modal__actions--split > .btn-row > a.btn,
.modal__actions--split > div.btn-row .btn,
.modal__actions--split > div.btn-row > a.btn {
  flex: 1 1 0;
  width: auto;
}

.modal__actions.btn-row.btn-row--stacked .btn,
.modal__actions.btn-row.btn-row--stacked > a.btn,
.modal__actions--split > .btn-row.btn-row--stacked .btn,
.modal__actions--split > .btn-row.btn-row--stacked > a.btn,
.modal__actions--split > div.btn-row.btn-row--stacked .btn,
.modal__actions--split > div.btn-row.btn-row--stacked > a.btn {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  padding: 0 22px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-sizing: border-box;
  text-decoration: none;
  white-space: nowrap;
}
.btn__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.btn__label { min-width: 0; }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--primary); color: var(--primary-contrast); }
.btn--primary:hover { background: var(--primary-hover); color: var(--primary-contrast); }
.btn--secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.btn--secondary:hover { border-color: var(--primary); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(1.1); }
.btn--block { width: 100%; }
.btn--small {
  padding: 0 14px;
  font-size: 0.85rem;
}
.btn--small .btn__icon {
  width: 16px;
  height: 16px;
}

.btn--progress {
  position: relative;
  overflow: hidden;
}
.btn--progress .btn__icon,
.btn--progress .btn__label {
  position: relative;
  z-index: 1;
}
.btn__progress-track {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--primary-contrast) 12%, transparent);
  pointer-events: none;
}
.btn__progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: color-mix(in srgb, var(--primary-contrast) 28%, transparent);
  transition: width 0.15s ease;
}
.btn.is-saving {
  pointer-events: none;
}

.btn--icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

.btn--icon-only .btn__icon {
  width: 18px;
  height: 18px;
}

[hidden] { display: none !important; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 1, 0, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .lightbox {
  background: rgba(0, 0, 0, 0.72);
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .lightbox {
    background: rgba(0, 0, 0, 0.72);
  }
}

.lightbox__viewport {
  position: relative;
  overflow: hidden;
  width: 85vw;
  height: 85vh;
  max-width: 85vw;
  max-height: 85vh;
  background: transparent;
}

.lightbox__pane {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.lightbox__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 16px;
  object-fit: contain;
}

.gallery-slide {
  will-change: transform;
}

.gallery-slide--current {
  transform: translateX(0);
  z-index: 1;
}

.gallery-slide--layer {
  z-index: 2;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-slide--next-enter {
  transform: translateX(100%);
}

.gallery-slide--next-exit {
  transform: translateX(-100%);
}

.gallery-slide--prev-enter {
  transform: translateX(-100%);
}

.gallery-slide--prev-exit {
  transform: translateX(100%);
}

.gallery-slide--active {
  transform: translateX(0);
}

.lightbox__close, .lightbox__nav {
  position: absolute;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: background 0.2s, color 0.2s;
}

[data-theme="dark"] .lightbox__close,
[data-theme="dark"] .lightbox__nav {
  background: rgba(255, 255, 255, 0.45);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .lightbox__close,
  [data-theme="auto"] .lightbox__nav {
    background: rgba(255, 255, 255, 0.45);
    color: #fff;
  }
}

.lightbox__close:hover,
.lightbox__nav:hover {
  background: rgba(0, 0, 0, 0.62);
}

[data-theme="dark"] .lightbox__close:hover,
[data-theme="dark"] .lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.62);
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .lightbox__close:hover,
  [data-theme="auto"] .lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.62);
  }
}
.lightbox__close svg,
.lightbox__nav svg {
  display: block;
  flex-shrink: 0;
}
.lightbox__close { top: 18px; right: 18px; }
.lightbox__nav--prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lightbox__nav--next { right: 18px; top: 50%; transform: translateY(-50%); }

/* Basket */

#basket-content {
  display: flex;
  flex-direction: column;
}

.basket-list { display: flex; flex-direction: column; }
.basket-line + .basket-line { margin-top: 10px; }

.basket-line {
  display: grid;
  grid-template-columns: 64px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.basket-line__thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-alt);
}
.basket-line__thumb img { width: 100%; height: 100%; object-fit: cover; }
.basket-line__title { font-weight: 600; color: var(--text); }
.basket-line__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.basket-line__size {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.basket-line__remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}
.basket-line__remove:hover { color: var(--danger); background: var(--surface-alt); }

.basket-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  flex-shrink: 0;
}
.basket-actions .btn { min-width: 220px; }
.order-success .btn { min-width: 220px; }
#basket-empty .btn { min-width: 220px; }

.order-success {
  text-align: center;
  padding: 48px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.order-success__icon { width: 72px; height: 72px; color: var(--success); }

.order-error {
  max-width: 480px;
  margin: 24px auto 0;
  padding: 16px 20px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--border));
  border-radius: 14px;
}

/* Forms */

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 0.88rem; font-weight: 600; flex: 1; }
.form input, .form textarea, .form select, .input {
  min-height: var(--control-height);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.form textarea {
  min-height: auto;
  resize: vertical;
}
.form input:focus, .form textarea:focus, .form select:focus, .input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
.form input:disabled { opacity: 0.6; }

.form input[type="number"]:not(.quantity-picker input),
.input[type="number"],
.size-row input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
  padding-right: 6px;
}

.form input[type="number"]:not(.quantity-picker input)::-webkit-outer-spin-button,
.input[type="number"]::-webkit-outer-spin-button,
.size-row input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.form input[type="number"]:not(.quantity-picker input)::-webkit-inner-spin-button,
.input[type="number"]::-webkit-inner-spin-button,
.size-row input[type="number"]::-webkit-inner-spin-button {
  opacity: 1;
  width: 28px;
  height: calc(var(--control-height) - 12px);
  min-height: 28px;
  margin: 0 4px 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface-alt);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.form input[type="number"]:not(.quantity-picker input):hover::-webkit-inner-spin-button,
.input[type="number"]:hover::-webkit-inner-spin-button,
.size-row input[type="number"]:hover::-webkit-inner-spin-button {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background-color: color-mix(in srgb, var(--primary) 8%, var(--surface-alt));
}

.form input[type="number"]:not(.quantity-picker input):focus::-webkit-inner-spin-button,
.input[type="number"]:focus::-webkit-inner-spin-button,
.size-row input[type="number"]:focus::-webkit-inner-spin-button {
  border-color: var(--primary);
}

.phone-field {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  box-sizing: border-box;
  min-height: var(--control-height);
  overflow: hidden;
}

.phone-field__prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

.phone-field__input {
  flex: 1;
  min-width: 0;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  min-height: calc(var(--control-height) - 2px);
  outline: none !important;
  box-shadow: none !important;
}

.password-field {
  position: relative;
  display: block;
  width: 100%;
}

.password-field input {
  padding-right: 44px;
}

.password-field__toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}

.password-field__toggle:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.password-field__toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}

.password-field__icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.password-field__icon--hide {
  display: none;
}

.password-field__toggle[aria-pressed="true"] .password-field__icon--show {
  display: none;
}

.password-field__toggle[aria-pressed="true"] .password-field__icon--hide {
  display: block;
}

.form__row { display: flex; gap: 12px; }
@media (max-width: 540px) { .form__row { flex-direction: column; } }

.form-error { color: var(--danger); font-weight: 600; }
.form-success { color: var(--success); font-weight: 600; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 16px var(--card-shadow);
}
.auth-card__alt { margin-top: 18px; font-size: 0.9rem; color: var(--text-muted); }

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.content-card h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.content-card h2:first-of-type { margin-top: 8px; }
.legal-content p { line-height: 1.65; color: var(--text); }
.legal-content ul {
  margin: 0 0 16px;
  padding-left: 1.25rem;
  line-height: 1.65;
}
.legal-content li + li { margin-top: 6px; }
.legal-meta {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.profile-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
@media (max-width: 800px) { .profile-layout { grid-template-columns: 1fr; } }
.profile-actions {
  margin-top: 24px;
  width: 100%;
}
.profile-actions.btn-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}
.profile-actions.btn-row > .btn,
.profile-actions.btn-row > form {
  width: 100%;
  min-width: 0;
  margin: 0;
  flex: unset;
}
.profile-actions.btn-row > form {
  display: flex;
}
.profile-actions.btn-row > .btn,
.profile-actions.btn-row > form .btn {
  display: flex;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width: 540px) {
  .profile-actions.btn-row {
    grid-template-columns: 1fr;
  }
}

.profile-orders-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-order {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}

.profile-order__meta {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0;
  padding: 0;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 560px) {
  .profile-order__meta { grid-template-columns: 1fr; }
}

.profile-order__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 14px 16px;
}

.profile-order__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.profile-order__value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.profile-order .table-wrap {
  border: none;
  border-radius: 0;
  background: transparent;
}

.profile-order .profile-order__table th,
.profile-order .profile-order__table td {
  padding: 14px 16px;
  vertical-align: top;
}

.profile-order__qty-col {
  width: 88px;
  text-align: center;
  white-space: nowrap;
}

/* Modal */

.modal[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.modal:not([hidden]) {
  display: flex !important;
  pointer-events: auto;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal__backdrop { position: absolute; inset: 0; background: var(--overlay); }
.modal__dialog {
  --modal-padding: 28px;
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 18px;
  padding: var(--modal-padding);
  padding-bottom: 0;
  box-shadow: 0 12px 48px var(--card-shadow);
  flex-shrink: 0;
}
.modal__dialog--wide { max-width: 760px; }
#order-modal .modal__dialog { max-width: 920px; }
.modal__dialog > h2 { margin-top: 0; flex-shrink: 0; }
.modal__subtitle { color: var(--text-muted); margin-top: -8px; flex-shrink: 0; }
.modal__dialog > form,
.modal__dialog > .form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
}
.modal__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  box-sizing: border-box;
}

.modal__dialog > h2,
.modal__dialog > .modal__subtitle {
  padding-inline: 8px;
}

#item-modal .modal__dialog > h2,
#category-modal .modal__dialog > h2 {
  padding-inline: 14px;
}

#item-modal .modal__body,
#category-modal .modal__body {
  padding: 14px 14px 18px;
  gap: 18px;
}
.modal__dialog .form__row {
  flex-wrap: wrap;
}
.modal__dialog .form__row > label {
  flex: 1 1 180px;
  min-width: min(100%, 180px);
}
.modal__actions {
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  gap: 10px;
  flex-shrink: 0;
  width: calc(100% + (2 * var(--modal-padding)));
  max-width: none;
  margin-top: var(--modal-padding);
  margin-inline: calc(-1 * var(--modal-padding));
  margin-bottom: 0;
  padding: var(--modal-padding);
  position: relative;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 0 0 18px 18px;
  box-sizing: border-box;
}
.modal__actions--split {
  justify-content: space-between;
  align-items: stretch;
  flex-wrap: wrap;
}
.modal__actions--split > div {
  display: inline-flex;
  align-items: stretch;
  gap: 10px;
  flex: 1 1 220px;
  min-width: min(100%, 220px);
}
.modal__actions--split > div.btn-row {
  flex: 1 1 220px;
  min-width: min(100%, 220px);
}
.modal__actions--split > div:last-child { justify-content: flex-end; }
.modal__actions--split > .btn,
.modal__actions--split > button.btn {
  flex: 1 1 100%;
  align-self: stretch;
}

@media (max-width: 540px) {
  .modal {
    padding: 12px;
  }

  .modal__dialog {
    --modal-padding: 20px;
    max-height: calc(100dvh - 24px);
  }

  .modal__dialog .form__row {
    flex-direction: column;
  }

  .modal__actions--split > div,
  .modal__actions--split > div.btn-row {
    flex-basis: 100%;
    min-width: 100%;
  }

  .modal__actions.btn-row,
  .modal__actions--split > div.btn-row {
    flex-direction: column;
  }

  .modal__actions.btn-row .btn,
  .modal__actions.btn-row > a.btn,
  .modal__actions--split > div.btn-row .btn,
  .modal__actions--split > div.btn-row > a.btn {
    width: 100%;
    min-width: 0 !important;
    flex: 1 1 auto;
  }
}

@media (max-width: 540px) {
  #guest-modal.modal {
    align-items: flex-end;
    padding: 0;
  }

  #guest-modal .modal__dialog {
    --modal-padding: 16px;
    width: 100%;
    max-width: none;
    max-height: min(94dvh, calc(100dvh - env(safe-area-inset-top, 0px)));
    margin: 0;
    border-radius: 18px 18px 0 0;
    padding: var(--modal-padding);
    padding-bottom: 0;
    overflow-x: hidden;
  }

  #guest-modal .modal__dialog h2 {
    font-size: 1.15rem;
    line-height: 1.3;
  }

  #guest-modal .modal__subtitle {
    font-size: 0.88rem;
    line-height: 1.45;
    margin-bottom: 4px;
  }

  #guest-modal .form {
    gap: 12px;
  }

  #guest-modal .form__row {
    flex-direction: column;
    gap: 12px;
  }

  #guest-modal .form__row > label {
    flex: 1 1 100%;
    min-width: 100%;
  }

  #guest-modal .form input,
  #guest-modal .form select,
  #guest-modal .phone-field__input,
  #guest-modal .custom-select__trigger {
    font-size: 16px;
  }

  #guest-modal .modal__actions {
    margin-top: var(--modal-padding);
    padding: var(--modal-padding);
    padding-bottom: calc(var(--modal-padding) + env(safe-area-inset-bottom, 0px));
    justify-content: center;
  }

  #guest-modal .guest-modal__actions > .btn-row {
    width: 100%;
  }

  #guest-modal .guest-modal__actions > .btn-row > .btn {
    width: 100%;
    min-width: 0 !important;
  }
}

#confirm-modal {
  z-index: 100;
}

#guest-modal .guest-modal__actions {
  justify-content: center;
}

#guest-modal .guest-modal__actions > .btn-row {
  display: flex;
  width: auto;
  max-width: 100%;
  margin-inline: auto;
  gap: 10px;
  justify-content: center;
  align-items: stretch;
}

#guest-modal .guest-modal__actions > .btn-row > .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}

.confirm-dialog {
  width: min(100%, 420px);
  max-width: 420px;
  text-align: center;
  padding-bottom: 0;
}

.confirm-dialog > h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.35;
}

.confirm-dialog__message {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  font-size: 0.95rem;
}

.confirm-dialog .modal__actions.confirm-dialog__actions {
  margin-top: var(--modal-padding);
  margin-inline: calc(-1 * var(--modal-padding));
  margin-bottom: 0;
  padding: var(--modal-padding);
  justify-content: center;
  align-self: stretch;
  width: auto;
  box-sizing: border-box;
}

.confirm-dialog__actions > .btn-row {
  display: flex;
  width: auto;
  max-width: 100%;
  margin-inline: auto;
  gap: 10px;
  justify-content: center;
  align-items: stretch;
}

.confirm-dialog__actions > .btn-row > .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}

.confirm-dialog__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--border));
}

.confirm-dialog__icon svg {
  width: 32px;
  height: 32px;
}

@media (max-width: 540px) {
  .confirm-dialog__actions > .btn-row {
    width: 100%;
  }

  .confirm-dialog__actions > .btn-row.btn-row--stacked > .btn {
    width: 100%;
  }
}

/* Footer */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.85rem;
}
.footer__link { color: var(--footer-text); opacity: 0.85; }
.footer__link:hover { opacity: 1; color: var(--primary); }
.footer__copyright { text-align: center; opacity: 0.7; }
@media (max-width: 540px) {
  .footer { flex-direction: column; gap: 6px; }
}

.error-page { text-align: center; padding-top: 64px; }
.error-page__code { font-size: 5rem; margin: 0; color: var(--primary); }
.error-page__message { color: var(--text-muted); margin-bottom: 24px; }

/* Admin */

.admin-page { max-width: 1280px; }

.admin-header { display: flex; align-items: center; justify-content: space-between; }

.admin-tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; }
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.admin-tab .badge {
  flex-shrink: 0;
  display: inline-block;
  height: 1.125rem;
  min-width: 1.125rem;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  box-sizing: border-box;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.125rem;
  text-align: center;
  vertical-align: middle;
}
.admin-tab .badge--len-4 {
  min-width: 1.65rem;
  padding-inline: 6px;
  font-size: 0.67rem;
}
.admin-tab .badge--len-5 {
  min-width: 2rem;
  padding-inline: 6px;
  font-size: 0.61rem;
}
.admin-tab .badge--len-6 {
  min-width: 2.25rem;
  padding-inline: 5px;
  font-size: 0.56rem;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.admin-section { display: none; }
.admin-section.is-active { display: block; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--surface-alt); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table--compact th, .admin-table--compact td { padding: 8px 10px; }

.admin-table__sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.admin-table__sortable:hover {
  color: var(--accent);
}

.admin-table__sort-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-table__sort-icon {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  width: 10px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.35;
}

.admin-table__sort-icon::before,
.admin-table__sort-icon::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  margin-inline: auto;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.admin-table__sort-icon::before {
  border-bottom: 5px solid currentColor;
}

.admin-table__sort-icon::after {
  border-top: 5px solid currentColor;
}

.admin-table__sortable.is-sorted-asc .admin-table__sort-icon,
.admin-table__sortable.is-sorted-desc .admin-table__sort-icon {
  opacity: 1;
}

.admin-table__sortable.is-sorted-asc .admin-table__sort-icon::after {
  opacity: 0.25;
}

.admin-table__sortable.is-sorted-desc .admin-table__sort-icon::before {
  opacity: 0.25;
}

.user-actions-cell {
  min-width: 88px;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-revoke-session.is-inactive:not(:disabled) {
  opacity: 0.45;
}

.order-row { cursor: pointer; }
.order-row:hover td { background: var(--surface-alt); }
.order-row .user-actions-cell { cursor: default; }

.status-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}
.status-pill--new { background: var(--badge-bg); color: var(--badge-text); }
.status-pill--processed { background: var(--surface-alt); color: var(--text-muted); }
.status-pill--deleted { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); margin-left: 6px; }

.inventory-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: stretch;
}
.inventory-toolbar .custom-select,
.inventory-toolbar > select.input {
  min-width: 180px;
  flex: 1 1 180px;
}
.inventory-toolbar .custom-select { display: flex; }
.inventory-toolbar .custom-select__trigger { flex: 1; }
.inventory-toolbar .btn {
  flex: 1 1 160px;
  min-width: max-content;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.inv-card {
  display: grid;
  grid-template-rows: auto 1fr;
  align-self: stretch;
  width: 100%;
  min-height: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  transition: transform 0.15s, border-color 0.15s;
}
.inv-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.inv-card__image {
  aspect-ratio: 1;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
  border-radius: 13px 13px 0 0;
}
.inv-card__image img { width: 100%; height: 100%; object-fit: cover; }
.inv-card__body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  min-height: 88px;
}
.inv-card__title { margin: 0; font-weight: 600; font-size: 0.9rem; color: var(--text); line-height: 1.35; }
.inv-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  margin-top: auto;
}
.inv-card__price { font-size: 0.82rem; color: var(--success); font-weight: 700; }
.inv-card__views {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.inv-card__views-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.inv-card__views-count { line-height: 1; }

.order-modal-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; }
.order-modal-grid > div { min-width: 0; }
@media (max-width: 700px) { .order-modal-grid { grid-template-columns: 1fr; } }

#order-modal .order-modal__table {
  table-layout: fixed;
  width: 100%;
}
#order-modal .order-modal__table th:nth-child(1),
#order-modal .order-modal__table td:nth-child(1) {
  width: 44%;
  overflow-wrap: anywhere;
}
#order-modal .order-modal__table th:nth-child(2),
#order-modal .order-modal__table td:nth-child(2) {
  width: 10%;
  text-align: center;
}
#order-modal .order-modal__table th:nth-child(3),
#order-modal .order-modal__table td:nth-child(3),
#order-modal .order-modal__table th:nth-child(4),
#order-modal .order-modal__table td:nth-child(4) {
  width: 23%;
}
#order-modal .order-modal__money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#order-modal .order-modal__money-text {
  display: block;
  white-space: nowrap;
  text-align: right;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
#order-modal .order-modal__money-text--total {
  display: inline-block;
  font-size: 1.05rem;
}
#order-modal .order-total {
  text-align: right;
}

.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 0.9rem; }
.detail-list dt { color: var(--text-muted); }
.detail-list dd { margin: 0; font-weight: 600; }

.order-total { text-align: right; font-size: 1.05rem; }

.image-manager { border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.image-manager legend { font-size: 0.85rem; font-weight: 600; padding: 0 6px; }
.image-manager__list { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.image-manager__count { font-size: 0.82rem; color: var(--text-muted); margin-left: 8px; }

.size-manager {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.size-manager legend { font-size: 0.85rem; font-weight: 600; padding: 0 6px; }
.size-manager__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.size-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px 44px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}
.size-row label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
}
.size-row input {
  min-height: var(--control-height);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}
.item-price-field.is-disabled input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.size-row__remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.size-row__remove:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.im-thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); transform-origin: center; cursor: grab; touch-action: none; }
.im-thumb:active { cursor: grabbing; }
.im-thumb--dragging { opacity: 0.45; cursor: grabbing; }
.im-thumb--drop-target { outline: 2px solid var(--primary); outline-offset: 2px; }
.im-thumb img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }
.im-thumb__remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

/* Custom select */

.native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.custom-select {
  position: relative;
  display: block;
  width: 100%;
}

.custom-select__trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: var(--control-height);
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.custom-select__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.custom-select__arrow {
  position: relative;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  transition: transform 0.2s ease, border-color 0.15s, background-color 0.15s;
}
.custom-select__arrow::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translate(-50%, -60%) rotate(45deg);
  transition: border-color 0.15s;
}
.custom-select__trigger:hover .custom-select__arrow {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background-color: color-mix(in srgb, var(--primary) 8%, var(--surface-alt));
}
.custom-select.is-open .custom-select__trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent);
}
.custom-select.is-open .custom-select__arrow {
  transform: rotate(180deg);
}
.custom-select.is-disabled .custom-select__trigger {
  opacity: 0.55;
  cursor: not-allowed;
}

.modal .custom-select.is-open {
  position: relative;
  z-index: auto;
}

.custom-select__list--fixed {
  z-index: 15;
}

.custom-select__list {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px 4px 6px 6px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 32px var(--card-shadow);
  animation: dropdownIn 0.18s ease both;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-muted) 55%, var(--border)) transparent;
}

.custom-select__list::-webkit-scrollbar {
  width: 8px;
}

.custom-select__list::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 6px;
}

.custom-select__list::-webkit-scrollbar-thumb {
  background-color: color-mix(in srgb, var(--text-muted) 42%, var(--border));
  border-radius: 999px;
  border: 2px solid var(--surface);
  background-clip: padding-box;
}

.custom-select__list::-webkit-scrollbar-thumb:hover {
  background-color: color-mix(in srgb, var(--text-muted) 62%, var(--border));
}
.custom-select__list[hidden] { display: none !important; }

.custom-select__option {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.custom-select__option:hover,
.custom-select__option.is-focused {
  background: var(--surface-alt);
}
.custom-select__option.is-selected {
  background: var(--primary);
  color: var(--primary-contrast);
  font-weight: 600;
}
.custom-select__option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.form .custom-select,
.form label .custom-select { margin-top: 0; }

/* Animations */

@keyframes revealUp {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes revealDown {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(10px) scale(0.96); }
}

@keyframes imThumbIn {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes imThumbOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.88); }
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes badgePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@keyframes toolbarLogoBounce {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(0.9); }
  60% { transform: scale(1.07); }
  80% { transform: scale(0.98); }
}

@keyframes btnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes basketBump {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

@keyframes addedNoteIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .animate-in {
    animation: revealUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 45ms);
  }

  .inv-card--enter {
    animation: revealUp 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 35ms);
  }

  .inv-card--exit {
    animation: revealDown 0.22s ease both;
    animation-delay: calc(var(--i, 0) * 25ms);
  }

  .inv-card.inv-card--move {
    z-index: 2;
    transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
    transform: translate(var(--flip-x, 0), var(--flip-y, 0));
  }

  .inv-card.inv-card--move:hover {
    border-color: var(--primary);
  }

  .im-thumb--enter {
    animation: imThumbIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .im-thumb--exit {
    animation: imThumbOut 0.22s ease both;
  }

  .admin-table tbody tr.admin-table__row--move td {
    transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
    transform: translate(var(--flip-x, 0), var(--flip-y, 0));
  }

  .modal--opening {
    animation: modalFadeIn 0.22s ease both;
  }
  .modal--opening .modal__dialog {
    animation: modalSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .modal--closing {
    animation: modalFadeOut 0.18s ease both;
  }
  .modal--closing .modal__dialog {
    animation: revealDown 0.18s ease both;
  }

  .lightbox--open {
    animation: modalFadeIn 0.2s ease both;
  }
  .lightbox--open.lightbox--intro .lightbox__viewport {
    animation: modalSlideUp 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .basket-line--exit,
  .basket-actions--exit {
    transition:
      height 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      margin-top 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      padding 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.22s ease,
      border-width 0.28s ease;
  }

  .basket-line--bump {
    animation: basketBump 0.28s ease;
  }

  .badge-pop {
    animation: badgePop 0.35s ease;
  }

  .toolbar__logo--bounce {
    animation: toolbarLogoBounce 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .btn--pulse {
    animation: btnPulse 0.35s ease;
  }

  .add-to-basket--added .add-to-basket__state--added {
    animation: addedNoteIn 0.28s ease both;
  }

  .order-success--show {
    animation: revealUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .order-success__icon {
    animation: badgePop 0.5s ease 0.1s both;
  }

  .basket-page--success #basket-content {
    animation: revealDown 0.25s ease both;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-page__logo-img {
    transition: opacity 0.15s;
  }

  .auth-page__logo {
    transition: none;
  }

  .toolbar__search-field,
  .toolbar__search.is-open .toolbar__search-field,
  .toolbar__search-form input,
  .toolbar__search.is-open .toolbar__search-form input,
  .search-dropdown,
  .search-dropdown.search-dropdown--show {
    transition: none;
    transform: none;
  }

  .toolbar__search.is-open .toolbar__search-field {
    max-width: min(420px, 62vw);
    opacity: 1;
    visibility: visible;
  }

  .toolbar__search:not(.is-open) .toolbar__search-field {
    max-width: 0;
    opacity: 0;
    visibility: hidden;
  }

  .toolbar__search.is-open .toolbar__search-form input {
    opacity: 1;
  }

  .gallery-slide--layer {
    transition: none;
  }
}

.toolbar__basket-count {
  transition: transform 0.15s ease;
}

.item-card,
.category-card,
.inv-card {
  will-change: transform, opacity;
}
