:root{color-scheme:dark;--bg:#07111c;--panel:#0d1b2a;--edge:#243f57;--text:#edf6ff;--muted:#abc2d9;--blue:#9bd5ff;background:var(--bg);color:var(--text);font:16px/1.48 "Inter",system-ui,sans-serif}
*{box-sizing:border-box}body{margin:0}h1,p{margin:0}[hidden]{display:none!important}
.chat{width:min(100%,52rem);height:100dvh;max-height:62rem;display:grid;grid-template-rows:auto minmax(0,1fr) auto;margin:auto;background:var(--panel);border-inline:1px solid var(--edge)}
.top,.composer{padding:.85rem clamp(.75rem,3vw,1.45rem);background:#102237}
.top{display:flex;align-items:center;gap:.8rem;border-bottom:1px solid var(--edge)}
.avatar{display:grid;place-items:center;width:48px;height:48px;border-radius:.8rem;background:#20415d;color:var(--blue);font-weight:800;flex:none}
.name{min-width:0;flex:1}.name h1{font-size:clamp(1.1rem,3vw,1.5rem);overflow-wrap:anywhere}.name p,.hint,#empty,#status{color:var(--muted);font-size:.85rem}
.menu{position:relative}.menu summary{display:grid;place-items:center;min-width:44px;min-height:44px;border:1px solid var(--edge);border-radius:.65rem;font-size:1.45rem;cursor:pointer;list-style:none}.menu summary::-webkit-details-marker{display:none}
.menu nav{position:absolute;top:calc(100% + .5rem);right:0;z-index:2;min-width:11rem;border:1px solid var(--edge);border-radius:.65rem;background:#152b40;padding:.35rem;box-shadow:0 10px 28px #0005}
.menu nav a{display:block;padding:.55rem;text-decoration:none}.menu nav a:hover{background:#233d56}
.conversation{overflow:auto;min-width:0;padding:1rem clamp(.75rem,4vw,1.55rem)}
#empty{text-align:center;margin-top:1rem}ol{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:.7rem}
li{white-space:pre-wrap;overflow-wrap:anywhere;padding:.65rem .9rem;border-radius:.9rem .9rem .9rem .22rem;background:#192f43;max-width:88%;align-self:start}
li.customer{align-self:end;background:#24537a;border-radius:.9rem .9rem .22rem .9rem}time{display:block;font-size:.72rem;color:#c1d6e8;margin-top:.25rem}
.composer{border-top:1px solid var(--edge);padding-bottom:max(.8rem,env(safe-area-inset-bottom))}
form{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:end;gap:.5rem}
textarea,button{font:inherit;border-radius:.65rem;padding:.56rem .7rem;min-height:44px}
textarea{width:100%;background:#0b1928;color:inherit;border:1px solid #46637c;resize:vertical;max-height:25dvh}
button{border:1px solid transparent;background:var(--blue);color:#081827;font-weight:700;cursor:pointer}button:disabled{opacity:.5}
#attach,#remove{background:#18324c;border-color:#3a5974;color:var(--blue)}#attach{min-width:44px;font-size:1.2rem}
#selected{display:flex;justify-content:space-between;align-items:center;gap:.6rem;padding:.35rem .5rem;background:#142d43;border-radius:.55rem;margin-bottom:.5rem}#filename{min-width:0;overflow-wrap:anywhere}
#status:not(:empty),.hint{margin:.25rem 0 .45rem}.hint{margin-bottom:0}a{color:#a8dbff}:focus-visible{outline:2px solid var(--blue);outline-offset:3px}.sr-only{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}
@media(min-width:900px) and (min-height:700px){.chat{height:calc(100dvh - 2rem);margin-block:1rem;border:1px solid var(--edge);border-radius:1rem;overflow:hidden;box-shadow:0 12px 55px #0005}}
/* Contraste en la zona de lectura y separación de los controles. */
:root{--bg:#070d16;--panel:#111c2a;--edge:#37516a;--text:#f7fbff;--muted:#c0d1e2}
.conversation{background:#111c2a}
li{background:#24374b;color:#fff}li.customer{background:#224c73;color:#fff}time{color:#d4e4f3}
form{grid-template-columns:auto minmax(0,1fr) auto auto}
.attach-menu summary{background:#18324c;color:var(--blue)}
.picker-menu{position:absolute;bottom:calc(100% + .5rem);left:0;z-index:3;min-width:11rem;display:grid;gap:.25rem;padding:.35rem;border:1px solid var(--edge);border-radius:.65rem;background:#152b40}
.picker-menu button,#microphone{background:#18324c;color:var(--blue);border-color:#3a5974}
.picker-menu button{text-align:left}
#microphone{min-width:44px;display:grid;place-items:center}
#microphone svg{display:block;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
#microphone[aria-pressed=true]{background:#632b39;color:#fff}
#selected{flex-wrap:wrap}#audio-preview{max-width:100%;min-width:0}
@media(max-width:370px){form{gap:.32rem}#send{padding-inline:.48rem}.composer{padding-inline:.55rem}}
/* El campo ocupa todo el ancho disponible aunque algún botón esté oculto. */
.composer form{display:flex;align-items:flex-end;gap:.45rem}
.composer form textarea{flex:1 1 0;width:0;min-width:0;min-height:52px;max-height:144px;line-height:1.45;resize:none;padding:.82rem .85rem;overflow-y:auto}
.composer form button,.composer form .attach-menu{flex:0 0 auto}
#status{min-height:1.2rem;margin:0 0 .45rem}
.conversation{overscroll-behavior:contain}
@media(max-width:390px){.composer form{gap:.3rem}.composer form textarea{padding-inline:.6rem}#send{padding-inline:.45rem}}
.message-enter{animation:chat-enter .19s ease-out both}
@keyframes chat-enter{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.message-enter{animation:none}}
.chat-brand{display:flex;align-items:center;gap:.42rem;color:var(--blue);font-size:.78rem;font-weight:700;margin-bottom:.24rem}
.chat-brand img{display:block;width:24px;height:24px}

.message-preview{display:block;max-width:100%;margin-top:.4rem}.message-preview img{display:block;max-width:100%;max-height:270px;border-radius:.5rem;object-fit:contain}
