:root {
  --red: #d71920;
  --red-dark: #ad0f15;
  --black: #101010;
  --ink: #181818;
  --muted: #656565;
  --line: #e8e8e8;
  --soft: #f5f5f5;
  --white: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: #efefef; }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

body.embedded { background: white; }
body.embedded .app-shell { min-height: 100dvh; padding: 0; }
body.embedded .chat-panel { width: 100%; height: 100dvh; border-radius: 0; box-shadow: none; }

.chat-panel {
  width: min(560px, 100%);
  height: min(760px, calc(100dvh - 48px));
  background: white;
  border-radius: 16px;
  box-shadow: 0 18px 55px rgba(0,0,0,.16);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
}

.chat-header {
  min-height: 76px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  background: var(--black);
  border-top: 4px solid var(--red);
}
.brand-mark { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 11px; background: white; display: grid; place-items: center; padding: 4px; overflow: hidden; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.chat-header > div:nth-child(2) { min-width: 0; display: grid; gap: 3px; flex: 1; }
.chat-header strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; }
.chat-header span { color: #b8b8b8; font-size: 12px; }
.chat-header span i { width: 7px; height: 7px; border-radius: 50%; background: #35c76f; display: inline-block; margin-right: 4px; }
.chat-body { padding: 20px 18px 14px; overflow-y: auto; background: #fafafa; scroll-behavior: smooth; }
.message { max-width: 88%; margin-bottom: 12px; padding: 11px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.48; animation: message-in .2s ease both; }
.message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-message { background: white; border: 1px solid var(--line); border-top-left-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.04); }
.user-message { margin-left: auto; color: white; background: var(--red); border-bottom-right-radius: 4px; }
.message-label { color: var(--red); font-size: 9px; letter-spacing: .12em; font-weight: 850; margin-bottom: 5px; }
.error-message { color: #7c1115; background: #fff0f0; border-color: #ffd0d2; }
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } }

.typing { display: flex; gap: 4px; width: fit-content; padding: 15px 17px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: #aaa; animation: bounce 1s infinite alternate; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { to { transform: translateY(-4px); background: var(--red); } }

.suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 4px; }
.suggestions button { border: 1px solid #d9d9d9; background: white; color: #333; border-radius: 999px; padding: 8px 10px; font-size: 11.5px; cursor: pointer; transition: border-color .15s, color .15s; }
.suggestions button:hover { border-color: var(--red); color: var(--red); }

.chat-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: white; }
.chat-actions a { min-height: 43px; display: flex; justify-content: center; align-items: center; gap: 7px; border-radius: 9px; padding: 8px; text-decoration: none; font-size: 11.5px; font-weight: 800; text-align: center; }
.chat-actions svg { width: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.primary-action { background: var(--red); color: white; }
.primary-action:hover { background: var(--red-dark); }
.secondary-action { border: 1px solid #c9c9c9; background: white; color: #1c1c1c; }
.secondary-action:hover { border-color: var(--red); color: var(--red-dark); }
.map-credit { margin: -4px 12px 8px; color: #777; font-size: 9px; text-align: center; }
.map-credit a { color: inherit; }

@media (max-width: 520px) {
  .chat-actions { grid-template-columns: 1fr; }
}

.chat-form { min-height: 62px; padding: 9px 10px 8px 14px; display: flex; align-items: flex-end; gap: 8px; border-top: 1px solid var(--line); background: white; }
.chat-form textarea { width: 100%; max-height: 90px; resize: none; border: 0; outline: 0; padding: 10px 0; line-height: 20px; font-size: 14px; color: var(--ink); }
.chat-form textarea::placeholder { color: #999; }
.chat-form button { flex: 0 0 auto; width: 42px; height: 42px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--black); color: white; cursor: pointer; }
.chat-form button:hover { background: var(--red); }
.chat-form button:disabled { opacity: .45; cursor: not-allowed; }
.chat-form svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.privacy-note { margin: 0; padding: 0 12px 9px; color: #888; background: white; text-align: center; font-size: 9.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 560px) {
  .app-shell { padding: 0; }
  .chat-panel { width: 100%; height: 100dvh; border-radius: 0; box-shadow: none; }
  .chat-header { padding-top: max(14px, env(safe-area-inset-top)); }
  .privacy-note { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
