.esys-assistant {
  --esys-assistant-ink: #e9f2fb;
  --esys-assistant-muted: rgba(233, 242, 251, 0.72);
  --esys-assistant-line: rgba(255, 255, 255, 0.1);
  --esys-assistant-panel: rgba(7, 15, 29, 0.94);
  --esys-assistant-panel-soft: rgba(16, 34, 58, 0.92);
  --esys-assistant-accent: #35c6ff;
  --esys-assistant-accent-2: #5cf0c3;
  position: fixed;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.9rem;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
}

.esys-assistant__launcher {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 56px;
  padding: 0.85rem 1.15rem;
  border: 0;
  border-radius: 999px;
  color: #04111c;
  background: linear-gradient(135deg, var(--esys-assistant-accent-2) 0%, var(--esys-assistant-accent) 100%);
  box-shadow: 0 18px 40px rgba(5, 19, 33, 0.24);
  font-weight: 700;
  cursor: pointer;
}

.esys-assistant.is-open .esys-assistant__launcher[hidden] {
  display: none;
}

.esys-assistant__launcher-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(4, 17, 28, 0.14);
  font-size: 0.75rem;
}

.esys-assistant__panel {
  width: min(420px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  border: 1px solid var(--esys-assistant-line);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(53, 198, 255, 0.2), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%),
    var(--esys-assistant-panel);
  box-shadow: 0 28px 80px rgba(3, 8, 18, 0.45);
  backdrop-filter: blur(18px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.esys-assistant__panel--preview {
  background:
    radial-gradient(circle at top right, rgba(92, 240, 195, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%),
    var(--esys-assistant-panel);
}

.esys-assistant__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid var(--esys-assistant-line);
}

.esys-assistant__eyebrow {
  margin: 0 0 0.2rem;
  color: var(--esys-assistant-accent-2);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.esys-assistant__header h2 {
  margin: 0;
  color: var(--esys-assistant-ink);
  font-size: 0.98rem;
  line-height: 1.15;
}

.esys-assistant__title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.esys-assistant__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--esys-assistant-line);
  border-radius: 50%;
  color: var(--esys-assistant-ink);
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.esys-assistant__tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.esys-assistant__preview-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(92, 240, 195, 0.2);
  border-radius: 999px;
  color: var(--esys-assistant-accent-2);
  background: rgba(92, 240, 195, 0.08);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: help;
}

.esys-assistant__tooltip {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 50%;
  width: min(280px, calc(100vw - 72px));
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(92, 240, 195, 0.14);
  border-radius: 14px;
  color: var(--esys-assistant-ink);
  background: rgba(7, 15, 29, 0.98);
  box-shadow: 0 16px 32px rgba(3, 8, 18, 0.32);
  font-size: 0.78rem;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -6px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 3;
}

.esys-assistant__tooltip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  border-top: 1px solid rgba(92, 240, 195, 0.14);
  border-left: 1px solid rgba(92, 240, 195, 0.14);
  background: rgba(7, 15, 29, 0.98);
  transform: translateX(-50%) rotate(45deg);
}

.esys-assistant__tooltip-wrap:hover .esys-assistant__tooltip,
.esys-assistant__tooltip-wrap:focus-within .esys-assistant__tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.esys-assistant__messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  padding: 0.85rem 1rem 0.25rem;
  overflow-y: auto;
}

.esys-assistant__message {
  max-width: 90%;
  padding: 0.78rem 0.9rem;
  border-radius: 16px;
  line-height: 1.55;
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.esys-assistant__message--compact {
  max-width: 100%;
  padding: 0.72rem 0.85rem;
  font-size: 0.9rem;
}

.esys-assistant__message--assistant {
  color: var(--esys-assistant-ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.esys-assistant__message--user {
  align-self: flex-end;
  color: #04111c;
  background: linear-gradient(135deg, #5cf0c3 0%, #35c6ff 100%);
}

.esys-assistant__prompts {
  display: flex;
  flex: 0 0 auto;
  gap: 0.5rem;
  padding: 0.55rem 1rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.esys-assistant__prompts::-webkit-scrollbar {
  display: none;
}

.esys-assistant__prompt {
  flex: 0 0 auto;
  max-width: 270px;
  padding: 0.48rem 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--esys-assistant-ink);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.esys-assistant__composer {
  flex: 0 0 auto;
  padding: 0.75rem 1rem 0.95rem;
}

.esys-assistant__lead-form {
  flex: 0 0 auto;
  padding: 0 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.esys-assistant__lead-heading {
  margin: 0.75rem 0 0.55rem;
  color: var(--esys-assistant-ink);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}

.esys-assistant__lead-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.6rem;
}

.esys-assistant__lead-fields input {
  width: 100%;
  min-height: 42px;
  padding: 0.72rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: var(--esys-assistant-ink);
  background: rgba(255, 255, 255, 0.04);
}

.esys-assistant__lead-fields input::placeholder {
  color: var(--esys-assistant-muted);
}

.esys-assistant__lead-fields input:last-child {
  grid-column: 1 / -1;
}

.esys-assistant__lead-form textarea {
  width: 100%;
  min-height: 82px;
  margin-bottom: 0.6rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: var(--esys-assistant-ink);
  background: rgba(255, 255, 255, 0.04);
  resize: vertical;
}

.esys-assistant__lead-form textarea::placeholder {
  color: var(--esys-assistant-muted);
}

.esys-assistant__composer textarea {
  width: 100%;
  min-height: 74px;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  color: var(--esys-assistant-ink);
  background: var(--esys-assistant-panel-soft);
  resize: vertical;
}

.esys-assistant__composer textarea::placeholder {
  color: var(--esys-assistant-muted);
}

.esys-assistant__composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.55rem;
}

.esys-assistant__status {
  margin: 0;
  color: var(--esys-assistant-muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.esys-assistant__lead-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.esys-assistant__lead-status {
  margin: 0;
  color: var(--esys-assistant-muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.esys-assistant__send {
  min-width: 78px;
  min-height: 40px;
  padding: 0.58rem 0.95rem;
  border: 0;
  border-radius: 999px;
  color: #04111c;
  background: linear-gradient(135deg, var(--esys-assistant-accent-2) 0%, var(--esys-assistant-accent) 100%);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.esys-assistant__lead-submit {
  min-width: 110px;
  min-height: 40px;
  padding: 0.58rem 0.95rem;
  border: 1px solid rgba(92, 240, 195, 0.18);
  border-radius: 999px;
  color: var(--esys-assistant-ink);
  background: rgba(92, 240, 195, 0.08);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.esys-assistant.is-busy .esys-assistant__send,
.esys-assistant__send:disabled {
  opacity: 0.65;
  cursor: wait;
}

.esys-assistant.is-lead-busy .esys-assistant__lead-submit,
.esys-assistant__lead-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 782px) {
  .esys-assistant {
    right: 16px;
    bottom: 16px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .esys-assistant__launcher {
    min-height: 52px;
    padding-inline: 1rem;
  }

  .esys-assistant__panel {
    width: min(100vw - 20px, 420px);
    max-height: calc(100vh - 20px);
  }

  .esys-assistant__messages {
    padding-inline: 0.95rem;
  }

  .esys-assistant__header,
  .esys-assistant__prompts,
  .esys-assistant__composer,
  .esys-assistant__lead-form {
    padding-inline: 0.95rem;
  }

  .esys-assistant__lead-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 760px) {
  .esys-assistant__panel {
    max-height: calc(100vh - 20px);
  }

  .esys-assistant__composer textarea {
    min-height: 64px;
  }
}
