*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  background: #f5f5f5;
  color: #1a1a1a;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

#sidebar {
  width: 260px;
  min-width: 260px;
  background: #1e293b;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 24px;
}

#logo {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

#logo span {
  color: #60a5fa;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin-bottom: 8px;
}

#suggested-prompts {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-chip {
  background: #2d3f55;
  border: 1px solid #3b516b;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #cbd5e1;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.prompt-chip:hover {
  background: #3b516b;
  border-color: #60a5fa;
  color: #fff;
}

#logout-btn {
  background: none;
  border: 1px solid #3b516b;
  border-radius: 6px;
  color: #94a3b8;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: color 0.15s, border-color 0.15s;
}

#logout-btn:hover { color: #e2e8f0; border-color: #64748b; }

/* ── Chat area ────────────────────────────────────────────────────────────── */

#chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  max-width: 780px;
  width: 100%;
}

.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }

.bubble {
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user .bubble {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.message.assistant .bubble {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 3px;
}

.citations {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.citation-tag {
  font-size: 11px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  border-radius: 4px;
  padding: 2px 8px;
}

.chart-img {
  margin-top: 12px;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.route-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 6px;
}

.route-badge.rag { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.route-badge.analytics { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }

/* ── Input area ───────────────────────────────────────────────────────────── */

#input-area {
  border-top: 1px solid #e5e7eb;
  padding: 16px 24px;
  background: #fff;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#question-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 140px;
  overflow-y: auto;
  transition: border-color 0.15s;
}

#question-input:focus { border-color: #2563eb; }

#send-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

#send-btn:hover { background: #1d4ed8; }
#send-btn:disabled { background: #93c5fd; cursor: not-allowed; }

/* ── Loading indicator ────────────────────────────────────────────────────── */

.thinking {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  border-bottom-left-radius: 3px;
  width: fit-content;
}

.thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: bounce 1.2s infinite;
}

.thinking span:nth-child(2) { animation-delay: 0.2s; }
.thinking span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}
