:root {
  --forest: #174f48;
  --forest-deep: #103a35;
  --forest-soft: #e8f0ed;
  --gold: #d6a33a;
  --gold-soft: #f7edda;
  --ink: #1d2927;
  --muted: #687572;
  --line: #d9e1df;
  --canvas: #f3f6f5;
  --surface: #ffffff;
  --danger: #a74338;
  --shadow: 0 18px 44px rgba(21, 51, 46, 0.11);
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.is-booting main,
body.is-booting .site-header { visibility: hidden; }

button,
input,
textarea { font: inherit; }

button { cursor: pointer; }

button:disabled { cursor: default; }

.hidden { display: none !important; }

.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;
}

.site-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--forest);
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.brand strong,
.brand small { display: block; }

.brand strong { font-size: 16px; }

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.text-button {
  border: 0;
  padding: 5px 0;
  background: transparent;
  color: var(--forest);
  font-size: 13px;
  font-weight: 750;
}

.text-button:hover { color: var(--forest-deep); }

.service-hero {
  position: relative;
  min-height: 210px;
  display: flex;
  align-items: end;
  padding: 28px clamp(18px, 6vw, 96px);
  background: url("/lead-response/request/assets/brighthome-kitchen.png") center 48% / cover no-repeat;
  color: white;
}

.service-hero::before {
  position: absolute;
  inset: 0;
  content: "";
  background: rgba(12, 39, 36, 0.58);
}

.hero-copy {
  position: relative;
  width: min(620px, 80vw);
}

.hero-copy p,
.hero-copy h1,
.hero-copy span { margin: 0; }

.hero-copy p {
  margin-bottom: 8px;
  color: #f3d695;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-copy h1 {
  max-width: 580px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.03;
}

.hero-copy span {
  display: block;
  max-width: 560px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  line-height: 1.5;
}

.quote-layout {
  width: min(1240px, 100%);
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(540px, 1.8fr);
  gap: clamp(22px, 4vw, 54px);
  margin: 0 auto;
  padding: 30px clamp(18px, 4vw, 54px) 48px;
}

.service-context { padding: 15px 0; }

.section-label {
  margin: 0 0 5px;
  color: var(--forest);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.service-context h2,
.chat-header h2,
.profile-step h3,
.auth-dialog h2 { margin: 0; }

.service-context h2 {
  max-width: 280px;
  font-size: 26px;
  line-height: 1.12;
}

.service-context > p:not(.section-label) {
  max-width: 330px;
  margin: 13px 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.service-context dl { margin: 0; }

.service-context dl div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.service-context dt { color: var(--muted); }
.service-context dd { margin: 0; font-weight: 700; }

.chat-tool {
  position: relative;
  min-width: 0;
  height: 580px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.chat-header h2 { font-size: 20px; }

.chat-presence {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.chat-presence span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2e9468;
  box-shadow: 0 0 0 4px rgba(46, 148, 104, 0.12);
}

.identity-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
  background: #fafcfb;
}

.identity-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold-soft);
  color: #7b5a16;
  font-size: 11px;
  font-weight: 850;
}

.identity-row strong,
.identity-row span { display: block; min-width: 0; }
.identity-row strong { font-size: 13px; }
.identity-row span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; }

.conversation {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px;
  scroll-behavior: smooth;
}

.empty-conversation {
  margin: auto;
  padding: 18px;
  text-align: center;
}

