/* ==========================================================================
   Кальянная · Telegram Mini App — стили
   Мобильный-first, тёмная тема по умолчанию.
   Цвета берутся из CSS-переменных Telegram, значения по умолчанию — тёмные.
   ========================================================================== */

/* ---------- 1. Токены темы ---------- */
:root {
  /* Значения по умолчанию (тёмная тема). Telegram переопределяет эти
     переменные инлайново на <html>, поэтому дальше везде используется var(). */
  --tg-theme-bg-color: #17212b;
  --tg-theme-text-color: #f2f5f8;
  --tg-theme-button-color: #2ea6ff;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #212d3b;
  --tg-theme-hint-color: #8b98a5;
  --tg-theme-link-color: #62bcf9;
  --tg-theme-destructive-text-color: #ff6b6b;

  --bg: var(--tg-theme-bg-color, #17212b);
  --text: var(--tg-theme-text-color, #f2f5f8);
  --button: var(--tg-theme-button-color, #2ea6ff);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #212d3b);
  --hint: var(--tg-theme-hint-color, #8b98a5);
  --link: var(--tg-theme-link-color, #62bcf9);
  --danger: var(--tg-theme-destructive-text-color, #ff6b6b);

  --ok: #34c77b;
  --warn: #f0b429;
  --accent-2: #a06bff;
  /* Использовалась в оформлении, но не была объявлена: подсветка строк
     и цвет «+» молча не работали */
  --accent: var(--button);

  --card: color-mix(in srgb, var(--secondary-bg) 88%, var(--text) 12%);
  --card-2: color-mix(in srgb, var(--secondary-bg) 72%, var(--text) 28%);
  --line: color-mix(in srgb, var(--hint) 26%, transparent);
  --line-soft: color-mix(in srgb, var(--hint) 16%, transparent);
  --hover: color-mix(in srgb, var(--hint) 14%, transparent);

  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --radius-pill: 999px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, .22);

  --tabbar-h: 58px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --app-height: 100vh;

  --fs-xs: 11px;
  --fs-s: 13px;
  --fs-m: 15px;
  --fs-l: 17px;
  --fs-xl: 21px;
}

/* Резервный вариант для браузеров без color-mix */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --card: var(--secondary-bg);
    --card-2: var(--secondary-bg);
    --line: rgba(139, 152, 165, .3);
    --line-soft: rgba(139, 152, 165, .18);
    --hover: rgba(139, 152, 165, .16);
  }
}

/* ---------- 2. Сброс и базовая типографика ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-m);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; overscroll-behavior-y: none; }

h1, h2, h3, h4, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

.hidden { display: none !important; }
.muted { color: var(--hint); }
.nowrap { white-space: nowrap; }

::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- 3. Каркас приложения ---------- */
.app {
  position: relative;
  height: var(--app-height);
  max-height: var(--app-height);
  overflow: hidden;
  background: var(--bg);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: var(--safe-top);
}

.screen--center {
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  overflow-y: auto;
}

.views {
  position: relative;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 0 14px calc(var(--tabbar-h) + var(--safe-bottom) + 22px);
}

.view { display: none; padding-top: 4px; }
.view.is-active { display: block; animation: fadeIn .18s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 4. Верхняя панель ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}

.topbar__left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__logo { font-size: 22px; line-height: 1; }
.topbar__titles { display: flex; flex-direction: column; min-width: 0; }
.topbar__title { font-size: var(--fs-l); font-weight: 700; letter-spacing: .2px; }
.topbar__sub { font-size: var(--fs-xs); color: var(--hint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.pill {
  font-size: var(--fs-xs);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--hint);
  white-space: nowrap;
}
.pill--ai { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.pill--dev { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* ---------- 5. Нижняя навигация ---------- */
.tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 6px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--secondary-bg) 92%, var(--bg));
  border-top: 1px solid var(--line-soft);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 46px;
  padding: 4px 2px;
  background: none;
  border: 0;
  border-radius: var(--radius-m);
  color: var(--hint);
  transition: color .15s ease, background .15s ease;
}
.tab.is-active { color: var(--button); background: var(--hover); }
.tab__icon { font-size: 19px; line-height: 1; }
.tab__label { font-size: 10px; font-weight: 600; letter-spacing: .1px; }

.tab__badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(20px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--button);
  color: var(--button-text);
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

/* ---------- 6. Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  background: var(--card-2);
  color: var(--text);
  font-size: var(--fs-m);
  font-weight: 600;
  transition: transform .06s ease, opacity .15s ease, background .15s ease;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn--primary { background: var(--button); color: var(--button-text); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--soft { background: var(--hover); }
.btn--danger { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn--sm { min-height: 36px; padding: 7px 12px; font-size: var(--fs-s); width: auto; }
.btn--block { width: 100%; }
.btn--icon { width: 38px; min-height: 38px; padding: 0; font-size: 17px; }
.btn--row { display: flex; gap: 8px; }
.btn--row > .btn { flex: 1 1 0; }

/* В Telegram кнопку оформления дублирует MainButton — прячем встроенную */
body.has-main-button .js-inline-submit { display: none; }

/* ---------- 7. Карточки и блоки ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  padding: 12px;
  margin-bottom: 10px;
}
.card--tap { transition: background .15s ease; }
.card--tap:active { background: var(--hover); }
.card--flat { background: transparent; border-color: var(--line-soft); }

.section { margin-bottom: 16px; }
.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 10px;
}
.section__title { font-size: var(--fs-l); font-weight: 700; }
.section__hint { font-size: var(--fs-xs); color: var(--hint); }

.view__head { padding: 12px 2px 6px; }
.view__title { font-size: var(--fs-xl); font-weight: 800; letter-spacing: .2px; }
.view__sub { font-size: var(--fs-s); color: var(--hint); margin-top: 2px; }

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

/* ---------- 8. Поиск, чипы, переключатели ---------- */
.input, .textarea, .select {
  width: 100%;
  padding: 11px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--button); }
.input::placeholder, .textarea::placeholder { color: var(--hint); }
.textarea { min-height: 84px; resize: vertical; }

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search__icon { position: absolute; left: 12px; font-size: 14px; color: var(--hint); pointer-events: none; }
.search .input { padding-left: 34px; padding-right: 34px; }
.search__clear {
  position: absolute; right: 6px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: var(--hover); color: var(--hint); font-size: 13px;
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips--wrap { flex-wrap: wrap; overflow: visible; }
.chips--strength { gap: 6px; margin-top: 2px; }
.chips--strength .chip { padding: 8px 12px; }

.chip {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-s);
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chip.is-active { background: var(--button); border-color: var(--button); color: var(--button-text); font-weight: 600; }
.chip--mini { padding: 2px 8px; font-size: var(--fs-xs); color: var(--hint); }
.chip--suggest { text-align: left; white-space: normal; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-s);
  color: var(--hint);
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  width: 40px; height: 24px;
  border-radius: var(--radius-pill);
  background: var(--hover);
  border: 1px solid var(--line);
  position: relative;
  transition: background .18s ease;
  flex: 0 0 auto;
}
.switch__track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--hint);
  transition: transform .18s ease, background .18s ease;
}
.switch input:checked + .switch__track { background: color-mix(in srgb, var(--button) 40%, transparent); border-color: var(--button); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: var(--button); }
.switch__label { color: var(--text); }

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
}
.segmented__item {
  padding: 9px 6px;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--hint);
  font-size: var(--fs-s);
  font-weight: 600;
  text-align: center;
  transition: background .15s ease, color .15s ease;
}
.segmented__item.is-active { background: var(--button); color: var(--button-text); }

