:root {
  --chat-accent: #4A39D8;
  --chat-accent-soft: #e8e5f8;
  --chat-bg: #fafafa;
  --chat-surface: #ffffff;
  --chat-ink: #0e1530;
  --chat-ink-2: #5a6075;
  --chat-border: #ebebe8;
  --chat-r: 12px;
  --chat-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--chat-font);
  background: var(--chat-bg);
  color: var(--chat-ink);
}

#chat-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  background: var(--chat-surface);
  border-left: 1px solid var(--chat-border);
  border-right: 1px solid var(--chat-border);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--chat-border);
  background: var(--chat-surface);
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--chat-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.chat-header-info h1 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.chat-header-info span {
  font-size: 12px;
  color: var(--chat-ink-2);
}

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

.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--chat-r);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-msg-agent {
  align-self: flex-start;
  background: var(--chat-bg);
  border: 1px solid var(--chat-border);
  border-bottom-left-radius: 4px;
}

.chat-msg-user {
  align-self: flex-end;
  background: var(--chat-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-typing {
  align-self: flex-start;
  background: var(--chat-bg);
  border: 1px solid var(--chat-border);
  border-bottom-left-radius: 4px;
  color: var(--chat-ink-2);
  font-style: italic;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--chat-border);
  background: var(--chat-surface);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-r);
  font-size: 14px;
  font-family: var(--chat-font);
  outline: none;
  resize: none;
  min-height: 42px;
  max-height: 120px;
}

.chat-input:focus {
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 2px var(--chat-accent-soft);
}

.chat-send {
  padding: 10px 20px;
  background: var(--chat-accent);
  color: #fff;
  border: none;
  border-radius: var(--chat-r);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.chat-send:hover { opacity: 0.9; }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

.chat-powered {
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: var(--chat-ink-2);
  flex-shrink: 0;
}

.chat-powered a {
  color: var(--chat-accent);
  text-decoration: none;
}

@media (max-width: 720px) {
  #chat-root { border: none; }
}
