#ertbot-root {
  --ertbot-red: #bf0e0e;
  --ertbot-red-dark: #9a0b0b;
  --ertbot-bg: #fff;
  --ertbot-fg: #0a0a0a;
  --ertbot-muted: #5c5c5c;
  --ertbot-bot-bg: #f2f2f2;
  --ertbot-line: #e2e2e2;
  --ertbot-link: #bf0e0e;
  --ertbot-scroll: rgba(0, 0, 0, .2);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
}

html.dark #ertbot-root {
  --ertbot-bg: #0a0a0a;
  --ertbot-fg: #fafafa;
  --ertbot-muted: #a6a6a6;
  --ertbot-bot-bg: #1c1c1c;
  --ertbot-line: #2b2b2b;
  --ertbot-link: #ff8080;
  --ertbot-scroll: rgba(255, 255, 255, .22);
}

html.show-nav #ertbot-root {
  display: none;
}

#ertbot-root *,
#ertbot-root *::before,
#ertbot-root *::after {
  box-sizing: border-box;
}

#ertbot-root .ertbot-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#ertbot-root :focus-visible {
  outline: 2px solid var(--ertbot-fg);
  outline-offset: 2px;
}

#ertbot-root textarea:focus-visible {
  outline: none;
}

.ertbot-launcher {
  width: 64px;
  height: 64px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ertbot-red);
  color: #fff;
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background-color .2s, transform .2s;
}

.ertbot-launcher:hover {
  background: var(--ertbot-red-dark);
  transform: scale(1.05);
}

.ertbot-launcher .ertbot-ic-close { display: none; }
#ertbot-root.open .ertbot-launcher .ertbot-ic-chat { display: none; }
#ertbot-root.open .ertbot-launcher .ertbot-ic-close { display: grid; }

.ertbot-teaser {
  position: absolute;
  right: 0;
  bottom: 80px;
  width: 280px;
  padding: 16px 44px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 24px;
  background: var(--ertbot-bg);
  color: var(--ertbot-fg);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}

.ertbot-teaser strong {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
}

.ertbot-teaser.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.ertbot-teaser-close {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px;
  border: 0;
  background: none;
  color: var(--ertbot-muted);
  cursor: pointer;
}

#ertbot-root.open .ertbot-teaser { display: none; }

