.hg-ai-assistant {
  --hg-ai-navy: #1f303f;
  --hg-ai-deep-navy: #142231;
  --hg-ai-gold: #c29a60;
  --hg-ai-deep-gold: #b48a4f;
  --hg-ai-warm-white: #f1eeea;
  --hg-ai-slate: #5f6c76;
  --hg-ai-white: #ffffff;
  --hg-ai-line: rgba(31, 48, 63, 0.14);
  position: relative;
  z-index: 70;
  color: var(--hg-ai-navy);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.hg-ai-assistant *,
.hg-ai-assistant *::before,
.hg-ai-assistant *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

.hg-ai-launch {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 71;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 1px solid rgba(194, 154, 96, 0.5);
  border-radius: 999px;
  padding: 9px 18px 9px 10px;
  background: var(--hg-ai-deep-navy);
  color: var(--hg-ai-white);
  box-shadow: 0 18px 44px rgba(20, 34, 49, 0.26);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

.hg-ai-launch[hidden] {
  display: none;
}

.hg-ai-launch::after {
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(194, 154, 96, 0.3);
  border-radius: inherit;
  content: "";
  pointer-events: none;
  animation: hg-ai-pulse 3.2s ease-in-out infinite;
}

.hg-ai-launch img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--hg-ai-white);
}

.hg-ai-launch__mobile {
  display: none;
}

.hg-ai-panel {
  position: fixed;
  right: 22px;
  bottom: 94px;
  z-index: 72;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 32px));
  height: min(720px, calc(100dvh - 118px));
  overflow: hidden;
  border: 1px solid rgba(31, 48, 63, 0.16);
  border-radius: 8px;
  background: var(--hg-ai-white);
  box-shadow: 0 28px 80px rgba(20, 34, 49, 0.24);
  transform-origin: right bottom;
  animation: hg-ai-panel-in 180ms ease-out;
}

.hg-ai-panel[hidden] {
  display: none;
}

.hg-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 74px;
  padding: 14px 16px;
  background: var(--hg-ai-deep-navy);
  color: var(--hg-ai-white);
}

.hg-ai-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hg-ai-brand img {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--hg-ai-white);
  object-fit: contain;
}

.hg-ai-brand div {
  display: grid;
  min-width: 0;
}

.hg-ai-brand strong {
  overflow: hidden;
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hg-ai-brand span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.76rem;
}

.hg-ai-header__actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hg-ai-icon-button,
.hg-ai-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--hg-ai-white);
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
}

.hg-ai-close {
  width: 36px;
  padding: 0;
  font-size: 1.45rem;
  line-height: 1;
}

.hg-ai-language {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hg-ai-line);
  background: var(--hg-ai-warm-white);
}

.hg-ai-language label {
  color: var(--hg-ai-slate);
  font-size: 0.78rem;
  font-weight: 850;
}

.hg-ai-language select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(31, 48, 63, 0.18);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--hg-ai-white);
  color: var(--hg-ai-navy);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 750;
}

.hg-ai-language-prompt {
  display: grid;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hg-ai-line);
  background: #fffaf2;
}

.hg-ai-language-prompt[hidden] {
  display: none;
}

.hg-ai-language-prompt p {
  margin: 0;
  color: var(--hg-ai-navy);
  font-size: 0.82rem;
}

.hg-ai-language-prompt div,
.hg-ai-translation-controls,
.hg-ai-message__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.hg-ai-language-prompt button,
.hg-ai-translation-controls button,
.hg-ai-message__actions a,
.hg-ai-message__copy {
  min-height: 34px;
  border: 1px solid rgba(31, 48, 63, 0.16);
  border-radius: 6px;
  padding: 7px 9px;
  background: var(--hg-ai-white);
  color: var(--hg-ai-navy);
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: none;
}

.hg-ai-translation-controls {
  padding: 9px 14px;
  border-bottom: 1px solid var(--hg-ai-line);
}

.hg-ai-quick-actions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 9px 14px;
  border-bottom: 1px solid var(--hg-ai-line);
  background: var(--hg-ai-white);
  scrollbar-width: thin;
}

.hg-ai-quick-actions button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--hg-ai-navy);
  color: var(--hg-ai-white);
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
}

.hg-ai-translation-controls button:first-child {
  border-color: rgba(194, 154, 96, 0.46);
  color: var(--hg-ai-deep-gold);
}

.hg-ai-messages {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 14px 10px;
  background: #fbfcfc;
  overscroll-behavior: contain;
}

.hg-ai-message {
  display: grid;
  justify-items: start;
  gap: 5px;
  margin-bottom: 12px;
}

.hg-ai-message--user {
  justify-items: end;
}

.hg-ai-message__bubble {
  max-width: 88%;
  border: 1px solid rgba(31, 48, 63, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--hg-ai-white);
  color: var(--hg-ai-navy);
  box-shadow: 0 8px 18px rgba(31, 48, 63, 0.06);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.hg-ai-message--user .hg-ai-message__bubble {
  border-color: transparent;
  background: var(--hg-ai-navy);
  color: var(--hg-ai-white);
}

.hg-ai-message__meta {
  color: var(--hg-ai-slate);
  font-size: 0.7rem;
}

.hg-ai-message__copy {
  min-height: 28px;
  padding: 4px 7px;
  background: transparent;
}

.hg-ai-message__actions {
  max-width: 92%;
}

.hg-ai-message__actions a {
  border-color: rgba(194, 154, 96, 0.5);
  color: var(--hg-ai-deep-gold);
}

.hg-ai-typing {
  display: flex;
  gap: 5px;
  padding: 8px 18px;
  background: #fbfcfc;
}

.hg-ai-typing[hidden] {
  display: none;
}

.hg-ai-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hg-ai-gold);
  animation: hg-ai-dot 1s ease-in-out infinite;
}