/* ---------- 9. Каталог ---------- */
.catalog-toolbar { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 10px; }
.catalog-toolbar__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand-row__name { font-size: var(--fs-m); font-weight: 700; }
.brand-row__meta { font-size: var(--fs-s); color: var(--hint); margin-top: 2px; }
.brand-row__chevron { color: var(--hint); font-size: 18px; }

.flavor__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.flavor__title { display: flex; flex-direction: column; min-width: 0; }
.flavor__name { font-size: var(--fs-m); font-weight: 700; }
.flavor__brand { font-size: var(--fs-xs); color: var(--hint); text-transform: uppercase; letter-spacing: .4px; }
.flavor__desc { font-size: var(--fs-s); color: var(--hint); margin-top: 6px; }
.flavor__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.flavor__actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.flavor__actions .btn--sm { margin-left: auto; }
.flavor--out .flavor__name { color: var(--hint); }

.badge {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}
.badge--ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge--off { color: var(--hint); background: var(--hover); border-color: var(--line); }
.badge--warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge--done { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.badge--off2 { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

.count-line { font-size: var(--fs-xs); color: var(--hint); padding: 2px 2px 8px; }

/* ---------- 10. ИИ-подбор ---------- */
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px;
  margin: 8px 0 14px;
  border-radius: var(--radius-l);
  background: linear-gradient(135deg, color-mix(in srgb, var(--button) 26%, var(--card)), color-mix(in srgb, var(--accent-2) 24%, var(--card)));
  border: 1px solid var(--line-soft);
}

.chat { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 8px; }

.bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: var(--radius-l);
  font-size: var(--fs-m);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: fadeIn .18s ease;
}
.bubble--user {
  align-self: flex-end;
  background: var(--button);
  color: var(--button-text);
  border-bottom-right-radius: 6px;
}
.bubble--assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-bottom-left-radius: 6px;
}
.bubble--note { align-self: flex-start; background: transparent; border: 1px dashed var(--line); color: var(--hint); font-size: var(--fs-s); }
.bubble--typing { display: inline-flex; gap: 4px; align-items: center; }
.bubble--typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--hint);
  animation: blink 1.2s infinite ease-in-out;
}
.bubble--typing i:nth-child(2) { animation-delay: .2s; }
.bubble--typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.rec {
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius-m);
  background: color-mix(in srgb, var(--secondary-bg) 70%, var(--bg));
  border: 1px solid var(--line);
}
.rec__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rec__title { font-size: var(--fs-l); font-weight: 800; }
.rec__mix { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.rec__item { display: flex; flex-direction: column; gap: 4px; }
.rec__item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rec__item-name { font-weight: 600; font-size: var(--fs-s); }
.rec__item-brand { font-size: var(--fs-xs); color: var(--hint); text-transform: uppercase; }
.rec__reason { font-size: var(--fs-xs); color: var(--hint); }
.rec__expl { font-size: var(--fs-s); color: color-mix(in srgb, var(--text) 88%, transparent); }
.rec__block { margin-top: 10px; }
.rec__block-title { font-size: var(--fs-xs); font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.rec__alt { font-size: var(--fs-s); padding: 6px 0; border-top: 1px solid var(--line-soft); }
.rec__alt--action {
  display: block; width: 100%; text-align: left;
  background: transparent; border-left: 0; border-right: 0; border-bottom: 0;
  color: inherit; font: inherit; cursor: pointer; padding: 8px 0;
  transition: background .15s ease;
}
.rec__alt--action:active { background: var(--hover); }
.rec__alt-hint { margin-top: 2px; font-size: var(--fs-xs); color: var(--button); }
.sheet__subtitle { margin: 14px 0 6px; font-size: var(--fs-s); color: var(--hint); }
.rec__strength { margin-top: 6px; font-size: var(--fs-s); color: var(--hint); }
.rec__analysis { font-size: var(--fs-s); color: var(--hint); line-height: 1.5; }
.rec__hint { margin-top: 10px; font-size: var(--fs-s); padding: 8px 10px; border-radius: var(--radius-s); background: var(--hover); color: var(--hint); }
.rec__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.share { display: flex; align-items: center; gap: 8px; }
.share__bar { flex: 1 1 auto; height: 6px; border-radius: var(--radius-pill); background: var(--hover); overflow: hidden; }
.share__bar > span { display: block; height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--button), var(--accent-2)); }
.share__val { font-size: var(--fs-xs); color: var(--hint); min-width: 34px; text-align: right; }

