/* =====================================================================
   CozyKat · Design tokens + base UI
   v1.0 · 2026-10-17 · для Telegram Mini App (storefront) и админки

   Как использовать:
   1) Скопировать файл рядом с index.html (storefront/tokens.css,
      admin/tokens.css) и подключить <link rel="stylesheet" href="./tokens.css">
      ПОСЛЕ основного <style> страницы.
   2) Шрифты (.woff2) положить в ./fonts/ и раскомментировать блок
      @font-face ниже. Пока файлов нет — работает системный fallback,
      вёрстка не ломается.
   3) Разметку и JS привести по спеке docs/design/DESIGN.md
      (там же — обязательные id и порядок внедрения).

   Цвета светлой/тёмной темы — собственные дефолты CozyKat.
   Мы НЕ подменяем палитру значениями --tg-theme-*; из Telegram берём
   только режим (colorScheme) и высоту вьюпорта.
   ===================================================================== */

/* ---------------------------------------------------------------------
   ШРИФТЫ (self-hosted, SIL OFL 1.1)
   Comfortaa      — логотип, заголовки. Мягкий скруглённый гуманист.
   Nunito Sans    — текст, цены, кнопки. Чистый читаемый гуманист.
   Оба — variable woff2 (latin + cyrillic в одном файле), формат
   "woff2-variations". Лицензию SIL OFL 1.1 (OFL.txt) кладём рядом.

   Где взять woff2 (в рантайме — только self-hosted, без внешнего CDN):
   · Google Fonts (скачать ZIP): fonts.google.com/specimen/Comfortaa,
     fonts.google.com/specimen/Nunito+Sans
   · Fontsource (npm): @fontsource/comfortaa, @fontsource/nunito-sans
   · GitHub: github.com/google/fonts/tree/main/ofl/comfortaa,
     github.com/google/fonts/tree/main/ofl/nunitosans
   Кладём в ./fonts/comfortaa-var.woff2 и ./fonts/nunito-sans-var.woff2.
   Раскомментировать @font-face после добавления файлов — вёрстка и без
   них не ломается (работает системный fallback).
   --------------------------------------------------------------------- */
