:root {
  --accent: #942824;
  --accent-ink: #ffffff;
  --bg: #ece5dd;          /* warm messenger backdrop */
  --bot-bubble: #ffffff;
  --user-bubble: #d9fdd3; /* will be tinted toward accent via JS if desired */
  --ink: #131414;
  --muted: #8c8985;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #20242a;
  color: var(--ink);
  display: flex; justify-content: center; align-items: stretch;
}

.phone {
  width: 100%; max-width: 460px; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,.35);
}

/* Header */
.bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 1px 6px rgba(0,0,0,.18); z-index: 2;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; flex: 0 0 auto;
}
.bar-name { font-weight: 600; font-size: 16px; line-height: 1.2; }
.bar-sub { font-size: 12px; opacity: .85; }
.bar-logo { max-height: 34px; max-width: 70%; object-fit: contain; }

/* Thread */
.thread {
  flex: 1; overflow-y: auto; padding: 16px 12px 8px;
  display: flex; flex-direction: column; gap: 8px;
  scroll-behavior: smooth;
}
.row { display: flex; }
.row.bot { justify-content: flex-start; }
.row.user { justify-content: flex-end; }

.bubble {
  max-width: 78%; padding: 8px 12px; border-radius: 14px;
  font-size: 15px; line-height: 1.42; white-space: pre-wrap; word-wrap: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
  animation: pop .18s ease-out;
}
.row.bot .bubble  { background: var(--bot-bubble); border-top-left-radius: 4px; }
.row.user .bubble { background: var(--user-bubble); border-top-right-radius: 4px; }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* Typing indicator */
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; align-items: center; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  opacity: .5; animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { transform: scale(.7); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* Composer */
.composer {
  display: flex; gap: 8px; padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: #f3efe9; border-top: 1px solid rgba(0,0,0,.06);
}
.composer input {
  flex: 1; border: none; border-radius: 22px; padding: 11px 16px;
  font-size: 15px; background: #fff; outline: none;
}
.composer button {
  flex: 0 0 auto; width: 44px; height: 44px; border: none; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s, opacity .2s;
}
.composer button:active { transform: scale(.92); }
.composer button:disabled { opacity: .45; cursor: not-allowed; }

.note {
  align-self: center; font-size: 12px; color: var(--muted);
  background: rgba(255,255,255,.55); padding: 4px 12px; border-radius: 12px; margin: 6px 0;
}
