:root {
  --teal-1: #1f8a91;
  --teal-2: #0e6a70;
  --teal-ink: #0b5b60;
  --bg: #eef2f2;
  --card: #ffffff;
  --bubble: #f2f2f2;
  --ink: #1f2328;
  --muted: #5f666d;
  --line: #d9dcdf;
  --radius: 22px;
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; background: var(--bg); }

button { font: inherit; cursor: pointer; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(14, 106, 112, 0.12);
  overflow: hidden;
}
.login-card .head {
  background: linear-gradient(135deg, var(--teal-1), var(--teal-2));
  color: #fff;
  padding: 28px 28px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.login-card .head h1 { margin: 0; font-size: 20px; font-weight: 650; }
.login-card .head p { margin: 2px 0 0; font-size: 13px; opacity: 0.85; }
.login-card form { padding: 24px 28px 28px; display: grid; gap: 14px; }
.login-card label { font-size: 14px; font-weight: 600; }
.login-card input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 16px;
}
.login-card input:focus { outline: 2px solid var(--teal-1); outline-offset: 1px; border-color: transparent; }
.login-card button {
  padding: 13px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--teal-2);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
}
.login-card button:hover { background: var(--teal-ink); }
.login-error { color: #b42318; font-size: 14px; margin: 0; }
.login-note { color: var(--muted); font-size: 12.5px; margin: 0; line-height: 1.5; }

/* ---------- logo ---------- */
.logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
}
.logo img { width: 34px; height: 34px; object-fit: contain; }

/* ---------- chat page ---------- */
.page {
  height: 100%;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}
.chat {
  width: 100%;
  max-width: 760px;
  height: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(14, 106, 112, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-head {
  background: linear-gradient(135deg, var(--teal-1), var(--teal-2));
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.chat-head h1 { margin: 0; font-size: 18px; font-weight: 650; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  background: transparent;
  border: 0;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  opacity: 0.9;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.14); opacity: 1; }
.icon-btn svg { width: 22px; height: 22px; }
.logout { color: #fff; font-size: 13px; opacity: 0.85; text-decoration: none; padding: 6px 4px; }
.logout:hover { opacity: 1; text-decoration: underline; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 20px;
  line-height: 1.5;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.msg.bot { background: var(--bubble); align-self: flex-start; border-top-left-radius: 8px; }
.msg.user { background: var(--teal-2); color: #fff; align-self: flex-end; border-top-right-radius: 8px; white-space: pre-wrap; }
.msg p { margin: 0 0 8px; }
.msg p:last-child, .msg ul:last-child, .msg ol:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 4px 0 8px; padding-left: 22px; }
.msg li { margin: 2px 0; }
.msg a { color: var(--teal-ink); font-weight: 500; }
.msg em { color: var(--muted); font-size: 14px; }

.feedback { display: flex; gap: 4px; align-self: flex-start; margin: -6px 0 0 8px; }
.feedback button {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 14px;
  color: var(--muted);
}
.feedback button:hover { border-color: var(--line); }
.feedback button.on { background: var(--bubble); border-color: var(--line); color: var(--ink); }

.typing { display: inline-flex; gap: 5px; padding: 4px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa1a6; animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.chips { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; margin-top: 8px; }
.chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 550;
  color: var(--ink);
}
.chip:hover { border-color: var(--teal-1); color: var(--teal-ink); }

.composer { padding: 12px 20px 8px; }
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid #4a4f54;
  border-radius: 28px;
  padding: 8px 8px 8px 20px;
  background: #fff;
}
.input-row:focus-within { border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(31, 138, 145, 0.15); }
.input-row textarea {
  flex: 1;
  border: 0;
  outline: 0;
  resize: none;
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  padding: 8px 0;
  max-height: 160px;
  background: transparent;
  color: var(--ink);
}
.send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--teal-2);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.send:disabled { background: #eef0f1; color: #b5bbc0; cursor: default; }
.send svg { width: 18px; height: 18px; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 6px 16px 14px; }

@media (max-width: 600px) {
  .page { padding: 0; }
  .chat { border-radius: 0; box-shadow: none; }
  .chat-head { gap: 8px; padding: 12px 12px 12px 14px; }
  .chat-head h1 { font-size: 17px; }
  .logout { font-size: 12px; }
  .messages { padding: 16px 14px 8px; }
  .composer { padding: 10px 14px 6px; }
  .msg { max-width: 92%; }
}
