/* Окно помощника ВАУ (SPEC-28 §7). Цвета — фирменные цвета шаблона wau_common. */
.wau-as-root {
  --as-ink: #363853;
  --as-ink-soft: #6c6d81;
  --as-gold: #ddcba4;
  --as-cream: #f9f6ef;
  --as-line: #ebecee;
  --as-white: #fff;
  --as-shadow: 0 12px 40px rgba(37, 39, 68, .18);
  font-family: Manrope, system-ui, sans-serif;
  color: var(--as-ink);
}

.wau-as-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9990;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--as-ink);
  color: var(--as-gold);
  box-shadow: var(--as-shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .15s ease;
}
.wau-as-launcher:hover { transform: scale(1.05); }
/* Новый ответ оператора, пока окно закрыто (SPEC-29). */
.wau-as-launcher--unread::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e5484d;
  border: 2px solid #fff;
}
.wau-as-launcher:focus-visible,
.wau-as-root button:focus-visible,
.wau-as-input:focus-visible { outline: 2px solid var(--as-gold); outline-offset: 2px; }

.wau-as-dialog {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 9991;
  width: 380px;
  height: min(600px, calc(100vh - 120px));
  background: var(--as-white);
  border-radius: 20px;
  box-shadow: var(--as-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wau-as-dialog[hidden] { display: none; }

/* Меню кнопки ВАУ: помощник, эксперт, мессенджеры RetailCRM */
.wau-as-menu {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 9991;
  width: 300px;
  max-width: calc(100vw - 28px);
  padding: 8px;
  background: var(--as-white);
  border-radius: 18px;
  box-shadow: var(--as-shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wau-as-menu[hidden] { display: none; }
.wau-as-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--as-ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.wau-as-menu-item:hover,
.wau-as-menu-item:focus-visible { background: var(--as-cream); color: var(--as-ink); text-decoration: none; }
.wau-as-menu-item:focus-visible { outline: 2px solid var(--as-gold); outline-offset: 0; }
.wau-as-menu-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.wau-as-menu-icon svg { display: block; }
.wau-as-menu-icon--bot { background: var(--as-gold); color: var(--as-ink); font-weight: 700; }
.wau-as-menu-icon--expert { background: var(--as-ink); color: var(--as-gold); }
.wau-as-menu-text { display: flex; flex-direction: column; font-size: 14px; font-weight: 600; line-height: 1.25; }
.wau-as-menu-text small { font-size: 12px; font-weight: 400; color: var(--as-ink-soft); }
.wau-as-operator[hidden] { display: none; }

.wau-as-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px 16px;
  background: var(--as-ink);
  color: var(--as-white);
}
.wau-as-avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--as-gold);
  color: var(--as-ink);
  display: grid;
  place-items: center;
  font-weight: 800;
}
.wau-as-titles { flex: 1; min-width: 0; }
.wau-as-title { font-weight: 700; font-size: 16px; line-height: 1.2; }
.wau-as-sub { font-size: 12px; opacity: .75; }
.wau-as-operator {
  flex: none;
  border: 1px solid rgba(221, 203, 164, .6);
  background: transparent;
  color: var(--as-gold);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.wau-as-close {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--as-white);
  padding: 4px;
  cursor: pointer;
}

.wau-as-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--as-cream);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}
/* Лента — flex-колонка с прокруткой: без этого дети сжимаются по высоте,
   и ряд карточек схлопывался в полоску. */
