/* СТО Сочи — мини-приложение MAX.
   Палитра снята с сайта заказчика (переменные --ys-* на сто-сочи.рф): светлый фон, голубой
   бренд #3FA0E8, тёмно-серый текст, шрифт Onest. ⛔ Тёмную тему не возвращать — исходник светлый.
   Иконки — inline SVG, эмодзи нет (закон). Мобильная вёрстка, ширина контента 460 px. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ⛔ Обязательно: класс с `display` перебивает атрибут `hidden`, и скрытое окно висит
   на экране. Поймано 16.08.2026 — окно «Заявка принята» показывалось сразу при открытии. */
[hidden] { display: none !important; }

:root {
  --brand: #3FA0E8;
  --brand-deep: #1C74BE;
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --line: #E3E6EB;
  --text: #33333F;
  --muted: #7C8496;
  --danger: #F8604A;
  --radius: 18px;
  --tabs-h: 62px;
  --shadow: 0 2px 10px rgba(38, 52, 74, 0.06);
}

body {
  font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 34px);
}

svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* --- шапка --- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  max-width: 460px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
/* Логотип заказчика горизонтальный, нарисован на белом — фон шапки белый, подложка не нужна. */
.top-logo { height: 36px; width: auto; max-width: 150px; object-fit: contain; flex: none; }
.top-text { min-width: 0; flex: 1; }
.top-name { font-weight: 700; font-size: 0.875rem; letter-spacing: -0.01em; }
.top-sub { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Кнопка избранного в шапке: включает фильтр «только избранное» поверх текущей категории. */
.top-fav {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; cursor: pointer;
  background: #F2F4F7; border: 1px solid var(--line); color: var(--muted);
}
.top-fav svg { width: 19px; height: 19px; }
.top-fav.on { color: var(--danger); border-color: rgba(248, 96, 74, 0.4); background: rgba(248, 96, 74, 0.08); }
.top-fav.on svg { fill: var(--danger); }
.top-fav i {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 100px; background: var(--danger); color: #fff;
  font-style: normal; font-size: 0.625rem; font-weight: 700; line-height: 17px; text-align: center;
}
.top-call {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 6px 16px rgba(63, 160, 232, 0.30);
}
.top-call svg { width: 19px; height: 19px; }

/* --- экраны --- */
.screen { position: relative; z-index: 1; max-width: 460px; margin: 0 auto; padding: 16px; }

.lead { margin-bottom: 16px; }
.lead h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.lead p { font-size: 0.9375rem; color: var(--muted); line-height: 1.5; }

/* --- поиск и категории --- */
.search-row { position: relative; margin-bottom: 12px; }
.search-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
#q {
  width: 100%; padding: 13px 40px 13px 42px; font: inherit; font-size: 0.9375rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px;
}
#q::placeholder { color: var(--muted); }
#q:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(63, 160, 232, 0.16); }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: #EDEFF3; color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.search-clear svg { width: 14px; height: 14px; }

/* Категорий 4 — переносим на новую строку, а не прячем за край (владелец: «что за обрывки?»). */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 100px; font: inherit; font-size: 0.8125rem; font-weight: 600;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); cursor: pointer; white-space: nowrap;
}
.chip.on { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); border-color: transparent; }
.chip span { opacity: 0.6; font-weight: 500; }

.catalog-meta { font-size: 0.75rem; color: var(--muted); margin-bottom: 12px; }

