/* Shared UI primitives. Class reference: docs/UI-KIT.md, live kit page: dev/components.html.
   Every interactive control keeps a hit target of at least 44x44px. */

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 20px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.btn:hover { color: var(--btn-fg); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn svg { width: 20px; height: 20px; }

.btn--primary {
  --btn-bg: var(--accent-strong);
  --btn-fg: #FFFFFF;
  --btn-bd: var(--accent-strong);
}
.btn--primary:hover { --btn-bg: var(--accent-hover); --btn-bd: var(--accent-hover); transform: translateY(-1px); }
.btn--primary:active { --btn-bg: var(--accent-press); --btn-bd: var(--accent-press); transform: translateY(0); }

.btn--secondary:hover { --btn-bd: var(--accent); --btn-fg: var(--accent-ink); }
.btn--secondary:active { --btn-bg: var(--accent-tint); }

/* Blue outline (e.g. "В корзину" next to a primary "Купить"). */
.btn--outline {
  --btn-bd: var(--accent);
  --btn-fg: var(--accent-ink);
}
.btn--outline:hover { --btn-bg: var(--accent-tint); --btn-fg: var(--accent-hover); }
.btn--outline:active { --btn-bg: #DCE9FF; }

/* Light blue fill, blue icon/text (compact cart buttons on cards). */
.btn--tinted {
  --btn-bg: var(--accent-tint);
  --btn-fg: var(--accent-ink);
  --btn-bd: transparent;
}
.btn--tinted:hover { --btn-bg: #DCE9FF; --btn-fg: var(--accent-hover); }
.btn--tinted:active { --btn-bg: #CFE0FF; }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink-2);
  --btn-bd: transparent;
}
.btn--ghost:hover { --btn-bg: var(--surface-sunken); --btn-fg: var(--ink); }
.btn--ghost:active { --btn-bg: #E6E6E2; }

.btn--danger {
  --btn-bg: var(--surface);
  --btn-fg: var(--danger);
  --btn-bd: #EBC3C3;
}
.btn--danger:hover { --btn-bg: var(--danger-tint); --btn-bd: var(--danger); --btn-fg: var(--danger); }

.btn--sm { min-height: 40px; padding: 0 14px; font-size: var(--fs-sm); border-radius: 10px; }
.btn--sm svg { width: 18px; height: 18px; }
/* Visual 40px, hit target 44px. The pseudo-element is positioned from the PADDING box (40 − 2×1px
   border = 38px), so it reaches 3px past it to make 44px. */
.btn--sm::before { content: ''; position: absolute; inset: -3px; }
.btn--lg { min-height: 52px; padding: 0 28px; font-size: var(--fs-md); border-radius: 14px; }
.btn--lg svg { width: 22px; height: 22px; }
.btn--block { display: flex; width: 100%; }

/* Square icon-only buttons (after the size rules so padding stays 0). */
.btn.btn--icon { padding: 0; width: 44px; }
.btn.btn--icon.btn--sm { width: 40px; min-width: 40px; }
.btn.btn--icon.btn--lg { width: 52px; }

/* Selected/pressed toggle buttons (e.g. favourite on) */
.btn[aria-pressed='true'].btn--ghost,
.btn[aria-pressed='true'].btn--secondary { --btn-fg: var(--accent-ink); --btn-bd: var(--accent); --btn-bg: var(--accent-tint); }

/* Disabled: flat, no lift, clearly inert. */
.btn:disabled,
.btn[aria-disabled='true'] {
  --btn-bg: var(--surface-sunken);
  --btn-fg: var(--ink-3);
  --btn-bd: transparent;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
/* aria-disabled buttons stay focusable (they explain why they are inert): keep the ring. */
.btn[aria-disabled='true']:focus-visible { box-shadow: var(--focus-ring); }
.btn--ghost:disabled,
.btn--ghost[aria-disabled='true'] { --btn-bg: transparent; }

/* Loading: keep the label, add a small ring, block repeat clicks. */
.btn.is-loading,
.btn[aria-busy='true'] { pointer-events: none; cursor: progress; }
.btn.is-loading::after,
.btn[aria-busy='true']::after {
  content: '';
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: sa-spin .7s linear infinite;
}
@keyframes sa-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn--primary:hover { transform: none; }
}

/* Plain text link-button */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 2px;
  color: var(--accent-ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
  border-radius: 6px;
}
.link-btn:hover { color: var(--accent-hover); }
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link-btn svg { width: 18px; height: 18px; }

/* ==========================================================================
   Form fields
   ========================================================================== */
.field { display: grid; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.field__hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field__error { font-size: var(--fs-xs); color: var(--danger); font-weight: 500; }

.input,
.select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-control);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-base);
  line-height: 1.3;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder { color: var(--ink-3); opacity: 1; }
.input:hover,
.select:hover { border-color: var(--ink-3); }
.input:focus,
.select:focus,
.input:focus-visible,
.select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.input[aria-invalid='true'] { border-color: var(--danger); }
.input[aria-invalid='true']:focus { box-shadow: 0 0 0 1px var(--danger); }
.input:disabled,
.select:disabled { background: var(--surface-sunken); color: var(--ink-3); border-color: var(--line); cursor: not-allowed; }
.input--sm { min-height: 40px; font-size: var(--fs-sm); padding: 0 12px; }
.input--num { font-variant-numeric: tabular-nums; }

/* Native select with a drawn chevron. */
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233F444E' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
  text-overflow: ellipsis;
}
.select::-ms-expand { display: none; }

/* Select with a leading icon (e.g. sort). */
.select-wrap { position: relative; display: inline-flex; min-width: 0; }
.select-wrap > svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: var(--ink-2);
  pointer-events: none;
}
.select-wrap > .select { padding-left: 44px; }

/* Search: leading icon + optional clear button. */
.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search__icon {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--ink-3);
  pointer-events: none;
}
.search__input { padding-left: 44px; padding-right: 48px; }
.search__input::-webkit-search-cancel-button,
.search__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search__clear {
  position: absolute;
  right: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  color: var(--ink-3);
}
.search__clear:hover { color: var(--ink); }
.search__clear:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.search__clear svg { width: 18px; height: 18px; }