@font-face {
  font-family: "Comfortaa";
  src: url("./fonts/comfortaa-latin.woff2?v=2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Comfortaa";
  src: url("./fonts/comfortaa-cyrillic.woff2?v=2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("./fonts/nunito-sans-latin.woff2?v=2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("./fonts/nunito-sans-cyrillic.woff2?v=2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* =====================================================================
   1. ТОКЕНЫ · СВЕТЛАЯ ТЕМА
   ===================================================================== */
:root,
[data-theme="light"] {
  color-scheme: light;

  /* --- Поверхности ------------------------------------------------- */
  --bg: #f7f1e9;                 /* тёплый крем, фон приложения */
  --bg-raised: #fbf6ef;
  --surface: #fffcf7;            /* карточки, шторки */
  --surface-2: #f1e8dd;          /* поля, чипы, вторичные плашки */
  --surface-3: #e9ddd0;
  --surface-glass: rgba(255, 252, 247, 0.82);
  --surface-glass-strong: rgba(247, 241, 233, 0.94);
  --scrim: rgba(26, 18, 32, 0.52);
  --bg-grad:
    radial-gradient(110% 70% at 100% -10%, #f6e5e1 0%, rgba(246, 229, 225, 0) 58%),
    radial-gradient(90% 60% at 0% -10%, #eee8f5 0%, rgba(238, 232, 245, 0) 60%);

  /* --- Текст ------------------------------------------------------- */
  --text: #3a3140;               /* 12.1:1 на surface */
  --text-2: #6c6177;             /* 5.7:1 на surface */
  --text-3: #7a6f85;             /* даты, плейсхолдеры: 4.6:1 на surface (AA) */
  --text-inverse: #fff8f1;

  /* --- Линии ------------------------------------------------------- */
  --border: #e6dacd;
  --border-strong: #d3c2b1;
  --border-input: #a78f79;       /* 3:1 — границы полей ввода */
  --divider: #efe4d8;

  /* --- Бренд-акцент ------------------------------------------------ */
  --accent: #75628b;             /* текст/кнопки: 5.3:1 на surface */
  --accent-hover: #66547d;
  --accent-press: #5a496f;
  --accent-contrast: #ffffff;    /* 5.4:1 на accent */
  --accent-soft: #ede7f3;
  --accent-soft-text: #66547d;
  --brand-violet: #7c6a93;       /* референс из фото пряжи */
  --lavender: #b7a6c9;
  --lavender-deep: #a896be;
  --rose: #c9a9b4;
  --rose-soft: #f3e4e7;
  --peach: #f5d9c8;
  --cream: #ede3d6;
  --ivory: #f2e9de;

  /* --- Статусы ----------------------------------------------------- */
  --success: #3f6e4e;
  --success-soft: #e0ede3;
  --danger: #9d4a56;
  --danger-soft: #f7e1e3;
  --danger-contrast: #ffffff;
  --warning: #7f5d1e;
  --warning-soft: #f7ead2;
  --info: #4c6480;
  --info-soft: #e3ebf3;

  /* --- Пилюли статусов -------------------------------------------- */
  --pill-new-bg: #f3e2e5;
  --pill-new-fg: #8a4353;
  --pill-confirmed-bg: #e9e2f2;
  --pill-confirmed-fg: #66547d;
  --pill-completed-bg: #e0ede3;
  --pill-completed-fg: #3f6e4e;
  --pill-cancelled-bg: #f5e3e4;
  --pill-cancelled-fg: #96414e;
  --pill-auction-bg: #f7ead2;
  --pill-auction-fg: #7f5d1e;

  /* --- Фото / оверлеи --------------------------------------------- */
  --media-ph: linear-gradient(135deg, #efe6f2 0%, #f3e4e7 52%, #f7eadf 100%);
  --photo-scrim:
    linear-gradient(180deg,
      rgba(26, 18, 32, 0) 0%,
      rgba(26, 18, 32, 0.16) 42%,
      rgba(26, 18, 32, 0.62) 74%,
      rgba(26, 18, 32, 0.88) 100%);
  --photo-chip: rgba(255, 252, 247, 0.92);
  --photo-chip-text: #3a3140;
  --photo-dot: rgba(255, 255, 255, 0.45);
  --photo-dot-active: #fff8f1;

  /* --- Тени -------------------------------------------------------- */
  --shadow-sm: 0 1px 2px rgba(58, 40, 56, 0.07), 0 1px 1px rgba(58, 40, 56, 0.04);
  --shadow-md: 0 6px 18px rgba(58, 40, 56, 0.1), 0 1px 3px rgba(58, 40, 56, 0.06);
  --shadow-lg: 0 22px 44px -16px rgba(58, 40, 56, 0.32), 0 6px 14px rgba(58, 40, 56, 0.07);
  --focus-ring: 0 0 0 3px rgba(117, 98, 139, 0.34);

  /* --- Шрифты ------------------------------------------------------ */
  --font-display: "Comfortaa", ui-rounded, "SF Pro Rounded", "Segoe UI",
    system-ui, sans-serif;
  --font-body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  /* --- Типографика -------------------------------------------------- */
  --text-2xs: 16px;   --lh-2xs: 20px;
  --text-xs: 16px;    --lh-xs: 20px;
  --text-sm: 16px;    --lh-sm: 22px;
  --text-md: 16px;    --lh-md: 24px;
  --text-lg: 17px;    --lh-lg: 24px;
  --text-xl: 20px;    --lh-xl: 26px;
  --text-2xl: 24px;   --lh-2xl: 30px;
  --text-3xl: 30px;   --lh-3xl: 34px;
  --text-4xl: 36px;   --lh-4xl: 40px;
  --weight-regular: 400;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-heavy: 800;
  --tracking-tight: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.02em;
  --tracking-caps: 0.12em;

  /* --- Отступы (шаг 4) --------------------------------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 48px;
  --s-10: 64px;
  --gutter: 16px;

  /* --- Радиусы ------------------------------------------------------ */
  --r-xs: 9px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-2xl: 32px;
  --r-pill: 999px;
  --r-full: 50%;

  /* --- Размеры / безопасные зоны ----------------------------------- */
  --app-max-w: 440px;
  --tap-min: 44px;
  --appbar-h: 56px;
  --rail-h: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-vh: 100vh; /* переопределяется JS: viewportStableHeight / innerHeight */
  --catalog-chrome-h: calc(
    var(--appbar-h) + var(--safe-top) + var(--rail-h) + var(--safe-bottom) + 58px
  );

  /* --- Движение ----------------------------------------------------- */
  --dur-fast: 120ms;
  --dur: 200ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- Слои --------------------------------------------------------- */
  --z-header: 40;
  --z-cta: 50;
  --z-sheet: 100;
  --z-toast: 200;
}

@supports (height: 100dvh) {
  :root { --app-vh: 100dvh; }
}

/* =====================================================================
   2. ТОКЕНЫ · ТЁМНАЯ ТЕМА
   Дублированный блок нужен осознанно: явный data-theme="dark" должен
   выигрывать у системной темы, а data-theme="light" — отменять её.
   ===================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #17131c;
    --bg-raised: #1d1823;
    --surface: #221c29;
    --surface-2: #2c2535;
    --surface-3: #372e42;
    --surface-glass: rgba(34, 28, 41, 0.84);
    --surface-glass-strong: rgba(23, 19, 28, 0.94);
    --scrim: rgba(8, 5, 11, 0.64);
    --bg-grad:
      radial-gradient(110% 70% at 100% -10%, rgba(201, 169, 180, 0.14) 0%, rgba(201, 169, 180, 0) 58%),
      radial-gradient(90% 60% at 0% -10%, rgba(183, 166, 201, 0.16) 0%, rgba(183, 166, 201, 0) 60%);

    --text: #f4ede6;
    --text-2: #bdb2c8;
    --text-3: #9b8fa8;
    --text-inverse: #fff8f1;

    --border: #3b3147;
    --border-strong: #4c3f5b;
    --border-input: #806e90;
    --divider: #312837;

    --accent: #c8b5e0;
    --accent-hover: #d8c8ec;
    --accent-press: #b6a2d2;
    --accent-contrast: #241c2f;
    --accent-soft: #372c46;
    --accent-soft-text: #d9c9ee;
    --brand-violet: #b7a6c9;
    --lavender: #b7a6c9;
    --lavender-deep: #a896be;
    --rose: #c9a9b4;
    --rose-soft: #3a2a31;
    --peach: #f5d9c8;
    --cream: #ede3d6;
    --ivory: #f2e9de;

    --success: #8cc79a;
    --success-soft: #26332a;
    --danger: #eda3ac;
    --danger-soft: #3e262b;
    --danger-contrast: #2a171b;
    --warning: #e7c486;
    --warning-soft: #3a2e1c;
    --info: #a9c4e2;
    --info-soft: #263340;

    --pill-new-bg: #3e2a31;
    --pill-new-fg: #f0b9c1;
    --pill-confirmed-bg: #352b44;
    --pill-confirmed-fg: #d6c4ea;
    --pill-completed-bg: #26332a;
    --pill-completed-fg: #a9d6b3;
    --pill-cancelled-bg: #3a2629;
    --pill-cancelled-fg: #efb3b8;
    --pill-auction-bg: #3a2e1c;
    --pill-auction-fg: #e7c486;

    --media-ph: linear-gradient(135deg, #2c2535 0%, #352b3c 52%, #3b2e33 100%);
    --photo-scrim:
      linear-gradient(180deg,
        rgba(8, 5, 11, 0) 0%,
        rgba(8, 5, 11, 0.2) 40%,
        rgba(8, 5, 11, 0.7) 74%,
        rgba(8, 5, 11, 0.92) 100%);
    --photo-chip: rgba(34, 28, 41, 0.9);
    --photo-chip-text: #f4ede6;
    --photo-dot: rgba(255, 255, 255, 0.38);
    --photo-dot-active: #fff8f1;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.42);
    --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 52px rgba(0, 0, 0, 0.58);
    --focus-ring: 0 0 0 3px rgba(200, 181, 224, 0.38);
  }
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #17131c;
  --bg-raised: #1d1823;
  --surface: #221c29;
  --surface-2: #2c2535;
  --surface-3: #372e42;
  --surface-glass: rgba(34, 28, 41, 0.84);
  --surface-glass-strong: rgba(23, 19, 28, 0.94);
  --scrim: rgba(8, 5, 11, 0.64);
  --bg-grad:
    radial-gradient(110% 70% at 100% -10%, rgba(201, 169, 180, 0.14) 0%, rgba(201, 169, 180, 0) 58%),
    radial-gradient(90% 60% at 0% -10%, rgba(183, 166, 201, 0.16) 0%, rgba(183, 166, 201, 0) 60%);

  --text: #f4ede6;
  --text-2: #bdb2c8;
  --text-3: #9b8fa8;
  --text-inverse: #fff8f1;

  --border: #3b3147;
  --border-strong: #4c3f5b;
  --border-input: #806e90;
  --divider: #312837;

  --accent: #c8b5e0;
  --accent-hover: #d8c8ec;
  --accent-press: #b6a2d2;
  --accent-contrast: #241c2f;
  --accent-soft: #372c46;
  --accent-soft-text: #d9c9ee;
  --brand-violet: #b7a6c9;
  --lavender: #b7a6c9;
  --lavender-deep: #a896be;
  --rose: #c9a9b4;
  --rose-soft: #3a2a31;
  --peach: #f5d9c8;
  --cream: #ede3d6;
  --ivory: #f2e9de;

  --success: #8cc79a;
  --success-soft: #26332a;
  --danger: #eda3ac;
  --danger-soft: #3e262b;
  --danger-contrast: #2a171b;
  --warning: #e7c486;
  --warning-soft: #3a2e1c;
  --info: #a9c4e2;
  --info-soft: #263340;

  --pill-new-bg: #3e2a31;
  --pill-new-fg: #f0b9c1;
  --pill-confirmed-bg: #352b44;
  --pill-confirmed-fg: #d6c4ea;
  --pill-completed-bg: #26332a;
  --pill-completed-fg: #a9d6b3;
  --pill-cancelled-bg: #3a2629;
  --pill-cancelled-fg: #efb3b8;
  --pill-auction-bg: #3a2e1c;
  --pill-auction-fg: #e7c486;

  --media-ph: linear-gradient(135deg, #2c2535 0%, #352b3c 52%, #3b2e33 100%);
  --photo-scrim:
    linear-gradient(180deg,
      rgba(8, 5, 11, 0) 0%,
      rgba(8, 5, 11, 0.2) 40%,
      rgba(8, 5, 11, 0.7) 74%,
      rgba(8, 5, 11, 0.92) 100%);
  --photo-chip: rgba(34, 28, 41, 0.9);
  --photo-chip-text: #f4ede6;
  --photo-dot: rgba(255, 255, 255, 0.38);
  --photo-dot-active: #fff8f1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 52px rgba(0, 0, 0, 0.58);
  --focus-ring: 0 0 0 3px rgba(200, 181, 224, 0.38);
}

/* =====================================================================
   3. БАЗА
   ===================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body { min-height: 100%; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--lh-md);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

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

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

button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); }

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

[hidden] { display: none !important; }

h1, h2, h3, h4,
.h1, .h2, .h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

h1, .h1 { font-size: var(--text-3xl); line-height: var(--lh-3xl); }
h2, .h2 { font-size: var(--text-xl);  line-height: var(--lh-xl); }
h3, .h3 { font-size: var(--text-lg);  line-height: var(--lh-lg); }

p { margin: 0; }

.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-2xs);
  line-height: 1.25;
  font-weight: var(--weight-heavy);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-2);
}

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

.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.no-scrollbar::-webkit-scrollbar { display: none; }

/* =====================================================================
   4. КАРКАС ЭКРАНА
   ===================================================================== */
.app-shell,
.view-shell {
  width: 100%;
  max-width: var(--app-max-w);
  margin: 0 auto;
  height: var(--app-vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: transparent;
}

.catalog-view {
  width: 100%;
  max-width: var(--app-max-w);
  margin: 0 auto;
  height: var(--app-vh);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  position: relative;
}

.catalog-controls {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.screen-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen-scroll::-webkit-scrollbar { display: none; }

.screen-pad {
  padding: var(--s-4) var(--gutter) calc(var(--s-10) + var(--safe-bottom));
}

/* =====================================================================
   5. ЛОГОТИП / БРЕНД
   ===================================================================== */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.brand__text { display: grid; gap: 5px; min-width: 0; }

.brand__name {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  color: var(--text);
}

.brand__tag {
  font-family: var(--font-body);
  font-size: 9px;
  line-height: 1.1;
  font-weight: var(--weight-heavy);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* =====================================================================
   6. APP BAR / ИКОНКИ / ЧИПЫ
   ===================================================================== */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: calc(var(--appbar-h) + var(--safe-top));
  padding: calc(var(--safe-top) + 8px) var(--gutter) 8px;
  background: linear-gradient(180deg, var(--bg) 62%, transparent);
  position: relative;
  z-index: var(--z-header);
}

.appbar__actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.icon-btn {
  position: relative;
  width: var(--tap-min);
  height: var(--tap-min);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 24px; height: 24px; max-width: none; }

.icon-btn__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--rose);
  box-shadow: 0 0 0 2px var(--bg);
}
.icon-btn__badge--count {
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: var(--weight-heavy);
  color: var(--accent-contrast);
  background: var(--accent);
}

.view-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: calc(var(--appbar-h) + var(--safe-top));
  padding: calc(var(--safe-top) + 6px) var(--gutter) 6px;
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid transparent;
  position: relative;
  z-index: var(--z-header);
  flex: 0 0 auto;
}
.view-head--bordered { border-bottom-color: var(--border); }

.view-head__title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: var(--lh-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-head__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: -8px;
}

/* Видимая кнопка «Назад» — закрывает проблему №1 */
.back-btn {
  width: var(--tap-min);
  height: var(--tap-min);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}
.back-btn:hover { background: var(--surface-2); }
.back-btn:active { transform: scale(0.94); }
.back-btn svg { width: 24px; height: 24px; max-width: none; }
.back-btn--labeled {
  width: auto;
  min-width: var(--tap-min);
  padding: 0 14px 0 10px;
  gap: 4px;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  border-radius: var(--r-pill);
}

/* Рейл категорий */
.category-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--rail-h);
  padding: 4px var(--gutter);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  scroll-padding-inline: var(--gutter);
  flex: 0 0 auto;
}
.category-rail::-webkit-scrollbar { display: none; }

.category-tag,
.chip-btn,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap-min);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: var(--weight-bold);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}
.category-tag:hover,
.chip-btn:hover { border-color: var(--border-strong); color: var(--text); }

.category-tag.active,
.category-tag.is-active,
.chip-btn.active,
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* Поиск */
.search-row {
  padding: 0 var(--gutter) 0;
  flex: 0 0 auto;
}

.input,
.search-row input,
.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: var(--tap-min);
  padding: 10px 14px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px; /* 16px — чтобы iOS не зумил при фокусе */
  line-height: 1.35;
  transition: border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder,
.search-row input::placeholder,
.field input::placeholder,
.field textarea::placeholder { color: var(--text-3); }

.input:focus,
.search-row input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

textarea.input,
.field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
  padding-top: 12px;
  padding-bottom: 12px;
}

select.input,
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
    linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% + 1px),
    calc(100% - 14px) calc(50% + 1px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

/* =====================================================================
   7. ЛЕНТА КАТАЛОГА (Instagram-подобная, 1 карточка ≈ 100dvh)
   ===================================================================== */
.feed {
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0;
}
.feed::-webkit-scrollbar { display: none; }

.feed-card {
  height: 100%;
  min-height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  padding: 6px var(--gutter) 10px;
  position: relative;
  min-width: 0;
}

/* Кадр 9:16 без искажений. Ширина ограничена и шириной экрана, и высотой
   каталога, поэтому карточка всегда целиком влезает в «один экран». */
.feed-card__media {
  position: relative;
  width: min(100%, calc((var(--app-vh) - var(--catalog-chrome-h)) * 9 / 16));
  aspect-ratio: 9 / 16;
  border-radius: var(--r-2xl);
  overflow: hidden;
  background: var(--media-ph);
  box-shadow: var(--shadow-lg);
  isolation: isolate;
  margin: auto;
}

.feed-card__media .slider,
.detail-slider .slider {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.feed-card__media .slider::-webkit-scrollbar,
.detail-slider .slider::-webkit-scrollbar { display: none; }

.feed-card__media .slider img,
.detail-slider .slider img {
  width: 100%;
  height: 100%;
  flex: 0 0 100%;
  object-fit: cover;
  object-position: center 42%;
  scroll-snap-align: center;
  background: var(--media-ph);
}

.feed-card__media .no-photo,
.detail-slider .no-photo {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--text-2);
  font-size: var(--text-sm);
  background:
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(183, 166, 201, 0.13) 12px 13px),
    var(--media-ph);
}

