.partner-summary { flex: 1; min-width: 0; }
.partner-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
body.chat-active { overflow: hidden; overscroll-behavior: none; }
.app-shell.chat-shell {
  position: fixed; top: var(--chat-offset, 0px); left: 0; right: 0;
  height: var(--chat-viewport, 100dvh); min-height: 0;
  display: flex; flex-direction: column; background: var(--paper);
}
.chat-shell .demo-bar { flex-shrink: 0; }
.chat-main { width: 100%; max-width: 740px; margin: 0 auto; flex: 1; min-height: 0; }
.chat-room { height: 100%; display: flex; flex-direction: column; position: relative; }
.chat-header {
  display: flex; align-items: center; gap: 12px; padding: 22px 24px;
  padding-top: max(22px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.chat-header .icon-button { margin-left: -8px; }
.chat-heading { flex: 1; min-width: 0; }
.chat-heading h1 { font-size: 19px; letter-spacing: 0; overflow-wrap: anywhere; }
.chat-heading > span { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.chat-private { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chat-private .icon { width: 13px; height: 13px; }
.chat-connection { font-size: 11px; text-align: center; padding: 7px 20px; color: #9d805b; background: #f1ecdf; flex-shrink: 0; line-height: 1.6; }
.chat-connection[data-state="connected"] { padding: 0; height: 0; overflow: hidden; background: transparent; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; padding: 20px 26px; scroll-padding-bottom: 16px; }
.chat-history-control { display: flex; align-items: center; justify-content: center; font-size: 10px; color: #a1a995; min-height: 20px; margin-bottom: 16px; }
.chat-history-control .text-button { font-size: 11px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 20px; }
.chat-date { text-align: center; color: #9aa391; font-size: 10px; margin: 14px 0 24px; }
.chat-message { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
.chat-message > .avatar { margin-top: 3px; width: 29px; height: 29px; font-size: 11px; }
.chat-message.own { flex-direction: row-reverse; }
.chat-message-content { max-width: min(440px, 78%); min-width: 0; }
.chat-bubble {
  padding: 13px 16px; border-radius: 3px 15px 15px 15px;
  background: var(--surface); border: 1px solid var(--line);
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.8;
  user-select: text; -webkit-user-select: text;
}
.own .chat-bubble { background: #e8eee2; border-color: #e0e7d9; border-radius: 15px 3px 15px 15px; }
.chat-message-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; color: #9aa18f; font-size: 10px; }
.own .chat-message-meta { justify-content: flex-end; }
.chat-message.failed .chat-bubble { border-color: #dbc5b5; }
.chat-retry { color: #a17053; background: transparent; padding: 3px 0; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
.chat-retry .icon { width: 13px; height: 13px; }
.chat-empty { padding: 65px 20px; text-align: center; color: var(--muted); }
.chat-empty > span { display: inline-grid; place-items: center; width: 70px; height: 70px; border: 1px solid var(--line); border-radius: 24px; background: #f0f2eb; color: #95a78a; margin-bottom: 23px; }
.chat-empty .icon { width: 31px; height: 31px; }
.chat-empty h2 { font-size: 18px; color: #6e7c66; margin-bottom: 11px; }
.chat-empty p { font-size: 12px; }
.chat-jump-wrap { height: 0; position: relative; flex-shrink: 0; z-index: 1; }
.chat-jump { position: absolute; bottom: 16px; right: 26px; color: var(--green); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); font-size: 11px; padding: 10px 14px; display: flex; align-items: center; gap: 7px; }
.chat-jump .icon { width: 14px; height: 14px; transform: rotate(90deg); }
.chat-composer { flex-shrink: 0; border-top: 1px solid var(--line); padding: 18px 24px max(15px, env(safe-area-inset-bottom)); background: var(--paper); }
.chat-input-row { display: flex; align-items: flex-end; gap: 10px; }
textarea#chat-input { flex: 1; min-width: 0; min-height: 48px; max-height: 128px; margin: 0; padding: 11px 14px; line-height: 24px; resize: none; font-size: 16px; border-radius: 14px; background: #ffffffdb; }
.chat-send { min-width: 74px; height: 48px; border-radius: 14px; padding: 10px 16px; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; }
.chat-send .icon { width: 17px; height: 17px; }
.chat-send:disabled { opacity: .35; cursor: default; }
.chat-composer-meta { color: #a0a794; font-size: 10px; display: flex; justify-content: space-between; gap: 8px; margin: 7px 3px 0; }
.chat-keyboard-hint { display: none; }
.chat-composer .form-error:not(:empty) { margin-top: 8px; margin-bottom: 0; }
@media (pointer: fine) {
  .chat-keyboard-hint { display: inline; }
  .chat-send-hint { display: none; }
}
@media (min-width: 800px) {
  .chat-main { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .chat-header { padding: 15px 17px; padding-top: max(15px, env(safe-area-inset-top)); gap: 10px; }
  .chat-heading h1 { font-size: 17px; }
  .chat-header .avatar { width: 34px; height: 34px; font-size: 13px; }
  .chat-scroll { padding: 16px; }
  .chat-message-content { max-width: 78%; }
  .chat-bubble { padding: 10px 13px; font-size: 14px; }
  .chat-message { gap: 8px; margin-bottom: 18px; }
  .chat-composer { padding: 12px 14px max(12px, env(safe-area-inset-bottom)); }
  .chat-send { min-width: 60px; padding: 10px 12px; }
  .chat-send .icon { display: none; }
  .chat-jump { right: 16px; }
}