/* Min–max pair (price, float). */
.range-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.range-pair__sep { color: var(--ink-3); }

/* Native checkbox (tables, lists) */
.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}
.check input {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid var(--line-control);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.check input::after {
  content: '';
  width: 10px;
  height: 6px;
  border: solid #FFFFFF;
  border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform var(--dur-fast) var(--ease-out);
}
.check input:checked { background: var(--accent-strong); border-color: var(--accent-strong); }
.check input:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.check input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.check input:disabled { background: var(--surface-sunken); border-color: var(--line); cursor: not-allowed; }

/* ==========================================================================
   Chips
   ========================================================================== */
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
/* 40px visual → 44px target: 38px padding box (1px border) + 3px above and below. */
.chip::before { content: ''; position: absolute; inset: -3px 0; }
.chip svg { width: 20px; height: 20px; }
.chip:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-2); }
.chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.chip[aria-pressed='true'],
.chip[aria-checked='true'],
.chip[aria-current='page'],
.chip.is-selected {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #FFFFFF;
}
.chip[aria-pressed='true']:hover,
.chip[aria-checked='true']:hover,
.chip[aria-current='page']:hover,
.chip.is-selected:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #FFFFFF; }
.chip:disabled,
.chip[aria-disabled='true'] {
  background: var(--surface-2);
  border-style: dashed;
  color: var(--ink-3);
  cursor: not-allowed;
}

/* Compact square-ish chip (wear codes FN/MW/…): 36px visual, 44px target. */
.chip--compact { min-height: 36px; min-width: 44px; padding: 0 10px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; border-radius: 10px; }
.chip--compact::before { inset: -5px 0; }   /* 34px padding box + 2 × 5px = 44px */

