.leasing-chat-launch {
  position: fixed;
  inset-inline-end: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 30;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid #e5c78b;
  border-radius: 24px;
  background: #e5c78b;
  color: #211a10;
  font: 700 14px system-ui, sans-serif;
  box-shadow: 0 3px 14px #0006;
  cursor: pointer;
}
.leasing-chat {
  box-sizing: border-box;
  width: min(440px, calc(100% - 24px));
  max-width: none;
  max-height: min(690px, calc(100dvh - 32px));
  margin: auto max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #806a46;
  border-radius: 16px;
  background: #171d22;
  color: #f7f2e8;
  box-shadow: 0 16px 50px #0009;
  font: 15px/1.5 system-ui, sans-serif;
  color-scheme: dark;
}
.leasing-chat::backdrop { background: #080c10aa; }
.leasing-chat .leasing-chat-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 8px 16px;
  border-bottom: 1px solid #62523a;
  background: #171d22;
  color: #f7f2e8;
}
.leasing-chat h2 { margin: 0; font: 650 17px/1.4 system-ui, sans-serif; }
.leasing-chat h3 { margin: 0; font: 650 15px/1.4 system-ui, sans-serif; }
.leasing-chat-body { padding: 14px 16px 18px; }
.leasing-chat p { margin: 0 0 10px; color: #e0d9cb; font: inherit; overflow-wrap: anywhere; }
.leasing-chat .leasing-chat-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.leasing-chat button,
.leasing-chat .leasing-chat-actions a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border: 1px solid #ad8f58;
  border-radius: 7px;
  background: #242b31;
  color: #f7e2b4;
  text-decoration: none;
  font: 600 14px/1.35 system-ui, sans-serif;
  cursor: pointer;
}
.leasing-chat .leasing-chat-header button { min-width: 44px; font-size: 21px; }
.leasing-chat button:focus-visible,
.leasing-chat a:focus-visible,
.leasing-chat input:focus-visible { outline: 2px solid #f7e2b4; outline-offset: 2px; }
.leasing-chat .leasing-chat-form { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin: 16px 0; }
.leasing-chat .leasing-chat-form[hidden] { display: none; }
.leasing-chat label { color: #f7f2e8; font-size: 14px; }
.leasing-chat label span { color: #e0d9cb; }
.leasing-chat input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 5px;
  padding: 8px;
  border: 1px solid #8a7a61;
  border-radius: 6px;
  background: #242b31;
  color: #fff;
  font: 16px system-ui, sans-serif;
}
.leasing-chat .leasing-chat-results article {
  padding: 12px 0;
  border-top: 1px solid #62523a;
}
.leasing-chat .leasing-chat-results a { color: #f7e2b4; }
.leasing-chat-status:empty, .leasing-chat-results:empty { display: none; }

@media (max-width: 640px), (pointer: coarse) {
  .leasing-chat {
    --leasing-top-gap: max(12px, env(safe-area-inset-top));
    --leasing-bottom-gap: max(12px, env(safe-area-inset-bottom));
    position: fixed;
    inset: calc(var(--leasing-viewport-top, 0px) + var(--leasing-top-gap)) max(12px, env(safe-area-inset-right)) auto auto;
    margin: 0;
    max-height: calc(100vh - var(--leasing-top-gap) - var(--leasing-bottom-gap));
    max-height: min(690px, calc(var(--leasing-viewport-height, 100dvh) - var(--leasing-top-gap) - var(--leasing-bottom-gap)));
    scroll-padding-top: 70px;
  }
}

/* Conversation layout keeps the composer above an on-screen keyboard. */
.leasing-chat[open] {display:flex;flex-direction:column;height:min(690px,calc(100dvh - 32px));overflow:hidden;font-size:16px;}
.leasing-chat .leasing-chat-header {position:relative;flex:none;}
.leasing-chat-header > div {display:flex;gap:6px;align-items:center;}
.leasing-chat .leasing-chat-header [data-reset] {font-size:14px;}
.leasing-chat-body {flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scroll-padding:12px;}
.leasing-conversation {display:flex;flex-direction:column;gap:16px;}
.leasing-chat-bubble {max-width:100%;padding:12px;border:1px solid #3c454e;border-radius:12px;background:#202830;}
.leasing-chat-user {align-self:flex-end;max-width:90%;border-color:#88724b;background:#3b3427;}
.leasing-chat-speaker {display:block;margin-bottom:6px;color:#e5c78b;font-size:14px;font-weight:650;}
.leasing-chat .leasing-chat-bubble p:last-child {margin-bottom:0;}
.leasing-chat .leasing-chat-form {flex:none;margin:0;padding:12px 16px;border-top:1px solid #62523a;gap:6px;background:#171d22;}
.leasing-chat-compose {display:flex;gap:8px;align-items:center;min-width:0;}
.leasing-chat .leasing-chat-compose input {flex:1;min-width:0;margin:0;}
.leasing-chat .leasing-chat-form small {color:#d1cabc;font-size:13px;line-height:1.4;}
.leasing-chat .leasing-chat-results a {overflow-wrap:anywhere;}
.leasing-chat .leasing-chat-results h3 {font-size:16px;}
.leasing-chat button:disabled {opacity:.65;cursor:wait;}
@media (max-width:640px),(pointer:coarse) {
 .leasing-chat[open] {height:min(690px,calc(var(--leasing-viewport-height,100dvh) - var(--leasing-top-gap) - var(--leasing-bottom-gap)));}
 .leasing-chat .leasing-chat-header {padding:8px 12px;gap:6px;}
 .leasing-chat h2 {font-size:16px;}
 .leasing-chat-body {padding:12px;}
 .leasing-chat .leasing-chat-form {padding:10px 12px;}
}