/* --- сетка товаров --- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform 0.12s ease, border-color 0.2s ease;
}
.tile:active { transform: scale(0.985); border-color: var(--brand); }
.tile-img { position: relative; aspect-ratio: 1 / 1; background: #fff; }
.tile-img img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.tile-sale {
  position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 100px;
  background: var(--danger); color: #fff; font-size: 0.6875rem; font-weight: 700;
}
/* Избранное: сердечко на плитке и в карточке. Заливка появляется у .fav.on. */
.fav {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.9);
  color: #B4BAC6; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 1px 6px rgba(38, 52, 74, 0.14);
}
.fav svg { width: 17px; height: 17px; }
.fav.on { color: var(--danger); }
.fav.on svg { fill: var(--danger); }
.fav-card { position: static; width: 40px; height: 40px; flex: none; background: #F2F4F7; box-shadow: none; }
#toast { white-space: nowrap; }
.tile-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tile-name { font-size: 0.8125rem; line-height: 1.35; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile-vendor { font-size: 0.6875rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tile-price { margin-top: auto; display: flex; align-items: baseline; gap: 6px; }
.tile-price b { font-size: 0.9375rem; font-weight: 800; }
.tile-price s { font-size: 0.75rem; color: var(--muted); }

.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }

/* --- карточки-блоки --- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-title { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 12px; }

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 0.8125rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 0.9375rem; color: var(--text);
  background: #F7F8FA; border: 1px solid var(--line); border-radius: 12px;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px rgba(63, 160, 232, 0.16); }
.field input.bad, .field textarea.bad { border-color: var(--danger); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 0.75rem; color: var(--muted); line-height: 1.45; margin-top: 10px; }

.checks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.check {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #F7F8FA; cursor: pointer;
}
.check.on { border-color: var(--brand); background: rgba(63, 160, 232, 0.10); }
.check-box { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #C9CDD6; background: #fff; display: grid; place-items: center; }
.check.on .check-box { background: var(--brand); border-color: var(--brand); }
.check-box svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3; opacity: 0; }
.check.on .check-box svg { opacity: 1; }
.check-text { flex: 1; min-width: 0; }
.check-text b { display: block; font-size: 0.9375rem; font-weight: 600; }
.check-text i { display: block; font-style: normal; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.check-price { font-size: 0.875rem; font-weight: 700; color: var(--brand-deep); white-space: nowrap; }

.segmented { display: flex; gap: 6px; }
.segmented button {
  flex: 1; padding: 10px 6px; font: inherit; font-size: 0.8125rem; font-weight: 600;
  color: var(--text); background: #F7F8FA;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.segmented button.on { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); border-color: transparent; }

.btn {
  display: block; width: 100%; padding: 15px 20px; font: inherit; font-size: 1rem; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  border: 0; border-radius: 14px; cursor: pointer; text-align: center; text-decoration: none;
  box-shadow: 0 8px 20px rgba(28, 116, 190, 0.25); transition: transform 0.1s ease;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.6; }
.btn-ghost {
  display: block; width: 100%; margin-top: 14px; padding: 13px 20px; font: inherit; font-size: 0.9375rem; font-weight: 600;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
}
.link-btn { display: inline-block; margin-top: 8px; padding: 0; font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--brand-deep); background: none; border: 0; cursor: pointer; }
.agree { font-size: 0.6875rem; color: var(--muted); line-height: 1.45; margin-top: 12px; text-align: center; }

.picked { display: flex; gap: 12px; align-items: center; }
.picked img { width: 52px; height: 52px; border-radius: 10px; background: #fff; border: 1px solid var(--line); object-fit: contain; padding: 4px; flex: none; }
.picked b { display: block; font-size: 0.875rem; font-weight: 600; line-height: 1.35; }
.picked span { font-size: 0.8125rem; color: var(--brand-deep); font-weight: 700; }

/* --- контакты --- */
.contacts { padding: 6px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; text-decoration: none; color: inherit; }
.row:active { background: #F2F4F7; }
.row-ic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(63, 160, 232, 0.12); color: var(--brand-deep); }
.row-ic svg { width: 18px; height: 18px; }
.row b { display: block; font-size: 0.9375rem; font-weight: 600; }
.row i { display: block; font-style: normal; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.socials { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.socials a {
  padding: 12px; text-align: center; text-decoration: none; font-size: 0.875rem; font-weight: 600;
  color: var(--text); background: #F7F8FA; border: 1px solid var(--line); border-radius: 12px;
}
.foot { font-size: 0.6875rem; color: var(--muted); text-align: center; line-height: 1.5; padding: 4px 8px 8px; }

/* --- карточка товара и подтверждение --- */
.sheet { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
/* ⛔ Подложку не затемнять сильно и не размывать: на светлой теме это читается как «чернота». */
.sheet-back { position: absolute; inset: 0; background: rgba(51, 51, 63, 0.28); }
.sheet-body {
  position: relative; width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 30px rgba(38, 52, 74, 0.18);
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: sheetUp 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sheetUp { from { transform: translateY(28px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: #EDEFF3; color: var(--text); display: grid; place-items: center; cursor: pointer; z-index: 2;
}
.sheet-close svg { width: 16px; height: 16px; }

.prod-img { width: 100%; aspect-ratio: 4 / 3; background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 14px; }
.prod-img img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.prod-vendor { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.prod-name { font-size: 1.125rem; font-weight: 700; line-height: 1.3; margin: 4px 0 10px; }
.prod-price { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.prod-price b { font-size: 1.5rem; font-weight: 800; }
.prod-price s { color: var(--muted); }
.prod-desc { font-size: 0.875rem; line-height: 1.55; color: #4A4E5C; margin-bottom: 14px; white-space: pre-line; }
.specs { border-top: 1px solid var(--line); margin-bottom: 16px; }
.spec { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.8125rem; }
.spec span { color: var(--muted); }
.spec b { font-weight: 600; text-align: right; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }

.done-body { text-align: center; padding-top: 28px; }
.done-mark {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  display: grid; place-items: center; animation: pop 0.45s cubic-bezier(0.22, 1.4, 0.5, 1);
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.done-mark svg { width: 30px; height: 30px; stroke-width: 3; }
.done-body h2 { font-size: 1.25rem; font-weight: 800; margin-bottom: 8px; }
.done-body p { font-size: 0.9375rem; color: var(--muted); line-height: 1.55; margin-bottom: 18px; }

/* --- нижние вкладки: плавающая панель, активная вкладка — голубая таблетка --- */
.tabs {
  position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  z-index: 50; display: flex; gap: 4px;
  max-width: 436px; margin: 0 auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 10px 30px rgba(38, 52, 74, 0.16);
}
.tabs button {
  flex: 1; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: inherit; font-size: 0.625rem; font-weight: 600; color: var(--muted);
  background: none; border: 0; border-radius: 14px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tabs button svg { width: 21px; height: 21px; }
.tabs button.on {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 4px 12px rgba(28, 116, 190, 0.30);
}

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 24px); transform: translateX(-50%) translateY(12px);
  z-index: 200; max-width: 88vw; padding: 11px 18px; border-radius: 100px;
  background: #33333F; color: #fff; box-shadow: 0 8px 24px rgba(38, 52, 74, 0.25);
  font-size: 0.875rem; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.skeleton { background: linear-gradient(90deg, #EDEFF3, #F7F8FA, #EDEFF3); background-size: 200% 100%; animation: shine 1.2s linear infinite; border-radius: var(--radius); aspect-ratio: 3 / 4; }
@keyframes shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (min-width: 520px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