.ertbot-panel {
  position: absolute;
  right: 0;
  bottom: 84px;
  width: 400px;
  height: min(660px, calc(100dvh - var(--header-height, 88px) - 124px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: var(--ertbot-bg);
  color: var(--ertbot-fg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
  animation: ertbot-open .2s ease-out;
}

html.dark .ertbot-panel {
  box-shadow: 0 0 0 1px var(--ertbot-line), 0 20px 50px rgba(0, 0, 0, .6);
}

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

@keyframes ertbot-open {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.ertbot-head {
  display: flex;
  align-items: flex-start;
  padding: 20px 20px 18px 24px;
  background: var(--ertbot-red);
  color: #fff;
}

.ertbot-head-txt h2 {
  margin: 0;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.ertbot-head-txt h2::after {
  content: '';
  display: block;
  width: 28px;
  height: 3px;
  margin: 10px 0 8px;
  background: #fff;
}

.ertbot-head-txt span {
  display: block;
  font-size: 13px;
  font-weight: 500;
}

.ertbot-head-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.ertbot-head-btn {
  padding: 4px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #fff;
  cursor: pointer;
}

.ertbot-head-btn:hover { background: rgba(255, 255, 255, .15); }
.ertbot-head-btn[hidden] { display: none; }

#ertbot-root .ertbot-head-btn:focus-visible { outline-color: #fff; }

.ertbot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Chromium ignores the ::-webkit-scrollbar rules, arrows included, once the standard properties are set */
@supports not selector(::-webkit-scrollbar) {
  .ertbot-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--ertbot-scroll) transparent;
  }
}

.ertbot-messages::-webkit-scrollbar { width: 6px; }
.ertbot-messages::-webkit-scrollbar-track { background: transparent; }
.ertbot-messages::-webkit-scrollbar-button { display: none; height: 0; }

.ertbot-messages::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background: var(--ertbot-scroll);
}

.ertbot-disclosure {
  margin: 0 0 4px;
  color: var(--ertbot-muted);
  font-size: 12px;
  line-height: 1.45;
}

.ertbot-msg {
  max-width: 88%;
  padding: 11px 15px;
  border-radius: 20px;
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  animation: ertbot-in .2s ease-out;
}

@keyframes ertbot-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.ertbot-msg.bot {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: var(--ertbot-bot-bg);
  color: var(--ertbot-fg);
}

.ertbot-msg.user {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: var(--ertbot-red);
  color: #fff;
  white-space: pre-wrap;
}

.ertbot-msg.error { box-shadow: inset 0 0 0 1px var(--ertbot-red); }

.ertbot-msg a {
  color: var(--ertbot-link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ertbot-msg strong { font-weight: 700; }
.ertbot-msg p { margin: 0 0 8px; }
.ertbot-msg p:last-child { margin: 0; }
.ertbot-msg ul { margin: 4px 0 12px; padding-left: 18px; list-style: disc; }
.ertbot-msg ul:last-child { margin-bottom: 0; }
.ertbot-msg li { margin: 0 0 8px; }
.ertbot-msg li:last-child { margin-bottom: 0; }
.ertbot-msg li::marker { color: var(--ertbot-red); }

.ertbot-msg .ertbot-h {
  margin: 14px 0 6px;
  color: var(--ertbot-fg);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.ertbot-msg .ertbot-h:first-child { margin-top: 0; }

.ertbot-chips {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.ertbot-chip {
  padding: 9px 16px;
  border: 2px solid var(--ertbot-red);
  border-radius: 999px;
  background: transparent;
  color: var(--ertbot-fg);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .02em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s, color .15s;
}

.ertbot-chip:hover {
  background: var(--ertbot-red);
  color: #fff;
}

.ertbot-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 1.55em;
}

.ertbot-typing-note {
  display: block;
  margin-top: 4px;
  font-size: .85em;
  color: var(--ertbot-muted);
}

.ertbot-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ertbot-muted);
  animation: ertbot-bounce 1.2s infinite;
}

.ertbot-typing i:nth-child(2) { animation-delay: .15s; }
.ertbot-typing i:nth-child(3) { animation-delay: .3s; }

@keyframes ertbot-bounce {
  0%, 60%, 100% { transform: none; opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ertbot-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 0;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--ertbot-line);
}

.ertbot-input textarea {
  flex: 1;
  min-height: 46px;
  max-height: 120px;
  margin: 0;
  padding: 12px 18px;
  border: 2px solid var(--ertbot-line);
  border-radius: 23px;
  background: var(--ertbot-bg);
  color: var(--ertbot-fg);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  resize: none;
  outline: none;
  overflow-y: hidden;
  scrollbar-width: none;
}

.ertbot-input textarea::-webkit-scrollbar { display: none; }

.ertbot-input textarea:focus { border-color: var(--ertbot-red); }
.ertbot-input textarea::placeholder { color: var(--ertbot-muted); opacity: 1; }

.ertbot-send {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ertbot-red);
  color: #fff;
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background-color .15s, opacity .15s;
}

.ertbot-send:hover { background: var(--ertbot-red-dark); }

.ertbot-send:disabled {
  opacity: .4;
  cursor: default;
}

@media (max-width: 767px) {
  #ertbot-root {
    right: 16px;
    bottom: 100px;
  }

  .ertbot-launcher {
    width: 56px;
    height: 56px;
  }

  .ertbot-panel {
    position: fixed;
    right: 8px;
    bottom: 164px;
    left: 8px;
    width: auto;
    height: calc(100dvh - var(--header-height, 72px) - 176px);
    max-height: 640px;
  }

  .ertbot-input textarea {
    font-size: 16px;
  }

  .ertbot-teaser {
    bottom: 68px;
    width: min(280px, calc(100vw - 32px));
  }
}

@media (prefers-reduced-motion: reduce) {
  #ertbot-root *,
  #ertbot-root *::after {
    animation: none !important;
    transition: none !important;
  }
}
