.fredbot {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
}

.fredbot * {
  box-sizing: border-box;
}

.fredbot-toggle {
  min-width: 132px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  box-shadow: 0 16px 36px rgba(23, 32, 51, .22);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  padding: 0 18px;
}

.fredbot-toggle:hover,
.fredbot-toggle:focus-visible {
  background: #991b1b;
}

.fredbot-panel {
  position: absolute;
  right: 0;
  bottom: 62px;
  width: min(380px, calc(100vw - 28px));
  height: min(580px, calc(100vh - 108px));
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2ded4;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(23, 32, 51, .24);
}

.fredbot.is-open .fredbot-panel {
  display: grid;
}

.fredbot.is-open .fredbot-toggle {
  display: none;
}

.fredbot-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #e2ded4;
  background: #f7f4ed;
}

.fredbot-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.15;
  font-weight: 950;
  letter-spacing: 0;
}

.fredbot-subtitle {
  margin: 4px 0 0;
  color: #5f6b7a;
  font-size: 13px;
  line-height: 1.35;
}

.fredbot-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #e2ded4;
  border-radius: 999px;
  background: #fff;
  color: #172033;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.fredbot-messages {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  background: #fff;
}

.fredbot-message {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.42;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.fredbot-message.bot {
  justify-self: start;
  background: #f7f4ed;
  border: 1px solid #e2ded4;
}

.fredbot-message.user {
  justify-self: end;
  background: #1746a2;
  color: #fff;
}

.fredbot-message.error {
  background: #fff7db;
  border-color: #eadc9a;
  color: #493d16;
}

.fredbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
  border-top: 1px solid #f0ece3;
}

.fredbot-chip {
  border: 1px solid #e2ded4;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  padding: 8px 10px;
}

.fredbot-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e2ded4;
  background: #f9fafb;
}

.fredbot-input {
  min-width: 0;
  height: 44px;
  border: 1px solid #d8d3c8;
  border-radius: 999px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  color: #172033;
  background: #fff;
}

.fredbot-send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.fredbot-send:disabled,
.fredbot-input:disabled {
  opacity: .62;
  cursor: wait;
}

.fredbot-footnote {
  grid-column: 1 / -1;
  margin: -2px 4px 0;
  color: #5f6b7a;
  font-size: 11px;
  line-height: 1.3;
}

@media (max-width: 520px) {
  .fredbot {
    right: 12px;
    bottom: 12px;
  }

  .fredbot-panel {
    right: -2px;
    bottom: 58px;
    width: calc(100vw - 24px);
    height: min(560px, calc(100vh - 92px));
    border-radius: 16px;
  }

  .fredbot-toggle {
    min-width: 116px;
  }
}
