* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --bg: #f1f5f4;
  --bubble-bot: #ffffff;
  --bubble-user: var(--teal);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: #1f2937;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  box-shadow: 0 0 24px rgba(0,0,0,.08);
}
#topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--teal);
  color: #fff;
}
#avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; }
#titles { flex: 1; min-width: 0; }
#biz-name { font-size: 17px; font-weight: 700; }
#biz-sub { font-size: 12px; opacity: .85; }
#lang {
  border: 1px solid rgba(255,255,255,.5);
  background: transparent;
  color: #fff;
  border-radius: 8px;
  padding: 5px 6px;
  font-size: 13px;
}
#lang option { color: #111; }
#chat {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-line;
  animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.msg.bot {
  align-self: flex-start;
  background: var(--bubble-bot);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.msg.user {
  align-self: flex-end;
  background: var(--bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}
[dir="rtl"] .msg.bot { border-radius: 16px; border-bottom-right-radius: 4px; }
[dir="rtl"] .msg.user { border-radius: 16px; border-bottom-left-radius: 4px; }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #9ca3af;
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
#chips {
  display: flex;
  gap: 8px;
  padding: 6px 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
#chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--teal);
  color: var(--teal-dark);
  background: #fff;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
}
.chip:active { background: #ccfbf1; }
#composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #e5e7eb;
}
#input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 15px;
  outline: none;
}
#input:focus { border-color: var(--teal); }
#send {
  width: 44px; height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
#send:active { background: var(--teal-dark); }
[dir="rtl"] #send svg { transform: scaleX(-1); }
#install-btn {
  position: fixed;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  cursor: pointer;
  z-index: 10;
}