/* Glass-чип статуса */
.feed-card__status {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  background: var(--photo-chip);
  color: var(--photo-chip-text);
  font-size: var(--text-xs);
  line-height: 1;
  font-weight: var(--weight-heavy);
  letter-spacing: 0.01em;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}
.feed-card__status--auction {
  background: var(--pill-auction-bg);
  color: var(--pill-auction-fg);
}
.feed-card__status--sold {
  background: var(--surface-2);
  color: var(--text-2);
}

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(63, 110, 78, 0.16);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
  flex: 0 0 auto;
}
.feed-card__status--auction .dot-live {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(127, 93, 30, 0.18);
  animation: cozy-pulse 2.4s var(--ease-out) infinite;
}

/* Точки слайдера: в ленте — сверху справа */
.slider-dots {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: var(--r-pill);
  background: rgba(26, 18, 32, 0.38);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--photo-dot);
  transition: width var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.dot.active {
  width: 16px;
  background: var(--photo-dot-active);
}

.feed-card__media .slider-dots {
  top: 14px;
  right: 14px;
  bottom: auto;
  left: auto;
  transform: none;
}
.detail-slider .slider-dots {
  top: 14px;
  right: 14px;
  bottom: auto;
  left: auto;
  transform: none;
}



/* Затемнение и оверлей с названием/ценой/кнопкой */
.feed-card__media::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 62%;
  background: var(--photo-scrim);
  z-index: 1;
  pointer-events: none;
}