/* Removable condition chip: the whole chip is the remove button. */
.chip--removable {
  background: var(--accent-tint);
  border-color: transparent;
  color: var(--accent-ink);
  padding-right: 10px;
}
.chip--removable:hover { background: #DCE9FF; color: var(--accent-hover); border-color: transparent; }
.chip__x {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(31, 91, 209, .1);
}
.chip__x svg { width: 14px; height: 14px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px;
  margin: -4px -2px;
}
.chip-row--scroll::-webkit-scrollbar { display: none; }

/* ==========================================================================
   Switch (checkbox role="switch")
   ========================================================================== */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.switch--block { display: flex; justify-content: space-between; width: 100%; }
.switch__label { font-size: var(--fs-base); font-weight: 500; color: var(--ink); }
.switch__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch__track {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--line-control);   /* off state ≥3:1 against the page and the white thumb */
  transition: background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(25, 27, 32, .2);
  transition: transform var(--dur-med) var(--ease-out);
}
.switch:hover .switch__track { background: #6F747E; }
.switch__input:checked + .switch__track { background: var(--accent-strong); }
.switch__input:checked + .switch__track::after { transform: translateX(18px); }
.switch__input:focus-visible + .switch__track { box-shadow: var(--focus-ring); }
.switch__input:disabled + .switch__track { background: var(--line); }
.switch:has(.switch__input:disabled) { cursor: not-allowed; }
.switch:has(.switch__input:disabled) .switch__label { color: var(--ink-3); }

/* ==========================================================================
   Segmented control (buttons with aria-pressed, or radios)
   ========================================================================== */
.segmented {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: stretch;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.segmented__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.segmented__item::before { content: ''; position: absolute; inset: -3px 0; }
.segmented__item svg { width: 18px; height: 18px; }
.segmented__item:hover { color: var(--ink); background: var(--surface-sunken); }
.segmented__item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.segmented__item[aria-pressed='true'],
.segmented__item[aria-checked='true'],
.segmented__item:has(input:checked) {
  background: var(--accent-strong);
  color: #FFFFFF;
}
.segmented__item:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.segmented__item:disabled,
.segmented__item[aria-disabled='true'] { color: var(--ink-3); cursor: not-allowed; background: transparent; }
.segmented__item input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface-sunken);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge svg { width: 14px; height: 14px; }
.badge--accent { background: var(--accent-tint); color: var(--accent-ink); }
.badge--solid { background: var(--accent-strong); color: #FFFFFF; }
.badge--success { background: var(--success-tint); color: var(--success); }
.badge--warning { background: var(--warning-tint); color: var(--warning); }
.badge--danger { background: var(--danger-tint); color: var(--danger); }
.badge--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-2); }
.badge--pill { border-radius: var(--radius-pill); }
.badge__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ==========================================================================
   Card surface
   ========================================================================== */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.card--pad { padding: var(--space-6); }
.card--sunken { background: var(--surface-2); }
.card--interactive {
  transition:
    transform var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
.card--interactive:hover {
  transform: translateY(-2px);
  border-color: rgba(55, 129, 252, .38);
  box-shadow: var(--shadow-2);
}
@media (prefers-reduced-motion: reduce) {
  .card--interactive:hover { transform: none; }
}
.surface-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

/* ==========================================================================
   Skeleton (restrained: flat blocks, gentle opacity pulse only if motion allowed)
   ========================================================================== */
.skeleton {
  display: block;
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
}
.skeleton--text { height: 12px; width: 100%; }
.skeleton--text + .skeleton--text { margin-top: 8px; }
.skeleton--title { height: 20px; width: 60%; }
.skeleton--media { aspect-ratio: 4 / 3; width: 100%; border-radius: var(--radius-md); }
.skeleton--btn { height: 40px; width: 96px; border-radius: 10px; }
.skeleton--circle { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: sa-skeleton-pulse 1.6s var(--ease-in-out) infinite alternate; }
}
@keyframes sa-skeleton-pulse { from { opacity: 1; } to { opacity: .55; } }