.empty-conversation strong,
.empty-conversation span { display: block; }
.empty-conversation strong { font-size: 16px; }
.empty-conversation span { max-width: 390px; margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.message-row { display: flex; }
.message-row.customer { justify-content: flex-end; }
.message-row.assistant { justify-content: flex-start; }

.message-bubble {
  max-width: min(74%, 560px);
  padding: 10px 13px;
  border-radius: 8px;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message-row.customer .message-bubble { background: var(--forest); color: white; }
.message-row.assistant .message-bubble { border: 1px solid var(--line); background: var(--forest-soft); color: var(--ink); }

.typing-bubble { display: inline-flex; gap: 4px; align-items: center; min-height: 39px; }
.typing-bubble i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typing 900ms infinite ease-in-out; }
.typing-bubble i:nth-child(2) { animation-delay: 120ms; }
.typing-bubble i:nth-child(3) { animation-delay: 240ms; }

@keyframes typing { 0%, 70%, 100% { transform: translateY(0); opacity: 0.45; } 35% { transform: translateY(-3px); opacity: 1; } }

.chat-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 18px;
  border-top: 1px solid rgba(167, 67, 56, 0.22);
  background: #fff4f1;
  color: var(--danger);
  font-size: 12px;
}

.composer {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 10px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  background: white;
}

.composer textarea,
.profile-step input,
.auth-dialog input {
  width: 100%;
  border: 1px solid #cbd6d3;
  border-radius: 7px;
  background: white;
  color: var(--ink);
  outline: none;
}

.composer textarea {
  height: 54px;
  resize: none;
  padding: 9px 11px;
  line-height: 1.35;
}

.composer textarea:focus,
.profile-step input:focus,
.auth-dialog input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(23, 79, 72, 0.1); }

.send-button,
.primary-button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--forest);
  color: white;
  font-weight: 800;
}

.send-button { height: 54px; }
.send-button:hover,
.primary-button:hover { background: var(--forest-deep); }
.send-button:disabled,
.primary-button:disabled { opacity: 0.62; }

.chat-footer {
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 18px 9px;
  color: var(--muted);
  font-size: 11px;
}

.profile-step {
  position: absolute;
  inset: 76px 0 0;
  z-index: 4;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: clamp(24px, 7vw, 70px);
  background: rgba(255, 255, 255, 0.98);
}

.profile-step h3 { font-size: 24px; }
.profile-step label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 750; }
.profile-step input { min-height: 46px; padding: 0 12px; color: var(--ink); font-size: 14px; }
.profile-step .primary-button { width: fit-content; min-width: 170px; padding: 0 18px; }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(236, 242, 240, 0.94);
  backdrop-filter: blur(12px);
}

.auth-dialog {
  width: min(390px, 100%);
  display: grid;
  gap: 15px;
  padding: 27px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.auth-dialog h2 { font-size: 25px; }
.auth-dialog input { min-height: 48px; padding: 0 13px; font-size: 18px; }
.form-error { margin: 0; color: var(--danger); font-size: 12px; }

@media (max-width: 820px) {
  .service-hero { min-height: 190px; background-position: 58% center; }
  .quote-layout { grid-template-columns: 1fr; padding-top: 22px; }
  .service-context { padding: 0; }
  .service-context dl { display: none; }
  .service-context > p:not(.section-label) { margin-bottom: 0; }
  .chat-tool { height: min(640px, calc(100vh - 120px)); min-height: 520px; }
}

@media (max-width: 560px) {
  .site-header { min-height: 68px; padding: 10px 14px; }
  .brand small { display: none; }
  .service-hero { min-height: 178px; padding: 22px 16px; }
  .hero-copy { width: 100%; }
  .hero-copy h1 { font-size: 29px; }
  .hero-copy span { font-size: 13px; }
  .quote-layout { padding: 18px 12px 28px; }
  .service-context h2 { font-size: 22px; }
  .chat-tool { height: 620px; }
  .chat-header,
  .identity-row,
  .conversation,
  .composer { padding-left: 13px; padding-right: 13px; }
  .identity-row { grid-template-columns: 32px minmax(0, 1fr); }
  .identity-row .text-button { grid-column: 2; justify-self: start; }
  .message-bubble { max-width: 86%; }
  .composer { grid-template-columns: minmax(0, 1fr) 70px; }
  .chat-footer span { display: none; }
  .chat-footer { justify-content: flex-end; }
  .profile-step { padding: 24px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .conversation { scroll-behavior: auto; }
  .typing-bubble i { animation: none; }
}