.feed-card__overlay {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  display: grid;
  gap: 6px;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  color: var(--text-inverse);
}

.feed-card__title {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-inverse);
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 27px;
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  text-align: left;
  text-wrap: balance;
  cursor: pointer;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.18);
}

.feed-card__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: 4px;
}

.feed-card__price {
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 26px;
  font-weight: var(--weight-heavy);
  font-variant-numeric: tabular-nums;
  color: var(--text-inverse);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);
}
.feed-card__price small {
  display: block;
  font-size: var(--text-2xs);
  line-height: 14px;
  font-weight: var(--weight-semibold);
  color: rgba(255, 248, 241, 0.72);
  text-shadow: none;
}

.feed-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap-min);
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-pill);
  background: #fff8f1;
  color: #3a3140;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: var(--weight-heavy);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring),
    background var(--dur-fast) var(--ease-out);
}
.feed-card__cta:hover { background: #ffffff; }
.feed-card__cta:active { transform: scale(0.95); }

.feed-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  line-height: 1.25;
  font-weight: var(--weight-semibold);
  color: rgba(255, 248, 241, 0.8);
}

.feed-card__hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  margin-top: 6px;
  color: var(--text-2);
  font-size: var(--text-2xs);
  line-height: 1.25;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
}
.feed-card__hint svg {
  width: 14px;
  height: 14px;
  opacity: 0.8;
  animation: cozy-nudge 2.8s var(--ease-out) infinite;
}

