/* chat-layout.css — WhatsApp-grade chat layout shared by every conversation
   view. Paired with chat-layout.js, which adds the cl-* classes and measures
   the header / tab bar / keyboard. */
.cl-chat{display:flex!important;flex-direction:column!important;min-height:0;overflow:hidden!important}
.cl-chat>header,.cl-chat>.tc-head,.cl-chat>.messaging-tools{flex:0 0 auto}
.cl-list{flex:1 1 auto!important;min-height:0!important;max-height:none!important;overflow-y:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;display:flex;flex-direction:column}
/* Newest at the bottom even when the thread is short. */
.cl-list>:first-child{margin-top:auto}
.cl-list>*{overflow-wrap:anywhere;word-break:break-word;max-width:100%}
.cl-list img,.cl-list video{max-width:100%;height:auto}
.cl-composer{flex:0 0 auto!important;position:relative;z-index:2}
.cl-composer input,.cl-composer textarea{font-size:16px} /* < 16px makes iOS zoom the page on focus */

/* Phone: the chat owns the viewport between header and tab bar (or keyboard). */
@media (max-width:900px){
  html.cl-lock,html.cl-lock body{overflow:hidden!important;overscroll-behavior:none;height:100%}
  .cl-chat.cl-fixed{position:fixed!important;left:0!important;right:0!important;
    top:var(--cl-top,0px)!important;bottom:var(--cl-bottom,0px)!important;
    width:auto!important;height:auto!important;max-height:none!important;margin:0!important;border-radius:0!important;z-index:40}
  .cl-cb-reset{transform:none!important;filter:none!important;perspective:none!important;contain:none!important;will-change:auto!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;container-type:normal!important;animation:none!important}
  .owner-messaging:not(.cl-thread) .owner-message-panes{display:none!important}
  .owner-messaging.cl-thread .owner-message-list{display:none!important}
  .owner-messaging.cl-thread .owner-message-thread.cl-fixed{padding:0 12px!important}
  iframe.cl-frame.cl-fixed{position:fixed!important;left:0!important;right:0!important;top:var(--cl-top,0px)!important;bottom:var(--cl-bottom,0px)!important;
    width:100%!important;height:var(--cl-h,100%)!important;min-height:0!important;max-height:none!important;margin:0!important;border:0!important;border-radius:0!important;z-index:40}
  .cl-chat.cl-fixed .cl-composer{padding-bottom:max(10px,env(safe-area-inset-bottom))}
  /* With a tab bar measured below us, the tab bar already owns the home indicator. */
  .cl-chat.cl-fixed:not([style*="--cl-bottom: 0px"]) .cl-composer{padding-bottom:10px}
}

/* Chat bubbles: date separator, delivery state, link buttons. */
.chat-day{align-self:center;margin:10px 0 4px;padding:3px 10px;border-radius:8px;font-size:12px;background:rgba(0,0,0,.06);color:inherit;opacity:.8}
.chat-links{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.chat-link-btn{display:inline-block;padding:9px 16px;border-radius:999px;background:var(--copper,#A86339);color:#fff!important;text-decoration:none;font-weight:600}
.chat-tick{margin-left:4px;opacity:.75}
.cl-back{display:none}
@media (max-width:900px){.owner-message-thread .cl-back{display:inline-flex;align-self:flex-start;flex:0 0 auto;margin:8px 0;padding:8px 12px;border:1px solid currentColor;border-radius:999px;background:transparent;color:inherit;font:inherit;cursor:pointer}}
/* Owner bubbles: --msg-out / --surface2 fall back to near-white on the dark
   owner theme, under light text. Tint from the text colour instead so the
   bubble reads on either theme. */
.owner-message-thread .msg{background:color-mix(in srgb,currentColor 8%,transparent)!important;color:inherit!important}
.owner-message-thread .msg.owner{background:color-mix(in srgb,var(--gold,#ac7b43) 24%,transparent)!important}