.hg-ai-typing span:nth-child(2) {
  animation-delay: 120ms;
}

.hg-ai-typing span:nth-child(3) {
  animation-delay: 240ms;
}

.hg-ai-suggestions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 9px 14px;
  border-top: 1px solid var(--hg-ai-line);
  background: var(--hg-ai-white);
  scrollbar-width: thin;
}

.hg-ai-chip {
  flex: 0 0 auto;
  max-width: 230px;
  min-height: 34px;
  border: 1px solid rgba(31, 48, 63, 0.14);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--hg-ai-warm-white);
  color: var(--hg-ai-navy);
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 750;
  overflow-wrap: anywhere;
  white-space: normal;
}

.hg-ai-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 11px 14px 8px;
  border-top: 1px solid var(--hg-ai-line);
  background: var(--hg-ai-white);
}

.hg-ai-composer textarea {
  width: 100%;
  min-height: 46px;
  max-height: 112px;
  resize: none;
  border: 1px solid rgba(31, 48, 63, 0.2);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--hg-ai-white);
  color: var(--hg-ai-navy);
  font: inherit;
}

.hg-ai-composer button {
  min-width: 66px;
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 10px 13px;
  background: var(--hg-ai-gold);
  color: var(--hg-ai-white);
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

.hg-ai-composer textarea:focus,
.hg-ai-language select:focus,
.hg-ai-assistant button:focus-visible,
.hg-ai-assistant a:focus-visible {
  outline: 3px solid rgba(194, 154, 96, 0.42);
  outline-offset: 2px;
}

.hg-ai-privacy {
  margin: 0;
  padding: 0 14px 10px;
  background: var(--hg-ai-white);
  color: var(--hg-ai-slate);
  font-size: 0.68rem;
  text-align: center;
}

.hg-ai-panel[dir="rtl"] .hg-ai-message,
.hg-ai-panel[dir="rtl"] .hg-ai-brand div,
.hg-ai-panel[dir="rtl"] .hg-ai-language-prompt {
  text-align: right;
}

.hg-ai-panel[dir="rtl"] .hg-ai-message--user {
  justify-items: start;
}

body.hg-ai-panel-open {
  overflow: hidden;
}

@keyframes hg-ai-panel-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes hg-ai-pulse {
  0%,
  70%,
  100% {
    opacity: 0;
    transform: scale(1);
  }
  82% {
    opacity: 0.6;
  }
  94% {
    opacity: 0;
    transform: scale(1.08);
  }
}

@keyframes hg-ai-dot {
  0%,
  100% {
    opacity: 0.36;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (min-width: 769px) {
  body.hg-ai-panel-open {
    overflow: auto;
  }
}

@media (max-width: 640px) {
  .hg-ai-launch {
    right: 14px;
    bottom: 14px;
    min-height: 54px;
    padding: 7px 14px 7px 8px;
  }

  .hg-ai-launch__desktop {
    display: none;
  }

  .hg-ai-launch__mobile {
    display: inline;
  }

  .hg-ai-panel {
    inset: auto 0 0;
    width: 100%;
    height: min(88svh, 760px);
    max-height: 100dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
    transform-origin: center bottom;
  }

  .hg-ai-header {
    min-height: 66px;
    padding: 11px 12px;
  }

  .hg-ai-icon-button,
  .hg-ai-close {
    min-height: 44px;
  }

  .hg-ai-close {
    width: 44px;
  }

  .hg-ai-language {
    padding: 9px 12px;
  }

  .hg-ai-language select,
  .hg-ai-language-prompt button,
  .hg-ai-translation-controls button,
  .hg-ai-quick-actions button,
  .hg-ai-message__actions a,
  .hg-ai-message__copy,
  .hg-ai-chip {
    min-height: 44px;
  }

  .hg-ai-translation-controls {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 8px 12px;
  }

  .hg-ai-quick-actions {
    padding: 8px 12px;
  }

  .hg-ai-translation-controls button {
    flex: 0 0 auto;
  }

  .hg-ai-messages {
    padding: 13px 12px 8px;
  }

  .hg-ai-message__bubble {
    max-width: 92%;
  }

  .hg-ai-suggestions {
    padding: 8px 12px;
  }

  .hg-ai-composer {
    padding: 9px 12px 7px;
  }

  .hg-ai-privacy {
    padding: 0 12px max(8px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .hg-ai-brand span,
  .hg-ai-icon-button {
    display: none;
  }

  .hg-ai-language {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .hg-ai-composer {
    grid-template-columns: minmax(0, 1fr) 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hg-ai-assistant *,
  .hg-ai-assistant *::before,
  .hg-ai-assistant *::after,
  .hg-ai-chatbot * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