/* ==========================================================================
   Dialog (native <dialog>, see components/dialog.js)
   ========================================================================== */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  flex-direction: column;
}
.dialog[open] { display: flex; animation: sa-dialog-in var(--dur-med) var(--ease-out); }
.dialog.is-closing { animation: sa-dialog-out 140ms var(--ease-in-out) forwards; }
.dialog::backdrop { background: rgba(25, 27, 32, .44); }
.dialog[open]::backdrop { animation: sa-fade-in var(--dur-med) var(--ease-out); }
.dialog.is-closing::backdrop { animation: sa-fade-out 140ms var(--ease-in-out) forwards; }
/* the global reduced-motion reset (base.css) covers *, ::before, ::after — not ::backdrop */
@media (prefers-reduced-motion: reduce) {
  .dialog[open]::backdrop,
  .dialog.is-closing::backdrop { animation: none; }
}
.dialog--sm { width: min(440px, calc(100vw - 32px)); }
.dialog--lg { width: min(880px, calc(100vw - 32px)); }
.dialog--full { width: calc(100vw - 32px); height: calc(100dvh - 32px); }

.dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 16px 8px 24px;
}
.dialog__title { font-size: var(--fs-xl); font-weight: 600; line-height: 1.25; padding-top: 8px; }
.dialog__close { margin-left: auto; }
.dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 24px 24px;
  color: var(--ink-2);
  overscroll-behavior: contain;
}
.dialog__body > * + * { margin-top: 12px; }
.dialog__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 24px;
  border-top: 1px solid var(--line);
}
.dialog__footer:empty { display: none; }

@keyframes sa-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes sa-dialog-out { to { opacity: 0; transform: translateY(4px) scale(.99); } }
@keyframes sa-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sa-fade-out { to { opacity: 0; } }

@media (max-width: 767.98px) {
  .dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 20px; }
  .dialog__header { padding: 16px 8px 4px 20px; }
  .dialog__body { padding: 8px 20px 20px; }
  .dialog__footer { padding: 12px 20px 20px; }
  .dialog__footer .btn { flex: 1 1 auto; }
}

/* ==========================================================================
   Toasts (see components/toast.js)
   ========================================================================== */
/* One region per context: the page's (#toast-region) and, while a modal dialog is open, one inside
   that dialog shown as a manual popover (top layer above the dialog, not inert, not clipped). The
   explicit inset/box values also reset the UA [popover] styles. */