.feed-end {
  width: min(100%, calc((var(--app-vh) - var(--catalog-chrome-h)) * 9 / 16));
  aspect-ratio: 9 / 16;
  max-height: 100%;
  display: grid;
  place-items: center;
  gap: var(--s-3);
  padding: var(--s-6);
  text-align: center;
  border-radius: var(--r-2xl);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  box-shadow: var(--shadow-sm);
}

/* =====================================================================
   8. ПОДСКАЗКА НА ПЕРВОМ ЭКРАНЕ / SKELETON / EMPTY
   ===================================================================== */
.empty-state {
  display: grid;
  justify-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-8) var(--s-4);
  text-align: center;
}

.empty-state__art {
  width: 148px;
  height: 140px;
  margin-bottom: var(--s-1);
}

.empty-state__title {
  max-width: 24ch;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: var(--lh-xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.empty-state__text {
  max-width: 32ch;
  color: var(--text-2);
  font-size: var(--text-md);
  line-height: 1.55;
}

.empty-state .btn,
.empty-state .empty-state__actions {
  margin-top: var(--s-2);
}
.empty-state__actions {
  display: grid;
  gap: var(--s-2);
  width: min(100%, 280px);
}

/* Совместимость со старым .empty */
.empty {
  display: grid;
  place-items: center;
  gap: var(--s-2);
  padding: var(--s-7) var(--s-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text-2);
  text-align: center;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.error-box,
.error-state {
  display: grid;
  gap: var(--s-2);
  justify-items: start;
  padding: var(--s-4);
  border: 1px solid var(--danger-soft);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--surface-glass), transparent);
  animation: cozy-shimmer 1.5s infinite;
}
.skeleton--card { height: 168px; }
.skeleton--line { height: 12px; border-radius: var(--r-pill); }
.skeleton--line + .skeleton--line { margin-top: 8px; }

/* =====================================================================
   9. КНОПКИ
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.2;
  font-weight: var(--weight-heavy);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(0.985); }
.btn svg { width: 24px; height: 24px; max-width: none; flex: 0 0 auto; }

.btn--primary,
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover,
.btn-primary:hover { background: var(--accent-hover); }
.btn--primary:active,
.btn-primary:active { background: var(--accent-press); }

.btn--secondary,
.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn--secondary:hover,
.btn-secondary:hover { background: var(--surface-2); }

.btn--ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.btn--danger,
.btn-danger {
  background: var(--danger);
  color: var(--danger-contrast);
}
.btn--danger:hover,
.btn-danger:hover { filter: brightness(1.04); }

.btn--ghost-danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
.btn--ghost-danger:hover { background: var(--danger-soft); }

.btn--sm,
.btn-small {
  min-height: var(--tap-min);
  padding: 0 14px;
  font-size: var(--text-sm);
  border-radius: var(--r-sm);
}
.btn--lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: var(--text-lg);
  border-radius: var(--r-lg);
}
.btn--block,
.btn-block { width: 100%; }
.btn--pill { border-radius: var(--r-pill); }

.btn:disabled,
.btn[disabled],
.btn.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn.is-loading {
  color: transparent !important;
  position: relative;
  pointer-events: none;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  border: 2px solid currentColor;
  border-top-color: transparent;
  color: var(--accent-contrast);
  animation: cozy-spin 0.8s linear infinite;
}
.btn--secondary.is-loading::after,
.btn--ghost.is-loading::after { color: var(--text); }

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  border-radius: var(--r-full);
  color: var(--text-2);
  text-decoration: none;
}
.icon-link:hover { background: var(--surface-2); color: var(--text); }

/* =====================================================================
   10. КАРТОЧКА ТОВАРА
   ===================================================================== */
.detail-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.detail-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  height: auto;
  background: var(--media-ph);
  overflow: hidden;
  border-radius: 0;
}

