/* ===== Chat ===== */

section.chat { display:grid; gap:18px; }

.chat-shell {
  border:1px solid var(--stroke);
  border-radius: var(--radius-xl);
  overflow:hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
}

.chat-header {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:14px 16px; border-bottom:1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
}

.agent { display:flex; align-items:center; gap:12px; min-width:0; }
.avatar {
  width:36px; height:36px; border-radius:50%;
  background: linear-gradient(135deg, #0f1a2b, #0a1322);
  border:1px solid rgba(255,255,255,.12); display:grid; place-items:center;
}
.status { display:inline-flex; align-items:center; gap:8px; font-size:12px; color: var(--muted); }
.dot { width:8px; height:8px; border-radius:50%; background: var(--success); box-shadow: 0 0 0 3px rgba(61,220,151,.15); }

.toolbar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

/* Messages */
.messages-wrap { max-height: 52vh; overflow:auto; padding:12px 16px; }
#messages { list-style:none; margin:0; padding:0; display:grid; gap:10px; }
#messages li { position:relative; display:flex; gap:10px; align-items:flex-end; }

.bubble {
  max-width: 80ch; width: fit-content; padding:12px 14px; border-radius:16px;
  background: rgba(255,255,255,.07); border:1px solid var(--stroke); color: var(--text);
}
.bubble.me {
  margin-left:auto; background: linear-gradient(135deg, #0f315f, #102543);
  border:1px solid rgba(77,163,255,.45); color: #e6f2ff;
}
.time { font-size:11px; color: var(--muted); margin:0 6px; white-space: nowrap; }

/* Composer */
.composer {
  position: sticky; bottom:0; display:flex; align-items:center; gap:10px;
  padding:12px 16px; border-top:1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,0));
  backdrop-filter: var(--glass);
}

/* ⬇️  Scoped sólo al botón de adjuntar del composer
      (evita afectar los chips del Agent Portal) */
.composer label.chip {
  display:inline-grid; place-items:center; width:40px; height:40px;
  border-radius:12px; border:1px solid var(--stroke); background: var(--card);
}

#message-input {
  flex:1; padding:12px 14px; border-radius:999px; border:1px solid var(--stroke);
  background: rgba(255,255,255,.05); outline:0; color: var(--text);
}
.send {
  padding:12px 16px; border-radius:999px;
  border:1px solid rgba(77,163,255,.45);
  background: linear-gradient(135deg, #0e3b7e, #112a55);
  color:#e6f1ff; font-weight:700; cursor:pointer;
}

/* Responsive ajuste de alto del histórico */
@media (max-width:920px){
  .messages-wrap { max-height: calc(100svh - var(--topbar-h) - var(--bottombar-h) - 260px); }
}
