:root {
  color-scheme: light;
  font-family: "DM Sans", Arial, sans-serif;
  color: #0b0b0b;
  background: #fff;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  background: #fff;
}

button, textarea { font: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.chat-app {
  height: 100svh;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) auto;
  background: #fff;
}

.topbar {
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e8e8e8;
}

.brand {
  width: fit-content;
  color: #050505;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
}

.status {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #6a6a6a;
  font-size: 12px;
  font-weight: 500;
}

.status-dot { width: 7px; height: 7px; background: #111; border-radius: 50%; }

.restart-button {
  justify-self: end;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #505050;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.restart-button:hover { color: #000; background: #f2f2f2; }

.conversation {
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.conversation-inner {
  width: min(100%, 740px);
  min-height: 100%;
  margin: 0 auto;
  padding: 48px 24px 32px;
}

.message {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 26px;
  animation: message-in 260ms ease both;
}

.message--user { justify-content: flex-end; }

.avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  background: #090909;
  border-radius: 50%;
}

.bubble {
  min-width: 0;
  max-width: min(590px, calc(100% - 42px));
  color: #171717;
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.message--assistant .bubble { padding-top: 3px; }
.message--assistant .bubble { width: calc(100% - 42px); }

.message--user .bubble {
  padding: 10px 15px;
  background: #f1f1f1;
  border-radius: 16px 16px 4px 16px;
}

.bubble p { margin: 0; }
.bubble strong { font-weight: 600; }

.typing {
  display: inline-flex;
  gap: 4px;
  padding-top: 9px;
}

.typing span {
  width: 5px;
  height: 5px;
  background: #aaa;
  border-radius: 50%;
  animation: blink 900ms infinite alternate;
}

.typing span:nth-child(2) { animation-delay: 180ms; }
.typing span:nth-child(3) { animation-delay: 360ms; }

.estimate-card {
  width: 100%;
  margin-top: 18px;
  padding: 24px;
  border: 1px solid #d7d7d7;
}

.estimate-label {
  margin: 0 0 7px;
  color: #6b6b6b;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.estimate-price {
  margin: 0;
  font-size: clamp(27px, 5vw, 38px);
  font-weight: 600;
  line-height: 1.15;
}

.estimate-meta { margin: 9px 0 20px; color: #696969; font-size: 13px; }

.estimate-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 17px 0;
  border-top: 1px solid #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
}

.detail-item span, .detail-item strong { display: block; }
.detail-item span { margin-bottom: 3px; color: #777; font-size: 11px; }
.detail-item strong { font-size: 13px; font-weight: 500; }
.estimate-note { margin: 15px 0 20px; color: #737373; font-size: 11px; line-height: 1.5; }

.site-link {
  min-height: 44px;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  background: #090909;
  border: 1px solid #090909;
  text-decoration: none;
}

.site-link:hover { color: #090909; background: #fff; }

.contact-form {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid #e1e1e1;
}

.contact-form[hidden] { display: none; }
.contact-form-heading > p:last-child { margin: 0 0 18px; color: #656565; font-size: 12px; line-height: 1.55; }
.contact-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.contact-fields label { margin: 0; color: #333; font-size: 11px; font-weight: 600; }
.contact-fields label span { color: #888; font-weight: 400; }

.contact-fields input {
  width: 100%;
  height: 44px;
  margin-top: 7px;
  padding: 0 12px;
  color: #111;
  background: #fff;
  border: 1px solid #c9c9c9;
  border-radius: 0;
}

.contact-fields input:focus { border-color: #111; outline: 2px solid rgba(0,0,0,.1); }

.consent-field {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 17px 0;
  color: #555;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
}

.consent-field input { flex: 0 0 auto; margin: 2px 0 0; accent-color: #111; }
.website-field { position: absolute; left: -10000px; }

.contact-submit {
  min-height: 44px;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  background: #090909;
  border: 1px solid #090909;
}

.contact-submit:hover { color: #090909; background: #fff; }

.thanks-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f5f5f5;
}

.thanks-panel { width: min(100%, 600px); padding: 54px; background: #fff; border: 1px solid #ddd; text-align: center; }
.thanks-mark { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 24px; color: #fff; background: #090909; border-radius: 50%; }
.thanks-panel h1 { margin: 0; font-size: clamp(30px, 6vw, 48px); font-weight: 600; }
.thanks-panel > p { margin: 17px auto 28px; color: #666; line-height: 1.6; }

.composer-area {
  z-index: 2;
  padding: 10px 24px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, #fff 78%, rgba(255, 255, 255, 0));
}

.quick-replies, .composer {
  width: min(100%, 692px);
  margin: 0 auto;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.quick-reply {
  min-height: 42px;
  padding: 0 16px;
  color: #171717;
  font-size: 13px;
  font-weight: 500;
  background: #fff;
  border: 1px solid #cfcfcf;
  border-radius: 22px;
}

.quick-reply:hover { color: #fff; background: #111; border-color: #111; }

.composer {
  position: relative;
  min-height: 58px;
  background: #fff;
  border: 1px solid #bcbcbc;
  border-radius: 16px;
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.07);
}

.composer:focus-within { border-color: #111; }

textarea {
  width: 100%;
  min-height: 56px;
  max-height: 120px;
  resize: none;
  padding: 18px 58px 15px 18px;
  color: #111;
  line-height: 1.45;
  background: transparent;
  border: 0;
  outline: 0;
}

textarea::placeholder { color: #8b8b8b; }

.send-button {
  position: absolute;
  right: 9px;
  bottom: 9px;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: #111;
  border: 0;
  border-radius: 50%;
}

.send-button:hover { background: #383838; }

.composer-hint {
  min-height: 14px;
  margin: 8px 0 0;
  color: #898989;
  font-size: 10px;
  text-align: center;
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid #111; outline-offset: 2px; }

@keyframes message-in { from { opacity: 0; transform: translateY(7px); } }
@keyframes blink { to { opacity: 0.25; transform: translateY(-2px); } }

@media (max-width: 600px) {
  .topbar { grid-template-columns: 1fr auto; height: 58px; padding: 0 16px; }
  .status { display: none; }
  .conversation-inner { padding: 32px 16px 24px; }
  .composer-area { padding-inline: 12px; }
  .message { margin-bottom: 22px; }
  .message--assistant .bubble { width: calc(100% - 58px); max-width: 280px; }
  .estimate-card { padding: 19px; }
  .estimate-details { grid-template-columns: 1fr; gap: 12px; }
  .contact-fields { grid-template-columns: 1fr; }
  .thanks-panel { padding: 38px 22px; }
  .quick-replies { gap: 7px; }
  .quick-reply { min-height: 40px; padding: 0 13px; }
}

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