/* корневой контейнер */
.aiop-chat-root { position: relative; }

/* кнопка-лаунчер */
.aiop-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #2563eb; color:#fff;
  border: none; font: inherit; cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  display: flex; align-items: center; justify-content: center;
  z-index: 2147483000;
}

/* окно чата */
.aiop-chat-window {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: 360px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 120px);
  background: #fff; border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  display: none; flex-direction: column; overflow: hidden;
  z-index: 2147483001;
}

/* шапка */
.aiop-chat-header {
  height: 48px; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: #111827; color:#fff; font-weight:600;
}

/* сообщения */
.aiop-thread { display: flex; flex-direction: column; }
.aiop-chat-body { flex:1 1 auto; overflow-y:auto; padding:12px; background:#f9fafb; }
.aiop-msg {
  display:inline-block; padding:8px 10px; border-radius:10px;
  margin:6px 0; max-width:85%; line-height:1.3; white-space:pre-wrap; word-break:break-word;
}
.aiop-msg.user  { background:#dbeafe; align-self:flex-end; }
.aiop-msg.agent { background:#e5e7eb; align-self:flex-start; }

/* нижняя панель ввода */
.aiop-chat-input {
  border-top:1px solid #e5e7eb; padding:8px; background:#fff;
  display:grid; grid-template-columns:1fr auto; gap:8px;
}
.aiop-chat-input textarea {
  width:100%; min-height:40px; max-height:120px; resize:vertical;
  padding:8px 10px; border:1px solid #e5e7eb; border-radius:8px; font:inherit;
}
.aiop-chat-input button {
  padding:0 16px; border-radius:8px; border:none; background:#2563eb; color:#fff; font-weight:600; cursor:pointer;
}

/* состояние open */
.aiop-chat-window.open { display:flex; }

/* мобилка */
@media (max-width: 480px) {
  .aiop-chat-window { right:10px; bottom:78px; width:calc(100vw - 20px); height:70vh; }
  .aiop-launcher { right:12px; bottom:12px; }
}

/* кнопка закрытия */
.aiop-close { background:transparent; color:#fff; border:none; cursor:pointer; font-size:18px; }
