/* Production chat shell, conversation, composer and onboarding patterns adapted
   to Wendy. No source product logic, source endpoints, or topbar selectors. */
body.bt-chat { min-height: 100dvh; overflow: hidden; background: #0B0C0C; font-family: Inter,-apple-system,BlinkMacSystemFont,"SF Pro Display","PingFang TC","Noto Sans TC",sans-serif; }
.bt-chat .app { height: var(--chat-viewport-height,100dvh); display: grid; grid-template-rows: auto minmax(0,1fr); background: #0B0C0C; }
.chat-page { width: min(calc(100% - 48px),var(--ds-max)); min-height: 0; margin-inline: auto; padding: 28px 0 max(16px,env(safe-area-inset-bottom)); display: grid; grid-template-rows: auto minmax(0,1fr); color: var(--ds-ink); background: #0B0C0C; }
.chat-page .hero { padding: 8px 10px 10px; text-align: center; }
.chat-page .eyebrow { margin: 0 0 8px; color: var(--ds-muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.chat-page .hero h1 { margin: 8px 0 0; font-size: clamp(24px,2.6vw,36px); font-weight: 600; line-height: 1.18; letter-spacing: -.02em; }
.chat-page .hero-copy { max-width: 640px; margin: 0 auto; color: var(--ds-muted); font-size: 14px; }
.chat-shell { min-height: 0; position: relative; display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; overflow: hidden; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.chat-head { min-width: 0; display: block; position: relative; padding: 4px 0 0; }
.chat-page button, .chat-page textarea { font: inherit; }
.chat-page .clear { position: absolute; top: 4px; right: 0; z-index: 2; min-height: 36px; padding: 6px 11px; border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-pill); background: transparent; color: var(--ds-muted); font-size: 12px; cursor: pointer; }
.chat-page .clear:hover, .chat-page .retry:hover { background: var(--ds-soft); }
.chat-log { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px 16px; scrollbar-width: thin; scrollbar-color: #444 transparent; background: #0B0C0C; }
.message { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.message.user { align-items: flex-end; }
.role { color: var(--ds-muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.bubble { max-width: min(82%,660px); padding: 10px 12px; overflow-wrap: anywhere; word-break: break-word; border: 1px solid var(--ds-line-strong); border-radius: 14px; background: var(--ds-elevated); line-height: 1.6; white-space: pre-wrap; }
.user .bubble { border-color: #f1f1ee; background: #f1f1ee; color: #111; }
.message.onboarding { position: relative; display: block; max-width: 760px; margin: 12px 0; padding: 4px 0 4px 30px; }
.onboarding::before { content: ""; position: absolute; left: 0; top: 16%; width: 3px; height: 68%; border-radius: var(--ds-radius-pill); background: rgba(255,255,255,.16); }
.onboarding .role { display: none; }
.onboarding .bubble { display: block; max-width: none; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: clamp(18px,1.15vw,20px); line-height: 1.58; font-weight: 400; }
.onboarding strong { display: block; font-weight: 400; }
.onboarding span { display: block; }
.typing .bubble { color: var(--ds-muted); font-size: 13px; }
.error .bubble { border-color: var(--ds-danger); }
.chat-page .retry { display: block; margin-top: 8px; min-height: 44px; padding: 9px 12px; border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-app); background: transparent; color: var(--ds-ink); font-size: 13px; cursor: pointer; }
.composer { display: grid; grid-template-columns: 46px minmax(0,1fr) 50px; align-items: center; gap: 8px; width: 100%; max-width: none; min-height: 68px; max-height: none; margin: 0; padding: 9px 10px; border: 1px solid rgba(255,255,255,.07); border-radius: 24px; background: #181919; box-shadow: none; }
.composer:focus-within { background: #1D1E1E; border-color: rgba(255,255,255,.16); }
.composer > .chat-attach { grid-column: 1; grid-row: 2; }
.composer > textarea { grid-column: 2; grid-row: 2; }
.composer > .send { grid-column: 3; grid-row: 2; }
.composer > #chat-upload-review { grid-column: 1 / -1; grid-row: 1; }
.composer textarea,
body.bt-chat .composer #chat-input { width: 100%; min-width: 0; min-height: 50px; max-height: min(144px,22dvh); padding: 12px 8px; border: 0; border-radius: 0; resize: none; overflow-y: auto; background: transparent; color: var(--ds-ink); font-size: 16px; line-height: 1.4; outline: none; box-shadow: none; }
.composer textarea::placeholder { color: var(--ds-muted); }
.composer textarea:focus,
.composer textarea:focus-visible { border: 0; outline: none; box-shadow: none; }
.composer .chat-attach { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; min-height: 46px; flex: 0 0 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); background: #191919; color: #8a8a86; font-size: 22px; line-height: 1; }
.chat-page .composer .send { display: grid; width: 50px; height: 50px; min-width: 50px; min-height: 50px; place-items: center; border: 0; border-radius: 50%; background: #f3f4f2; color: #111; font-size: 18px; line-height: 1; cursor: pointer; }
.chat-page .composer .send:disabled { background: #2a2a2a; color: #6a6a66; opacity: 1; }
.chat-page button:disabled { opacity: .4; cursor: not-allowed; }
.chat-page .composer .send:disabled { opacity: 1; }
.disclaimer { margin: 16px 0 0; padding: 0 8px; color: var(--ds-muted); background: transparent; font-size: 12px; line-height: 1.45; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
@media (min-width: 1200px) {
  .chat-page { width: min(calc(100% - 64px),var(--ds-max)); padding-top: 34px; }
  .chat-log { padding-inline: 18px; }
  .message { margin-bottom: 14px; }
  .bubble { padding: 11px 14px; }
}
@media (max-width: 767px) {
  .chat-page { width: 100%; padding: 10px 12px max(10px,env(safe-area-inset-bottom)); font-size: 13px; }
  .chat-page .hero { padding: 4px 4px 14px; }
  .chat-page .hero h1 { font-size: 24px; }
  .chat-page .hero-copy { font-size: 13px; }
  .chat-head { padding: 6px 10px; }
  .chat-log { padding: 8px 12px 12px; }
  .bubble { max-width: 92%; padding: 9px 11px; border-radius: 13px; }
  .message.onboarding { padding-left: 20px; }
  .onboarding .bubble { font-size: 18px; line-height: 1.6; }
  .composer { grid-template-columns: 42px minmax(0,1fr) 46px; min-height: 64px; padding: 8px; border-radius: 22px; }
  .composer .chat-attach { width: 42px; height: 42px; min-height: 42px; flex-basis: 42px; font-size: 20px; }
  .chat-page .composer .send { width: 46px; height: 46px; min-width: 46px; min-height: 46px; font-size: 16px; }
  .composer textarea,
  .chat-page .composer #chat-input { min-height: 46px; font-size: 16px; padding: 10px 6px; }
  .disclaimer { margin-top: 14px; font-size: 12px; }
}
/* Short viewports, including an open software keyboard: keep input accessible. */
@media (max-height: 560px) {
  .chat-page { padding-top: 4px; padding-bottom: 4px; }
  .chat-page .hero { padding: 0 4px 4px; }
  .chat-page .hero h1 { margin: 0; font-size: 20px; }
  .chat-page .eyebrow, .chat-page .hero-copy { display: none; }
  .chat-head { padding-block: 0; }
  .composer { padding-block: 6px; }
  .disclaimer { padding-block: 3px; }
}
.bt-chat.keyboard-open .hero { display: none; }
.bt-chat.keyboard-open .chat-page { grid-template-rows: minmax(0,1fr); padding-block: 4px; }