.toast-region {
  position: fixed;
  inset: auto 24px 24px auto;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: visible;
  pointer-events: none;
}
.toast-region[popover]:not(:popover-open) { display: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 6px 6px 6px 16px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--rail-ink);
  box-shadow: var(--shadow-3);
  font-size: var(--fs-sm);
  line-height: 1.4;
  pointer-events: auto;
  animation: sa-toast-in var(--dur-med) var(--ease-out);
}
.toast.is-leaving { animation: sa-toast-out 160ms var(--ease-in-out) forwards; }
.toast.is-moved:not(.is-leaving) { animation: none; }   /* re-parented into/out of a dialog: no re-entry */
.toast__icon { flex: none; width: 20px; height: 20px; color: #8DB8FF; }
.toast--success .toast__icon { color: #5FD69A; }
.toast--error .toast__icon { color: #FF8A8A; }
.toast__msg { flex: 1 1 auto; min-width: 0; padding: 8px 0; }
.toast__action {
  flex: none;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: #9CC2FF;
  font-weight: 600;
  position: relative;
}
.toast__action::before { content: ''; position: absolute; inset: -2px 0; }
.toast__action:hover { background: rgba(255, 255, 255, .08); color: #FFFFFF; }
.toast__close {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--rail-ink-2);
  position: relative;
}
.toast__close::before { content: ''; position: absolute; inset: -2px; }
.toast__close:hover { background: rgba(255, 255, 255, .08); color: #FFFFFF; }
.toast__close svg { width: 18px; height: 18px; }
.toast__action:focus-visible,
.toast__close:focus-visible { outline: 2px solid #8DB8FF; outline-offset: 0; }

@keyframes sa-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sa-toast-out { to { opacity: 0; transform: translateY(4px); } }

@media (max-width: 767.98px) {
  .toast-region { inset: auto 16px 16px 16px; width: auto; align-items: stretch; }
  /* Phones: the message keeps the full width of row 1; an action moves to row 2, under the text
     (its label aligned with the message, clear of the close button's hit area). */
  .toast {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    column-gap: 12px;
    align-items: center;
  }
  .toast__icon { grid-area: 1 / 1; }
  .toast__msg { grid-area: 1 / 2; }
  .toast__close { grid-area: 1 / 3; }
  .toast__action { grid-area: 2 / 2; justify-self: start; margin: -12px 0 0 -12px; }
}

/* ==========================================================================
   Tooltip: add data-tip="…" to an element that already has an accessible name.
   Visual only; shows on hover (after 120ms) and on keyboard focus.
   - Hidden tips are display:none, so they never add scrollable overflow near an edge.
   - While hovered, the bubble is part of its anchor's hit area and a transparent border bridges the
     8px gap, so the pointer can move onto it without losing it (WCAG 1.4.13 "hoverable"). It stays
     visibility:hidden during the delay, so passing over its future spot does not catch the pointer.
   - Escape hides it without moving focus or the pointer (a11y.js sets [data-tip-hidden]).
   ========================================================================== */
:where([data-tip]) { position: relative; }
[data-tip]::after {
  --tip-shift: 0 4px;           /* entry slide, separate from the positioning transform pages may override */
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: 100%;
  z-index: 20;
  display: none;
  padding: 6px 10px;
  border: 0 solid transparent;
  border-bottom-width: 8px;
  /* the padding-box corners stay 8px round although one side carries the 8px bridge */
  border-radius: 8px / 8px 8px 16px 16px;
  background: var(--ink) padding-box;
  color: #FFFFFF;
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 500;
  font-style: normal;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  filter: drop-shadow(0 4px 10px rgba(25, 27, 32, .16));
  transform: translateX(-50%);
  pointer-events: none;
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after { display: block; animation: sa-tip-in 140ms var(--ease-out) 120ms both; }
[data-tip]:hover::after { pointer-events: auto; }
[data-tip][data-tip-hidden]::after { display: none; }
[data-tip][data-tip-pos='bottom']::after {
  --tip-shift: 0 -4px;
  bottom: auto;
  top: 100%;
  border-width: 8px 0 0;
  border-radius: 8px / 16px 16px 8px 8px;
}
[data-tip][data-tip-pos='right']::after {
  --tip-shift: -4px 0;
  left: 100%;
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  border-width: 0 0 0 8px;
  border-radius: 16px 8px 8px 16px / 8px;
}
[data-tip][data-tip-pos='left']::after {
  --tip-shift: 4px 0;
  left: auto;
  right: 100%;
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  border-width: 0 8px 0 0;
  border-radius: 8px 16px 16px 8px / 8px;
}
@keyframes sa-tip-in {
  from { opacity: 0; visibility: hidden; translate: var(--tip-shift); }
  to { opacity: 1; visibility: visible; translate: 0 0; }
}
/* Touch: a tap leaves :hover stuck on the element, so only keyboard focus shows the tip. */
@media (hover: none) {
  [data-tip]:hover:not(:focus-visible)::after { display: none; }
}

/* ==========================================================================
   Logo + page header + breadcrumbs (see components/logo.js)
   ========================================================================== */
.wordmark {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-logo);
  font-weight: 400;
  font-size: 26px;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
  border-radius: 6px;
}
a.wordmark { min-height: 44px; }
a.wordmark:hover { color: var(--ink); }
.wordmark__skin { color: var(--ink); }
.wordmark__aura { color: var(--accent); }
.wordmark--sm { font-size: 18px; }
.wordmark--md { font-size: 26px; }
.wordmark--lg { font-size: 40px; }
.wordmark:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.monogram {
  display: block;
  width: 44px;            /* the calligraphic SA mark (SVG, traced from the brand artwork) */
  height: auto;
  fill: currentColor;
  overflow: visible;
}

.page-header {
  display: flex;
  align-items: center;
  min-height: 56px;
  margin-bottom: var(--space-4);
}
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  column-gap: 0;
  row-gap: 0;
}
.breadcrumbs li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumbs li + li::before {
  content: '/';
  margin: 0 12px;
  color: var(--line-strong);
  font-size: var(--fs-md);
}
.breadcrumbs__home + li::before { margin-left: 22px; }
.breadcrumbs a:not(.wordmark),
.breadcrumbs [aria-current] {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--fs-base);
  color: var(--ink-3);
  text-decoration: none;
  border-radius: 6px;
}
.breadcrumbs a:not(.wordmark) { position: relative; }
/* Short crumbs («CS2») get an invisible 44px-wide hit area without changing the visual rhythm. */
.breadcrumbs a:not(.wordmark)::before { content: ''; position: absolute; inset: 0 min(-8px, calc(50% - 22px)); }
.breadcrumbs a:not(.wordmark):hover { color: var(--ink); text-decoration: underline; text-underline-offset: .22em; }
.breadcrumbs a:not(.wordmark):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.breadcrumbs [aria-current] { color: var(--ink-2); }
@media (max-width: 767.98px) {
  .page-header { min-height: 48px; margin-bottom: var(--space-2); }
  .page-header .wordmark { font-size: 18px; }
  .breadcrumbs__home + li::before { margin-left: 12px; }
  .breadcrumbs li + li::before { margin: 0 8px; }
  .breadcrumbs a:not(.wordmark), .breadcrumbs [aria-current] { font-size: var(--fs-sm); }
}

/* ==========================================================================
   Empty / error state block
   ========================================================================== */
.state {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}
.state--boxed { border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-2); }
.state__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--surface-sunken);
  color: var(--ink-2);
}
.state__icon svg { width: 26px; height: 26px; }
.state__title { font-size: var(--fs-xl); font-weight: 600; line-height: 1.25; color: var(--ink); }
.state__text { max-width: 52ch; color: var(--ink-2); }
.state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.state--error .state__icon { background: var(--danger-tint); color: var(--danger); }
.state--info .state__icon { background: var(--accent-tint); color: var(--accent-ink); }
.state--compact { padding: 24px 16px; gap: 8px; }
.state--compact .state__icon { width: 44px; height: 44px; border-radius: 14px; }
.state--compact .state__title { font-size: var(--fs-lg); }

