:root {
  --ejs-blue: #0b5c8e;
  --ejs-blue-dark: #084a72;
  --ejs-orange: #ff914e;
  --ejs-gray: #505050;
  --ejs-gray-light: #9a9a9a;
  --ejs-white: #ffffff;
  --ejs-bg: #f4f7fa;
  --shadow: 0 8px 32px rgba(11, 92, 142, 0.18);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #eef4f8 0%, #ffffff 45%, #fdf6f0 100%);
  color: var(--ejs-gray);
  min-height: 100vh;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.badge {
  display: inline-block;
  background: rgba(255, 145, 78, 0.15);
  color: var(--ejs-orange);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--ejs-blue);
  font-weight: 700;
}

.header p {
  margin: 0;
  color: var(--ejs-gray-light);
  line-height: 1.5;
}

.chat-shell {
  background: var(--ejs-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(11, 92, 142, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.chat-header {
  background: var(--ejs-blue);
  color: var(--ejs-white);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ejs-orange);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}

.chat-header h2 {
  margin: 0;
  font-size: 1rem;
}

.chat-header span {
  display: block;
  font-size: 0.82rem;
  opacity: 0.85;
  margin-top: 2px;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #fbfdff;
}

.message {
  max-width: 88%;
  line-height: 1.55;
  font-size: 0.96rem;
}

.message.user {
  align-self: flex-end;
  background: var(--ejs-blue);
  color: var(--ejs-white);
  padding: 12px 14px;
  border-radius: 16px 16px 4px 16px;
}

.message.assistant {
  align-self: flex-start;
  background: var(--ejs-white);
  border: 1px solid rgba(11, 92, 142, 0.12);
  padding: 14px 16px;
  border-radius: 16px 16px 16px 4px;
  white-space: pre-wrap;
}

.message.system {
  align-self: center;
  color: var(--ejs-gray-light);
  font-size: 0.85rem;
  text-align: center;
}

.fault-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.fault-tag {
  font-size: 0.72rem;
  background: rgba(255, 145, 78, 0.12);
  color: #c65d1a;
  padding: 4px 8px;
  border-radius: 999px;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid rgba(11, 92, 142, 0.08);
  background: var(--ejs-white);
}

.composer textarea {
  flex: 1;
  resize: none;
  min-height: 52px;
  max-height: 140px;
  border: 1px solid rgba(11, 92, 142, 0.18);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

.composer textarea:focus {
  border-color: var(--ejs-blue);
  box-shadow: 0 0 0 3px rgba(11, 92, 142, 0.12);
}

.composer button {
  border: none;
  background: var(--ejs-orange);
  color: var(--ejs-white);
  font-weight: 700;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  min-width: 88px;
}

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

.footer-links {
  margin-top: 18px;
  text-align: center;
  font-size: 0.88rem;
}

.footer-links a {
  color: var(--ejs-blue);
  text-decoration: none;
  margin: 0 8px;
}

.footer-links a:hover {
  text-decoration: underline;
}

.typing {
  color: var(--ejs-gray-light);
  font-style: italic;
}

@media (max-width: 640px) {
  .message {
    max-width: 95%;
  }
}
