.mineev-chat {
  position: fixed;
  z-index: 70;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

.mineev-chat__launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.28);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.mineev-chat__launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(37, 99, 235, 0.36);
}

.mineev-chat-logo,
.mineev-chat-logo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.mineev-chat-logo img {
  object-fit: contain;
}

.mineev-chat.is-open .mineev-chat__launcher {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.mineev-chat__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(400px, calc(100vw - 24px));
  height: min(680px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(190, 201, 229, 0.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 28px 80px rgba(25, 37, 74, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.98);
  transform-origin: right bottom;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.2, 0.75, 0.25, 1);
  backdrop-filter: blur(20px);
}

.mineev-chat.is-open .mineev-chat__panel {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.mineev-chat__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid #e6eaf5;
  background: linear-gradient(135deg, #f7f9ff, #fff);
}

.mineev-chat__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mineev-chat__avatar {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  box-shadow: 0 7px 18px rgba(37, 99, 235, 0.2);
}

.mineev-chat__brand strong,
.mineev-chat__brand span {
  display: block;
}

.mineev-chat__brand strong {
  color: #10172a;
  font-size: 0.92rem;
  line-height: 1.35;
}

.mineev-chat__brand div > span {
  margin-top: 4px;
  color: #6b7289;
  font-size: 0.74rem;
}

.mineev-chat__brand i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #22c55e;
}

.mineev-chat__close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #68708a;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.mineev-chat__close:hover {
  background: #eef1f8;
  color: #172036;
}

.mineev-chat__body {
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 80% 0, rgba(37, 99, 235, 0.055), transparent 30%),
    #f8f9fd;
  scrollbar-width: thin;
}

.mineev-chat__intro {
  max-width: 88%;
  padding: 13px 15px;
  border: 1px solid #e1e6f2;
  border-radius: 6px 17px 17px 17px;
  background: #fff;
  color: #39435e;
  font-size: 0.89rem;
  line-height: 1.55;
}

.mineev-chat__intro p {
  margin: 0;
}

.mineev-chat__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.mineev-chat__quick button {
  padding: 8px 11px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: #fff;
  color: #2854bb;
  font: inherit;
  font-size: 0.77rem;
  font-weight: 650;
  cursor: pointer;
}

.mineev-chat__quick button:hover {
  border-color: rgba(37, 99, 235, 0.38);
  background: #eef4ff;
}

.mineev-chat__messages {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.mineev-chat__message {
  width: fit-content;
  max-width: 88%;
  padding: 11px 14px;
  white-space: pre-wrap;
  color: #303a54;
  font-size: 0.88rem;
  line-height: 1.55;
}

.mineev-chat__message--assistant {
  justify-self: start;
  border: 1px solid #e1e6f2;
  border-radius: 6px 17px 17px 17px;
  background: #fff;
}

.mineev-chat__message--user {
  justify-self: end;
  border-radius: 17px 17px 6px 17px;
  background: #2563eb;
  color: #fff;
}

.mineev-chat__message.is-typing {
  color: #7a8299;
  font-style: italic;
}

.mineev-chat__message.is-error {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b42318;
}

.mineev-chat__action {
  justify-self: start;
  width: fit-content;
  padding: 9px 13px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 999px;
  background: #fff;
  color: #2459cf;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 720;
  text-decoration: none;
  cursor: pointer;
}

.mineev-chat__action:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: #eef4ff;
}

.mineev-chat__lead {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #f1f5ff);
}

.mineev-chat__lead > strong {
  color: #111a30;
  font-size: 0.94rem;
}

.mineev-chat__lead > p {
  margin: 6px 0 14px;
  color: #66708a;
  font-size: 0.78rem;
  line-height: 1.45;
}

.mineev-chat__lead-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.mineev-chat__lead label span {
  display: block;
  margin-bottom: 4px;
  color: #5b647c;
  font-size: 0.7rem;
  font-weight: 650;
}

.mineev-chat__lead input {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid #d6ddec;
  border-radius: 10px;
  background: #fff;
  color: #172036;
  font: inherit;
  font-size: 0.8rem;
}

.mineev-chat__consent {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}

.mineev-chat__consent input {
  width: 15px;
  min-height: 15px;
  flex: 0 0 15px;
  margin-top: 2px;
}

.mineev-chat__consent span {
  margin: 0;
  font-weight: 400;
  line-height: 1.4;
}

.mineev-chat__submit-lead {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  border: 0;
  border-radius: 11px;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
}

.mineev-chat__lead-status {
  margin: 8px 0 0;
  color: #b42318;
  font-size: 0.76rem;
}

.mineev-chat__lead-status.is-success {
  color: #166534;
}

.mineev-chat__composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e4e8f2;
  background: #fff;
}

.mineev-chat__composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  resize: none;
  border: 1px solid #d9deeb;
  border-radius: 13px;
  outline: 0;
  color: #182036;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.4;
}

.mineev-chat__composer textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.mineev-chat__composer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 13px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

.mineev-chat__composer button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.mineev-chat__composer svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mineev-chat__privacy {
  margin: 0;
  padding: 0 14px 10px;
  background: #fff;
  color: #8a91a5;
  font-size: 0.66rem;
  text-align: center;
}

.mineev-chat__privacy a {
  color: inherit;
}

@media (max-width: 560px) {
  .mineev-chat {
    right: 8px;
    bottom: 8px;
    left: auto;
  }

  .mineev-chat__launcher {
    margin: 0;
  }

  .mineev-chat__panel {
    position: fixed;
    inset: 8px;
    width: auto;
    height: auto;
    border-radius: 20px;
  }

  .mineev-chat__lead-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mineev-chat__launcher,
  .mineev-chat__panel {
    transition: none;
  }
}
