:root {
  --assistant-accent: #d86f32;
  --assistant-accent-dark: #b65322;
  --assistant-ink: #053040;
  --assistant-muted: #5f7474;
  --assistant-line: rgba(0, 83, 74, 0.16);
  --assistant-surface: rgba(255, 255, 255, 0.96);
  --assistant-soft: #f6faf8;
  --assistant-shadow: 0 22px 60px rgba(2, 35, 43, 0.18);
  --assistant-mobile-bottom-gap: calc(92px + env(safe-area-inset-bottom, 0px));
  --assistant-mobile-top-gap: calc(74px + env(safe-area-inset-top, 0px));
}

.assistant-root {
  position: fixed;
  inset: 0;
  z-index: 620;
  pointer-events: none;
  font-family: inherit;
}

.assistant-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 623;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 8px 15px 8px 8px;
  border: 1px solid rgba(216, 111, 50, 0.34);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--assistant-accent), var(--assistant-accent-dark));
  color: #fff;
  box-shadow: 0 14px 34px rgba(174, 78, 27, 0.28);
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

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

.assistant-launcher__icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
}

.assistant-launcher__icon img,
.assistant-panel__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.assistant-scrim {
  position: fixed;
  inset: 0;
  z-index: 620;
  background: rgba(2, 23, 26, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.assistant-panel {
  position: fixed;
  right: 22px;
  bottom: 82px;
  z-index: 622;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(410px, calc(100vw - 32px));
  max-height: min(650px, calc(100dvh - 116px));
  border: 1px solid var(--assistant-line);
  border-radius: 18px;
  background: var(--assistant-surface);
  box-shadow: var(--assistant-shadow);
  overflow: hidden;
  pointer-events: none;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
  backdrop-filter: blur(14px);
}

.assistant-root.is-open .assistant-scrim {
  opacity: 1;
  pointer-events: auto;
}

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

.assistant-panel__head {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 15px;
  border-bottom: 1px solid rgba(0, 83, 74, 0.11);
  background: linear-gradient(135deg, #fff, #fbf6ef);
  touch-action: none;
}

.assistant-panel__avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(216, 111, 50, 0.25);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.assistant-panel__head h2 {
  margin: 0;
  color: var(--assistant-ink);
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: 0;
}

.assistant-panel__head p {
  margin: 3px 0 0;
  color: var(--assistant-muted);
  font-size: 12px;
  line-height: 1.3;
}

.assistant-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0, 83, 74, 0.13);
  border-radius: 50%;
  background: #fff;
  color: var(--assistant-ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.assistant-panel__body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
  padding: 14px;
}

.assistant-messages {
  display: grid;
  gap: 9px;
  max-height: 310px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
  -webkit-overflow-scrolling: touch;
}

.assistant-message {
  max-width: 92%;
  padding: 11px 12px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.42;
}

.assistant-message p {
  margin: 0;
}

.assistant-message p + p {
  margin-top: 6px;
}

.assistant-message--assistant {
  justify-self: start;
  border: 1px solid rgba(0, 83, 74, 0.1);
  border-top-left-radius: 6px;
  background: var(--assistant-soft);
  color: var(--assistant-ink);
}

.assistant-message--user {
  justify-self: end;
  border-top-right-radius: 6px;
  background: #005b50;
  color: #fff;
}

.assistant-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.assistant-choice {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid rgba(0, 83, 74, 0.14);
  border-radius: 999px;
  background: #fff;
  color: var(--assistant-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.assistant-choice--guide:hover,
.assistant-choice--back:hover {
  border-color: rgba(216, 111, 50, 0.42);
  background: #fffaf5;
}

.assistant-choice--action {
  border-color: rgba(216, 111, 50, 0.38);
  background: var(--assistant-accent);
  color: #fff;
  box-shadow: 0 9px 20px rgba(216, 111, 50, 0.2);
}

.assistant-choice--action:hover {
  background: var(--assistant-accent-dark);
}

.assistant-choice--back {
  color: var(--assistant-muted);
}

.assistant-zone-highlight {
  outline: 3px solid rgba(216, 111, 50, 0.32);
  outline-offset: 4px;
  border-radius: 16px;
  transition: outline-color 160ms ease;
}

@media (max-width: 768px) {
  .assistant-launcher {
    right: 14px;
    bottom: var(--assistant-mobile-bottom-gap);
    min-height: 43px;
    padding: 7px 13px 7px 7px;
    font-size: 13px;
  }

  .assistant-launcher__icon {
    width: 29px;
    height: 29px;
  }

  .assistant-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    min-height: 0;
    max-height: min(84dvh, calc(100dvh - var(--assistant-mobile-top-gap)));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .assistant-panel__handle {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(5, 48, 64, 0.18);
    transform: translateX(-50%);
  }

  .assistant-panel__head {
    padding: 19px 14px 12px;
    grid-template-columns: 40px 1fr auto;
  }

  .assistant-panel__avatar {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .assistant-panel__body {
    gap: 13px;
    padding: 13px 13px calc(13px + env(safe-area-inset-bottom, 0px));
  }

  .assistant-messages {
    max-height: none;
    min-height: 0;
  }

  .assistant-message {
    max-width: 95%;
    font-size: 14px;
  }

  .assistant-choice {
    min-height: 44px;
    font-size: 13px;
  }
}

@media (max-width: 768px) and (max-height: 720px) {
  .assistant-panel {
    min-height: 0;
    max-height: calc(100dvh - var(--assistant-mobile-top-gap) - var(--assistant-mobile-bottom-gap));
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-scrim,
  .assistant-panel,
  .assistant-launcher {
    transition: none;
  }
}