/* Плашка ввода вынесена из потока прокрутки: контент скроллится ПОД ней,
   а запас снизу (padding у #view-ai) не даёт тексту прятаться за плашкой. */
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  z-index: 30;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 14px;
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
  transition: transform .22s ease, opacity .22s ease;
}
#view-ai { padding-bottom: 82px; }
.composer--hidden {
  transform: translateY(130%);
  opacity: 0;
  pointer-events: none;
}
.composer .input { border-radius: var(--radius-l); }
.composer__send { flex: 0 0 auto; width: 46px; min-height: 46px; padding: 0; font-size: 18px; }

/* ---------- 11. Микс ---------- */
.mix-item { display: flex; align-items: center; gap: 10px; }
.mix-item__info { flex: 1 1 auto; min-width: 0; }
.mix-item__name { font-weight: 600; }
/* Карточка кальяна: активная подсвечена, тап переключает */
.mix-summary { cursor: pointer; }
.mix-summary--active {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
}
.mix-summary__empty { font-size: var(--fs-s); color: var(--hint); }
.mix-summary__drop {
  align-self: flex-start; border: 0; background: transparent;
  color: var(--hint); font: inherit; font-size: var(--fs-s);
  padding: 0; cursor: pointer; text-decoration: underline;
}
/* Весь микс одной карточкой — компактно, чтобы не занимал пол-экрана */
.mix-summary { display: flex; flex-direction: column; gap: 6px; }
.mix-summary__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.mix-summary__title {
  font-weight: 700; font-size: var(--fs-m); line-height: 1.25;
}
.mix-summary__strength { font-size: var(--fs-s); color: var(--hint); flex-shrink: 0; }
.mix-summary__parts {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 2px 12px; font-size: var(--fs-s);
}
.mix-part { display: inline-flex; align-items: baseline; gap: 4px; }
.mix-part--gone .mix-part__name { color: #e06666; }
.mix-part__share {
  font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text);
}
.mix-part__name { color: color-mix(in srgb, var(--text) 82%, transparent); }
.mix-part__remove {
  border: 0; background: transparent; color: var(--hint); font: inherit;
  font-size: 11px; line-height: 1; padding: 0 0 0 2px; cursor: pointer;
}
.mix-item__pct {
  font-variant-numeric: tabular-nums; font-weight: 700;
  color: var(--hint); flex-shrink: 0; margin-right: 4px;
}
.mix-item__meta { font-size: var(--fs-xs); color: var(--hint); }
.mix-total-box { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.mix-total { font-size: var(--fs-s); color: var(--hint); text-align: center; }
.mix-total--over { color: #e0a03a; font-weight: 600; }
/* Дорожка заливается синим до текущего значения (--mix-fill ставит JS) */

.field { margin-bottom: 14px; }
.field__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.field__label { font-size: var(--fs-s); font-weight: 600; }
.field__value { font-size: var(--fs-s); color: var(--hint); }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper__btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.stepper__btn[disabled] { opacity: .4; pointer-events: none; }
.stepper__val { min-width: 44px; text-align: center; font-size: var(--fs-l); font-weight: 700; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: var(--radius-pill);
  background: var(--hover);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px; margin-top: -9px;
  border-radius: 50%;
  background: var(--button);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: var(--radius-pill); background: var(--hover); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 3px solid var(--bg); border-radius: 50%; background: var(--button); }

.price-box {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-m);
  background: var(--card);
  border: 1px solid var(--line-soft);
}
.price-box__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.price-box__label { font-size: var(--fs-s); color: var(--hint); }
.price-box__value { font-size: var(--fs-xl); font-weight: 800; }
.price-box__parts { font-size: var(--fs-s); color: var(--hint); }
.price-box__hint { font-size: var(--fs-s); color: var(--hint); font-style: italic; }

.note--err { color: #e06666; }
.note {
  font-size: var(--fs-s);
  color: var(--hint);
  padding: 9px 11px;
  border-radius: var(--radius-s);
  background: var(--hover);
  margin-top: 8px;
}

/* ---------- 12. Заказы ---------- */
.order__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.order__id { font-weight: 800; }
.order__meta { font-size: var(--fs-xs); color: var(--hint); margin-top: 2px; }
.order__mix { margin: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.order__mix-row { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-s); }
.order__mix-row span:last-child { color: var(--hint); }
.order__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.order__price { font-weight: 700; }
.order__actions { display: flex; gap: 8px; margin-top: 10px; }
.order__actions .btn { flex: 1 1 0; }

.ptr {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height .18s ease;
  color: var(--hint);
  font-size: var(--fs-xs);
}
.ptr--armed { color: var(--button); }

/* ---------- 13. Профиль ---------- */
.profile-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 52px; height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: var(--hover);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: var(--hint);
}
.profile-head__name { font-size: var(--fs-l); font-weight: 700; }
.profile-head__meta { font-size: var(--fs-s); color: var(--hint); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat {
  padding: 10px 12px;
  border-radius: var(--radius-m);
  background: var(--card);
  border: 1px solid var(--line-soft);
}
.stat__value { font-size: var(--fs-xl); font-weight: 800; }
.stat__label { font-size: var(--fs-xs); color: var(--hint); }
.stat--wide { grid-column: 1 / -1; }

/* Длинные значения (направления, дата) — мельче и аккуратнее: крупный
   шрифт растягивал плашку на несколько строк */
.stat--wide .stat__value {
  font-size: var(--fs-s);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .1px;
}

/* Плашка «Последний заказ» — нажимается и открывает состав */
.stat--link {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
.stat--link:hover { border-color: var(--accent); }
.stat--link:active { transform: scale(.99); }
.stat--link .stat__label { color: var(--accent); }

/* Названия брендов: спокойный, но заметный шрифт — не гигантский и без переносов */
.stat--brands .stat__value {
  font-size: var(--fs-m);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: .2px;
}

/* Оценка заказа: 👍 нравится / 👎 не нравится */
.order__rating { margin: 10px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.order__rating--sheet { margin: 4px 0 10px; }
.order__rating-title { font-size: var(--fs-s); font-weight: 600; }
.order__rating-row { display: flex; gap: 8px; }
.order__rating-row .btn { flex: 1; }
.order__rating-note { font-size: var(--fs-xs); color: var(--hint); }

/* Вертикальный список внутри шторки */
.stack { display: flex; flex-direction: column; gap: 10px; }

.pref-list { display: flex; flex-wrap: wrap; gap: 6px; }
.btn--off, .btn--off:disabled {
  opacity: 0.55; color: var(--hint); cursor: not-allowed;
}
/* Поиск в миксе: выпадающая панель под полем, как автоподсказки */
.mix-search__field { position: relative; }
.mix-search__panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  max-height: 46vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-m); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 6px;
}
.mix-search__status { font-size: var(--fs-s); color: var(--hint); padding: 8px 10px; }
.mix-search__empty { font-size: var(--fs-s); color: var(--hint); padding: 10px; }
.mix-search__results { display: flex; flex-direction: column; }
.mix-search__title {
  font-size: 11px; font-weight: 700; color: var(--hint);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 8px 10px 4px;
}
.mix-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.mix-row:hover, .mix-row:active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.mix-row__main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.mix-row__head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mix-row__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mix-row__brand { font-size: var(--fs-s); color: var(--hint); flex-shrink: 0; }
.mix-row__reason {
  font-size: var(--fs-s); color: var(--hint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mix-row__add { font-weight: 800; color: var(--accent); flex-shrink: 0; }
.mix-row__add--off { color: var(--hint); font-weight: 600; font-size: var(--fs-s); }
.mix-card {
  padding: 10px; border-radius: var(--radius-m);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px;
}
.mix-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mix-card__title { font-weight: 700; }
.mix-card__strength { font-size: var(--fs-s); color: var(--hint); flex-shrink: 0; }
.mix-card__parts { display: flex; flex-wrap: wrap; gap: 6px; }
.mix-card__part {
  font-size: var(--fs-s); padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.mix-search__combo {
  padding: 10px; border-radius: var(--radius-m);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  display: flex; flex-direction: column; gap: 8px;
}
.mix-search__combo-title { font-weight: 700; }
.mix-search__combo-mix { display: flex; flex-wrap: wrap; gap: 6px; }
.mix-search__combo-note { font-size: var(--fs-s); color: var(--hint); line-height: 1.45; }
.mood { padding: 4px 2px 12px; }
.mood__title { font-size: var(--fs-l); font-weight: 800; margin-bottom: 6px; }
.mood__text { font-size: var(--fs-s); color: var(--hint); line-height: 1.45; margin-bottom: 14px; }
.mood__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mood__item {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px; border-radius: var(--radius-m);
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; cursor: pointer;
}
.mood__item:active { transform: scale(0.98); }
.mood__emoji { font-size: 24px; line-height: 1; }
.mood__body { display: flex; flex-direction: column; gap: 2px; }
.mood__name { font-weight: 700; font-size: var(--fs-m); }
.mood__hint { font-size: var(--fs-s); color: var(--hint); }
.catalog-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 4px 0 12px; font-size: var(--fs-s);
}
.prefs-status { min-height: 20px; text-align: center; font-size: var(--fs-s); color: var(--hint); }
.prefs-status--saving { color: var(--hint); }
.prefs-status--ok { color: var(--ok); }
.prefs-status--err { color: #e06666; }
.pref-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  font-size: var(--fs-s);
}
.pref-tag button {
  width: 20px; height: 20px; border: 0; border-radius: 50%;
  background: var(--hover); color: var(--hint); font-size: 11px; line-height: 1;
}

/* ---------- 14. Служебные состояния ---------- */
.boot { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.boot__logo { font-size: 44px; }
.boot__title { font-size: var(--fs-xl); font-weight: 800; }
.boot__text { color: var(--hint); font-size: var(--fs-s); max-width: 280px; }

.spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--button);
  animation: spin .8s linear infinite;
  margin-top: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.state-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 18px;
  border-radius: var(--radius-l);
  background: var(--card);
  border: 1px solid var(--line-soft);
  text-align: center;
  box-shadow: var(--shadow-soft);
}
.state-card__icon { font-size: 34px; }
.state-card__title { font-size: var(--fs-l); font-weight: 800; }
.state-card__text { font-size: var(--fs-s); color: var(--hint); }
.state-card__hint { font-size: var(--fs-xs); color: var(--hint); min-height: 14px; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 34px 18px;
  text-align: center;
  color: var(--hint);
}
.empty__icon { font-size: 34px; }
.empty__title { color: var(--text); font-weight: 700; }
.empty__text { font-size: var(--fs-s); max-width: 300px; }

/* Скелетоны загрузки */
.skel-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.skel-card {
  padding: 14px 12px;
  border-radius: var(--radius-m);
  background: var(--card);
  border: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 8px;
}
.skel { border-radius: 6px; background: linear-gradient(90deg, var(--hover), color-mix(in srgb, var(--hint) 22%, transparent), var(--hover)); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.skel--line { height: 12px; }
.skel--w70 { width: 70%; }
.skel--w45 { width: 45%; }
.skel--w30 { width: 30%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- 15. Тост ---------- */
.toast-root {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
  z-index: 60;
}
.toast {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-m);
  background: color-mix(in srgb, var(--secondary-bg) 88%, var(--text) 12%);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-s);
  box-shadow: var(--shadow);
  animation: toastIn .18s ease;
}
.toast--err { border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: var(--danger); }
.toast--ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 16. Нижняя шторка и модальные окна ---------- */
.sheet-root, .modal-root { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.sheet-root.is-open, .modal-root.is-open { pointer-events: auto; }

.backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity .2s ease;
}
.is-open .backdrop { opacity: 1; }

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-top-left-radius: var(--radius-l);
  border-top-right-radius: var(--radius-l);
  border-top: 1px solid var(--line);
  transform: translateY(102%);
  transition: transform .22s ease;
  padding-bottom: var(--safe-bottom);
}
.is-open .sheet { transform: none; }
.sheet__grab { width: 38px; height: 4px; border-radius: var(--radius-pill); background: var(--line); margin: 8px auto 4px; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 16px 10px; border-bottom: 1px solid var(--line-soft); }
.sheet__title { font-size: var(--fs-l); font-weight: 700; }
.sheet__body { padding: 14px 16px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.modal {
  position: absolute;
  left: 50%; top: 50%;
  width: calc(100% - 40px);
  max-width: 360px;
  transform: translate(-50%, -46%) scale(.96);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 18px 16px 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.is-open .modal { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal__icon { font-size: 38px; }
.modal__title { font-size: var(--fs-l); font-weight: 800; margin-top: 6px; }
.modal__text { font-size: var(--fs-s); color: var(--hint); margin-top: 8px; }
.modal__price { font-size: 26px; font-weight: 800; margin-top: 10px; }
.modal__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.toast-root, .sheet-root, .modal-root { padding-bottom: 0; }

@media (min-width: 620px) {
  .views { padding-left: 0; padding-right: 0; }
  .view { max-width: 620px; margin: 0 auto; }
  .topbar { padding-left: 18px; padding-right: 18px; }
}
