.fitto-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  font-family: "Inter", Arial, sans-serif;
  color: var(--text, #25231f);
}

.fitto-chat * {
  box-sizing: border-box;
}

.fitto-chat__toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid rgba(111, 127, 85, 0.24);
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(255, 250, 242, 0.96), rgba(226, 234, 216, 0.92));
  box-shadow: 0 18px 36px rgba(79, 69, 56, 0.16);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.fitto-chat__toggle::before {
  content: "";
  position: absolute;
  inset: -7px;
  z-index: -1;
  border: 1px solid rgba(111, 127, 85, 0.2);
  border-radius: inherit;
  opacity: 0;
  transform: scale(0.88);
  pointer-events: none;
}

.fitto-chat.is-attention .fitto-chat__toggle {
  animation: fitto-greeting 900ms ease 1;
}

.fitto-chat.is-attention .fitto-chat__toggle::before {
  animation: fitto-soft-pulse 1600ms ease 2;
}

.fitto-chat__toggle:hover,
.fitto-chat__toggle:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(111, 127, 85, 0.42);
  box-shadow: 0 22px 42px rgba(79, 69, 56, 0.2);
}

.fitto-chat__hint {
  position: absolute;
  right: 72px;
  top: 50%;
  width: max-content;
  max-width: 170px;
  padding: 8px 11px;
  border: 1px solid rgba(228, 221, 210, 0.88);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 14px 30px rgba(79, 69, 56, 0.12);
  color: var(--accent-dark, #4f5f3d);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  opacity: 0;
  transform: translate(8px, -50%);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.fitto-chat__hint::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-top: 1px solid rgba(228, 221, 210, 0.88);
  border-right: 1px solid rgba(228, 221, 210, 0.88);
  background: rgba(255, 250, 242, 0.98);
  transform: translateY(-50%) rotate(45deg);
}

.fitto-chat.is-attention .fitto-chat__hint,
.fitto-chat__toggle:hover .fitto-chat__hint,
.fitto-chat__toggle:focus-visible .fitto-chat__hint {
  opacity: 1;
  transform: translate(0, -50%);
}

.fitto-chat.is-open .fitto-chat__hint {
  opacity: 0;
}

.fitto-chat__status {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255, 250, 242, 0.96);
  border-radius: 999px;
  background: var(--accent, #6f7f55);
  box-shadow: 0 5px 12px rgba(79, 69, 56, 0.18);
}

.fitto-chat__toggle:focus-visible,
.fitto-chat__send:focus-visible,
.fitto-chat__input:focus-visible,
.fitto-chat__close:focus-visible {
  outline: 3px solid rgba(111, 127, 85, 0.28);
  outline-offset: 3px;
}

.fitto-chat__avatar {
  width: 54px;
  height: 54px;
  object-fit: contain;
  object-position: center;
}

.fitto-chat__panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  width: 360px;
  max-height: min(560px, calc(100vh - 130px));
  overflow: hidden;
  border: 1px solid rgba(228, 221, 210, 0.9);
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 26px 70px rgba(79, 69, 56, 0.18);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: right bottom;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.fitto-chat__header {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 15px 16px 13px;
  border-bottom: 1px solid rgba(111, 127, 85, 0.28);
  background:
    radial-gradient(circle at 16% 16%, rgba(255, 250, 242, 0.62), transparent 9rem),
    linear-gradient(135deg, rgba(218, 229, 202, 0.94), rgba(193, 208, 169, 0.9));
  box-shadow: 0 9px 22px rgba(79, 69, 56, 0.08);
}

.fitto-chat__mini-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  overflow: visible;
}

.fitto-chat__mini-avatar img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.fitto-chat__title {
  margin: 0;
  color: #23281e;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.2;
}

.fitto-chat__subtitle {
  margin: 2px 0 0;
  color: #405038;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.fitto-chat__close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(79, 95, 61, 0.24);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.78);
  color: #405038;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.fitto-chat__close:hover {
  background: rgba(255, 250, 242, 0.96);
  color: var(--accent-dark, #4f5f3d);
  transform: translateY(-1px);
}

.fitto-chat__messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  padding: 16px;
  overflow-y: auto;
  background:
    radial-gradient(circle at top left, rgba(226, 234, 216, 0.46), transparent 16rem),
    rgba(255, 250, 242, 0.82);
}

.fitto-chat__message {
  max-width: 86%;
  padding: 11px 13px;
  border-radius: 18px;
  color: var(--text, #25231f);
  font-size: 14px;
  line-height: 1.48;
  white-space: pre-wrap;
}

.fitto-chat__message--bot {
  align-self: flex-start;
  border: 1px solid rgba(228, 221, 210, 0.88);
  border-bottom-left-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.fitto-chat__message--user {
  align-self: flex-end;
  border-bottom-right-radius: 8px;
  background: rgba(111, 127, 85, 0.9);
  color: #fffaf2;
}

.fitto-chat-link {
  color: var(--accent-dark, #4f5f3d);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(111, 127, 85, 0.34);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.fitto-chat-link:hover {
  color: var(--accent, #6f7f55);
  text-decoration-color: rgba(111, 127, 85, 0.72);
}

.fitto-chat__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(228, 221, 210, 0.8);
  background: rgba(255, 255, 255, 0.82);
}

.fitto-chat__input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid rgba(111, 127, 85, 0.24);
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.9);
  color: var(--text, #25231f);
  font: inherit;
  font-size: 14px;
}

.fitto-chat__input::placeholder {
  color: rgba(114, 107, 97, 0.78);
}

.fitto-chat__send {
  min-width: 48px;
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--accent, #6f7f55);
  color: #fffaf2;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.fitto-chat__send:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-dark, #4f5f3d);
}

.fitto-chat__send:disabled {
  cursor: default;
  opacity: 0.62;
}

@media (max-width: 520px) {
  .fitto-chat {
    right: 16px;
    bottom: 16px;
  }

  .fitto-chat__toggle {
    width: 60px;
    height: 60px;
  }

  .fitto-chat__avatar {
    width: 50px;
    height: 50px;
  }

  .fitto-chat__hint {
    right: 66px;
    max-width: 150px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .fitto-chat__panel {
    right: 0;
    bottom: 72px;
    width: calc(100vw - 32px);
    max-height: 70vh;
    border-radius: 22px;
  }

  .fitto-chat__messages {
    min-height: 220px;
    padding: 14px;
  }

  .fitto-chat__message {
    max-width: 92%;
  }
}

@keyframes fitto-greeting {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  35% {
    transform: translateY(-4px) rotate(-2deg);
  }

  70% {
    transform: translateY(0) rotate(1deg);
  }
}

@keyframes fitto-soft-pulse {
  0% {
    opacity: 0;
    transform: scale(0.88);
  }

  42% {
    opacity: 0.62;
  }

  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}
