html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
}

header {
  background: #1e293b;
  color: white;
  padding: 1rem 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

#chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  border: 1px solid #e2e8f0;
  background: white;
}

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

.message {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  white-space: pre-wrap;
  line-height: 1.4;
}

.message img {
  max-width: 80%
}

.user {
  align-self: flex-end;
  background: #2563eb;
  color: white;
}

.assistant {
  align-self: flex-start;
  background: #e2e8f0;
  color: #1e293b;
}

/* Assistant tables */
.assistant table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.25rem 0;
  font-size: 0.95rem;
}
.assistant thead th {
  background: #dbe5f3;
  color: #0f172a;
  text-align: left;
}
.assistant th, .assistant td {
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.6rem;
  vertical-align: top;
}
.assistant tbody tr:nth-child(odd) {
  background: #f8fafc;
}
.assistant .table-scroll {
  overflow-x: auto;
}

/* Typing indicator (three animated dots) */
.typing {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.typing .dot {
  width: 6px;
  height: 6px;
  background: #475569;
  border-radius: 50%;
  opacity: 0.3;
  animation: typingBlink 1.4s infinite ease-in-out;
}
.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBlink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

#input-bar {
  display: flex;
  border-top: 1px solid #e2e8f0;
  padding: 0.5rem;
}

#user-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
}

button {
  margin-left: 0.5rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}