/* ============================================================
   iberchat — estilos
   Paleta oscura, burbujas con cola, layout responsive.
   ============================================================ */
:root {
    --bg:        #0b141a;
    --panel:     #111b21;
    --panel-2:   #202c33;
    --panel-3:   #2a3942;
    --border:    #222d34;
    --text:      #e9edef;
    --text-soft: #8696a0;
    --accent:    #00a884;
    --accent-2:  #06cf9c;
    --bubble-in: #202c33;
    --bubble-out:#005c4b;
    --link:      #53bdeb;
    --danger:    #f15c6d;
    --shadow:    0 6px 24px rgba(0,0,0,.4);
    --header-h:  60px;
    --chat-bg:   #0b141a;
    --ring-seen: #3b4a54;
}

/* PALETA CLARA - MODO CLARO PREMIUM (Raúl e Iberchat) */
:root[data-theme="light"] {
    --bg:        #f0f2f5;
    --panel:     #ffffff;
    --panel-2:   #f0f2f5;
    --panel-3:   #eae6df;
    --border:    #e9edef;
    --text:      #111b21;
    --text-soft: #667781;
    --accent:    #00a884;
    --accent-2:  #06cf9c;
    --bubble-in: #ffffff;
    --bubble-out:#d9fdd3;
    --link:      #027eb5;
    --danger:    #ea0038;
    --shadow:    0 4px 12px rgba(0,0,0,.08);
    --chat-bg:   #efeae2;
    --ring-seen: #c5cdd3;
}

/* MODO AUTOMÁTICO - SOPORTE POR MEDIA QUERY DEL SISTEMA */
@media (prefers-color-scheme: light) {
    :root[data-theme="auto"] {
        --bg:        #f0f2f5;
        --panel:     #ffffff;
        --panel-2:   #f0f2f5;
        --panel-3:   #eae6df;
        --border:    #e9edef;
        --text:      #111b21;
        --text-soft: #667781;
        --accent:    #00a884;
        --accent-2:  #06cf9c;
        --bubble-in: #ffffff;
        --bubble-out:#d9fdd3;
        --link:      #027eb5;
        --danger:    #ea0038;
        --shadow:    0 4px 12px rgba(0,0,0,.08);
        --chat-bg:   #efeae2;
        --ring-seen: #c5cdd3;
    }
}

/* AJUSTES ADICIONALES PARA MODO CLARO */
:root[data-theme="light"] input,
:root[data-theme="light"] textarea,
:root[data-theme="light"] .modal-input {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #111b21;
}
@media (prefers-color-scheme: light) {
    :root[data-theme="auto"] input,
    :root[data-theme="auto"] textarea,
    :root[data-theme="auto"] .modal-input {
        background: #ffffff;
        border-color: #cbd5e1;
        color: #111b21;
    }
}