.detail-slider .slider img { object-position: center 40%; }

.detail-body {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  margin-top: -26px;
  padding: var(--s-5) var(--gutter) calc(112px + var(--safe-bottom));
  background: var(--bg);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
}

.detail-kicker,
.detail-meta {
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.detail-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: var(--lh-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

.detail-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.detail-price {
  font-family: var(--font-body);
  font-size: var(--text-2xl);
  line-height: var(--lh-2xl);
  font-weight: var(--weight-heavy);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.detail-desc {
  color: var(--text-2);
  font-size: var(--text-md);
  line-height: 1.6;
  white-space: pre-wrap;
}

.detail-specs {
  display: grid;
  gap: 0;
  margin-top: var(--s-2);
  padding: 2px var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 12px 0;
  font-size: var(--text-sm);
  line-height: 1.4;
}
.spec-row + .spec-row { border-top: 1px solid var(--divider); }
.spec-row dt { color: var(--text-2); }
.spec-row dd {
  margin: 0;
  text-align: right;
  font-weight: var(--weight-bold);
  color: var(--text);
}

.master-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}
.master-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
}
.master-card__name { font-weight: var(--weight-bold); font-size: var(--text-sm); }
.master-card__note { color: var(--text-2); font-size: var(--text-xs); }

.cta-bar {
  position: fixed;
  z-index: var(--z-cta);
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: var(--app-max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--gutter) calc(10px + var(--safe-bottom));
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.cta-bar__label {
  color: var(--text-2);
  font-size: var(--text-2xs);
  line-height: 1.2;
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cta-bar__price {
  color: var(--text);
  font-size: var(--text-xl);
  line-height: 1.2;
  font-weight: var(--weight-heavy);
  font-variant-numeric: tabular-nums;
}
.cta-bar .btn { flex: 0 0 auto; min-width: 168px; }

/* =====================================================================
   11. ЗАЯВКИ / СПИСКИ / ПИЛЮЛИ
   ===================================================================== */
.list { display: grid; gap: var(--s-3); }

.order-card,
.item {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  min-width: 0;
}

.order-card__head,
.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  min-width: 0;
}

.order-card__body {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}

.order-card__title,
.item-title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-body);
  font-size: var(--text-lg);
  line-height: 1.3;
  font-weight: var(--weight-heavy);
  color: var(--text);
  overflow-wrap: anywhere;
}

