.chatbot-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 260;
}

.chatbot-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 58px;
  padding: 0.9rem 1.1rem;
  border: 1px solid rgba(13, 35, 77, 0.16);
  border-radius: 999px;
  background: linear-gradient(135deg, #173f89 0%, #0d1d38 100%);
  color: #f7fbff;
  box-shadow: 0 18px 40px rgba(6, 20, 45, 0.28);
  cursor: pointer;
}

.chatbot-fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.chatbot-fab-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.85rem);
  width: min(380px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1.4rem;
  background: color-mix(in srgb, var(--bg) 94%, white);
  box-shadow: 0 28px 56px rgba(7, 18, 41, 0.2);
  backdrop-filter: blur(16px);
}

.chatbot-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.chatbot-kicker {
  margin: 0 0 0.35rem;
  color: var(--accent2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chatbot-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 500;
}

.chatbot-close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.15rem;
  cursor: pointer;
}

.chatbot-body {
  padding: 0.95rem 1rem 0.8rem;
}

.chatbot-messages {
  display: grid;
  gap: 0.75rem;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.chatbot-message {
  max-width: 88%;
  padding: 0.8rem 0.9rem;
  border-radius: 1rem;
  line-height: 1.65;
  font-size: 0.95rem;
}

.chatbot-message p {
  margin: 0;
}

.chatbot-message p + p,
.chatbot-message p + ul,
.chatbot-message p + ol,
.chatbot-message ul + p,
.chatbot-message ol + p,
.chatbot-message ul + ul,
.chatbot-message ol + ol {
  margin-top: 0.7rem;
}

.chatbot-message ul,
.chatbot-message ol {
  margin: 0;
  padding-left: 1.15rem;
}

.chatbot-message li + li {
  margin-top: 0.32rem;
}

.chatbot-message a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.chatbot-message code {
  padding: 0.12rem 0.35rem;
  border-radius: 0.45rem;
  background: rgba(20, 32, 51, 0.08);
  font-family: var(--font-mono);
  font-size: 0.84em;
}

.chatbot-message-user code {
  background: rgba(255, 255, 255, 0.14);
}

.chatbot-message-bot {
  justify-self: start;
  border: 1px solid var(--border);
  background: var(--surface);
}

.chatbot-message-user {
  justify-self: end;
  background: linear-gradient(135deg, var(--accent) 0%, #0d1d38 100%);
  color: #fff;
}

.chatbot-message-loading {
  color: var(--muted);
  font-style: italic;
}

.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.chatbot-chip {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.chatbot-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.95rem 1rem 1rem;
  border-top: 1px solid var(--border);
}

.chatbot-input {
  min-height: 48px;
  max-height: 140px;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  color: var(--text);
  resize: none;
}

.chatbot-send {
  min-width: 82px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 1rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.chatbot-send[disabled],
.chatbot-input[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

body.theme-dark .chatbot-fab {
  border-color: rgba(156, 195, 255, 0.22);
  background: linear-gradient(135deg, #1c438a 0%, #081424 100%);
}

body.theme-dark .chatbot-panel {
  background: color-mix(in srgb, var(--bg) 92%, black);
}

@media (max-width: 640px) {
  .chatbot-widget {
    right: 0.85rem;
    bottom: 0.85rem;
  }

  .chatbot-fab {
    min-height: 54px;
    padding: 0.82rem 0.95rem;
  }

  .chatbot-panel {
    width: min(100vw - 20px, 380px);
  }

  .chatbot-form {
    grid-template-columns: 1fr;
  }
}
