:root {
  --bg: #f4f1e8;
  --panel: #fffaf0;
  --text: #1f1f1f;
  --accent: #005f73;
  --accent-2: #0a9396;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #e9d8a6, var(--bg));
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.app-shell {
  width: min(760px, 100%);
  background: color-mix(in srgb, var(--panel) 92%, white);
  border: 1px solid #e5e2d9;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}

.landing-shell {
  max-width: 820px;
}

.landing-content h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}

.landing-content p {
  margin-top: 0.5rem;
  line-height: 1.5;
}

.cta-btn {
  display: inline-block;
  margin-top: 0.75rem;
  background: var(--accent-2);
  color: #fff;
  text-decoration: none;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-weight: 600;
}

.auth-shell {
  width: min(520px, 100%);
}

label {
  font-weight: 600;
}

input[type="password"] {
  width: 100%;
  border: 1px solid #c7c7c7;
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 1rem;
}

.error-msg {
  margin: 0;
  color: #9b2c2c;
  font-weight: 600;
}

header h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-logo {
  width: clamp(2.2rem, 5vw, 3rem);
  height: clamp(2.2rem, 5vw, 3rem);
  border-radius: 10px;
  object-fit: cover;
}

.chat-window {
  min-height: 48vh;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid #ddd8c8;
  border-radius: 12px;
  background: #fff;
  display: grid;
  gap: 0.6rem;
}

.msg {
  white-space: pre-wrap;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  max-width: 90%;
}

.msg-user {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
}

.msg-bot {
  background: #edf8f8;
  border: 1px solid #cfe7e8;
}

.msg-bot a {
  color: #0a5f84;
  text-decoration: underline;
  word-break: break-word;
}

.msg-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.typing-label {
  color: #42646f;
  font-weight: 600;
  font-size: 0.92rem;
}

.typing-dots {
  display: inline-flex;
  gap: 0.22rem;
}

.typing-dots span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #4d7f8f;
  opacity: 0.35;
  animation: typingPulse 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

.chat-form {
  display: grid;
  gap: 0.6rem;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #c7c7c7;
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 1rem;
  font-family: inherit;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.62rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button[type="submit"] {
  background: var(--accent-2);
  color: #fff;
}

.secondary-btn {
  background: #dcecf0;
  color: #213a43;
}

.logout-form {
  margin: 0;
}

.success-msg {
  margin: 0;
  color: #146c2e;
  font-weight: 600;
}

@media (max-width: 640px) {
  body {
    padding: 0.4rem;
  }

  .app-shell {
    border-radius: 12px;
    padding: 0.75rem;
  }

  .chat-window {
    min-height: 52vh;
    max-height: 60vh;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
  }
}
