:root{
  --aiaa-top: 0px;
  --aiaa-z: 999999;
  --aiaa-radius: 16px;
  --aiaa-shadow: 0 20px 60px rgba(0,0,0,.25);
  --aiaa-border: rgba(0,0,0,.12);
}

/* ===== FAB (плавающая кнопка) ===== */
#aiaa-fab.aiaa-fab{
  position: fixed !important;
  right: 16px !important;
  bottom: 85px !important;
  z-index: calc(var(--aiaa-z) + 2) !important;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid var(--aiaa-border);
  background: #111;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.aiaa-fab__icon{
  font-size: 20px;
  line-height: 1;
}

/* ===== Overlay (ниже шапки) ===== */
#aiaa-overlay.aiaa-overlay{
  position: fixed !important;
  left: 0;
  right: 0;
  top: var(--aiaa-top) !important;
  height: calc(100vh - var(--aiaa-top)) !important;
  z-index: var(--aiaa-z) !important;
  display: none;
  background: rgba(0,0,0,.35);
  padding: 12px;
  box-sizing: border-box;
}

html.aiaa-open #aiaa-overlay.aiaa-overlay{
  display: block;
}

/* ===== Panel ===== */
.aiaa-panel{
  height: 100%;
  width: 100%;
  background: #fff;
  border-radius: var(--aiaa-radius);
  box-shadow: var(--aiaa-shadow);
  border: 1px solid var(--aiaa-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;

  /* Убиваем влияние тем */
  color: #111 !important;
}

/* ===== Top bar ===== */
.aiaa-panel__top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  background: #fff;
}
.aiaa-title__name{
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: #111 !important;
}
.aiaa-title__sub{
  font-size: 12px;
  opacity: .7;
  margin-top: 2px;
  color: #111 !important;
}

.aiaa-close{
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ===== Messages ===== */
.aiaa-messages{
  flex: 1;
  overflow: auto;
  padding: 14px;
  background: #fafafa;

  /* гарантируем читаемость */
  color: #111 !important;
}

.aiaa-msg{
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  margin: 0 0 10px 0;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  font-size: 14px;
  line-height: 1.35;
  color: #111 !important;
}

.aiaa-msg--assistant{
  margin-right: auto;
  background: #fff;
  color: #111 !important;
}

.aiaa-msg--user{
  margin-left: auto;
  background: #111;
  color: #fff !important;
  border-color: rgba(255,255,255,.12);
}

/* ===== Input bar (липнет к низу, не "создаёт пространство") ===== */
.aiaa-form{
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
}

.aiaa-input{
  flex: 1;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.14);
  outline: none;
  color: #111 !important;
  background: #fff !important;
}

.aiaa-send{
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.14);
  background: #111;
  color: #fff;
  cursor: pointer;
}

@media (max-width: 380px){
  .aiaa-title__sub{ display:none; }
  .aiaa-send{ padding: 0 10px; }
}

/* Когда чат открыт — плавающую кнопку прячем (она "за чатом") */
html.aiaa-open #aiaa-fab.aiaa-fab{
  display: none !important;
}



/* Карточки товаров в чате */
/* ===== GRID товаров в чате ===== */
.aiaa-products{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 10px 0 14px;
}

@media (max-width: 640px){
  .aiaa-products{
    grid-template-columns: 1fr;
  }
}

.aiaa-card{
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  grid-template-rows: 140px auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}

.aiaa-card__img{
  display: block;
  width: 100%;
  height: 140px;
  background: #f2f2f2;
  text-decoration: none !important;
}

.aiaa-card__img img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.aiaa-card__body{
  padding: 12px;
  display: grid;
  gap: 10px;
}

.aiaa-card__title{
  font-size: 13px;
  line-height: 1.25;
  font-weight: 700;
  color: #111 !important;
  text-decoration: none !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
}

.aiaa-card__meta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.aiaa-card__price{
  font-weight: 800;
  font-size: 13px;
  color: #111 !important;
}

.aiaa-card__stock{
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  background: #fafafa;
  color: #111 !important;
  white-space: nowrap;
}
.aiaa-card__stock.is-in{ opacity: .85; }
.aiaa-card__stock.is-out{ opacity: .6; }

.aiaa-card__actions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.aiaa-card__btn{
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.14);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  user-select: none;
  color: #111 !important;
  background: #fff;
}

.aiaa-card__btn--primary{
  background: #111;
  color: #fff !important;
  border-color: rgba(0,0,0,.14);
}

.aiaa-card__btn--ghost{
  background: #fff;
  color: #111 !important;
}

.aiaa-card__btn:disabled{
  opacity: .7;
  cursor: default;
}

/* под услуги: скрыть бейдж наличия (если не нужен) */
.aiaa-card__stock{ display:none; }

/* цена крупнее */
.aiaa-card__price{ font-size: 15px; }

/* кнопка как call-to-action */
.aiaa-card__btn--primary{ background:#000; color:#fff !important; }

/* ===== AIAA: products grid responsive ===== */

/* Пытаемся поймать контейнер карточек разными селекторами */
.aiaa-products,
.aiaa-products-grid,
.aiaa-products-list,
#aiaa-products,
.aiaa-chat .products,
.aiaa-chat .product-grid {
  display: grid;
  gap: 14px;
  align-items: stretch;
}

/* Desktop: 3–4 колонки (адаптивно по ширине) */
@media (min-width: 1024px) {
  .aiaa-products,
  .aiaa-products-grid,
  .aiaa-products-list,
  #aiaa-products,
  .aiaa-chat .products,
  .aiaa-chat .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Laptop/Tablet: 3 колонки */
@media (min-width: 768px) and (max-width: 1023px) {
  .aiaa-products,
  .aiaa-products-grid,
  .aiaa-products-list,
  #aiaa-products,
  .aiaa-chat .products,
  .aiaa-chat .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Mobile: 2 колонки */
@media (max-width: 767px) {
  .aiaa-products,
  .aiaa-products-grid,
  .aiaa-products-list,
  #aiaa-products,
  .aiaa-chat .products,
  .aiaa-chat .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Карточки: чтобы красиво тянулись */
.aiaa-product,
.aiaa-product-card,
.aiaa-products > a,
.aiaa-products-grid > a,
.aiaa-chat .products > a,
.aiaa-chat .product-grid > a {
  min-width: 0;
}


/* ===== AIAA Products Grid: desktop 4, medium 3, mobile 2 ===== */
.aiaa-products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 1200px) {
  .aiaa-products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .aiaa-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* чтобы карточки выглядели ровнее */
.aiaa-product-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.aiaa-product-card img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  object-fit: cover;
}

