*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color: var(--text);
}

a{ color: var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }

.topbar{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  border-bottom:1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
}
.brand{ font-weight:700; }
.topbar-actions{ display:flex; gap:14px; }
.link{ color: var(--muted); }

.layout{
  display:flex;
  height: calc(100vh - 56px);
}

.sidebar{
  width: 340px;
  border-right:1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  display:flex;
  flex-direction:column;
}
.sidebar-header{
  padding:12px;
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.chatlist{ overflow:auto; padding:8px; }
.chatitem{
  padding:10px;
  border-radius:10px;
  cursor:pointer;
  margin-bottom:8px;
  background: rgba(255,255,255,0.03);
  border:1px solid rgba(255,255,255,0.06);
}
.chatitem:hover{ border-color: rgba(255,255,255,0.16); }
.chatitem.active{ outline:2px solid rgba(34,197,94,0.4); }
.chatitem .row{
  display:flex; justify-content:space-between; gap:8px;
}
.small{ font-size:12px; }
.muted{ color: var(--muted); }
.btn-small{
  background: rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.14);
  color: var(--text);
  border-radius:10px;
  padding:6px 10px;
  cursor:pointer;
}
.btn-small:disabled{ opacity:0.5; cursor:not-allowed; }

.main{
  flex:1;
  display:flex;
  flex-direction:column;
}
.chat-header{
  padding:12px 14px;
  border-bottom:1px solid rgba(255,255,255,0.08);
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.chat-title{ font-weight:700; }

.messages{
  flex:1;
  overflow:auto;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.bubble{
  max-width: 72%;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  white-space: pre-wrap;
}
.bubble.out{ align-self:flex-end; background: rgba(148,163,184,0.10); border-color: rgba(148,163,184,0.20); }
.bubble.in{ align-self:flex-start; background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.22); }
.bubble.human{ align-self:flex-end; background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.22); }

.composer{
  display:flex;
  gap:10px;
  padding:12px;
  border-top:1px solid rgba(255,255,255,0.08);
  align-items:flex-end;
}
.composer input[type="text"]{
  flex:1;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  padding:10px 12px;
  outline:none;
}

/* En Web Demo: archivo + enviar en columna (para evitar clicks falsos) */
.composer-actions{
  display:flex;
  flex-direction:column;
  gap:12px;
  align-items:flex-start;
}
/* Acerca el bloque de botones al campo de texto sin cambiar el ancho del input */
.composer-actions{ transform: translateX(-50px); }
@media (max-width: 720px){
  /* Mantener el 'acercamiento' también en móvil */
  .composer-actions{ transform: translateX(-10px); }
}
.composer-actions input[type="file"],
.composer-actions button{
  width:220px;
  max-width:100%;
}

/* Web demo: custom file picker so "Elegir archivo" and "Enviar" align */
#fileInput{ display:none; }

.file-picker{
  display:flex;
  align-items:center;
  gap:12px;
}

.file-btn{
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color:var(--text);
  font-weight:700;
  padding:10px 14px;
  width:220px;
  cursor:pointer;
}

.file-name{
  color:var(--muted);
  font-size:12px;
  max-width:160px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.composer button:not(.file-btn){
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.14);
  background: var(--accent);
  color:#06210f;
  font-weight:700;
  padding:10px 14px;
  cursor:pointer;
}
.composer button:not(.file-btn):disabled{ opacity:0.5; cursor:not-allowed; }

.footer-note{ padding:0 12px 12px; }

.login-body{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
}
.login-card{
  width:360px;
  padding:18px;
  border-radius:14px;
  background: rgba(255,255,255,0.03);
  border:1px solid rgba(255,255,255,0.10);
}
.login-card input{
  width:100%;
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: var(--text);
}
.login-card button{
  width:100%;
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.14);
  background: var(--accent);
  color:#06210f;
  font-weight:700;
  cursor:pointer;
}
.error{
  background: rgba(239,68,68,0.15);
  border:1px solid rgba(239,68,68,0.25);
  padding:8px 10px;
  border-radius:12px;
  margin-top:10px;
}

.webdemo-body{ margin:0; }
.webdemo-wrap{
  display:flex;
  justify-content:center;
  padding:18px;
}
.webdemo-card{
  width:min(900px, 98vw);
  height: calc(100vh - 56px - 36px);
  border-radius:14px;
  background: rgba(255,255,255,0.03);
  border:1px solid rgba(255,255,255,0.10);
  display:flex;
  flex-direction:column;
}
.composer input[type="file"]{
  width:220px;
  color: var(--muted);
}
.quick-replies{
  padding:0 12px 12px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.qr{
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor:pointer;
}
.qr:hover{
  border-color: rgba(34,197,94,0.35);
}
