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

.ai-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 94px;
  z-index: 90;
  min-width: 174px;
  height: 62px;
  padding: 7px 18px 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background:
    linear-gradient(135deg, var(--green), var(--green-2));
  color: #fff;
  box-shadow:
    0 18px 45px rgba(11, 91, 211, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  isolation: isolate;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

body.theme-legacy .ai-chat-launcher {
  box-shadow:
    0 18px 45px rgba(7, 136, 71, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.ai-chat-launcher:hover {
  transform: translateY(-3px);
  box-shadow:
    0 22px 50px rgba(11, 91, 211, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.ai-chat-launcher:focus-visible,
.ai-chat-close:focus-visible,
.ai-chat-send:focus-visible,
.ai-chat-suggestions button:focus-visible {
  outline: 3px solid rgba(86, 221, 255, 0.75);
  outline-offset: 3px;
}

.ai-chat-launcher-icon {
  width: 47px;
  height: 47px;
  flex: 0 0 47px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.ai-chat-launcher-icon svg {
  width: 27px;
  height: 27px;
  overflow: visible;
}

.ai-chat-launcher-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-launcher-icon .ai-chat-spark {
  fill: #fff;
  stroke: none;
  transform-origin: 18.8px 11.1px;
  animation: ai-chat-sparkle 2.4s ease-in-out infinite;
}

.ai-chat-launcher-copy {
  display: grid;
  gap: 1px;
  text-align: left;
  line-height: 1.2;
}

.ai-chat-launcher-copy strong {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.ai-chat-launcher-copy small {
  color: rgba(255, 255, 255, 0.76);
  font-size: 9px;
  font-weight: 600;
}

.ai-chat-online {
  position: absolute;
  right: 10px;
  top: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #76ff9a;
  border: 2px solid var(--green-2);
  box-shadow: 0 0 0 4px rgba(118, 255, 154, 0.12);
}

.ai-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  width: min(400px, calc(100vw - 48px));
  height: min(680px, calc(100dvh - 48px));
  min-height: 500px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 30px 90px rgba(7, 31, 73, 0.28),
    0 5px 20px rgba(7, 31, 73, 0.1);
  backdrop-filter: blur(24px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transform-origin: right bottom;
  pointer-events: none;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

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

.ai-chat-root.is-open .ai-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ai-chat-root.is-open .ai-chat-launcher {
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  pointer-events: none;
}

body.ai-chat-open .call-button {
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  pointer-events: none;
}

.ai-chat-header {
  min-height: 86px;
  padding: 17px 18px;
  display: grid;
  grid-template-columns: 50px 1fr 38px;
  align-items: center;
  gap: 12px;
  color: #fff;
  background:
    radial-gradient(circle at 82% -20%, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(135deg, var(--green), var(--green-2));
  position: relative;
  overflow: hidden;
}

.ai-chat-header::after {
  content: "AI";
  position: absolute;
  right: 48px;
  bottom: -25px;
  color: rgba(255, 255, 255, 0.06);
  font-family: Unbounded, sans-serif;
  font-size: 76px;
  font-weight: 700;
  pointer-events: none;
}

.ai-chat-avatar {
  width: 50px;
  height: 50px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.17);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ai-chat-avatar svg {
  width: 29px;
  height: 29px;
}

.ai-chat-avatar path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-title {
  display: grid;
  gap: 4px;
  position: relative;
  z-index: 1;
}

.ai-chat-title strong {
  font-family: Unbounded, sans-serif;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.ai-chat-title span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 10px;
  font-weight: 600;
}

.ai-chat-title i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #79ff9b;
  box-shadow: 0 0 0 3px rgba(121, 255, 155, 0.15);
}

.ai-chat-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: background 160ms ease;
}

.ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ai-chat-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.ai-chat-messages {
  min-height: 0;
  padding: 20px 17px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 8% 8%, rgba(9, 185, 212, 0.08), transparent 28%),
    linear-gradient(180deg, #f7f9fc 0%, #f2f5f9 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 114, 135, 0.35) transparent;
}

.ai-chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 13px;
  animation: ai-chat-message-in 220ms ease both;
}

.ai-chat-message.user {
  justify-content: flex-end;
  padding-left: 42px;
}

.ai-chat-message.assistant {
  padding-right: 30px;
}

.ai-chat-message-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  font-size: 8px;
  font-family: Unbounded, sans-serif;
  font-weight: 700;
  box-shadow: 0 5px 12px rgba(11, 91, 211, 0.2);
}

.ai-chat-bubble {
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 18px 18px 18px 5px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 7px 22px rgba(7, 31, 73, 0.08);
  border: 1px solid rgba(11, 25, 48, 0.06);
}

.ai-chat-message.user .ai-chat-bubble {
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  border: 0;
  border-radius: 18px 18px 5px 18px;
  box-shadow: 0 8px 24px rgba(11, 91, 211, 0.2);
}

.ai-chat-bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.55;
}

.ai-chat-photo {
  width: 100%;
  max-height: 190px;
  object-fit: cover;
  border-radius: 13px;
  margin-top: 10px;
}

.ai-chat-attachment {
  margin-top: 10px;
  min-height: 45px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(11, 91, 211, 0.07);
  color: var(--green);
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 800;
}

.ai-chat-attachment svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-attachment b {
  font-size: 14px;
}

.ai-chat-typing {
  min-width: 60px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.ai-chat-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: ai-chat-dot 1.2s ease-in-out infinite;
}

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

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

.ai-chat-suggestions {
  padding: 8px 16px 6px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  background: #fff;
  scrollbar-width: none;
}

.ai-chat-suggestions[hidden] {
  display: none;
}

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

.ai-chat-suggestions button {
  flex: 0 0 auto;
  border: 1px solid rgba(11, 91, 211, 0.16);
  border-radius: 999px;
  background: rgba(11, 91, 211, 0.04);
  color: var(--green);
  padding: 8px 11px;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  transition:
    color 150ms ease,
    background 150ms ease;
}

.ai-chat-suggestions button:hover {
  background: var(--green);
  color: #fff;
}

.ai-chat-form {
  padding: 9px 13px 11px;
  background: #fff;
  border-top: 1px solid rgba(11, 25, 48, 0.07);
}

.ai-chat-input-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 43px;
  align-items: end;
  gap: 7px;
  min-height: 51px;
  padding: 5px 5px 5px 14px;
  border-radius: 18px;
  background: #f2f5f9;
  border: 1px solid transparent;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.ai-chat-input-shell:focus-within {
  border-color: rgba(11, 91, 211, 0.35);
  box-shadow: 0 0 0 4px rgba(11, 91, 211, 0.07);
}

.ai-chat-input-shell textarea {
  width: 100%;
  min-height: 39px;
  max-height: 96px;
  padding: 10px 0 7px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
}

.ai-chat-input-shell textarea::placeholder {
  color: #8b96a7;
}

.ai-chat-send {
  width: 41px;
  height: 41px;
  border: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  cursor: pointer;
  box-shadow: 0 7px 16px rgba(11, 91, 211, 0.22);
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

.ai-chat-send:hover {
  transform: translateY(-1px);
}

.ai-chat-send:disabled {
  opacity: 0.45;
  cursor: wait;
}

.ai-chat-send svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-note {
  margin: 6px 3px 0;
  color: #8a95a5;
  text-align: center;
  font-size: 8px;
  line-height: 1.3;
}

.ai-chat-note a {
  color: var(--green);
  text-decoration: underline;
}

.ai-chat-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes ai-chat-sparkle {
  0%,
  100% {
    opacity: 0.72;
    transform: scale(0.82) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.12) rotate(12deg);
  }
}

@keyframes ai-chat-message-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ai-chat-dot {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@media (max-width: 700px) {
  .ai-chat-launcher {
    right: 16px;
    bottom: 86px;
    min-width: 162px;
    height: 56px;
  }

  .ai-chat-launcher-icon {
    width: 41px;
    height: 41px;
    flex-basis: 41px;
  }

  .ai-chat-panel {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    height: min(680px, calc(100dvh - 24px));
    min-height: min(500px, calc(100dvh - 24px));
    border-radius: 25px;
  }

  .ai-chat-header {
    min-height: 78px;
    padding: 13px 14px;
  }

  .ai-chat-messages {
    padding: 17px 13px 10px;
  }

  .ai-chat-message.assistant {
    padding-right: 14px;
  }

  .ai-chat-message.user {
    padding-left: 28px;
  }
}

@media (max-height: 560px) and (min-width: 701px) {
  .ai-chat-panel {
    height: calc(100dvh - 24px);
    min-height: 0;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-chat-launcher,
  .ai-chat-panel,
  .ai-chat-message,
  .ai-chat-launcher-icon .ai-chat-spark,
  .ai-chat-typing i {
    animation: none;
    transition: none;
  }
}
