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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  height: 100vh;
  overflow: hidden;
}

#chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
}

/* Header */
header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  background: #1a1a2e;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

.header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
}

/* Messages area */
main {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  max-width: 92%;
}

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

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

.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.message.user .bubble {
  background: #1a1a2e;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant .bubble {
  background: #f0f0f0;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

/* Markdown inside bubbles */
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 4px 0 8px 20px; }
.bubble code {
  background: rgba(0,0,0,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}
.bubble pre {
  background: rgba(0,0,0,0.06);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 6px 0;
}
.bubble pre code {
  background: none;
  padding: 0;
}
.bubble strong { font-weight: 600; }
.bubble .table-wrapper {
  overflow-x: auto;
  margin: 8px 0;
}
.bubble table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
  min-width: 280px;
}
.bubble th, .bubble td {
  border: 1px solid #ccc;
  padding: 6px 10px;
  text-align: left;
}
.bubble th {
  background: rgba(0,0,0,0.07);
  font-weight: 600;
  white-space: nowrap;
}
.bubble h2, .bubble h3 {
  margin: 12px 0 6px;
  font-size: 15px;
}
.bubble h2:first-child, .bubble h3:first-child {
  margin-top: 0;
}
.bubble hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 10px 0;
}

/* Suggested questions */
#suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 0;
  align-self: flex-start;
  max-width: 92%;
}

.suggestion-chip {
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 16px;
  padding: 8px 14px;
  font-size: 13px;
  color: #1a1a2e;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  line-height: 1.3;
  text-align: left;
  font-family: inherit;
  width: fit-content;
}

.suggestion-chip:hover {
  background: #f0f0f0;
  border-color: #1a1a2e;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Typing indicator */
.typing .bubble::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  background: #888;
  margin-left: 2px;
  animation: blink 0.8s infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Input form */
form {
  display: flex;
  padding: 12px 16px;
  gap: 8px;
  border-top: 1px solid #e5e5e5;
  background: #fff;
  flex-shrink: 0;
}

input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus {
  border-color: #1a1a2e;
}

button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #1a1a2e;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

button:hover { opacity: 0.85; }
button:disabled { opacity: 0.4; cursor: default; }

/* Scrollbar */
main::-webkit-scrollbar { width: 6px; }
main::-webkit-scrollbar-track { background: transparent; }
main::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
