.amg-bot {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  font-family: Inter, system-ui, sans-serif;
}

.amg-bot-panel {
  position: absolute;
  right: 0;
  bottom: 4.5rem;
  width: min(100vw - 2rem, 380px);
  height: min(72vh, 560px);
  display: flex;
  flex-direction: column;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(11, 15, 26, 0.98);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 80px -20px rgba(0, 0, 0, 0.65), 0 0 60px -20px rgba(94, 54, 255, 0.25);
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.amg-bot-panel[hidden] {
  display: none !important;
}

.amg-bot-panel.is-opening {
  animation: amg-bot-in 0.22s ease;
}

@keyframes amg-bot-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.amg-bot-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, rgba(94, 54, 255, 0.35), rgba(52, 211, 153, 0.12));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.amg-bot-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.amg-bot-new {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(7, 9, 18, 0.35);
  color: #e2e8f0;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}

.amg-bot-new:hover {
  background: rgba(94, 54, 255, 0.35);
  border-color: rgba(164, 140, 255, 0.45);
  color: #fff;
}

.amg-bot-new.is-highlight {
  background: rgba(94, 54, 255, 0.55);
  border-color: rgba(164, 140, 255, 0.6);
  color: #fff;
  box-shadow: 0 0 20px rgba(94, 54, 255, 0.35);
}

.amg-bot-new[hidden] {
  display: none !important;
}

.amg-bot-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(7, 9, 18, 0.35);
  color: #e2e8f0;
  flex-shrink: 0;
  margin-left: auto;
}

.amg-bot-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.amg-bot-new-label {
  display: none;
}

@media (min-width: 380px) {
  .amg-bot-new-label {
    display: inline;
  }
}

.amg-bot-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #111727;
}

.amg-bot-head-text h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.amg-bot-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: #cbd5e1;
}

.amg-bot-status::before {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
}

.amg-bot-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.amg-bot-msg {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  max-width: 92%;
}

.amg-bot-msg.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.amg-bot-msg-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #111727;
}

.amg-bot-msg-body {
  min-width: 0;
}

.amg-bot-bubble {
  padding: 0.65rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  line-height: 1.45;
  word-break: break-word;
}

.amg-bot-msg:not(.is-user) .amg-bot-bubble {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border-bottom-left-radius: 0.35rem;
}

.amg-bot-msg.is-user .amg-bot-bubble {
  background: rgba(94, 54, 255, 0.28);
  color: #f8fafc;
  border-bottom-right-radius: 0.35rem;
}

.amg-bot-time {
  margin-top: 0.25rem;
  font-size: 0.68rem;
  color: #64748b;
  text-align: center;
}

.amg-bot-msg.is-user .amg-bot-time {
  text-align: right;
}

.amg-bot-bubble a {
  color: #a48cff;
  text-decoration: underline;
}

.amg-bot-typing {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.15rem 0;
}

.amg-bot-typing span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: #94a3b8;
  animation: amg-bot-dot 1.2s infinite ease-in-out;
}

.amg-bot-typing span:nth-child(2) { animation-delay: 0.15s; }
.amg-bot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes amg-bot-dot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.amg-bot-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem;
  background: rgba(7, 9, 18, 0.65);
}

.amg-bot-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.amg-bot-input {
  flex: 1 1 auto;
  min-height: 2.5rem;
  max-height: 6rem;
  resize: none;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 23, 39, 0.9);
  color: #f8fafc;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
  outline: none;
}

.amg-bot-input:focus {
  border-color: rgba(126, 92, 255, 0.65);
  box-shadow: 0 0 0 2px rgba(94, 54, 255, 0.2);
}

.amg-bot-send {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5e36ff;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.amg-bot-send:hover:not(:disabled) {
  background: #7e5cff;
}

.amg-bot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.amg-bot-fab {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5e36ff;
  color: #fff;
  box-shadow: 0 0 50px -10px rgba(126, 92, 255, 0.55);
  transition: transform 0.15s ease, background 0.15s ease;
}

.amg-bot-fab:hover {
  background: #7e5cff;
  transform: translateY(-1px);
}

.amg-bot-fab[aria-expanded='true'] {
  background: #283155;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

@media (max-width: 767px) {
  .amg-bot {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .amg-bot-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    z-index: 70;
    transform-origin: center center;
  }

  .amg-bot-close {
    display: inline-flex;
  }

  .amg-bot-fab[aria-expanded='true'] {
    display: none;
  }

  .amg-bot-foot {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  .amg-bot-head {
    padding-top: max(0.9rem, env(safe-area-inset-top));
  }
}

body.amg-bot-open-mobile {
  overflow: hidden;
}

.amg-bot-contact {
  margin-top: 0.25rem;
  padding: 0.85rem;
  border-radius: 1rem;
  border: 1px solid rgba(94, 54, 255, 0.25);
  background: rgba(94, 54, 255, 0.08);
}

.amg-bot-contact-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #c9bbff;
  margin-bottom: 0.65rem;
}

.amg-bot-contact-form {
  display: grid;
  gap: 0.5rem;
}

.amg-bot-contact-input {
  width: 100%;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 23, 39, 0.95);
  color: #f8fafc;
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
  outline: none;
}

.amg-bot-contact-input:focus {
  border-color: rgba(126, 92, 255, 0.65);
  box-shadow: 0 0 0 2px rgba(94, 54, 255, 0.2);
}

.amg-bot-contact-submit {
  margin-top: 0.15rem;
  border-radius: 999px;
  background: #5e36ff;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.85rem;
}

.amg-bot-contact-submit:hover:not(:disabled) {
  background: #7e5cff;
}

.amg-bot-contact-check {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.68rem;
  line-height: 1.45;
  color: #94a3b8;
}

.amg-bot-contact-check input {
  margin-top: 0.12rem;
  accent-color: #5e36ff;
  flex-shrink: 0;
}

.amg-bot-contact-check a {
  color: #a48cff;
  text-decoration: underline;
}

.amg-bot-contact-error {
  font-size: 0.75rem;
  color: #fecaca;
}

.amg-bot-contact-error.hidden {
  display: none;
}
