/* Chat Volcanarias. Marca: azul Volvo + naranja. Claro por defecto; oscuro automático.
   Ordenador: lista de conversaciones a la izquierda y conversación a la derecha, a pantalla completa.
   Móvil: una pantalla cada vez (lista o conversación), como una app de mensajería. */
:root {
  --navy: #1f2f63; --navy-2: #2a3f86; --orange: #e8541c; --orange-2: #ff7a3d;
  --bg: #eef1f8; --surface: #fff; --surface-2: #f6f7fc; --border: #e3e7f1; --border-2: #d3d9e8;
  --text: #151c33; --muted: #647091; --faint: #94a0bd;
  --accent: var(--navy); --accent-ink: #fff; --accent-soft: #e8edfb;
  --me: #1f2f63; --me-ink: #fff; --me-soft: #aebbe8; --other: #fff; --sys: #dfe4f3;
  --ok: #178a4a; --ok-soft: #e4f7ec; --warn: #b45309; --warn-soft: #fff1de; --danger: #d12b2b; --danger-soft: #fdeaea; --read: #5fb6ff;
  --shadow-s: 0 1px 2px rgba(21, 28, 51, .08); --shadow-m: 0 10px 30px -12px rgba(21, 28, 51, .3); --shadow-l: 0 30px 80px -24px rgba(21, 28, 51, .5);
  --radius: 16px; --lista: 388px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --surface: #141b33; --surface-2: #19213d; --border: #252f52; --border-2: #33406a;
    --text: #e8ecf8; --muted: #9aa5c6; --faint: #6e7aa0; --accent: #8fa6f5; --accent-ink: #0b1020; --accent-soft: #232f5e;
    --me: #2f4390; --me-ink: #fff; --me-soft: #b5c3f5; --other: #1c2547; --sys: #1d2648;
    --ok: #52d08a; --ok-soft: #123524; --warn: #f4a64e; --warn-soft: #3a2a12; --danger: #ff7b7b; --danger-soft: #3d1b1f;
    --shadow-s: 0 1px 2px rgba(0, 0, 0, .4); --shadow-m: 0 10px 30px -12px rgba(0, 0, 0, .7); --shadow-l: 0 30px 80px -24px rgba(0, 0, 0, .85);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body { font: 15px/1.45 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.hide { display: none !important; }
.muted { color: var(--muted); }
svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.ic.sm { width: 16px; height: 16px; } svg.ic.xs { width: 13px; height: 13px; stroke-width: 2.4; } svg.ic.lg { width: 28px; height: 28px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- pantalla de espera ---------- */
#espera { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
#espera .box { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 30px 28px; text-align: center; max-width: 360px; width: 100%; box-shadow: var(--shadow-m); }
#espera img { height: 44px; margin-bottom: 8px; }
#espera h2 { font-size: 19px; margin: 4px 0 6px; }
#espera .btn { margin-top: 14px; }

/* ---------- botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); border-radius: 12px; padding: 10px 16px; font-weight: 600; font-size: 14.5px; transition: background .15s, transform .05s; text-decoration: none; }
.btn:hover { background: var(--surface-2); } .btn:active { transform: translateY(1px); }
.btn.pri { background: var(--accent); color: var(--accent-ink); border-color: transparent; } .btn.pri:hover { filter: brightness(1.1); background: var(--accent); }
.btn.nar { background: var(--orange); color: #fff; border-color: transparent; } .btn.nar:hover { background: var(--orange-2); }
.btn.dan { color: var(--danger); } .btn.block { width: 100%; } .btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.iconbtn { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 12px; color: inherit; position: relative; flex: none; }
.iconbtn:hover { background: rgba(127, 140, 180, .16); }
.input { width: 100%; border: 1px solid var(--border-2); background: var(--surface); border-radius: 12px; padding: 10px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
label.campo { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }

/* ---------- estructura ---------- */
.layout { display: grid; grid-template-columns: var(--lista) 1fr; height: 100dvh; width: 100%; }
.lista-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.chat-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.l-cab { background: var(--navy); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 14px 12px 18px; display: flex; align-items: center; gap: 6px; }
.l-cab .marca { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.l-cab .marca img { width: 34px; height: 34px; border-radius: 10px; }
.l-cab h1 { font-size: 19px; font-weight: 800; }
.l-cab .iconbtn:hover { background: rgba(255, 255, 255, .14); }
.l-cab .iconbtn .punto { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); border: 2px solid var(--navy); }
.l-buscar { padding: 12px 14px 6px; background: var(--surface); }
.buscador { position: relative; } .buscador svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 18px; height: 18px; }
.buscador .input { padding-left: 38px; background: var(--surface-2); border-color: transparent; border-radius: 14px; }
.tabs { display: flex; gap: 6px; padding: 6px 14px 10px; }
.tab { border: 0; background: transparent; padding: 6px 13px; border-radius: 99px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.tab:hover { background: var(--surface-2); } .tab.on { background: var(--accent-soft); color: var(--accent); }
.l-lista { flex: 1; overflow-y: auto; padding-bottom: calc(86px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.fab { position: absolute; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); height: 54px; padding: 0 20px 0 16px; border-radius: 99px; border: 0; background: var(--orange); color: #fff; font-weight: 700; display: flex; align-items: center; gap: 8px; box-shadow: 0 10px 24px -8px rgba(232, 84, 28, .7); z-index: 5; }
.fab:hover { background: var(--orange-2); }
.lista-panel { position: relative; }

/* conversaciones */
.item { display: flex; gap: 12px; align-items: center; padding: 10px 16px; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left; position: relative; }
.item:hover { background: var(--surface-2); } .item.on { background: var(--accent-soft); }
.item .cuerpo { flex: 1; min-width: 0; }
.item .fila { display: flex; align-items: baseline; gap: 8px; }
.item .nom { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .hora { font-size: 12px; color: var(--faint); flex: none; }
.item.nl .hora { color: var(--orange); font-weight: 700; }
.item .prev { color: var(--muted); font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.nl .prev { color: var(--text); font-weight: 600; }
.item .prev .quien { color: var(--accent); font-weight: 600; }
.badge { background: var(--orange); color: #fff; font-size: 12px; font-weight: 800; min-width: 21px; height: 21px; border-radius: 99px; padding: 0 6px; display: inline-grid; place-items: center; flex: none; }
.badge.mudo { background: var(--faint); }
.item .mudo-ic { color: var(--faint); flex: none; }
.vacio { text-align: center; color: var(--muted); padding: 44px 28px; }
.vacio svg { width: 52px; height: 52px; color: var(--faint); margin-bottom: 8px; }
.vacio b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* avatares */
.av { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff; flex: none; letter-spacing: .02em; }
.av.s { width: 32px; height: 32px; font-size: 12px; } .av.m { width: 40px; height: 40px; font-size: 14px; }
.av.grupo { border-radius: 16px; } .av.general { border-radius: 16px; background: linear-gradient(135deg, var(--orange), var(--orange-2)) !important; }
.av svg { width: 55%; height: 55%; }

/* aviso (banner) de notificaciones */
.aviso { margin: 4px 14px 10px; border-radius: 16px; padding: 14px; background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--orange) 10%, var(--accent-soft))); border: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.aviso .ico { width: 38px; height: 38px; border-radius: 12px; background: var(--orange); color: #fff; display: grid; place-items: center; flex: none; }
.aviso b { display: block; font-size: 14.5px; margin-bottom: 2px; } .aviso p { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.aviso .acc { display: flex; gap: 8px; flex-wrap: wrap; }
.aviso.bloq { background: var(--warn-soft); } .aviso.bloq .ico { background: var(--warn); }
.sinconex { background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; text-align: center; padding: 6px 12px; }

/* ---------- conversación ---------- */
.c-cab { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px 18px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 4; }
.c-cab .atras { display: none; }
.c-cab .quien { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 2px 6px; border-radius: 12px; display: flex; gap: 12px; align-items: center; }
.c-cab button.quien:hover { background: var(--surface-2); }
.c-cab h2 { font-size: 16.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-cab .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs { flex: 1; overflow-y: auto; padding: 14px clamp(10px, 4vw, 56px) 10px; display: flex; flex-direction: column; gap: 2px; -webkit-overflow-scrolling: touch; scroll-behavior: auto; background-image: radial-gradient(color-mix(in srgb, var(--faint) 14%, transparent) 1px, transparent 1px); background-size: 22px 22px; }
.msgs .espacio { flex: 1; }
.dia { align-self: center; background: var(--sys); color: var(--muted); font-size: 12.5px; font-weight: 600; border-radius: 99px; padding: 4px 14px; margin: 12px 0 8px; box-shadow: var(--shadow-s); }
.sis { align-self: center; background: var(--sys); color: var(--muted); font-size: 12.5px; border-radius: 12px; padding: 5px 14px; margin: 6px 0; text-align: center; max-width: 80%; }
.nuevos-sep { align-self: stretch; display: flex; align-items: center; gap: 12px; margin: 10px 0; color: var(--orange); font-size: 12.5px; font-weight: 700; }
.nuevos-sep::before, .nuevos-sep::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--orange) 40%, transparent); }
.fila-m { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; margin-top: 2px; }
.fila-m.mio { justify-content: flex-end; } .fila-m.primero { margin-top: 10px; }
.fila-m .av { margin-bottom: 2px; } .fila-m .hueco { width: 32px; flex: none; }
.burb { max-width: min(78%, 640px); padding: 7px 11px 6px; border-radius: 16px; background: var(--other); border: 1px solid var(--border); box-shadow: var(--shadow-s); position: relative; word-wrap: break-word; overflow-wrap: anywhere; cursor: pointer; }
.mio .burb { background: var(--me); color: var(--me-ink); border-color: transparent; border-bottom-right-radius: 5px; }
.fila-m:not(.mio) .burb { border-bottom-left-radius: 5px; }
.burb .autor { font-size: 12.5px; font-weight: 700; margin-bottom: 1px; }
.burb .txt { white-space: pre-wrap; font-size: 15px; }
.burb .txt a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.burb .meta { float: right; margin: 6px 0 -2px 12px; font-size: 11px; opacity: .7; display: inline-flex; align-items: center; gap: 4px; line-height: 1; }
.burb .meta .ic { width: 14px; height: 14px; } .burb .meta .leido { color: var(--read); opacity: 1; }
.burb.borrado { opacity: .75; font-style: italic; } .burb.borrado .txt { display: flex; align-items: center; gap: 6px; }
.burb.pend { opacity: .7; } .burb.err { outline: 2px solid var(--danger); }
.cita { border-left: 3px solid var(--orange); background: rgba(127, 140, 180, .16); border-radius: 8px; padding: 4px 9px; margin: 2px 0 5px; font-size: 13px; cursor: pointer; }
.cita b { display: block; font-size: 12px; color: var(--orange); } .cita span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.mio .cita b { color: #ffc9ae; }
.img-adj { display: block; max-width: 100%; border-radius: 10px; margin: 2px 0 4px; cursor: zoom-in; max-height: 340px; background: rgba(127, 140, 180, .2); min-width: 120px; min-height: 80px; object-fit: cover; }
.arch { display: flex; align-items: center; gap: 10px; background: rgba(127, 140, 180, .16); border-radius: 10px; padding: 9px 11px; margin: 2px 0 4px; text-decoration: none; color: inherit; min-width: 200px; }
.arch .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--orange); color: #fff; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; flex: none; text-transform: uppercase; }
.arch b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; } .arch small { opacity: .75; font-size: 12px; }
.bajar { position: absolute; right: 18px; bottom: 86px; z-index: 6; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--surface); box-shadow: var(--shadow-m); display: grid; place-items: center; }
.bajar .badge { position: absolute; top: -8px; right: -4px; }

/* escribir */
.compo { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.compo .resp { display: flex; align-items: center; gap: 10px; border-left: 3px solid var(--orange); background: var(--surface-2); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.compo .resp > div { flex: 1; min-width: 0; } .compo .resp b { display: block; color: var(--orange); font-size: 12px; } .compo .resp span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.compo .linea { display: flex; align-items: flex-end; gap: 6px; }
.compo textarea { flex: 1; resize: none; border: 1px solid var(--border-2); background: var(--surface-2); border-radius: 22px; padding: 10px 16px; max-height: 160px; min-height: 44px; outline: none; line-height: 1.4; }
.compo textarea:focus { border-color: var(--accent); }
.enviar { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px -6px rgba(232, 84, 28, .8); }
.enviar:disabled { background: var(--border-2); box-shadow: none; color: var(--faint); cursor: default; }
.compo .iconbtn { width: 44px; height: 44px; color: var(--muted); }
.emojis { position: absolute; left: 12px; bottom: 74px; z-index: 12; background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow-l); padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; width: min(340px, calc(100% - 24px)); }
.emojis button { border: 0; background: transparent; font-size: 22px; border-radius: 8px; padding: 4px 0; } .emojis button:hover { background: var(--surface-2); }
.leyenda-solo { text-align: center; padding: 14px; color: var(--muted); font-size: 13.5px; background: var(--surface); border-top: 1px solid var(--border); }

/* pantalla vacía (ordenador, sin conversación abierta) */
.bienvenida { flex: 1; display: grid; place-items: center; padding: 30px; text-align: center; }
.bienvenida .in { max-width: 420px; }
.bienvenida img { width: 96px; height: 96px; border-radius: 26px; box-shadow: var(--shadow-m); margin-bottom: 18px; }
.bienvenida h2 { font-size: 22px; margin-bottom: 8px; } .bienvenida p { color: var(--muted); margin: 0 0 6px; }
.bienvenida .cand { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 6px 14px; }

/* ---------- ventana (capa) ---------- */
#capa { position: fixed; inset: 0; z-index: 60; background: rgba(8, 12, 28, .55); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; padding: 20px; }
#capa.on { display: flex; }
.hoja { background: var(--surface); width: 100%; max-width: 480px; max-height: min(86dvh, 760px); border-radius: 22px; box-shadow: var(--shadow-l); display: flex; flex-direction: column; overflow: hidden; animation: sube .18s ease-out; }
.hoja.ancha { max-width: 560px; }
.hoja .cab { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--border); }
.hoja .cab h3 { flex: 1; font-size: 17px; }
.hoja .cuerpo { padding: 16px 20px; overflow-y: auto; flex: 1; }
.hoja .pie { padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
@keyframes sube { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.pers { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 12px; cursor: pointer; width: 100%; border: 0; background: transparent; text-align: left; }
.pers:hover { background: var(--surface-2); }
.pers .n { flex: 1; font-weight: 600; } .pers small { color: var(--muted); font-weight: 400; display: block; font-size: 12.5px; }
.pers input { width: 20px; height: 20px; accent-color: var(--orange); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 3px 5px 3px 12px; font-size: 13px; font-weight: 600; margin: 0 6px 6px 0; }
.chip button { border: 0; background: rgba(127, 140, 180, .25); color: inherit; border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; padding: 0; }
.menu-op { display: flex; flex-direction: column; padding: 6px; }
.menu-op button { display: flex; align-items: center; gap: 14px; padding: 13px 14px; border: 0; background: transparent; border-radius: 12px; font-weight: 600; text-align: left; }
.menu-op button:hover { background: var(--surface-2); } .menu-op .dan { color: var(--danger); }
.menu-op .previa { padding: 10px 14px 6px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- ajustes ---------- */
.ajustes { flex: 1; overflow-y: auto; padding: 20px clamp(14px, 4vw, 40px) 60px; }
.ajustes .col { max-width: 720px; margin: 0 auto; }
.ajustes h2 { font-size: 22px; margin: 4px 0 18px; }
.tarjeta { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 6px 18px; margin-bottom: 18px; box-shadow: var(--shadow-s); }
.tarjeta > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 0 4px; }
.fila-aj { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.fila-aj:last-child { border-bottom: 0; }
.fila-aj .t { flex: 1; min-width: 0; } .fila-aj .t b { display: block; font-size: 15px; } .fila-aj .t small { color: var(--muted); font-size: 13px; display: block; margin-top: 1px; }
.tg { position: relative; width: 50px; height: 30px; flex: none; display: inline-block; }
.tg input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 2; }
.tg i { position: absolute; inset: 0; border-radius: 99px; background: var(--border-2); transition: background .2s; }
.tg i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.tg input:checked + i { background: var(--ok); } .tg input:checked + i::after { transform: translateX(20px); }
.tg input:disabled + i { opacity: .5; } .tg input:focus-visible + i { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.estado { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 3px 11px; font-size: 12.5px; font-weight: 700; }
.estado.ok { background: var(--ok-soft); color: var(--ok); } .estado.no { background: var(--surface-2); color: var(--muted); } .estado.mal { background: var(--warn-soft); color: var(--warn); }
.privacidad { display: flex; gap: 14px; background: var(--accent-soft); border-radius: 14px; padding: 14px; margin: 12px 0 16px; font-size: 14px; }
.privacidad svg { color: var(--accent); margin-top: 2px; }
.pasos { margin: 8px 0 4px; padding-left: 22px; } .pasos li { margin: 8px 0; }
.horas { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; } .horas .input { width: auto; }
.cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 14px; }
.cifras div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; } .cifras b { display: block; font-size: 22px; } .cifras span { font-size: 12.5px; color: var(--muted); }

/* ---------- visor de imágenes y avisos ---------- */
#visor { position: fixed; inset: 0; z-index: 70; background: rgba(4, 7, 18, .92); display: none; align-items: center; justify-content: center; padding: 20px; flex-direction: column; gap: 12px; }
#visor.on { display: flex; } #visor img { max-width: 100%; max-height: calc(100dvh - 100px); border-radius: 8px; object-fit: contain; }
#visor .barra { display: flex; gap: 10px; } #visor .btn { background: rgba(255, 255, 255, .12); color: #fff; border-color: transparent; }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); background: #151c33; color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow-l); opacity: 0; pointer-events: none; transition: all .25s; z-index: 90; max-width: min(92vw, 460px); font-weight: 500; font-size: 14px; }
#toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; cursor: pointer; } #toast.err { background: var(--danger); }

/* ---------- móvil: una pantalla cada vez ---------- */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .chat-panel { position: fixed; inset: 0; z-index: 20; transform: translateX(100%); transition: transform .22s ease; }
  .layout.ver-chat .chat-panel { transform: none; }
  .c-cab { padding-left: 8px; }
  .c-cab .atras { display: grid; }
  .burb { max-width: 84%; }
  #capa { align-items: flex-end; padding: 0; }
  .hoja { max-width: none; border-radius: 22px 22px 0 0; max-height: 92dvh; animation: sube-m .22s ease-out; }
  @keyframes sube-m { from { transform: translateY(100%); } to { transform: none; } }
  .emojis { grid-template-columns: repeat(7, 1fr); }
}
@media (min-width: 821px) { .bajar { right: 32px; } }
@media print { body { display: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