.order-card__meta,
.item-meta {
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.order-card__date {
  color: var(--text-3);
  font-size: var(--text-xs);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.order-card__comment {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--media-ph);
  border: 1px solid var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb--yarn {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 252, 247, 0.9), transparent 55%),
    linear-gradient(135deg, var(--lavender) 0%, var(--rose) 100%);
  color: var(--accent-contrast);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  line-height: 1;
  font-weight: var(--weight-heavy);
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
}

.pill--new, .pill-new { background: var(--pill-new-bg); color: var(--pill-new-fg); }
.pill--confirmed, .pill-confirmed { background: var(--pill-confirmed-bg); color: var(--pill-confirmed-fg); }
.pill--completed, .pill-completed { background: var(--pill-completed-bg); color: var(--pill-completed-fg); }
.pill--cancelled, .pill-cancelled { background: var(--pill-cancelled-bg); color: var(--pill-cancelled-fg); }
.pill--auction, .pill-auction { background: var(--pill-auction-bg); color: var(--pill-auction-fg); }
.pill--in-stock { background: var(--success-soft); color: var(--success); }
.pill--order { background: var(--accent-soft); color: var(--accent-soft-text); }
.pill--sold { background: var(--surface-2); color: var(--text-2); }

.status-in_stock { color: var(--success); }
.status-order { color: var(--accent-soft-text); }
.status-auction { color: var(--warning); }
.status-sold { color: var(--text-2); }

.badge-auction {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--pill-auction-bg);
  color: var(--pill-auction-fg);
  font-size: var(--text-xs);
  font-weight: var(--weight-heavy);
}

/* =====================================================================
   12. ФОРМЫ / ШТОРКА ЗАЯВКИ
   ===================================================================== */
label {
  display: grid;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text);
}

.field { display: grid; gap: 6px; }
.field__label {
  font-size: var(--text-sm);
  line-height: 1.3;
  font-weight: var(--weight-bold);
  color: var(--text);
}
.field__hint {
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--text-2);
}
.field__error {
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--danger);
  font-weight: var(--weight-bold);
}

.form-stack { display: grid; gap: var(--s-3); }
.form-grid { display: grid; gap: var(--s-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
@media (max-width: 380px) { .form-row { grid-template-columns: 1fr; } }

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.segmented label,
.segmented__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap-min);
  padding: 0 12px;
  border-radius: calc(var(--r-md) - 3px);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented label:has(input:checked),
.segmented__item:has(input:checked),
.radio-row label:has(input:checked),
.segmented label.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.segmented svg { width: 18px; height: 18px; }

/* Старая разметка radio-row из storefront */
.radio-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.radio-row label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-min);
  padding: 0 12px;
  border-radius: calc(var(--r-md) - 3px);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-2);
  cursor: pointer;
}
.radio-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.radio-row label:has(input:checked),
.radio-row label.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid transparent;
  color: var(--accent-soft-text);
  font-size: var(--text-xs);
  line-height: 1.5;
}
.notice--warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.msg {
  min-height: 18px;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--text-2);
}
.msg.ok { color: var(--success); font-weight: var(--weight-bold); }
.msg.err { color: var(--danger); font-weight: var(--weight-bold); }

/* Модалка/шторка */
.modal-overlay,
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  overscroll-behavior: contain;
}
.modal-overlay.active,
.sheet-backdrop.is-open { display: flex; }

.modal,
.sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px var(--gutter) calc(var(--s-5) + var(--safe-bottom));
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: cozy-sheet-in var(--dur) var(--ease-out);
}

.modal::before,
.sheet::before {
  content: "";
  width: 42px;
  height: 4px;
  margin: 2px auto var(--s-4);
  border-radius: var(--r-pill);
  background: var(--border-strong);
  flex: 0 0 auto;
}

.sheet__head,
.modal-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: var(--lh-xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}
.sheet__grab {
  width: 42px;
  height: 4px;
  margin: 2px auto var(--s-4);
  border-radius: var(--r-pill);
  background: var(--border-strong);
}
.sheet__summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.sheet__summary-title { font-weight: var(--weight-heavy); font-size: var(--text-sm); }
.sheet__summary-price { color: var(--text-2); font-size: var(--text-xs); }
.sheet__footer {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

@media (min-width: 600px) and (min-height: 700px) {
  .modal-overlay,
  .sheet-backdrop { align-items: center; padding: var(--s-6); }
  .modal,
  .sheet {
    max-height: 86vh;
    border-radius: var(--r-2xl);
    padding-top: var(--s-5);
  }
  .modal::before,
  .sheet::before { display: none; }
}

/* =====================================================================
   13. АУКЦИОНЫ
   ===================================================================== */
.auction-card {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.auction-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.auction-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}
.auction-price {
  font-size: var(--text-xl);
  line-height: var(--lh-xl);
  font-weight: var(--weight-heavy);
  font-variant-numeric: tabular-nums;
  color: var(--warning);
}
.auction-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: var(--text-xs);
  font-weight: var(--weight-heavy);
  font-variant-numeric: tabular-nums;
}
.auction-timer svg { width: 24px; height: 24px; }
.auction-timer.is-ending { color: var(--danger); background: var(--danger-soft); }

