:root {
  --bi-chat-bg: #050810;
  --bi-chat-surface: #0b0f1a;
  --bi-chat-surface-2: #111828;
  --bi-chat-border: rgba(0, 229, 255, 0.25);
  --bi-chat-text: #e8edf5;
  --bi-chat-muted: #7a8ba0;
  --bi-chat-cyan: #00e5ff;
  --bi-chat-magenta: #c026ff;
  --bi-chat-cyan-soft: rgba(0, 229, 255, 0.16);
}

.bi-chat-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 950;
  font-family: "IBM Plex Mono", "Space Mono", "Courier New", monospace;
}

.bi-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  border: 1px solid var(--bi-chat-cyan);
  background: radial-gradient(circle at 30% 20%, #12304a 0%, #07101e 55%, #050810 100%);
  color: var(--bi-chat-cyan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.2), 0 0 20px rgba(0, 212, 255, 0.35);
  transition: transform 0.24s ease, box-shadow 0.24s ease, filter 0.24s ease;
}

.bi-chat-toggle:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.35), 0 0 26px rgba(0, 212, 255, 0.52);
  filter: brightness(1.05);
}

.bi-chat-toggle svg {
  width: 28px;
  height: 28px;
}

.bi-chat-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: 400px;
  height: 600px;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--bi-chat-border);
  background: rgba(10, 8, 20, 0.85);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.52), 0 0 30px rgba(0, 229, 255, 0.13);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s ease, transform 0.26s ease;
}

.bi-chat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.bi-chat-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bi-chat-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(18, 14, 30, 0.82);
}

.bi-chat-title {
  color: var(--bi-chat-cyan);
  letter-spacing: 1px;
  font-size: 12px;
  text-transform: uppercase;
}

.bi-chat-subtitle {
  color: var(--bi-chat-muted);
  font-size: 10px;
}

.bi-chat-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--bi-chat-border);
  color: var(--bi-chat-muted);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.bi-chat-close:hover {
  color: var(--bi-chat-cyan);
  border-color: var(--bi-chat-cyan);
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.26);
}

.bi-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.bi-chat-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.45;
  font-size: 12px;
  white-space: pre-wrap;
}

.bi-chat-msg.user {
  align-self: flex-end;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.36);
  color: var(--bi-chat-text);
}

.bi-chat-msg.assistant {
  align-self: flex-start;
  background: rgba(22, 18, 34, 0.86);
  border: 1px solid var(--bi-chat-border);
  color: var(--bi-chat-text);
}

.bi-chat-msg.status {
  align-self: center;
  background: transparent;
  border: 1px dashed rgba(122, 139, 160, 0.4);
  color: var(--bi-chat-muted);
  font-size: 11px;
  max-width: 95%;
}

.bi-chat-loader {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bi-chat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bi-chat-cyan);
  animation: bi-chat-bounce 1s infinite ease-in-out;
}

.bi-chat-dot:nth-child(2) { animation-delay: 0.15s; }
.bi-chat-dot:nth-child(3) { animation-delay: 0.3s; }

.bi-chat-cursor {
  margin-left: 7px;
  color: var(--bi-chat-cyan);
  animation: bi-chat-blink 0.9s steps(2, start) infinite;
}

.bi-chat-input-wrap {
  border-top: 1px solid var(--bi-chat-border);
  background: rgba(10, 8, 20, 0.85);
  padding: 10px;
}

.bi-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.bi-chat-input {
  min-height: 42px;
  max-height: 116px;
  resize: none;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--bi-chat-border);
  background: var(--bi-chat-surface-2);
  color: var(--bi-chat-text);
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  outline: none;
}

.bi-chat-input:focus {
  border-color: var(--bi-chat-cyan);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.3), 0 0 16px rgba(0, 212, 255, 0.2);
}

.bi-chat-send {
  height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(0, 229, 255, 0.4);
  background: linear-gradient(180deg, #00e5ff 0%, #00c8df 100%);
  color: #041018;
  font: inherit;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.bi-chat-send:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.32);
}

.bi-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.bi-chat-hint {
  margin-top: 8px;
  color: var(--bi-chat-muted);
  font-size: 10px;
}

@keyframes bi-chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

@keyframes bi-chat-blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (max-width: 640px) {
  .bi-chat-root {
    right: 12px;
    bottom: 12px;
  }

  .bi-chat-panel {
    width: min(420px, calc(100vw - 24px));
    height: min(600px, calc(100vh - 94px));
  }

  .bi-chat-toggle {
    width: 56px;
    height: 56px;
  }
}