.mk-ai-chat {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 9999;
  direction: rtl;
  font-family: "Assistant", "Heebo", Arial, sans-serif;
  color: #172635;
}

.mk-ai-chat * {
  box-sizing: border-box;
}

.mk-ai-chat__toggle {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: #0f7f95;
  color: #fff;
  box-shadow: 0 14px 34px rgba(15, 127, 149, 0.28);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.mk-ai-chat__toggle:hover,
.mk-ai-chat__toggle:focus {
  background: #0b5f70;
  outline: 2px solid rgba(15, 127, 149, 0.26);
  outline-offset: 3px;
}

.mk-ai-chat__panel {
  position: absolute;
  left: 0;
  bottom: 72px;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 112px));
  border: 1px solid rgba(21, 32, 43, 0.12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(21, 32, 43, 0.22);
  overflow: hidden;
  display: none;
}

.mk-ai-chat.is-open .mk-ai-chat__panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.mk-ai-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(21, 32, 43, 0.08);
  background: #f4f8f8;
}

.mk-ai-chat__title {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
  color: #172635;
}

.mk-ai-chat__close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(21, 32, 43, 0.12);
  border-radius: 8px;
  background: #fff;
  color: #172635;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.mk-ai-chat__messages {
  padding: 14px;
  overflow-y: auto;
  background: #fbf8f5;
}

.mk-ai-chat__message {
  max-width: 88%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mk-ai-chat__message--bot {
  margin-left: auto;
  background: #fff;
  border: 1px solid rgba(21, 32, 43, 0.08);
  color: #243447;
}

.mk-ai-chat__message--user {
  margin-right: auto;
  background: #0f7f95;
  color: #fff;
}

.mk-ai-chat__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

.mk-ai-chat__source {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(15, 127, 149, 0.08);
  color: #0b5f70;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mk-ai-chat__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(21, 32, 43, 0.08);
  background: #fff;
}

.mk-ai-chat__input {
  min-width: 0;
  height: 42px;
  resize: none;
  border: 1px solid rgba(21, 32, 43, 0.16);
  border-radius: 8px;
  padding: 9px 11px;
  color: #172635;
  background: #fff;
  font: inherit;
  line-height: 1.45;
}

.mk-ai-chat__input:focus {
  border-color: #0f7f95;
  outline: 2px solid rgba(15, 127, 149, 0.16);
}

.mk-ai-chat__send {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: #0f7f95;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.mk-ai-chat__send:disabled,
.mk-ai-chat__input:disabled {
  opacity: 0.64;
  cursor: wait;
}

@media (max-width: 520px) {
  .mk-ai-chat {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .mk-ai-chat__panel {
    left: 0;
    right: 0;
    width: 100%;
    height: min(560px, calc(100vh - 96px));
  }
}
