body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f4f7fa;
  color: #1f2d3d;
}

.container {
  max-width: 1180px;
  margin: 24px auto;
  background: #ffffff;
  padding: 28px;
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.05);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.title-wrap {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  color: #00667d;
  letter-spacing: 0.2px;
  font-weight: 700;
}

.user-bar {
  margin-top: 12px;
  font-size: 13px;
  color: #667085;
}

.user-bar a {
  color: #00667d;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.lang-wrap select {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #d8dee6;
  background: #ffffff;
  font-size: 14px;
  min-width: 170px;
  transition: border-color 0.2s ease;
}

.lang-wrap select:hover,
.lang-wrap select:focus {
  border-color: #00667d;
  outline: none;
}

.clear-btn {
  background: transparent;
  border: 1px solid #d8dee6;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #475467;
}

.clear-btn:hover {
  background: #f4f7fa;
  border-color: #00667d;
  color: #00667d;
}

.intro-text {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #758399;
  text-align: center;
}

.chat-window {
  height: min(590px, 62vh);
  min-height: 430px;
  overflow-y: auto;
  border: 1px solid #e3e9ef;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  background: #ffffff;
  scroll-behavior: smooth;
}

.starter-tip {
  font-size: 13px;
  color: #6b7785;
  padding: 8px;
}

.message {
  margin-bottom: 22px;
}

.user {
  font-size: 17px;
  font-weight: 750;
  margin-bottom: 14px;
  color: #334e68;
}

.assistant-label {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #344054;
}

.copilot-wrapper {
  position: relative;
}

.copilot {
  background: #f2f8fa;
  padding: 18px 22px;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 15.5px;
  border-left: 5px solid #00667d;
  animation: fadeIn 0.2s ease-in;
  overflow-wrap: anywhere;
}

.copilot a {
  color: #2c6e8f;
  font-weight: 600;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 15px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.15s ease;
  color: #5f6c7b;
  z-index: 2;
}

.copilot-wrapper:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  transform: scale(1.08);
  color: #00667d;
}

.metadata {
  font-size: 13px;
  color: #667085;
  margin-top: 12px;
}

.follow-up-message {
  line-height: 1.45;
}

.reference-title {
  margin-top: 10px;
  margin-bottom: 9px;
  font-weight: 700;
  color: #4a5568;
}

.reference-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reference-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 24px;
  background: #eaf5f8;
  border: 1px solid #c7dfe7;
  color: #2c6e8f;
  text-decoration: none;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.reference-chip:hover {
  background: #d9eef5;
  border-color: #9fcbd8;
  text-decoration: none;
}

.input-area {
  display: flex;
  gap: 12px;
}

#userInput {
  flex: 1;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #d8dee6;
  font-size: 15px;
  transition: all 0.2s ease;
}

#userInput:focus {
  outline: none;
  border-color: #00667d;
  box-shadow: 0 0 0 2px rgba(0, 102, 125, 0.1);
}

#sendBtn {
  padding: 12px 24px;
  background: #00667d;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  min-width: 120px;
  transition: all 0.2s ease;
}

#sendBtn:hover {
  background: #005463;
  transform: translateY(-1px);
}

#sendBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.footer-note {
  margin-top: 18px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.5;
  color: #98a2b3;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  animation: fadeIn 0.3s ease;
}

.loader {
  display: flex;
  gap: 6px;
}

.loader span {
  width: 8px;
  height: 8px;
  background: #00667d;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.loader span:nth-child(2) {
  animation-delay: 0.2s;
}

.loader span:nth-child(3) {
  animation-delay: 0.4s;
}

.thinking-text {
  font-size: 12px;
  color: #667085;
  margin-top: 7px;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .container {
    margin: 0;
    padding: 18px;
    border-radius: 0;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .lang-wrap select {
    min-width: 150px;
  }

  .chat-window {
    min-height: 400px;
    height: 58vh;
    padding: 14px;
  }

  h1 {
    font-size: 26px;
  }

  .input-area {
    gap: 8px;
  }

  #sendBtn {
    min-width: 92px;
    padding-inline: 16px;
  }
}