.bid-form {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-1);
}
.bid-form label { font-size: var(--text-sm); }
.bid-form input {
  width: 100%;
  min-height: var(--tap-min);
  padding: 10px 14px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.bid-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px 0;
  font-size: var(--text-sm);
}
.bid-row + .bid-row { border-top: 1px solid var(--divider); }
.bid-row__amount { font-weight: var(--weight-heavy); font-variant-numeric: tabular-nums; }
.bid-row__meta { color: var(--text-2); font-size: var(--text-xs); }

/* =====================================================================
   14. АДМИНКА (телефон-first, компактно)
   ===================================================================== */
.admin-wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 10px) var(--gutter) calc(var(--s-10) + var(--safe-bottom));
  display: grid;
  gap: var(--s-4);
  align-content: start;
}

.admin-appbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: 4px;
}
.admin-appbar h1 {
  font-size: var(--text-2xl);
  line-height: var(--lh-2xl);
}
.admin-appbar__sub {
  margin-top: 2px;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--text-2);
}

.admin-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--pill-new-bg);
  color: var(--pill-new-fg);
  font-size: var(--text-2xs);
  font-weight: var(--weight-heavy);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.admin-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline: calc(var(--gutter) * -1);
  padding: 2px var(--gutter);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  padding-top: 8px;
  padding-bottom: 8px;
  margin-top: -8px;
}
.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tab,
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap-min);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: var(--weight-bold);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.admin-tab.is-active,
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.admin-tab__count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--rose-soft);
  color: var(--pill-new-fg);
  font-size: 16px;
  font-weight: var(--weight-heavy);
}
.admin-tab.is-active .admin-tab__count {
  background: var(--accent-contrast);
  color: var(--accent);
}

.admin-panel { display: grid; gap: var(--s-3); }
.admin-panel[hidden] { display: none; }

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.admin-toolbar h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: var(--lh-lg);
}

.admin-order { padding: var(--s-3) var(--s-4); gap: 10px; }

.admin-order__contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.admin-order__contact a {
  font-weight: var(--weight-heavy);
  color: var(--text);
  text-decoration: none;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: var(--s-1);
}
.admin-actions .btn { min-height: var(--tap-min); padding: 0 10px; font-size: var(--text-sm); }
.admin-actions .btn--wide { grid-column: 1 / -1; }

.admin-product {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.admin-product__info { flex: 1 1 auto; min-width: 0; }
.admin-product__title {
  font-size: var(--text-sm);
  line-height: 1.35;
  font-weight: var(--weight-heavy);
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.admin-product__meta {
  margin-top: 3px;
  color: var(--text-2);
  font-size: var(--text-xs);
  line-height: 1.4;
}
.admin-product__actions { display: flex; gap: 2px; flex: 0 0 auto; }
.admin-product__actions .icon-btn { width: 40px; height: 40px; }

.admin-thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--media-ph);
}
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }

.admin-category {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.admin-category__name { flex: 1 1 auto; font-weight: var(--weight-bold); font-size: var(--text-sm); }
.admin-category__slug { color: var(--text-2); font-size: var(--text-xs); }

.admin-form-card {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-empty {
  padding: var(--s-6) var(--s-4);
  text-align: center;
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: 1.5;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
}

/* =====================================================================
   15. УТИЛИТЫ И АНИМАЦИИ
   ===================================================================== */
.stack { display: grid; gap: var(--s-3); }
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.divider {
  height: 1px;
  background: var(--divider);
  border: 0;
  margin: var(--s-2) 0;
}
.text-center { text-align: center; }

@keyframes cozy-shimmer {
  100% { transform: translateX(100%); }
}
@keyframes cozy-sheet-in {
  from { transform: translateY(18px); opacity: 0.6; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes cozy-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(127, 93, 30, 0.18); }
  50%      { box-shadow: 0 0 0 5px rgba(127, 93, 30, 0.06); }
}
@keyframes cozy-nudge {
  0%, 70%, 100% { transform: translateY(0); }
  80%           { transform: translateY(-2px); }
}
@keyframes cozy-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================================================
   16. АДАПТИВ / НИЗКИЕ ЭКРАНЫ
   ===================================================================== */
@media (max-height: 700px) {
  :root {
    --appbar-h: 48px;
    --rail-h: 46px;
    --catalog-chrome-h: calc(
      var(--appbar-h) + var(--safe-top) + var(--rail-h) + var(--safe-bottom) + 46px
    );
  }
  .brand__mark { width: 32px; height: 32px; }
  .brand__name { font-size: 18px; }
  .feed-card__title { font-size: 19px; line-height: 25px; }
  .feed-card__price { font-size: 18px; line-height: 24px; }
  .feed-card__hint { display: none; }
}

@media (max-width: 359px) {
  :root { --gutter: 12px; }
  .feed-card__title { font-size: 19px; line-height: 25px; }
  .cta-bar .btn { min-width: 140px; }
}

@media (min-width: 600px) {
  .app-shell,
  .view-shell,
  .catalog-view {
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
  }
}

/* Печать не нужна */
@media print {
  .cta-bar, .appbar, .category-rail { display: none !important; }
}