* { box-sizing: border-box; }
/* El atributo hidden debe ocultar SIEMPRE, aunque la clase defina display. */
[hidden] { display: none !important; }
html, body { height: 100%; overflow-x: hidden; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
input, textarea, button { color: inherit; font-family: inherit; }

/* ---------- Utilidades ---------- */
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center;
    color: #fff; font-weight: 600; flex: 0 0 auto;
    background: var(--accent); user-select: none; overflow: hidden;
    font-size: 1.05rem;
}
.icon-btn {
    background: none; border: 0; cursor: pointer;
    width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center; color: var(--text-soft);
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.btn-primary {
    background: var(--accent); color: #06241c; border: 0; border-radius: 24px;
    padding: 12px 22px; font-size: .95rem; font-weight: 600; cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }


/* ============================================================
   AUTENTICACIÓN
   ============================================================ */
.auth-body {
    display: grid; place-items: center; min-height: 100dvh; padding: 20px;
    background:
        radial-gradient(1200px 500px at 50% -10%, #0c2e27 0%, transparent 60%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 400px; background: var(--panel);
    border: 1px solid var(--border); border-radius: 16px; padding: 32px;
    box-shadow: var(--shadow);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand img { filter: drop-shadow(0 4px 12px rgba(0,168,132,.4)); }
.auth-brand h1 { margin: 12px 0 4px; font-size: 1.7rem; letter-spacing: -.5px; }
.auth-brand p { margin: 0; color: var(--text-soft); font-size: .9rem; }
.auth-tabs { display: flex; background: var(--panel-2); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.auth-tab {
    flex: 1; background: none; border: 0; padding: 10px; border-radius: 7px;
    color: var(--text-soft); cursor: pointer; font-size: .95rem; font-weight: 600;
    transition: background .15s, color .15s;
}
.auth-tab.is-active { background: var(--accent); color: #06241c; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--text-soft); }
.auth-form input {
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; font-size: 1rem; outline: none; transition: border-color .15s;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-form .btn-primary { margin-top: 6px; }
.auth-error {
    margin: 0; color: var(--danger); font-size: .85rem; background: rgba(241,92,109,.1);
    border: 1px solid rgba(241,92,109,.3); border-radius: 8px; padding: 10px 12px;
}
.auth-success {
    margin: 0; color: var(--accent-2); font-size: .85rem;
    background: rgba(6,207,156,.08); border: 1px solid rgba(6,207,156,.25);
    border-radius: 8px; padding: 10px 12px;
}
.btn-secondary {
    background: var(--panel-3); color: var(--text); border: 1px solid var(--border);
    border-radius: 24px; padding: 12px 22px; font-size: .95rem; font-weight: 600;
    cursor: pointer; transition: background .15s, transform .05s; width: 100%;
}
.btn-secondary:hover { background: var(--panel-2); }
.btn-secondary:active { transform: translateY(1px); }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
.auth-divider {
    display: flex; align-items: center; gap: 10px;
    color: var(--text-soft); font-size: .8rem; margin: 2px 0;
}
.auth-divider::before,
.auth-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border);
}


/* ---------- Layout principal ---------- */
/* Body fijado: en Android/PWA el teclado desplazaba el scroller raíz y la
   página quedaba paneada (cabecera o composer fuera de pantalla). Con
   position:fixed el documento no puede desplazarse jamás. */
.app-body { position: fixed; inset: 0; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; }
.app { display: grid; grid-template-columns: 360px 1fr; height: 100%; position: relative; }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.side-head {
    height: var(--header-h); flex: 0 0 auto;
    display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px;
    background: var(--panel-2);
}
.side-head .avatar { width: 40px; height: 40px; cursor: default; }
.side-head-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; position: relative; }
.menu {
    position: absolute; top: 46px; right: 0; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
    min-width: 190px; padding: 6px; z-index: 30;
    transform-origin: top right;
    animation: menu-in .12s ease-out;
}
@keyframes menu-in {
    from { opacity: 0; transform: scale(.95) translateY(-4px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.menu button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; text-align: left; background: none; border: 0; padding: 10px 14px;
    border-radius: 7px; color: var(--text); cursor: pointer; font-size: .92rem;
}
.menu button svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .75; }
.menu button:hover, .menu button:focus-visible { background: var(--panel-3); outline: none; }
.menu button.danger { color: #ea5455; }
.menu button.danger svg { opacity: 1; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--border); }

.call-row-meta { display: flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--text-2, #8696a0); }
.call-row-meta.missed { color: #ea5455; }
.side-search { padding: 8px 12px; background: var(--panel); flex: 0 0 auto; }
.side-search input {
    width: 100%; background: var(--panel-2); border: 0; border-radius: 10px;
    padding: 10px 16px; font-size: .9rem; outline: none;
}

.conv-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.conv-item {
    display: flex; align-items: center; gap: 13px; padding: 10px 16px; cursor: pointer;
    border-bottom: 1px solid var(--border); transition: background .12s;
}
.conv-item:hover { background: var(--panel-2); }
.conv-item.is-active { background: var(--panel-3); }
.conv-main { flex: 1 1 auto; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv-name { font-weight: 500; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: .72rem; color: var(--text-soft); flex: 0 0 auto; }
.conv-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.conv-preview {
    color: var(--text-soft); font-size: .87rem; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto;
}
.conv-badge {
    background: var(--accent); color: #06241c; font-size: .72rem; font-weight: 700;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    display: grid; place-items: center; flex: 0 0 auto;
}
.conv-empty { padding: 40px 24px; text-align: center; color: var(--text-soft); }
.conv-empty .btn-primary { margin-top: 16px; }

/* ---------- Chat pane ---------- */
.chat { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-placeholder {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; color: var(--text-soft); gap: 6px; padding: 24px;
    border-bottom: 4px solid var(--accent);
    background:
        radial-gradient(900px 400px at 50% 0%, rgba(0,168,132,.06), transparent 70%);
}
.chat-placeholder img { opacity: .85; }
.chat-placeholder h2 { color: var(--text); margin: 12px 0 0; font-weight: 300; font-size: 2rem; }

.chat-room { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
    height: var(--header-h); flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
    padding: 0 16px; background: var(--panel-2); border-left: 1px solid var(--border);
}
.back-btn { display: none; margin-left: -8px; }
.chat-head-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1 1 auto; }
.chat-head-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.chat-head-info strong { font-size: 1rem; font-weight: 500; }
.chat-head-info span { font-size: .78rem; color: var(--text-soft); }

/* Fondo de mensajes con patrón sutil */
.messages {
    flex: 1 1 auto; overflow-y: auto; min-height: 0;
    padding: 16px 6% 12px; display: flex; flex-direction: column; gap: 3px;
    background-color: var(--chat-bg);
    background-image:
        radial-gradient(rgba(127,127,127,.07) 1px, transparent 1px);
    background-size: 22px 22px;
}
.msg {
    max-width: min(75%, 560px); padding: 7px 10px 8px; border-radius: 9px;
    position: relative; font-size: .94rem; line-height: 1.35; word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0,0,0,.18); animation: pop .14s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.msg.in  { align-self: flex-start; background: var(--bubble-in);  border-top-left-radius: 2px; }
.msg.out { align-self: flex-end;   background: var(--bubble-out); border-top-right-radius: 2px; }
.msg.in::before, .msg.out::before {
    content: ""; position: absolute; top: 0; width: 8px; height: 13px;
}
.msg.in::before  { left: -8px;  background: radial-gradient(circle at top right, transparent 70%, var(--bubble-in) 0); }
.msg.out::before { right: -8px; background: radial-gradient(circle at top left,  transparent 70%, var(--bubble-out) 0); }
.msg + .msg.same { margin-top: -2px; }
.msg-sender { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; }
.msg-text a { color: var(--link); }
.msg-img { display: block; max-width: 100%; border-radius: 6px; cursor: pointer; margin: 1px 0; }
.msg-meta { float: right; margin: 6px 0 -2px 8px; font-size: .68rem; color: var(--text-soft); user-select: none; }
.msg.out .msg-meta { color: rgba(233,237,239,.6); }
.ticks { letter-spacing: -3px; margin-left: 3px; color: rgba(233,237,239,.55); transition: color .2s; }
.ticks.read { color: var(--link); }

/* Burbuja "escribiendo…" con texto cifrado */
.msg.ghost { opacity: .92; }
.msg.ghost .cipher {
    display: inline-block; min-width: 14px; word-break: break-all;
}
.cipher {
    font-family: "Consolas", "SF Mono", "Roboto Mono", ui-monospace, monospace;
    color: var(--accent-2); letter-spacing: 1px;
    text-shadow: 0 0 6px rgba(6,207,156,.55);
}
.chat-head-info span.is-typing { color: var(--accent-2); }
.chat-head-info span.online { color: var(--accent-2); }

.msg.system {
    align-self: center; background: var(--panel-2); color: var(--text-soft);
    font-size: .78rem; padding: 5px 12px; border-radius: 8px; box-shadow: none; max-width: 80%;
}
.msg.system::before { display: none; }

.day-sep {
    align-self: center; background: var(--panel-2); color: var(--text-soft);
    font-size: .72rem; padding: 5px 12px; border-radius: 8px; margin: 8px 0; text-transform: uppercase;
    box-shadow: 0 1px 1px rgba(0,0,0,.08);
}

/* ---------- Composer "burbuja fantasma" (idea de Raúl) ----------
   No hay barra de escribir: tu próximo mensaje es una burbuja vacía al final
   del hilo ("Toca para escribir…"). Al tocarla se edita ahí mismo y los
   iconos (emoji/adjuntar/voz/temporales) aparecen a su izquierda. */
.composer {
    flex: 0 0 auto; display: flex; align-items: flex-end; gap: 6px;
    justify-content: flex-end;
    padding: 3px 6% 10px;
    background-color: var(--chat-bg);
    background-image: radial-gradient(rgba(127,127,127,.07) 1px, transparent 1px);
    background-size: 22px 22px;
    /* Barra de gestos de Android (edge-to-edge): que no tape el composer. */
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.composer-tools { display: flex; align-items: flex-end; gap: 0; flex: 0 0 auto; }
.composer-tools .icon-btn { width: 36px; height: 36px; margin-bottom: 1px; }
/* Sin editar: solo se ve la burbuja (y el micro para notas de voz rápidas). */
.composer:not(.editing) .composer-tools .icon-btn { display: none; }
.composer:not(.editing) .composer-tools #btn-voice { display: grid; }
.composer:not(.editing) .send-btn { display: none; }
.composer-input {
    position: relative; flex: 0 1 auto; min-width: 176px; max-width: min(75%, 560px);
    display: flex; align-items: flex-end; gap: 4px;
    background: var(--bubble-out); border-radius: 9px; border-top-right-radius: 2px;
    padding: 4px 6px 4px 12px; box-shadow: 0 1px 1px rgba(0,0,0,.18);
}
/* Cola de la burbuja, como un mensaje propio de verdad */
.composer-input::before {
    content: ""; position: absolute; top: 0; right: -8px; width: 8px; height: 13px;
    background: radial-gradient(circle at top left, transparent 70%, var(--bubble-out) 0);
}
.composer:not(.editing) .composer-input { opacity: .78; cursor: text; }
.composer-input textarea {
    /* !important: la regla de modo claro pinta los textarea de blanco y aquí
       rompería la burbuja (el fondo lo pone .composer-input). */
    flex: 1 1 auto; min-width: 0; background: none !important; border: 0; outline: none; resize: none;
    font-size: .94rem; line-height: 1.35; max-height: 140px; padding: 6px 0 7px; display: block;
    color: var(--text);
}
.composer-input textarea::placeholder { color: var(--text-soft); font-style: italic; }
.send-btn {
    background: var(--accent); color: #06241c; border-radius: 50%;
    flex: 0 0 auto; width: 34px; height: 34px; margin-bottom: 1px;
}
.send-btn svg { width: 19px; height: 19px; }
.send-btn:hover { background: var(--accent-2); color: #06241c; }

/* ---------- Emoji ---------- */
.emoji-panel {
    position: absolute; left: 14px; bottom: 64px; width: min(360px, calc(100% - 28px));
    height: 300px; background: var(--panel-2); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 20;
}
.emoji-cats { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); }
.emoji-cats button {
    flex: 1; background: none; border: 0; font-size: 1.15rem; padding: 6px; cursor: pointer;
    border-radius: 8px; opacity: .65;
}
.emoji-cats button:hover, .emoji-cats button.is-active { background: var(--panel-3); opacity: 1; }
.emoji-grid { flex: 1; overflow-y: auto; padding: 6px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button {
    background: none; border: 0; font-size: 1.45rem; cursor: pointer; padding: 4px; border-radius: 8px;
    line-height: 1;
}
.emoji-grid button:hover { background: var(--panel-3); }

/* ---------- Modal ---------- */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50;
    display: grid; place-items: center; padding: 20px;
}
.modal-card {
    width: 100%; max-width: 440px; max-height: 80dvh; background: var(--panel);
    border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--panel-2); }
.modal-head h3 { margin: 0; font-size: 1.05rem; font-weight: 500; flex: 1; }
.modal-body { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-body input[type=search], .modal-body input[type=text] {
    width: 100%; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
    padding: 11px 14px; font-size: .95rem; outline: none;
}
.modal-body input:focus { border-color: var(--accent); }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.user-results { list-style: none; margin: 0; padding: 0; }
.user-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 6px; cursor: pointer; border-radius: 10px;
}
.user-row:hover { background: var(--panel-2); }
.user-row .meta { display: flex; flex-direction: column; min-width: 0; }
.user-row .meta strong { font-weight: 500; }
.user-row .meta span { font-size: .8rem; color: var(--text-soft); }
.user-row .check { margin-left: auto; color: var(--accent); opacity: 0; }
.user-row.is-picked .check { opacity: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; background: var(--panel-3);
    border-radius: 16px; padding: 4px 6px 4px 10px; font-size: .82rem;
}
.chip button { background: none; border: 0; color: var(--text-soft); cursor: pointer; font-size: 1rem; line-height: 1; }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 60;
    display: grid; place-items: center; padding: 30px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.lightbox-close { position: absolute; top: 16px; right: 16px; color: #fff; }

/* ---------- Toast ---------- */
.toast {
    /* A media altura (algo por encima) para no tapar el campo de escritura. */
    position: fixed; top: 40%; bottom: auto; left: 50%; transform: translateX(-50%);
    background: var(--panel-3); color: var(--text); padding: 12px 20px; border-radius: 24px;
    box-shadow: var(--shadow); z-index: 70; font-size: .9rem; max-width: 90vw;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   RESPONSIVE — móvil: una columna, navegación lista <-> chat
   ============================================================ */
@media (max-width: 820px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; }
    .chat { position: absolute; inset: 0; z-index: 10; }
    .back-btn { display: grid; }
    /* Vista lista: oculta el chat. Vista chat: oculta la lista. */
    body[data-view="list"] .chat { display: none; }
    body[data-view="chat"] .sidebar { display: none; }
    .emoji-panel { width: calc(100% - 28px); }
    /* iOS hace zoom automático al enfocar campos con fuente <16px: la página
       queda ampliada y se desplaza por los lados. Forzamos 16px en móvil. */
    input, textarea, select, .modal-input { font-size: 16px; }
    /* Nada debe forzar scroll horizontal: todo se queda en la caja del móvil. */
    .sidebar, .chat { min-width: 0; max-width: 100%; overflow-x: hidden; }
    .status-viewer, .modal, .lightbox { width: 100%; max-width: 100vw; }
    /* iOS a pantalla completa (PWA): la cabecera queda bajo el notch/Dynamic
       Island y se mezcla con los iconos de batería/cámara. Bajamos el
       contenido el alto de la "isla segura" sin perder la altura del header. */
    .side-head, .chat-head {
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    }
}

/* ---------- CONFIRMACIONES MODALES CUSTOM PREMIUM (Raúl) ---------- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 20, 26, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 11000;
    display: grid;
    place-items: center;
    padding: 20px;
    animation: fadeInTheme 0.2s ease;
}
.confirm-card {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 24px;
    width: 90%;
    max-width: 360px;
    box-shadow: var(--shadow);
    text-align: center;
    animation: scaleInTheme 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.confirm-card p {
    color: var(--text);
    font-size: 15px;
    margin: 0 0 20px 0;
    line-height: 1.5;
}
.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}
.confirm-buttons button {
    padding: 10px 22px;
    border-radius: 20px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}
.confirm-buttons button:active {
    transform: scale(0.96);
}
.confirm-buttons .btn-cancel {
    background: var(--panel-3);
    color: var(--text-soft);
}
.confirm-buttons .btn-confirm {
    background: var(--danger);
    color: white;
}

@keyframes fadeInTheme {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleInTheme {
    from { transform: scale(0.9); }
    to { transform: scale(1); }
}

@keyframes bounceArrow {
    0%, 100% { transform: translateY(0) rotate(-45deg); }
    50% { transform: translateY(-8px) rotate(-45deg); }
}

/* ---------- LANDING DE INTRODUCCIÓN PREMIUM DE ARRASTRE (Raúl) ---------- */
.auth-intro {
    position: fixed;
    inset: 0;
    background: #0b141a;
    z-index: 13000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.5s ease, transform 0.5s ease;
    user-select: none;
}
.auth-intro.hidden {
    opacity: 0;
    transform: translateY(-50px);
    pointer-events: none;
}
.intro-carousel {
    width: 100%;
    max-width: 420px;
    height: 380px;
    position: relative;
    overflow: hidden;
    cursor: grab;
}
.intro-carousel:active {
    cursor: grabbing;
}
.intro-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(120px);
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1), transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
}
.intro-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: none;
}
.intro-slide.active button {
    pointer-events: auto;
}
.intro-slide.prev {
    opacity: 0;
    transform: translateX(-120px);
}
.intro-card {
    background: #111b21;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: var(--shadow);
    width: 100%;
}
.intro-card h2 {
    color: #e9edef;
    font-size: 24px;
    margin: 0 0 12px 0;
    font-weight: 600;
}
.intro-card p {
    color: #8696a0;
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
}
.intro-dots {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}
.intro-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.3s, transform 0.3s;
}
.intro-dots .dot.active {
    background: #00a884;
    transform: scale(1.3);
}

/* ============================================================
   v17 — Pestañas con icono, Estados, Mensajes temporales,
   Ajustes rediseñados y Llamadas. (Raúl e Iberchat)
   ============================================================ */

/* ---------- Pestañas de la sidebar (Chats/Grupos/Estados/Llamadas) ---------- */
.side-tabs { display: flex; gap: 4px; padding: 8px 10px 6px; background: var(--panel); }
.side-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: 0; border-radius: 12px; padding: 8px 0 6px;
    color: var(--text-soft); font-size: .7rem; font-weight: 500; cursor: pointer;
    position: relative; transition: background .15s, color .15s;
}
.side-tab svg { width: 21px; height: 21px; fill: currentColor; }
.side-tab.active { background: rgba(0,168,132,.14); color: var(--accent); font-weight: 600; }
.side-tab:hover:not(.active) { background: var(--panel-2); }
.tab-dot {
    position: absolute; top: 6px; right: calc(50% - 16px);
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--accent-2); border: 2px solid var(--panel);
}

/* ---------- Mensajes temporales ---------- */
.ephemeral-btn.on { color: var(--accent); background: rgba(0,168,132,.14); }
.ephemeral-menu {
    position: absolute; right: 14px; bottom: 64px; z-index: 25;
    width: min(280px, calc(100% - 28px));
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow); padding: 12px;
}
.ephemeral-menu-title {
    display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem;
}
.ephemeral-menu-title svg { width: 18px; height: 18px; color: var(--accent); }
.ephemeral-menu p { margin: 8px 0 10px; color: var(--text-soft); font-size: .8rem; line-height: 1.4; }
.ephemeral-menu button {
    display: block; width: 100%; text-align: left; background: none; border: 0;
    padding: 10px 12px; border-radius: 8px; color: var(--text); font-size: .9rem; cursor: pointer;
}
.ephemeral-menu button:hover { background: var(--panel-3); }
.ephemeral-menu button.selected { color: var(--accent); font-weight: 600; }
.ephemeral-menu button.selected::after { content: " ✓"; }
.ephemeral-banner {
    flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 7px;
    background: rgba(0,168,132,.12); color: var(--accent);
    font-size: .78rem; padding: 6px 12px; border-bottom: 1px solid var(--border);
}
.ephemeral-banner svg { width: 15px; height: 15px; flex: 0 0 auto; }
.msg-timer {
    display: inline-block; vertical-align: -1px; margin-right: 3px; opacity: .75;
    width: 12px; height: 12px;
}
.msg-timer svg { width: 12px; height: 12px; fill: currentColor; display: block; }

.composer { position: relative; }

/* ---------- Panel de Estados ---------- */
.status-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.status-row {
    display: flex; align-items: center; gap: 13px; padding: 10px 16px; cursor: pointer;
    border-bottom: 1px solid var(--border); transition: background .12s;
}
.status-row:hover { background: var(--panel-2); }
.status-sep {
    padding: 10px 16px 4px; color: var(--accent); font-size: .74rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
}
.status-list { flex: 0 0 auto; overflow: visible; }

/* ---- Muro (feed vertical de estados, idea de Raúl) ---- */
.status-list.feed {
    display: flex; flex-direction: column; gap: 14px;
    padding: 10px 12px 28px; list-style: none; margin: 0;
}
.feed-post {
    background: var(--panel-2); border: 1px solid var(--border);
    border-radius: 16px; overflow: hidden;
}
.feed-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.feed-head .status-ring { width: 44px; height: 44px; border-width: 2px; }
.feed-head .status-ring .avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 15px;
}
.feed-who { min-width: 0; }
.feed-who .conv-name { font-size: 14px; }
.feed-time { font-size: 12px; color: var(--text-soft); }
.feed-media img { width: 100%; display: block; max-height: 440px; object-fit: cover; background: #000; }
.feed-text {
    min-height: 220px; display: flex; align-items: center; justify-content: center;
    padding: 26px 20px; color: #fff; font-size: 20px; font-weight: 600;
    text-align: center; word-break: break-word; white-space: pre-wrap;
}
.feed-caption { padding: 10px 12px 0; font-size: 14px; color: var(--text); word-break: break-word; }
.feed-foot {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px 10px; font-size: 12px; color: var(--text-soft);
}
.feed-del { background: none; border: 0; cursor: pointer; font-size: 15px; opacity: .8; }
.feed-del:hover { opacity: 1; }
.feed-seen { color: var(--accent-2); }
.status-ring {
    position: relative; flex: 0 0 auto; width: 52px; height: 52px;
    display: grid; place-items: center; border-radius: 50%;
    border: 2.5px solid var(--accent-2); padding: 2px;
}
.status-ring.seen { border-color: var(--ring-seen); }
.status-ring.none { border-color: transparent; }
.status-ring .avatar { width: 42px; height: 42px; }
.status-add {
    position: absolute; right: -2px; bottom: -2px;
    width: 19px; height: 19px; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
    display: grid; place-items: center; border: 2px solid var(--panel); line-height: 1;
}

/* ---------- Visor de estados ---------- */
.status-viewer {
    position: fixed; inset: 0; z-index: 9000; background: #000;
    display: flex; flex-direction: column;
}
.sv-progress {
    display: flex; gap: 4px; padding: 10px 12px 6px; z-index: 2;
}
.sv-progress .bar {
    flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); overflow: hidden;
}
.sv-progress .bar > i {
    display: block; height: 100%; width: 0; background: #fff; border-radius: 2px;
}
.sv-progress .bar.done > i { width: 100%; }
.sv-progress .bar.running > i { animation: sv-run linear forwards; }
@keyframes sv-run { from { width: 0; } to { width: 100%; } }
.sv-head {
    display: flex; align-items: center; gap: 10px; padding: 6px 12px; z-index: 2; color: #fff;
}
.sv-head .avatar { width: 38px; height: 38px; }
.sv-meta { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.sv-meta strong { font-size: .95rem; font-weight: 600; }
.sv-meta span { font-size: .75rem; color: rgba(255,255,255,.7); }
.sv-head .icon-btn { color: #fff; }
.sv-content {
    flex: 1; display: flex; align-items: center; justify-content: center;
    min-height: 0; padding: 12px; text-align: center; position: relative;
}
.sv-content img { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }
.sv-content .sv-text {
    font-size: clamp(1.3rem, 4vw, 2rem); font-weight: 500; color: #fff; line-height: 1.4;
    /* min-width 0 + anywhere: un enlace largo sin espacios no puede ensanchar el
       bloque más allá de la pantalla (en móvil se salía por los dos lados). */
    max-width: min(640px, 100%); min-width: 0; white-space: pre-wrap;
    overflow-wrap: anywhere; word-break: break-word; padding: 24px;
}
.sv-content .sv-caption {
    position: absolute; left: 0; right: 0; bottom: 18px; color: #fff; font-size: .95rem;
    text-shadow: 0 1px 3px rgba(0,0,0,.8); padding: 0 24px;
}
.sv-views {
    z-index: 2; text-align: center; color: rgba(255,255,255,.85); font-size: .82rem;
    padding: 10px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.sv-nav {
    position: absolute; top: 15%; bottom: 15%; width: 30%;
    background: none; border: 0; cursor: pointer; z-index: 1;
}
.sv-prev { left: 0; }
.sv-next { right: 0; width: 45%; }

/* ---------- Composer de estados ---------- */
.st-canvas {
    position: relative; border-radius: 12px; min-height: 220px;
    background: #075E54; display: flex; align-items: center; justify-content: center;
    overflow: hidden; transition: background .25s;
}
.st-canvas img { max-width: 100%; max-height: 300px; object-fit: contain; display: block; }
.st-canvas textarea {
    width: 100%; background: none; border: 0; outline: none; resize: none;
    color: #fff; font-size: 1.25rem; font-weight: 500; text-align: center;
    padding: 24px 18px; line-height: 1.4;
}
.st-canvas textarea::placeholder { color: rgba(255,255,255,.65); }
.st-canvas.has-img textarea {
    position: absolute; left: 0; right: 0; bottom: 0; font-size: .95rem; padding: 10px 14px;
    background: rgba(0,0,0,.45); text-align: left;
}
.st-tools { display: flex; align-items: center; gap: 8px; }
.st-hint { color: var(--text-soft); font-size: .78rem; }

/* ---------- Ajustes (modal de perfil) ---------- */
.modal-card-sm { max-width: 380px; }
.modal-input {
    width: 100%; padding: 11px 12px; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: .93rem; outline: none;
}
.modal-input:focus { border-color: var(--accent); }
select.modal-input { cursor: pointer; }
.set-field { margin-bottom: 14px; }
.set-label { color: var(--text-soft); font-size: .8rem; display: block; margin-bottom: 6px; }
.set-hint { display: block; color: var(--text-soft); font-size: .74rem; margin-top: 6px; line-height: 1.35; }
.set-group-title {
    color: var(--text-soft); font-size: .72rem; text-transform: uppercase; letter-spacing: .4px;
    margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--border);
}
.set-avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.set-avatar { width: 72px; height: 72px; font-size: 26px; }
.btn-sm { font-size: .82rem; padding: 8px 14px; }

/* Interruptores tipo WhatsApp */
.set-switch {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    padding: 10px 0; user-select: none;
}
.set-switch + .set-switch { border-top: 1px solid var(--border); }
.set-switch-text { flex: 1; font-size: .9rem; color: var(--text); }
.set-switch-text small { display: block; color: var(--text-soft); font-size: .76rem; margin-top: 2px; line-height: 1.35; }
.set-switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui {
    flex: 0 0 auto; width: 38px; height: 22px; border-radius: 11px;
    background: var(--panel-3); position: relative; transition: background .18s;
}
.switch-ui::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; transition: transform .18s;
    box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.set-switch input:checked + .switch-ui { background: var(--accent); }
.set-switch input:checked + .switch-ui::after { transform: translateX(16px); }

/* Modo asistente IA: switches sobre la lista de chats */
.icon-btn.bot-active { color: var(--accent); background: var(--panel-3); border-radius: 50%; }
.conv-item .bot-switch { padding: 0; margin-left: 8px; flex: 0 0 auto; }
.conv-item .bot-switch + .bot-switch { border-top: 0; }
.bot-all-row { border-bottom: 1px solid var(--border); }
.bot-all-row .bot-avatar { background: var(--accent); font-size: 20px; }

.set-subacc { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 6px; }
.set-subacc-btn {
    width: 100%; padding: 9px 2px; background: none; border: 0; color: var(--accent);
    font-size: .84rem; font-weight: 500; cursor: pointer; text-align: left;
    display: flex; justify-content: space-between; align-items: center;
}
.set-subacc-btn:hover { color: var(--accent-2); }
.set-subacc-btn span:last-child { transition: transform .25s; }
.set-subacc-body { padding-top: 10px; }

.set-devices { display: flex; flex-direction: column; gap: 8px; }
.set-devices-loading {
    color: var(--text-soft); font-size: .8rem; text-align: center; padding: 12px;
    background: var(--panel-2); border-radius: 8px;
}
.device-row {
    padding: 11px 12px; border-radius: 8px; display: flex; align-items: center; gap: 12px;
    background: var(--panel-2); border: 1px solid var(--border);
}
.device-row.current { background: rgba(0,168,132,.1); border-color: rgba(0,168,132,.3); }
.device-row .dr-main { flex: 1; min-width: 0; }
.device-row .dr-name { font-size: .86rem; font-weight: 500; }
.device-row .dr-name b { color: var(--accent); font-size: .72rem; font-weight: 600; }
.device-row .dr-sub { color: var(--text-soft); font-size: .76rem; margin-top: 2px; }
.device-row .dr-close {
    background: none; border: 0; color: var(--text-soft); cursor: pointer; font-size: 17px;
    padding: 4px 8px; border-radius: 6px;
}
.device-row .dr-close:hover { color: var(--danger); background: var(--panel-3); }

.btn-outline-danger {
    margin-top: 10px; width: 100%; background: none; border: 1px solid rgba(234,84,85,.4);
    color: #ea5455; border-radius: 8px; padding: 10px; font-size: .84rem; cursor: pointer;
}
.btn-outline-danger:hover { background: rgba(234,84,85,.08); }
.btn-oauth {
    width: 100%; padding: 11px; background: var(--panel-2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: .84rem; font-weight: 500; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s;
}
.btn-oauth:hover { background: var(--panel-3); }
.btn-danger {
    margin-top: 18px; width: 100%; padding: 11px; background: var(--danger); border: 0;
    border-radius: 8px; color: #fff; font-size: .86rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-danger svg { width: 16px; height: 16px; }
.btn-danger:hover { filter: brightness(1.08); }

/* Acordeón de ajustes */
.accordion-container { display: flex; flex-direction: column; gap: 8px; }
.accordion-item {
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
    background: var(--panel);
}
.accordion-header {
    width: 100%; padding: 14px 16px; background: transparent; border: 0;
    color: var(--text); font-size: .9rem; font-weight: 500;
    display: flex; justify-content: space-between; align-items: center; cursor: pointer;
    transition: background .15s;
}
.accordion-header:hover { background: var(--panel-2); }
.accordion-icon { transition: transform .25s ease; font-size: 11px; color: var(--text-soft); }
.accordion-body {
    display: none; padding: 4px 16px 16px; color: var(--text);
    border-top: 1px solid var(--border);
}
.accordion-body.active { display: block; animation: slideDown .25s ease-out; }
.accordion-header.active .accordion-icon { transform: rotate(180deg); }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Multimedia colapsable (antes inline en chat.php) ---------- */
.msg-img-container {
    border-radius: 12px; overflow: hidden; display: inline-block; max-width: 100%;
    cursor: pointer; transition: all .3s cubic-bezier(.25,.8,.25,1);
}
.msg-img-container img { max-width: 100%; max-height: 300px; border-radius: 8px; display: block; }
.msg-img-container.collapsed {
    max-width: 130px; max-height: 80px; border: 1px solid var(--border);
    opacity: .85; position: relative;
}
.msg-img-container.collapsed::after {
    content: '👁️ Expandir'; position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 500;
    text-align: center; padding: 4px 0;
}
.msg-img-container.collapsed img { max-width: 130px !important; height: 80px !important; object-fit: cover !important; }

.voice-note-card {
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
    padding: 10px 14px; margin-top: 4px; display: inline-block; width: 100%;
    box-sizing: border-box; max-width: 320px; cursor: pointer;
}
.voice-note-card.collapsed { max-width: 220px; padding: 6px 12px; background: var(--panel); }
.voice-note-header { display: flex; align-items: center; gap: 8px; }
.voice-note-header svg { width: 22px; height: 22px; color: var(--accent); flex: 0 0 auto; }
.voice-note-title { font-size: 13px; font-weight: 500; }
.voice-note-player { margin-top: 8px; }
.voice-note-player audio { width: 100%; height: 32px; outline: none; }

#btn-voice.recording { color: #ea0038 !important; animation: pulse-rec 1.2s infinite; }
@keyframes pulse-rec {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: .7; }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------- Llamadas WebRTC ---------- */
.call-overlay {
    position: fixed; inset: 0; background: rgba(11,20,26,.85);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 10000; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.call-overlay.active { opacity: 1; pointer-events: auto; }
.call-card {
    position: relative;
    background: var(--panel); border: 1px solid var(--border); border-radius: 24px;
    width: 92%; max-width: 500px; overflow: hidden;
    box-shadow: 0 16px 40px rgba(0,0,0,.5);
    transform: scale(.9); transition: transform .3s cubic-bezier(.34,1.56,.64,1);
    display: flex; flex-direction: column;
}
.call-overlay.active .call-card { transform: scale(1); }
#call-video-remote { width: 100%; height: 380px; object-fit: cover; background: #000; display: block; }
.call-video-local-wrap {
    position: absolute; width: 120px; height: 120px; border-radius: 12px;
    top: 12px; right: 12px; border: 2px solid var(--accent-2); background: #000;
    z-index: 2; overflow: hidden;
}
#call-video-local { width: 100%; height: 100%; object-fit: cover; display: block; }
.call-flip-btn {
    position: absolute; bottom: 4px; right: 4px; z-index: 3;
    width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center;
}
.call-flip-btn svg { width: 16px; height: 16px; }
.call-flip-btn:hover { background: rgba(0,0,0,.75); }
.call-info { padding: 24px; text-align: center; }
.call-avatar {
    width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: bold; color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,.3); box-shadow: 0 8px 24px rgba(0,0,0,.35);
    position: relative;
}
.call-avatar::after {
    content: ''; position: absolute; inset: -8px; border-radius: 50%;
    border: 2px solid #25D366; opacity: .4; animation: pulse-ring 1.8s infinite;
}
.call-overlay.in-call .call-avatar::after { animation: none; opacity: 0; }
.call-info h3 { color: var(--text); font-size: 20px; margin: 0 0 4px; font-weight: 600; }
.call-info p {
    color: var(--text-soft); font-size: 13px; margin: 0 0 22px;
    letter-spacing: .5px; text-transform: uppercase;
}
.call-actions { display: flex; justify-content: center; gap: 18px; }
.call-btn {
    width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: #fff;
    transition: transform .2s, box-shadow .2s, background .2s;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.call-btn svg { width: 26px; height: 26px; }
.call-btn:hover { transform: scale(1.1); }
.call-btn.accept { background: #25D366; box-shadow: 0 4px 14px rgba(37,211,102,.4); }
.call-btn.decline, .call-btn.hangup { background: #ea0038; box-shadow: 0 4px 14px rgba(234,0,56,.4); }
.call-btn.ctrl { background: var(--panel-3); color: var(--text); }
.call-btn.ctrl.off { background: #fff; color: #111b21; }
.call-mic-menu {
    list-style: none; margin: 14px auto 0; padding: 6px; max-width: 260px;
    background: var(--panel-3); border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.call-mic-menu li {
    padding: 10px 14px; border-radius: 8px; cursor: pointer; color: var(--text);
    font-size: 13px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.call-mic-menu li:hover { background: var(--panel-2); }
.call-mic-menu li.active { color: #25D366; font-weight: 600; }
@keyframes pulse-ring {
    0% { transform: scale(.95); opacity: .8; }
    50% { transform: scale(1.1); opacity: .4; }
    100% { transform: scale(1.2); opacity: 0; }
}
.danger-hover:hover { color: var(--danger); }

/* Llamada de voz: sin panel de vídeo */
.call-overlay.voice-only #call-video-remote,
.call-overlay.voice-only .call-video-local-wrap { display: none; }

/* Botón de pantalla completa (esquina superior izquierda del vídeo) */
.call-btn-corner {
    position: absolute; top: 12px; left: 12px; z-index: 3;
    width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center;
    transition: background .2s, transform .2s;
}
.call-btn-corner:hover { background: rgba(0,0,0,.65); transform: scale(1.08); }
.call-btn-corner svg { width: 20px; height: 20px; }

/* Pantalla completa: la tarjeta ocupa toda la ventana y el vídeo remoto se ve grande */
.call-card.fullscreen {
    width: 100vw; height: 100vh; max-width: none; border-radius: 0;
}
.call-card.fullscreen #call-video-remote { height: 100vh; }
.call-card.fullscreen .call-video-local-wrap {
    width: 160px; height: 160px; top: 16px; right: 16px;
}
.call-card.fullscreen .call-info {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
    padding-top: 60px;
}

/* PiP propio: arrastrable (touch-action none para que el dedo no haga scroll)
   y ocultable con doble toque */
.call-video-local-wrap { touch-action: none; cursor: grab; }
.call-video-local-wrap.pip-hidden { display: none; }

/* Pantalla completa: los controles se esconden solos y reaparecen al tocar */
.call-card.fullscreen .call-info,
.call-card.fullscreen .call-btn-corner { transition: opacity .35s ease; }
.call-card.fullscreen.hide-ui .call-info,
.call-card.fullscreen.hide-ui .call-btn-corner { opacity: 0; pointer-events: none; }

/* Aviso de consentimiento de cámara (el otro lado subió la llamada a vídeo) */
.cam-consent {
    position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
    z-index: 5; background: rgba(0,0,0,.78); color: #fff;
    border-radius: 14px; padding: 12px 16px; width: max-content; max-width: 92%;
    text-align: center; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.45);
}
.cam-consent p { margin: 0 0 10px; color: #fff; }
.cam-consent-row { display: flex; gap: 10px; justify-content: center; }
.cam-consent button {
    border: 0; border-radius: 10px; padding: 8px 14px;
    cursor: pointer; font-weight: 600; font-size: 13px;
}
.cam-consent .consent-yes { background: #25D366; color: #fff; }
.cam-consent .consent-no { background: rgba(255,255,255,.18); color: #fff; }

/* Enlaces legales al pie del panel de ajustes */
.settings-legal {
    text-align: center; padding: 16px 12px 10px; font-size: 12px; color: var(--text-soft);
}
.settings-legal a { color: var(--accent-2); text-decoration: none; }
.settings-legal a:hover { text-decoration: underline; }

/* ---------- Banner de notificaciones ---------- */
.notification-banner {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--panel); border: 1px solid var(--accent); border-top-width: 5px;
    border-radius: 16px; padding: 24px; width: 90%; max-width: 380px;
    box-shadow: 0 12px 40px rgba(0,0,0,.6); z-index: 12000;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px;
}
.notification-banner .nb-bell { font-size: 36px; animation: pulse-bell 1.5s infinite; }
.notification-banner strong { color: var(--text); display: block; font-size: 16px; margin-bottom: 8px; }
.notification-banner span { color: var(--text-soft); font-size: 14px; line-height: 1.5; display: block; }
.notification-banner b { color: #25D366; }
@keyframes pulse-bell {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
#notification-arrow {
    position: fixed; top: 10px; left: 120px; z-index: 12100; color: var(--accent);
    animation: bounceArrow 1s infinite; font-size: 32px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.5)); transform: rotate(-45deg);
}

/* Detalles finales v17 */
.ephemeral-banner { cursor: pointer; }

/* ---------- Traducción automática ---------- */
.translate-wrap { position: relative; }
.translate-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 500;
    background: var(--panel-3); border-radius: 12px; padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4); min-width: 200px;
}
.translate-toggle-row, .translate-lang-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    color: var(--text); font-size: 13px; padding: 6px 0;
}
.translate-lang-row select {
    background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; padding: 4px 8px; font-size: 13px;
}
.msg-translated {
    display: flex; align-items: flex-start; gap: 6px; margin-top: 4px;
    padding-top: 6px; border-top: 1px dashed var(--border);
    color: var(--text-soft); font-size: 13px; font-style: italic; line-height: 1.35;
}
.msg-translated-icon { flex-shrink: 0; font-size: 12px; opacity: .7; }
.ephemeral-banner:hover { background: rgba(0,168,132,.18); }


/* Ubicación compartida: mini-mapa en la burbuja */
.msg-location { display: flex; flex-direction: column; gap: 4px; }
.msg-location iframe { width: min(280px, 68vw); height: 170px; border: 0; border-radius: 10px; pointer-events: none; }
.msg-location a { font-size: 13px; color: #53bdeb; text-decoration: none; }
.msg-location a:hover { text-decoration: underline; }
