/* ТЦ «Дом» — ИИ-консультант: кнопка + панель чата. Классы с префиксом ai-, чтобы не задеть вёрстку сайта. */
.ai-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 9998;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, #f2b705, #e0a000); color: #1a1200;
  font: 600 16px/1 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .12) inset;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0, 0, 0, .42); }
.ai-fab b { font-size: 20px; line-height: 1; }
.ai-fab .ai-fab-txt { white-space: nowrap; }
.ai-fab.ai-hidden { display: none; }

.ai-panel {
  position: fixed; right: 18px; bottom: 86px; z-index: 9999;
  width: 392px; max-width: calc(100vw - 24px);
  height: 580px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #0d1220; color: #e9eef7;
  border: 1px solid rgba(242, 183, 5, .35); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  font: 15px/1.45 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.ai-panel[hidden] { display: none; }

.ai-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px;
  background: linear-gradient(135deg, #16203a, #101728);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.ai-ava {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  background: linear-gradient(135deg, #f2b705, #e0a000); color: #1a1200;
  display: grid; place-items: center; font-size: 19px;
}
.ai-title { flex: 1; min-width: 0; }
.ai-title b { display: block; font-size: 15px; }
.ai-title span { display: block; font-size: 12px; color: #8fa0bd; }
.ai-x {
  background: transparent; border: 0; color: #8fa0bd; font-size: 22px; line-height: 1;
  cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.ai-x:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.ai-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-log::-webkit-scrollbar { width: 8px; }
.ai-log::-webkit-scrollbar-thumb { background: #26314b; border-radius: 8px; }

.ai-m { max-width: 86%; padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.ai-m.bot { align-self: flex-start; background: #17203a; border: 1px solid rgba(255, 255, 255, .07); border-bottom-left-radius: 5px; }
.ai-m.me { align-self: flex-end; background: #f2b705; color: #1a1200; border-bottom-right-radius: 5px; font-weight: 500; }
.ai-m.err { align-self: flex-start; background: #3a1d20; border: 1px solid #7c3038; color: #ffd9dd; }
.ai-m a { color: #ffd76a; }

.ai-cards { align-self: stretch; display: flex; flex-direction: column; gap: 8px; margin-top: -2px; }
.ai-card {
  display: flex; gap: 10px; align-items: center; padding: 8px;
  background: #121a2d; border: 1px solid rgba(255, 255, 255, .08); border-radius: 12px;
}
.ai-card img, .ai-card .ai-noimg {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 9px; object-fit: cover; background: #1c2740;
  display: grid; place-items: center; font-size: 20px;
}
.ai-card .ai-noimg { color: #55658a; }
.ai-card .ai-ci { flex: 1; min-width: 0; }
.ai-card .ai-cn { font-size: 13.5px; line-height: 1.3; margin-bottom: 3px; }
.ai-card .ai-cp { font-weight: 700; color: #ffd76a; font-size: 14px; }
.ai-card .ai-cs { font-size: 12px; color: #7ee0a1; }
.ai-card .ai-cs.o { color: #8fa0bd; }
.ai-card button {
  border: 0; background: rgba(242, 183, 5, .14); color: #ffd76a; cursor: pointer;
  font-size: 12px; padding: 7px 9px; border-radius: 8px; white-space: nowrap;
}
.ai-card button:hover { background: rgba(242, 183, 5, .26); }

.ai-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 14px 10px; }
.ai-chips button {
  border: 1px solid rgba(255, 255, 255, .14); background: transparent; color: #c9d5ea;
  font-size: 12.5px; padding: 7px 11px; border-radius: 999px; cursor: pointer;
}
.ai-chips button:hover { border-color: #f2b705; color: #ffd76a; }

.ai-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, .07); background: #101728; }
.ai-form textarea {
  flex: 1; resize: none; height: 42px; max-height: 110px; padding: 10px 12px;
  background: #17203a; color: #e9eef7; border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px; font: inherit; outline: none;
}
.ai-form textarea:focus { border-color: #f2b705; }
.ai-form button {
  flex: 0 0 46px; border: 0; border-radius: 12px; cursor: pointer; background: #f2b705; color: #1a1200;
  font-size: 18px;
}
.ai-form button:disabled { opacity: .5; cursor: default; }
.ai-foot { padding: 0 14px 10px; font-size: 11.5px; color: #7d8cab; }
.ai-foot a { color: #ffd76a; }
.ai-dots span { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: #8fa0bd; animation: ai-b 1s infinite; }
.ai-dots span:nth-child(2) { animation-delay: .2s; }
.ai-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes ai-b { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

@media (max-width: 640px) {
  .ai-fab { right: 12px; bottom: 12px; padding: 13px 16px; font-size: 15px; }
  .ai-panel { right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%; height: 84vh; max-height: 84vh; border-radius: 18px 18px 0 0; }
}
