* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f6f8;
  color: #1f2933;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.header h1 {
  margin: 0 0 4px;
  font-size: 2rem;
}

.header p {
  margin: 0 0 24px;
  color: #52606d;
}

.chat {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  min-height: 360px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
}

.message .bubble {
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 0.98rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user {
  justify-content: flex-end;
}

.message.user .bubble {
  max-width: 70%;
  background: #2563eb;
  color: #ffffff;
}

.message.bot {
  justify-content: flex-start;
}

.message.bot .bubble {
  max-width: 100%;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  white-space: normal;
  overflow-x: auto;
}

.message.bot .bubble table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0 0;
  font-size: 0.94rem;
}

.message.bot .bubble th,
.message.bot .bubble td {
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.message.bot .bubble th {
  background: #f1f5f9;
  font-weight: 600;
}

.thinking {
  margin-top: 12px;
  color: #52606d;
  font-size: 0.92rem;
  display: none;
}

.thinking.active {
  display: inline-block;
}

.thinking .dots {
  display: inline-block;
  width: 1.2em;
  overflow: hidden;
  vertical-align: bottom;
  animation: ellipsis 1.2s steps(4, end) infinite;
}

.typing-cursor {
  display: inline-block;
  width: 0.6ch;
  margin-left: 2px;
  color: #0f172a;
  animation: blink 1s step-end infinite;
}

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

@keyframes ellipsis {
  from {
    width: 0;
  }
  to {
    width: 1.2em;
  }
}

.composer {
  margin-top: 20px;
  display: flex;
  gap: 12px;
}

.composer input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #cbd2d9;
  border-radius: 10px;
  font-size: 1rem;
}

.composer button {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: #0f172a;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

.composer button:hover {
  background: #1e293b;
}
