/* Conversaciones de Qeubo: solo la vista previa, sin modificar la lógica de los mensajes. */
#borradores.thread-open .page-intro,
#borradores.thread-open #draft-list { display: none; }
#borradores.thread-open .wrap { padding-top: 15px; }
#thread-area { scroll-margin-top: 110px; }
#thread-area .chat-shell {
  width: min(100%, 820px);
  margin: 0 auto 56px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fffefb;
  box-shadow: 0 18px 55px #243d2810;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: min(76dvh, 720px);
  min-height: 390px;
}
#thread-area .chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
  flex-shrink: 0;
}
#thread-area .chat-back {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
#thread-area .chat-cover,
#draft-list .thread-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 13px;
  background: #e3ece3;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--forest);
  font-weight: 850;
  font-size: 23px;
}
#thread-area .chat-cover img { display:block; width:100%; height:100%; object-fit:cover; }
#thread-area .chat-heading { min-width:0; flex:1; }
#thread-area .chat-heading h2 { margin:0; font-size:16px; line-height:1.35; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#thread-area .chat-heading p { margin:3px 0 0; font-size:12px; color:var(--muted); }
#thread-area .chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 24px 18px;
  background: linear-gradient(160deg,#f7f8f3,#fffdfa);
  overscroll-behavior: contain;
}
#thread-area .chat-message { display:flex; flex-direction:column; align-items:flex-start; max-width:85%; gap:5px; }
#thread-area .chat-message.mine { align-self:flex-end; align-items:flex-end; }
#thread-area .chat-message.theirs { align-self:flex-start; }
#thread-area .chat-who { color:var(--muted); font-size:11px; padding:0 9px; }
#thread-area .chat-bubble {
  padding: 10px 14px;
  border-radius: 17px 17px 17px 5px;
  border: 1px solid #e3e9e1;
  background: white;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 8px #172e2408;
}
#thread-area .chat-message.mine .chat-bubble {
  background: #f7e1d7;
  border-color: #f1d1c2;
  border-radius: 17px 17px 5px 17px;
}
#thread-area .chat-time { font-size:10px; color:var(--muted); padding:0 8px; }
#thread-area .chat-composer {
  display: flex;
  align-items: end;
  gap: 9px;
  padding: 11px 13px;
  border-top: 1px solid var(--line);
  background: #fffefb;
  flex-shrink: 0;
}
#thread-area .chat-composer textarea {
  flex:1;
  min-width:0;
  width:100%;
  min-height:44px;
  max-height:116px;
  padding:11px 13px;
  border:1px solid #dce3d9;
  border-radius:17px;
  background:#f7f8f4;
  font:inherit;
  font-size:14px;
  line-height:1.4;
  resize:vertical;
  color:var(--ink);
}
#thread-area .chat-composer textarea:focus { outline:2px solid #bbdbc9; border-color:#639784; }
#thread-area .chat-send {
  flex:0 0 auto;
  width:46px;
  height:46px;
  border:0;
  border-radius:15px;
  display:grid;
  place-items:center;
  color:#192e29;
  background:var(--coral);
  cursor:pointer;
  font-size:22px;
}
#thread-area .chat-send:disabled { opacity:.55; cursor:wait; }
#thread-area .chat-error { flex-basis:100%; margin:0; color:#9e3930; font-size:12px; }
#draft-list .thread-row {
  display:flex;
  width:100%;
  align-items:center;
  gap:13px;
  border:1px solid var(--line);
  border-radius:18px;
  background:white;
  color:var(--ink);
  padding:14px;
  text-align:left;
  cursor:pointer;
}
#draft-list .thread-row:focus-visible,
#thread-area .chat-back:focus-visible,
#thread-area .chat-send:focus-visible { outline:3px solid #639784; outline-offset:2px; }
#draft-list .thread-summary { display:flex; flex-direction:column; gap:3px; min-width:0; flex:1; }
#draft-list .thread-summary strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:15px; }
#draft-list .thread-preview { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; color:var(--muted); }
#draft-list .thread-context { font-size:11px; color:var(--forest); font-weight:750; }
#draft-list .thread-arrow { color:var(--forest); font-size:20px; }
@media (max-width:750px) {
  #thread-area { scroll-margin-top: 225px; }
  #thread-area .chat-shell {
    width:100%;
    height:min(61dvh,590px);
    min-height:345px;
    border-radius:19px;
    margin-bottom:105px;
  }
  #thread-area .chat-header { padding:10px; }
  #thread-area .chat-messages { padding:16px 11px; gap:11px; }
  #thread-area .chat-message { max-width:88%; }
  #thread-area .chat-composer { padding:9px; padding-bottom:calc(9px + env(safe-area-inset-bottom)); }
}
