:root {
  --primary: #0f1b2d;
  --accent: #2f6df6;
  --text-on-accent: #ffffff;
  --bg: #f7f8fb;
  --assistant-bg: #eef1f6;
  --assistant-text: #14202e;
  --muted: #8a93a3;
  --border: #e3e7ee;
  --radius: 16px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--assistant-text);
}

.chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
}

.chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.98rem;
  flex: 0 0 auto;
}
.chat__status {
  width: 9px; height: 9px; border-radius: 50%;
  background: #36d399; box-shadow: 0 0 0 3px rgba(54,211,153,.2);
}

.chat__messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: var(--radius);
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: rise .18s ease-out;
}
.bubble--assistant {
  align-self: flex-start;
  background: var(--assistant-bg);
  color: var(--assistant-text);
  border-bottom-left-radius: 5px;
}
.bubble--user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--text-on-accent);
  border-bottom-right-radius: 5px;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }

.chat__typing {
  display: flex; gap: 4px; padding: 4px 22px 8px;
}
.chat__typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite both;
}
.chat__typing span:nth-child(2) { animation-delay: .2s; }
.chat__typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chat__footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  padding: 10px 12px 8px;
  background: #fff;
}
.chat__composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.chat__input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px 14px;
  font: inherit;
  max-height: 120px;
  outline: none;
}
.chat__input:focus { border-color: var(--accent); }
.chat__send {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border: none; border-radius: 50%;
  background: var(--accent); color: var(--text-on-accent);
  font-size: 1.1rem; cursor: pointer;
  transition: opacity .15s;
}
.chat__send:disabled { opacity: .4; cursor: default; }
.chat__signature {
  display: block;
  text-align: center;
  margin-top: 7px;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .02em;
}
.chat__signature:hover { color: var(--accent); }