/* Inline status / alert line */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice--info { background: var(--accent-tint); color: #1B4FB5; }
.notice--success { background: var(--success-tint); color: var(--success); }
.notice--warning { background: var(--warning-tint); color: var(--warning); }
.notice--error { background: var(--danger-tint); color: var(--danger); }

/* Key–value spec list */
.spec-list { display: grid; margin: 0; }
/* «Сторона» of a CS2 agent (product page, quick view): a small T / CT tag in the game's colours */
.team-tag {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 22px;
  margin-right: 6px;
  padding: 0 7px;
  border: 1px solid;
  border-radius: 7px;
  font-size: var(--fs-xs);
  font-weight: 700;
  vertical-align: 1px;
}
.team-tag--t { border-color: #E9C36A; background: #FFF3D6; color: #8A5A00; }
.team-tag--ct { border-color: #A9C3F2; background: #E7EFFF; color: #2457B3; }
.spec-list__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.spec-list__row:last-child { border-bottom: 0; }
.spec-list dt { color: var(--ink-3); }
.spec-list dd { margin: 0; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.divider { height: 1px; border: 0; margin: 0; background: var(--line); }

/* Drop-down list of select.select (components/select-menu.js): a light floating island instead of the OS list */
.smenu {
  position: fixed;
  z-index: 120;
  min-width: 200px;
  max-width: min(360px, calc(100vw - 16px));
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(25, 27, 32, .08);
  border-radius: 14px;
  background: rgba(255, 255, 255, .97);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 22px 48px -16px rgba(25, 27, 32, .28), 0 2px 6px rgba(25, 27, 32, .06);
  outline: none;
  animation: smenu-in 150ms var(--ease-out);
}
.smenu.is-instant { animation: none; }
@keyframes smenu-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } }
.smenu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px 0 8px;
  border-radius: 9px;
  font-size: var(--fs-sm);
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.smenu__item.is-active { background: var(--surface-sunken); }
.smenu__item[aria-selected='true'] { font-weight: 600; }
.smenu__item[aria-disabled='true'] { color: var(--ink-3); cursor: default; }
.smenu__check { flex: none; color: var(--accent-strong); visibility: hidden; }
.smenu__item[aria-selected='true'] .smenu__check { visibility: visible; }
.select.is-menu-open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (prefers-reduced-motion: reduce) { .smenu { animation: none; } }
