:root {
  --header-bg: #2b65de;
  --bot-bg: #edf1fa;
  --bot-text: #2b3244;
  --user-bg: #2b65de;
  --user-text: #ffffff;
  --send-bg: #2b65de;
  --surface: #f7f9fc;
  --border: #d8e0ef;
  --text: #2b3244;
  --muted: #5c667a;
  --error: #b42318;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(43, 50, 68, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--surface);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 920px;
  margin: 0 auto;
  background: #fff;
  box-shadow: var(--shadow);
}

.header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--header-bg);
  color: #fff;
}

.header-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  object-fit: cover;
}

.header-text h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}

.header-text p {
  margin: 2px 0 0;
  font-size: 0.88rem;
  opacity: 0.92;
}

.header-actions {
  margin-left: auto;
}

.btn-secondary {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: var(--radius);
  line-height: 1.55;
  font-size: 0.96rem;
  word-wrap: break-word;
}

.message.assistant {
  align-self: flex-start;
  background: var(--bot-bg);
  color: var(--bot-text);
}

.message.user {
  align-self: flex-end;
  background: var(--user-bg);
  color: var(--user-text);
}

.message.typing {
  opacity: 0.75;
  font-style: italic;
}

.message p {
  margin: 0 0 0.65em;
}

.message p:last-child {
  margin-bottom: 0;
}

.message ul,
.message ol {
  margin: 0.4em 0 0.6em 1.2em;
  padding: 0;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.composer textarea {
  flex: 1;
  resize: none;
  min-height: 46px;
  max-height: 140px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  line-height: 1.45;
}

.composer textarea:focus {
  outline: 2px solid rgba(43, 101, 222, 0.35);
  border-color: var(--send-bg);
}

.composer button {
  align-self: flex-end;
  border: 0;
  border-radius: 12px;
  background: var(--send-bg);
  color: #fff;
  font-weight: 600;
  padding: 12px 18px;
  cursor: pointer;
}

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

.footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 16px 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--error);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 640px) {
  .app {
    max-width: none;
    box-shadow: none;
  }

  .message {
    max-width: 94%;
  }
}
