/* The conversation stays in one scroll region; the composer is always in reach. */
dialog.drawer.chat-dialog {
  inset: auto 16px 16px auto;
  width: 460px;
  max-width: calc(100vw - 32px);
  height: min(780px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  margin: 0;
  border-radius: 24px;
  background: var(--bg-page);
}
dialog.chat-dialog > .modal-header { padding: 18px 20px; border: 0; box-shadow: 0 2px 12px rgb(24 30 41 / 3%); }
dialog.chat-dialog .modal-header h2 { font-size: 19px; }
dialog.chat-dialog .modal-header .eyebrow { font-size: 11px; color: var(--logo-accent); letter-spacing: .04em; }
.chat-panel-host, .chat-panel { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.chat-panel { overflow: hidden; }
.sr-only, .chat-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.chat-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 18px; color: var(--text-secondary); background: var(--bg-surface); font-size: 12px; line-height: 1.5; }
.chat-meta > span, .chat-meta > p { min-width: 0; }
.chat-meta-actions { display: flex; flex-shrink: 0; align-items: center; }
.chat-feedback { margin: 0 0 8px; color: var(--logo-accent); font-size: 12px; line-height: 1.6; }
.chat-meta button { min-height: 44px; flex-shrink: 0; padding: 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.chat-meta button:hover { color: var(--text-primary); background: var(--bg-subtle); }
.chat-transcript { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scroll-padding: 20px; scrollbar-gutter: stable; padding: 24px 18px 20px; }
.chat-transcript:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }
.chat-welcome { padding: 6px 6px 22px; }
.chat-welcome-mark { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 15px; padding: 5px; border-radius: 17px; background: #eaf0ff; object-fit: contain; }
.chat-welcome-mark img { width: 36px; height: 36px; object-fit: contain; }
.chat-welcome h3 { font-size: 23px; line-height: 1.45; font-weight: 750; letter-spacing: -.8px; word-break: keep-all; }
.chat-welcome p { margin-top: 10px; max-width: 340px; color: var(--text-secondary); font-size: 14px; line-height: 1.8; word-break: keep-all; }
.chat-welcome p.chat-welcome-note { margin-top: 14px; font-size: 12px; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chat-suggestions button { min-height: 44px; max-width: 100%; padding: 10px 14px; border-radius: 14px; background: var(--bg-surface); box-shadow: 0 2px 10px rgb(24 30 41 / 5%); color: var(--text-primary); font-size: 13px; font-weight: 550; text-align: left; line-height: 1.55; transition: background 150ms ease, transform 150ms ease; }
.chat-message { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 20px; min-width: 0; }
.chat-answer { flex: 1; min-width: 0; }
.chat-avatar { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; margin-top: 5px; }
.chat-avatar img { width: 26px; height: 26px; object-fit: contain; }
.chat-bubble { min-width: 0; max-width: 100%; padding: 14px 15px; border-radius: 5px 18px 18px; background: var(--bg-surface); box-shadow: 0 2px 12px rgb(24 30 41 / 4%); color: var(--text-primary); font-size: 14px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-bubble > p { white-space: pre-wrap; }
.chat-bubble > p + p { margin-top: 10px; }
.chat-message[data-role="user"] { justify-content: flex-end; padding-left: 30px; }
.chat-message[data-role="user"] .chat-bubble { max-width: 100%; border-radius: 18px 5px 18px 18px; background: var(--logo-accent); color: white; box-shadow: 0 3px 12px rgb(39 82 217 / 12%); }
.chat-products { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.chat-product { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; min-width: 0; padding: 10px; border-radius: 14px; background: var(--bg-page); }
.chat-product-art { position: relative; width: 64px; height: 76px; overflow: hidden; border-radius: 9px; background: #f0f1f3; }
.chat-product-art .garment-sprite { border-radius: inherit; }
.chat-product-copy { min-width: 0; }
.chat-product-copy small { display: block; color: var(--text-secondary); font-size: 11px; line-height: 1.5; }
.chat-product-name { display: block; width: 100%; min-height: 40px; padding: 3px 0; text-align: left; font-size: 13px; font-weight: 650; line-height: 1.55; overflow-wrap: anywhere; }
.chat-product-name:hover { color: var(--logo-accent); }
.chat-product-price { font-size: 13px; font-weight: 750; letter-spacing: -.3px; }
.chat-product-copy p { color: var(--text-secondary); font-size: 11px; line-height: 1.6; margin-top: 4px; }
.chat-product-copy .chat-product-price { margin-top: 0; color: var(--text-primary); font-size: 13px; }
.chat-product-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-card-button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 8px 10px; border-radius: 10px; background: var(--bg-surface); box-shadow: 0 1px 5px rgb(24 30 41 / 4%); color: var(--text-primary); font-size: 12px; font-weight: 650; line-height: 1.5; text-decoration: none; }
.chat-card-button .icon { width: 15px; height: 15px; }
.chat-card-button[aria-pressed="true"] { color: var(--logo-accent); background: #eaf0ff; }
.chat-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.chat-actions > button { min-height: 44px; padding: 9px 12px; border-radius: 11px; background: #edf2ff; color: var(--logo-accent); text-align: left; font-size: 12px; font-weight: 650; line-height: 1.5; }
.chat-context { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 10px 18px; background: #edf2ff; color: #294b9b; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.chat-context .icon { width: 16px; height: 16px; }
.chat-context > span { flex: 1; min-width: 0; }
.chat-context button { display: grid; place-items: center; flex-shrink: 0; min-width: 40px; min-height: 40px; border-radius: 10px; }
.chat-composer { flex-shrink: 0; padding: 15px 18px max(12px, env(safe-area-inset-bottom)); background: var(--bg-surface); box-shadow: 0 -4px 20px rgb(24 30 41 / 4%); }
.chat-composer .chat-suggestions { margin: 0 0 12px; }
.chat-compose-row { display: flex; align-items: flex-end; gap: 8px; padding: 6px; background: var(--bg-subtle); border-radius: 18px; }
.chat-compose-row:focus-within { box-shadow: 0 0 0 2px rgb(49 93 216 / 25%); }
.chat-input { display: block; flex: 1; min-width: 0; width: 100%; min-height: 50px; max-height: 150px; margin: 0; padding: 8px 7px; border: 0; border-radius: 10px; background: transparent; color: var(--text-primary); resize: none; font-size: 16px; line-height: 1.55; outline-offset: 1px; }
.chat-input::placeholder { color: var(--text-tertiary); opacity: 1; }
.chat-send { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; margin-bottom: 1px; border-radius: 13px; background: var(--logo-accent); color: white; box-shadow: 0 2px 8px rgb(39 82 217 / 15%); transition: background 150ms ease, transform 150ms ease; }
.chat-send .icon { width: 20px; height: 20px; }
.chat-send:disabled { background: #d9dde5; color: #858c98; opacity: 1; box-shadow: none; }
.chat-input-hint { color: var(--text-secondary); font-size: 12px; line-height: 1.6; }
.chat-input-hint { margin-top: 8px; padding: 0 2px; }
.chat-launcher { position: fixed; z-index: 29; right: 24px; bottom: max(24px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 56px; padding: 10px 18px 10px 11px; border-radius: 20px; color: white; background: var(--logo-accent); box-shadow: 0 6px 25px rgb(43 79 180 / 24%), 0 2px 6px rgb(24 30 41 / 8%); font-size: 14px; font-weight: 700; transition: transform 180ms ease, box-shadow 180ms ease, bottom 180ms ease; }
.chat-launcher img { width: 34px; height: 34px; object-fit: contain; }
.chat-launcher svg { width: 26px; height: 26px; }
body.has-comparison .chat-launcher { bottom: max(140px, calc(116px + env(safe-area-inset-bottom))); }
.chat-back { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 12px; color: var(--logo-accent); background: #edf2ff; font-size: 13px; font-weight: 650; }
.chat-back .icon { width: 17px; height: 17px; }
@media (hover: hover) {
  .chat-launcher:hover { transform: translateY(-3px); box-shadow: 0 9px 28px rgb(43 79 180 / 28%); }
  .chat-suggestions button:hover { background: #edf2ff; transform: translateY(-1px); }
  .chat-card-button:hover, .chat-actions > button:hover, .chat-back:hover { background: #e2eaff; color: var(--logo-accent); }
  .chat-send:not(:disabled):hover { background: #234cca; }
}
.chat-launcher:active, .chat-send:not(:disabled):active { transform: scale(.97); }
@media (max-width: 700px) {
  dialog.drawer.chat-dialog { inset: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  dialog.chat-dialog > .modal-header { padding: max(14px, env(safe-area-inset-top)) 16px 12px; }
  .chat-meta { padding-inline: 12px; }
  .chat-transcript { padding: 20px 12px 16px; scrollbar-gutter: auto; }
  .chat-welcome { padding-inline: 7px; }
  .chat-composer { padding: 12px 12px max(12px, env(safe-area-inset-bottom)); }
  .chat-composer .chat-suggestions { flex-wrap: nowrap; overflow-x: auto; padding: 2px 1px 6px; margin-bottom: 7px; scrollbar-width: thin; }
  .chat-composer .chat-suggestions button { flex-shrink: 0; white-space: nowrap; }
  .chat-context { padding-inline: 14px; }
  .chat-launcher { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); min-height: 52px; padding: 9px 15px 9px 10px; border-radius: 18px; }
  .chat-launcher img { width: 31px; height: 31px; }
}
@media (max-width: 360px) {
  .chat-bubble { padding: 12px; font-size: 13px; }
  .chat-message { gap: 6px; }
  .chat-avatar { flex-basis: 24px; width: 24px; }
  .chat-avatar img { width: 24px; height: 24px; }
  .chat-product { grid-template-columns: 54px minmax(0, 1fr); gap: 8px; padding: 8px; }
  .chat-product-art { width: 54px; height: 66px; }
  .chat-product-name { font-size: 12px; }
  .chat-card-button { padding-inline: 8px; }
  .chat-meta { font-size: 11px; }
}
@media (max-height: 650px) {
  .chat-composer .chat-suggestions { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; scrollbar-width: thin; }
  .chat-composer .chat-suggestions button { flex-shrink: 0; white-space: nowrap; }
  .chat-welcome { padding-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-launcher, .chat-send, .chat-suggestions button { transition: none; }
  .chat-launcher:hover, .chat-launcher:active, .chat-send:active, .chat-suggestions button:hover { transform: none; }
}