.wau-as-log > * { flex: none; }
.wau-as-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.wau-as-msg--bot { align-self: flex-start; background: var(--as-white); border-bottom-left-radius: 6px; }
.wau-as-msg--user { align-self: flex-end; background: var(--as-ink); color: var(--as-white); border-bottom-right-radius: 6px; }
.wau-as-msg--operator { align-self: flex-start; background: #fff7e8; border: 1px solid var(--as-gold); }
/* Ответ человека, а не ИИ: подпись над текстом (SPEC-29). */
.wau-as-msg--operator::before { content: 'Эксперт'; display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; color: #8a6d3b; }
.wau-as-msg--system { align-self: center; background: transparent; color: var(--as-ink-soft); font-size: 12px; text-align: center; }
.wau-as-msg a { color: inherit; text-decoration: underline; }

.wau-as-cards { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; align-self: stretch; scrollbar-width: thin; scrollbar-color: var(--as-gold) transparent; }
.wau-as-card {
  flex: none;
  width: 148px;
  background: var(--as-white);
  border-radius: 14px;
  padding: 8px;
  text-decoration: none;
  color: var(--as-ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--as-line);
}
.wau-as-card img { width: 100%; height: 110px; object-fit: contain; border-radius: 10px; background: var(--as-cream); }
.wau-as-card-name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.wau-as-card-price { font-size: 14px; font-weight: 700; }
.wau-as-card-old { font-size: 12px; color: var(--as-ink-soft); text-decoration: line-through; margin-left: 4px; font-weight: 400; }
.wau-as-card-out { font-size: 12px; color: var(--as-ink-soft); }

.wau-as-link { align-self: flex-start; font-size: 13px; color: var(--as-ink); }

.wau-as-rate { display: flex; gap: 6px; align-self: flex-start; margin-top: -4px; }
.wau-as-rate button {
  border: 1px solid var(--as-line);
  background: var(--as-white);
  border-radius: 999px;
  padding: 2px 9px;
  cursor: pointer;
  font-size: 13px;
}
.wau-as-rate button[aria-pressed="true"] { border-color: var(--as-ink); }

.wau-as-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--as-white); border-radius: 16px; }
.wau-as-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--as-ink-soft); animation: wau-as-dot 1.2s infinite; }
.wau-as-typing span:nth-child(2) { animation-delay: .2s; }
.wau-as-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes wau-as-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.wau-as-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: var(--as-white); }
.wau-as-chips:empty { display: none; }
.wau-as-chip {
  border: 1px solid var(--as-gold);
  background: var(--as-white);
  color: var(--as-ink);
  border-radius: 999px;
  padding: 6px 11px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.wau-as-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: var(--as-white); border-top: 1px solid var(--as-line); }
.wau-as-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--as-line);
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  max-height: 120px;
  color: var(--as-ink);
}
.wau-as-send {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--as-ink);
  color: var(--as-gold);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.wau-as-send:disabled { opacity: .5; cursor: default; }

.wau-as-note { margin: 0; padding: 0 14px 10px; font-size: 11px; color: var(--as-ink-soft); background: var(--as-white); }
.wau-as-note a { color: inherit; }

.wau-as-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 600px) {
  .wau-as-launcher { right: 14px; bottom: 14px; }
  .wau-as-menu { right: 14px; bottom: 84px; }
  .wau-as-dialog { inset: 0; width: auto; height: auto; border-radius: 0; }
  .wau-as-input { font-size: 16px; } /* иначе iOS увеличивает страницу при фокусе */
}

/* Нижнее меню сайта на телефоне и планшете (.js-hero-nav-mobile: 72 px и
   отступ 4 px, от 1024 px скрыто). Кнопка помощника стояла поверх его пятого
   пункта (прод, 28.09.2026) — теперь над меню, окно на планшете — над кнопкой. */
@media (max-width: 1023px) {
  body:has(.js-hero-nav-mobile) .wau-as-launcher { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  body:has(.js-hero-nav-mobile) .wau-as-menu { bottom: calc(158px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 601px) and (max-width: 1023px) {
  body:has(.js-hero-nav-mobile) .wau-as-dialog {
    bottom: calc(158px + env(safe-area-inset-bottom, 0px));
    height: min(600px, calc(100vh - 190px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .wau-as-launcher { transition: none; }
  .wau-as-typing span { animation: none; opacity: .6; }
}

/* Карточка заказа (SPEC-31) */
.wau-as-order { align-self: stretch; background: var(--as-white); border: 1px solid var(--as-line); border-radius: 14px; padding: 10px 13px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.wau-as-order-title { font-weight: 700; font-size: 14px; }
.wau-as-order-row { color: var(--as-ink); }
.wau-as-order .wau-as-link { margin-top: 2px; }

/* Корзина из чата (SPEC-32): карточка — ссылка на товар плюс кнопка */
.wau-as-card-link { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; flex: 1; }
.wau-as-cart {
  margin-top: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--as-ink);
  color: var(--as-gold);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  cursor: pointer;
}
.wau-as-cart--in { background: var(--as-white); color: var(--as-ink); border: 1px solid var(--as-ink); }
.wau-as-checkout { align-self: flex-start; font-weight: 600; }
