body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

.layout {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.chat-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.chat-header h1 {
  margin: 0;
  font-size: 20px;
}

.chat-header p {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 14px;
}

.status {
  flex-shrink: 0;
  font-size: 12px;
  color: #2563eb;
  background: #dbeafe;
  padding: 6px 10px;
  border-radius: 999px;
}

.chat-messages {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  background: #f8fafc;
  min-height: 420px;
}

.message {
  max-width: min(80%, 680px);
  padding: 12px 14px;
  border-radius: 10px;
  white-space: pre-wrap;
  line-height: 1.6;
  word-break: break-word;
}

.message.bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

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

.message.system {
  align-self: center;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  color: #dc2626;
  font-size: 13px;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px 24px 24px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
}

.chat-input textarea {
  resize: none;
  min-height: 52px;
  max-height: 160px;
  padding: 14px 16px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font: inherit;
  outline: none;
}

.chat-input textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.chat-input button {
  min-width: 96px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

.chat-input button:disabled {
  cursor: not-allowed;
  background: #93c5fd;
}

@media (max-width: 640px) {
  .layout {
    padding: 0;
  }

  .chat-shell {
    width: 100%;
    border-radius: 0;
    min-height: 100vh;
  }

  .chat-messages {
    min-height: 0;
  }

  .chat-input {
    grid-template-columns: 1fr;
  }
}

