.chat-assistant {
  position: fixed;
  z-index: 180;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  font-family: "Manrope", Arial, sans-serif;
}

.chat-launcher {
  display: flex;
  gap: 11px;
  align-items: center;
  min-height: 54px;
  padding: 8px 18px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  background: #15191e;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.42);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.chat-launcher:hover,
.chat-launcher:focus-visible {
  border-color: rgba(255, 32, 22, 0.82);
  background: #1b2026;
  transform: translateY(-2px);
}

.chat-launcher-mark {
  display: grid;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: #ff2016;
  font-size: 18px;
  font-weight: 800;
  place-items: center;
}

.chat-panel {
  display: grid;
  position: absolute;
  right: 0;
  bottom: 66px;
  width: min(390px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 112px));
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-top-color: rgba(255, 32, 22, 0.8);
  border-radius: 8px;
  color: #eef0f2;
  background: #0d1013;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.chat-header {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 17px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: #12161a;
}

.chat-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: white;
  background: #ff2016;
  font-size: 17px;
  font-weight: 800;
  place-items: center;
}

.chat-identity {
  min-width: 0;
  flex: 1;
}

.chat-identity strong,
.chat-identity span {
  display: block;
}

.chat-identity strong {
  font-size: 13px;
  line-height: 1.35;
}

.chat-identity span {
  margin-top: 2px;
  color: #929aa4;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-close {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #aab1b9;
  background: transparent;
  font: inherit;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
  place-items: center;
}

.chat-close:hover,
.chat-close:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.chat-messages {
  overflow-y: auto;
  padding: 20px 17px;
  scrollbar-color: #424951 transparent;
  scrollbar-width: thin;
}

.chat-message {
  display: flex;
  margin-bottom: 13px;
}

.chat-message-user {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 84%;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 4px 14px 14px;
  color: #d9dde2;
  background: #181d22;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-message-user .chat-bubble {
  border-color: rgba(255, 32, 22, 0.35);
  border-radius: 14px 4px 14px 14px;
  color: #fff;
  background: #3a1718;
}

.chat-action {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin: -3px 0 15px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 32, 22, 0.72);
  border-radius: 3px;
  color: #fff;
  background: rgba(255, 32, 22, 0.1);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.chat-action:hover,
.chat-action:focus-visible {
  background: #ff2016;
}

.chat-typing .chat-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  min-height: 39px;
}

.chat-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9ca4ae;
  animation: chat-pulse 900ms infinite alternate;
}

.chat-typing i:nth-child(2) { animation-delay: 150ms; }
.chat-typing i:nth-child(3) { animation-delay: 300ms; }

@keyframes chat-pulse {
  to { opacity: 0.28; transform: translateY(-2px); }
}

.chat-suggestions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 17px 13px;
  scrollbar-width: none;
}

.chat-suggestions::-webkit-scrollbar { display: none; }

.chat-suggestion {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #353c44;
  border-radius: 999px;
  color: #c9ced4;
  background: #12161a;
  font: inherit;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.chat-suggestion:hover,
.chat-suggestion:focus-visible {
  border-color: #ff2016;
  color: #fff;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  background: #12161a;
}

.chat-input {
  width: 100%;
  max-height: 104px;
  min-height: 42px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid #353c44;
  border-radius: 4px;
  outline: 0;
  color: #fff;
  background: #0b0e11;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
}

.chat-input::placeholder { color: #6f7781; }

.chat-input:focus {
  border-color: #ff2016;
  box-shadow: 0 0 0 2px rgba(255, 32, 22, 0.12);
}

.chat-send {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: white;
  background: #ff2016;
  cursor: pointer;
  place-items: center;
}

.chat-send:hover,
.chat-send:focus-visible { background: #d90f08; }
.chat-send:disabled { opacity: 0.42; cursor: wait; }

.chat-send svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.chat-disclaimer {
  grid-column: 1 / -1;
  margin: 0;
  color: #757e88;
  font-size: 8px;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 520px) {
  .chat-assistant {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .chat-panel {
    position: fixed;
    inset: 12px 12px max(78px, calc(66px + env(safe-area-inset-bottom))) 12px;
    width: auto;
    height: auto;
  }

  .chat-launcher { min-height: 50px; }
  .chat-launcher-mark { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-typing i { animation: none; }
  .chat-launcher { transition: none; }
}
