/* Pax TVD chat: réplica del diseño de WhatsApp (claro y oscuro) */
:root {
  --head: #008069; --head-text: #fff;
  --shell: #d1d7db; --band: #00a884;
  --chat-bg: #efeae2; --doodle: rgba(0, 0, 0, .06);
  --in: #ffffff; --out: #d9fdd3;
  --text: #111b21; --meta: #667781; --sub: #54656f;
  --composer: #f0f2f5; --field: #ffffff; --line: #e9edef;
  --accent: #00a884; --tick-read: #53bdeb;
  --quote-in: #f5f6f6; --quote-out: #d1f4cc; --quote-bar: #06cf9c; --quote-bar-mine: #53bdeb;
  --notice-bg: #ffeecd; --notice-text: #54656f;
  --day-bg: #ffffff; --menu-bg: #ffffff; --highlight: rgba(0, 168, 132, .25);
  --shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
@media (prefers-color-scheme: dark) {
  :root {
    --head: #202c33; --head-text: #e9edef;
    --shell: #0c1317; --band: #0c1317;
    --chat-bg: #0b141a; --doodle: rgba(255, 255, 255, .035);
    --in: #202c33; --out: #005c4b;
    --text: #e9edef; --meta: #8696a0; --sub: #aebac1;
    --composer: #202c33; --field: #2a3942; --line: #2a3942;
    --quote-in: #1d282f; --quote-out: #025144;
    --notice-bg: #182229; --notice-text: #ffd279;
    --day-bg: #182229; --menu-bg: #233138; --highlight: rgba(0, 168, 132, .3);
    --shadow: 0 1px .5px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--shell); color: var(--text);
  font: 14.2px/19px "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

/* Escritorio: tarjeta centrada con la franja verde como WhatsApp Web */
.shell { height: 100dvh; }
@media (min-width: 900px) {
  .shell { position: relative; padding: 19px 0; }
  .shell::before { content: ""; position: fixed; inset: 0 0 auto; height: 127px; background: var(--band); }
  .shell .app { max-width: 1000px; margin: 0 auto; height: calc(100dvh - 38px); box-shadow: 0 6px 18px rgba(11, 20, 26, .05); }
}

.app { position: relative; display: flex; flex-direction: column; height: 100dvh; background: var(--chat-bg); overflow: hidden; }

/* Cabecera */
.head {
  display: flex; align-items: center; gap: 12px; flex: none;
  background: var(--head); color: var(--head-text);
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); min-height: 59px; z-index: 3;
}
@media (min-width: 900px) { .head { background: var(--composer); color: var(--text); } }
.avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: none; background: #fff; color: #008069; display: grid; place-items: center; font-weight: 700; font-size: 12px; position: relative; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who b { font-weight: 500; font-size: 16px; line-height: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { font-size: 13px; line-height: 20px; opacity: .85; }
@media (min-width: 900px) { .who small { color: var(--sub); opacity: 1; } }

/* Zona de mensajes con fondo de garabatos propio (íconos de TV, play, control) */
.chat {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0;
  background: var(--chat-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.045' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='14' y='18' width='34' height='24' rx='4'/%3E%3Cpath d='M24 48h14M31 42v6'/%3E%3Cpath d='M98 20l12 8-12 8z'/%3E%3Ccircle cx='130' cy='62' r='9'/%3E%3Cpath d='M60 74c4-8 14-8 18 0M64 66a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/%3E%3Cpath d='M20 104l6-10 6 10M26 94v20'/%3E%3Crect x='96' y='96' width='22' height='34' rx='4'/%3E%3Cpath d='M104 124h6'/%3E%3Cpath d='M50 130c6 0 6-8 12-8s6 8 12 8'/%3E%3Cpath d='M138 128l6 6M144 128l-6 6'/%3E%3Ccircle cx='70' cy='26' r='2'/%3E%3Ccircle cx='146' cy='16' r='2'/%3E%3Cpath d='M12 70h10M17 65v10'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 220px;
  position: relative;
}
@media (prefers-color-scheme: dark) {
  .chat { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.03' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='14' y='18' width='34' height='24' rx='4'/%3E%3Cpath d='M24 48h14M31 42v6'/%3E%3Cpath d='M98 20l12 8-12 8z'/%3E%3Ccircle cx='130' cy='62' r='9'/%3E%3Cpath d='M60 74c4-8 14-8 18 0M64 66a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/%3E%3Cpath d='M20 104l6-10 6 10M26 94v20'/%3E%3Crect x='96' y='96' width='22' height='34' rx='4'/%3E%3Cpath d='M104 124h6'/%3E%3Cpath d='M50 130c6 0 6-8 12-8s6 8 12 8'/%3E%3Cpath d='M138 128l6 6M144 128l-6 6'/%3E%3Ccircle cx='70' cy='26' r='2'/%3E%3Ccircle cx='146' cy='16' r='2'/%3E%3Cpath d='M12 70h10M17 65v10'/%3E%3C/g%3E%3C/svg%3E"); }
}

#list { display: flex; flex-direction: column; padding: 0 4%; }
@media (min-width: 900px) { #list { padding: 0 7%; } }

.notice {
  margin: 8px auto 10px; max-width: min(90%, 480px); padding: 6px 12px 7px;
  background: var(--notice-bg); color: var(--notice-text); border-radius: 7.5px;
  font-size: 12.5px; line-height: 18px; text-align: center; box-shadow: var(--shadow);
}
.notice svg { vertical-align: -1px; margin-right: 4px; }

.day { align-self: center; margin: 10px 0 8px; padding: 5px 12px 6px; border-radius: 7.5px; background: var(--day-bg); color: var(--meta); font-size: 12.5px; line-height: 18px; box-shadow: var(--shadow); text-transform: uppercase; position: sticky; top: 8px; z-index: 2; }

/* Burbujas */
.msg { display: flex; position: relative; margin-bottom: 2px; touch-action: pan-y; }
.msg.first { margin-top: 10px; }
.msg.in { justify-content: flex-end; }   /* cliente (yo) a la derecha */
.msg.out { justify-content: flex-start; } /* Pax a la izquierda */
.bubble {
  position: relative; max-width: min(85%, 560px); min-width: 72px;
  padding: 6px 7px 8px 9px; border-radius: 7.5px; box-shadow: var(--shadow);
  word-wrap: break-word; overflow-wrap: anywhere; transition: background-color .4s;
}
@media (min-width: 900px) { .bubble { max-width: 65%; } }
.msg.in .bubble { background: var(--out); }
.msg.out .bubble { background: var(--in); }
.msg.first.in .bubble { border-top-right-radius: 0; }
.msg.first.out .bubble { border-top-left-radius: 0; }
.tail { position: absolute; top: 0; width: 8px; height: 13px; display: none; }
.msg.first .tail { display: block; }
.msg.in .tail { right: -8px; color: var(--out); }
.msg.out .tail { left: -8px; color: var(--in); }
.msg.flash .bubble { background-image: linear-gradient(var(--highlight), var(--highlight)); }
.text { white-space: pre-wrap; }
.text a { color: #027eb5; text-decoration: none; }
.text a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { .text a { color: #53bdeb; } }
.text code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.big-emoji .text { font-size: 40px; line-height: 48px; }
.big-emoji .bubble { background: transparent !important; box-shadow: none; }
.big-emoji .tail { display: none !important; }

/* Hora y palomitas flotando al final del texto, como WhatsApp */
.spacer { display: inline-block; width: 82px; height: 1px; }
.msg.out .spacer { width: 62px; }
.meta { position: absolute; right: 7px; bottom: 3px; display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 15px; color: var(--meta); white-space: nowrap; }
.big-emoji .meta { background: var(--in); padding: 0 6px; border-radius: 8px; }
.tick { display: inline-flex; color: var(--meta); }
.tick.read { color: var(--tick-read); }
.tick.error { color: #f15c6d; }

/* Cita dentro de la burbuja */
.quote {
  display: flex; flex-direction: column; border-radius: 7.5px; padding: 5px 10px 6px 11px; margin: -2px -3px 5px -5px;
  background: var(--quote-in); position: relative; overflow: hidden; cursor: pointer; font-size: 13.2px; line-height: 18px; min-width: 0;
}
.msg.in .quote { background: var(--quote-out); }
.quote::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--quote-bar); }
.quote.mine::before { background: var(--quote-bar-mine); }
.quote b { color: var(--quote-bar); font-weight: 500; font-size: 12.8px; }
.quote.mine b { color: var(--quote-bar-mine); }
.quote span { color: var(--sub); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Flecha de menú al pasar el mouse (escritorio) */
.chev { position: absolute; top: 3px; right: 3px; width: 26px; height: 22px; border-radius: 0 7px 0 14px; display: none; place-items: center; color: var(--meta); background: inherit; }
@media (hover: hover) { .bubble:hover .chev { display: grid; } }

/* Icono de responder que aparece al deslizar */
.swipe-ico { position: absolute; left: -36px; top: 50%; transform: translateY(-50%) scale(.6); opacity: 0; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.08); color: var(--sub); display: grid; place-items: center; transition: opacity .1s; }
@media (prefers-color-scheme: dark) { .swipe-ico { background: rgba(255,255,255,.1); } }

/* Escribiendo… */
.typing .bubble { padding: 10px 14px; min-width: 0; }
.dots { display: flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--meta); opacity: .5; animation: blink 1.3s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: .9; transform: translateY(-3px); } }

/* Botón bajar */
.to-bottom { position: absolute; right: 14px; bottom: 74px; width: 42px; height: 42px; border-radius: 50%; background: var(--composer); color: var(--sub); box-shadow: 0 1px 3px rgba(11,20,26,.3); display: grid; place-items: center; z-index: 4; }
.badge { position: absolute; top: -6px; right: -2px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11.5px; line-height: 20px; font-weight: 600; text-align: center; }

/* Barra de escritura */
.composer { flex: none; background: var(--chat-bg); padding: 5px 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); z-index: 3; }
@media (min-width: 900px) { .composer { background: var(--composer); padding: 5px 16px 8px; } }
.row { display: flex; align-items: flex-end; gap: 6px; }
.field { flex: 1; display: flex; align-items: flex-end; background: var(--field); border-radius: 24px; padding: 0 4px; min-height: 48px; box-shadow: var(--shadow); min-width: 0; }
@media (min-width: 900px) { .field { border-radius: 8px; min-height: 42px; box-shadow: none; } }
.icon { width: 40px; height: 48px; display: grid; place-items: center; color: var(--sub); flex: none; }
@media (min-width: 900px) { .icon { height: 42px; } }
#input { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; font-size: 16px; line-height: 21px; padding: 13px 2px; max-height: 126px; min-width: 0; }
@media (min-width: 900px) { #input { font-size: 15px; padding: 10px 2px; } }
#input::placeholder { color: var(--meta); }
.send { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; box-shadow: var(--shadow); transition: transform .1s; }
.send:active { transform: scale(.94); }
@media (min-width: 900px) { .send { background: transparent; color: var(--sub); box-shadow: none; height: 42px; } }
.send .i-send { display: none; }
.send.has-text .i-send { display: block; margin-left: 3px; }
.send.has-text .i-mic { display: none; }

.reply-bar { display: flex; align-items: center; gap: 4px; background: var(--field); border-radius: 18px 18px 0 0; padding: 6px 4px 0 6px; margin: 0 54px -2px 0; box-shadow: var(--shadow); }
@media (min-width: 900px) { .reply-bar { margin: 0 54px 4px 0; border-radius: 8px; padding: 6px; } }
.reply-bar .quote { flex: 1; margin: 0; background: var(--quote-in); }
.reply-bar + .row .field { border-top-left-radius: 0; border-top-right-radius: 0; }
@media (min-width: 900px) { .reply-bar + .row .field { border-radius: 8px; } }

/* Emojis */
.emoji-panel { flex: none; height: 280px; background: var(--composer); border-top: 1px solid var(--line); display: flex; flex-direction: column; z-index: 3; }
.emoji-tabs { display: flex; justify-content: space-around; border-bottom: 1px solid var(--line); flex: none; }
.emoji-tabs button { flex: 1; padding: 8px 0; font-size: 20px; opacity: .55; border-bottom: 3px solid transparent; }
.emoji-tabs button.on { opacity: 1; border-color: var(--accent); }
.emoji-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); padding: 6px 8px; align-content: start; }
.emoji-grid button { font-size: 26px; height: 44px; border-radius: 8px; }
.emoji-grid button:hover { background: var(--line); }

/* Menú contextual */
.menu { position: absolute; z-index: 10; background: var(--menu-bg); border-radius: 6px; padding: 8px 0; box-shadow: 0 2px 5px rgba(11,20,26,.26), 0 2px 10px rgba(11,20,26,.16); min-width: 160px; }
.menu button { display: block; width: 100%; text-align: left; padding: 10px 24px; font-size: 14.5px; color: var(--text); }
.menu button:hover { background: var(--line); }

/* Hoja de nombre y WhatsApp */
.sheet-bg { position: absolute; inset: 0; z-index: 20; background: rgba(11,20,26,.4); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 600px) { .sheet-bg { align-items: center; } }
.sheet { width: 100%; max-width: 420px; background: var(--in); color: var(--text); border-radius: 16px 16px 0 0; padding: 22px 22px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: up .22s ease-out; }
@media (min-width: 600px) { .sheet { border-radius: 12px; padding-bottom: 18px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet h2 { margin: 0; font-size: 19px; font-weight: 500; }
.sheet p { margin: 0; color: var(--meta); font-size: 14px; }
.sheet label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--accent); }
.sheet input { border: 0; border-bottom: 2px solid var(--accent); background: transparent; color: var(--text); font: inherit; font-size: 16px; padding: 8px 0; outline: 0; }
.sheet-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.sheet-btns button { padding: 10px 22px; border-radius: 24px; font-weight: 500; }
.primary { background: var(--accent); color: #fff; }
.ghost { color: var(--accent); }

.toast { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); background: #3b4a54; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 14px; z-index: 30; max-width: 90%; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.3); }

/* ---------- Multimedia ---------- */
.has-media .bubble { padding: 3px 3px 6px; }
.has-media .text { padding: 4px 4px 0 6px; }
.t-voice .bubble, .t-file .bubble { padding: 6px 7px 8px 7px; }
.media { position: relative; border-radius: 6px; overflow: hidden; cursor: pointer; background: rgba(0,0,0,.08); width: min(300px, 68vw); }
.media img, .media video { display: block; width: 100%; max-height: 340px; object-fit: cover; min-height: 120px; }
.bare .meta { color: #fff; right: 9px; bottom: 9px; padding: 0 4px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.bare .meta .tick { color: #fff; } .bare .meta .tick.read { color: #8cd9ff; }
.bare .media::after { content: ""; position: absolute; inset: auto 0 0; height: 36px; background: linear-gradient(transparent, rgba(0,0,0,.45)); pointer-events: none; }
.bare .bubble { padding: 3px; }
.play-ov { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; padding-left: 3px; }
.vdur { position: absolute; left: 8px; bottom: 7px; color: #fff; font-size: 11px; text-shadow: 0 1px 2px rgba(0,0,0,.6); z-index: 1; }
.up-ring { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; }
.up-ring svg { width: 40px; height: 40px; transform: rotate(-90deg); }
.up-ring circle { fill: none; stroke: #fff; stroke-width: 3; stroke-dasharray: 94.2; stroke-dashoffset: 94.2; transition: stroke-dashoffset .2s; animation: spin 1.4s linear infinite; transform-origin: 50% 50%; }
@keyframes spin { to { transform: rotate(360deg); } }
.vplay .up-ring, .doc .up-ring { position: static; margin: 0; width: 34px; height: 34px; background: transparent; }
.vplay .up-ring svg, .doc .up-ring svg { width: 30px; height: 30px; }
.vplay .up-ring circle, .doc .up-ring circle { stroke: var(--accent); }

/* Nota de voz */
.voice { display: flex; align-items: center; gap: 8px; width: min(310px, 72vw); padding: 2px 2px 10px; }
.vava { width: 46px; height: 46px; border-radius: 50%; flex: none; position: relative; background: #fff; overflow: visible; }
.vava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.vmic { position: absolute; right: -4px; bottom: -2px; color: #4fc3f7; }
.msg.in .vmic { color: var(--accent); }
.msg.in .voice { flex-direction: row; }
.msg.in .vava { order: -1; }
.vplay { width: 34px; height: 34px; display: grid; place-items: center; color: var(--sub); flex: none; }
.vbody { flex: 1; min-width: 0; position: relative; }
.wave { height: 26px; display: flex; align-items: center; gap: 2px; position: relative; cursor: pointer; }
.wave i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--meta); opacity: .55; }
.wave i.done { background: #4fc3f7; opacity: 1; }
.msg.in .wave i.done { background: #34b7f1; }
.knob { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #4fc3f7; left: 0; }
.msg.in .knob { background: var(--accent); }
.vfoot { position: absolute; left: 0; bottom: -16px; font-size: 11px; color: var(--meta); }
.vspeed { flex: none; min-width: 38px; height: 22px; border-radius: 11px; background: rgba(0,0,0,.18); color: #fff; font-size: 12px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .vspeed { background: rgba(255,255,255,.2); } .vava { background: #2a3942; } }
.transcript { margin: 4px 6px 0; padding-top: 4px; border-top: 1px solid rgba(0,0,0,.08); font-size: 13px; line-height: 18px; color: var(--sub); }
.transcript.wait { font-style: italic; color: var(--meta); }
.transcript::before { content: "📝 "; }
.transcript.wait::before { content: ""; }

/* Documento */
.doc { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; background: rgba(0,0,0,.05); color: inherit; text-decoration: none; width: min(300px, 70vw); margin-bottom: 4px; }
@media (prefers-color-scheme: dark) { .doc { background: rgba(255,255,255,.06); } }
.doc-ico { width: 34px; height: 40px; border-radius: 4px; background: #e8473f; color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: end center; padding-bottom: 5px; flex: none; }
.doc-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-name b { font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-name small { color: var(--meta); font-size: 12px; }
.doc-dl { color: var(--meta); flex: none; }

/* Menú de adjuntar */
.attach-menu { position: absolute; right: 64px; bottom: 66px; z-index: 6; background: var(--menu-bg); border-radius: 14px; padding: 8px; box-shadow: 0 4px 18px rgba(11,20,26,.25); display: flex; flex-direction: column; min-width: 200px; animation: up .15s ease-out; }
.attach-menu button { display: flex; align-items: center; gap: 14px; padding: 9px 12px; border-radius: 8px; font-size: 15px; text-align: left; }
.attach-menu button:hover { background: var(--line); }
.attach-menu span { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }

/* Grabación */
.row { position: relative; }
.rec-bar { position: absolute; inset: 0 54px 0 0; z-index: 2; display: flex; align-items: center; gap: 8px; background: var(--field); border-radius: 24px; padding: 0 14px 0 4px; box-shadow: var(--shadow); overflow: hidden; }
@media (min-width: 900px) { .rec-bar { border-radius: 8px; } }
.rec-trash { color: var(--meta); visibility: hidden; }
.rec-bar.locked .rec-trash { visibility: visible; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #f15c6d; animation: pulse 1s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .2; } }
.rec-time { font-size: 16px; color: var(--text); min-width: 40px; }
.rec-wave { flex: 1; height: 24px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.rec-wave i { width: 3px; flex: none; border-radius: 2px; background: var(--meta); }
.rec-slide { color: var(--meta); font-size: 14px; white-space: nowrap; transition: opacity .1s; }
.rec-bar:not(.locked) .rec-wave { display: none; }
.rec-bar.locked .rec-slide { display: none; }
.lock-hint { position: absolute; right: 4px; bottom: 62px; width: 40px; padding: 10px 0; border-radius: 20px; background: var(--field); color: var(--meta); box-shadow: 0 1px 4px rgba(0,0,0,.2); display: flex; flex-direction: column; align-items: center; gap: 2px; z-index: 2; animation: up .2s ease-out; }
.recording .rec-bar:not(.locked) ~ .send { transform: scale(1.3); }
.recording .rec-bar.locked ~ .send .i-mic { display: none; }
.recording .rec-bar.locked ~ .send .i-send { display: block; margin-left: 3px; }
@media (min-width: 900px) { .recording .send { background: var(--accent); color: #fff; } }

/* Vista previa y visor */
.overlay { position: absolute; inset: 0; z-index: 25; background: #0b141a; color: #e9edef; display: flex; flex-direction: column; }
.ov-top { display: flex; align-items: center; gap: 8px; padding: 8px; padding-top: calc(8px + env(safe-area-inset-top)); flex: none; }
.icon.light { color: #e9edef; }
.ov-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px; }
.ov-stage img, .ov-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.vw-who { flex: 1; font-size: 14px; color: #aebac1; }
.vw-caption { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); text-align: center; white-space: pre-wrap; }
.vw-caption:empty { display: none; }
.pv-thumbs { display: flex; gap: 6px; justify-content: center; padding: 6px; flex: none; overflow-x: auto; }
.pv-thumbs:empty { display: none; }
.pv-thumbs button { width: 52px; height: 52px; border-radius: 6px; overflow: hidden; border: 2px solid transparent; flex: none; }
.pv-thumbs button.on { border-color: var(--accent); }
.pv-thumbs img, .pv-thumbs video { width: 100%; height: 100%; object-fit: cover; }
.pv-bar { display: flex; gap: 8px; padding: 8px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); flex: none; }
.pv-bar input { flex: 1; border: 0; border-radius: 24px; background: #2a3942; color: #e9edef; padding: 12px 16px; font: inherit; font-size: 16px; outline: 0; min-width: 0; }
.pv-bar .send { background: var(--accent); color: #fff; }

/* ---------- App instalable y notificaciones ---------- */
.install { position: absolute; left: 8px; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 15; max-width: 420px; margin: 0 auto; background: var(--in); color: var(--text); border-radius: 16px; padding: 16px; box-shadow: 0 8px 28px rgba(11,20,26,.28); display: flex; flex-direction: column; gap: 12px; animation: up .25s ease-out; }
@media (min-width: 900px) { .install { left: auto; right: 24px; bottom: 80px; width: 380px; } }
.inst-row { display: flex; gap: 12px; align-items: center; }
.inst-ico { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.inst-row b { display: block; font-size: 16px; font-weight: 600; }
.inst-row small { color: var(--meta); font-size: 13px; }
.inst-list, .inst-guide { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.inst-list { list-style: none; }
.inst-list li { display: flex; gap: 10px; align-items: flex-start; }
.inst-list li::before { content: "✓"; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.inst-guide { padding-left: 20px; }
.inst-guide li { line-height: 22px; }
.inst-guide svg { vertical-align: -5px; color: #007aff; }
.inst-btns { display: flex; gap: 8px; }
.inst-btns button { flex: 1; padding: 11px; border-radius: 24px; font-weight: 600; }
.inst-btns .ghost { border: 1px solid var(--line); }
.push-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; background: var(--in); border-bottom: 1px solid var(--line); font-size: 13.5px; z-index: 3; flex: none; }
.push-bar span { flex: 1; }
.push-bar .primary { padding: 7px 14px; border-radius: 18px; font-weight: 600; font-size: 13px; flex: none; }
.push-bar .icon { width: 32px; height: 32px; }
