:root {
    /* Paleta primaria: teal Terappia (#539B99) en múltiples tonalidades. */
    --primary:          #539B99;
    --primary-dark:     #457F7D;
    --primary-darker:   #2E5D5B;
    --primary-light:    #85B7B5;
    --primary-lighter:  #BAD5D4;
    --primary-lightest: #E4EFEE;

    /* Tokens semánticos consumidos por el resto del stylesheet. */
    --bg:               #E4EFEE;
    --panel:            #FFFFFF;
    --panel-2:          #F1F7F7;
    --border:           #A5CDCB;
    --text:             #1A312F;
    --text-dim:         #4E6B69;
    --accent:           #539B99;
    --accent-strong:    #2E5D5B;
    --user-bubble:      #539B99;
    --assistant-bubble: #FFFFFF;
    --error:            #D64545;

    /* Ancho máximo de la columna de contenido. El body ocupa todo el
       viewport para que topbar, composer y bottom-nav pinten el ancho
       completo, y las franjas centran su contenido en esta medida vía
       padding lateral calculado. */
    --app-max-width:    820px;
}

* { box-sizing: border-box; }

/* El atributo [hidden] tiene que ganarle a nuestras reglas display:flex de
   #app-screen y .login-screen. Sin esto, ambas vistas quedan visibles a la
   vez porque el default de [hidden] es display:none con especificidad 0. */
[hidden] { display: none !important; }

html, body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    /* Bloquea el scroll del documento: solo los paneles internos
       (.chat, .dashboard-list, #tab-inicio, #tab-perfil, .login-screen)
       pueden scrollear. Sin esto, en móvil cualquier overflow empuja la
       topbar fuera del viewport hacia arriba y la bottom-nav hacia abajo,
       porque el navegador scrollea la ventana entera y esconde/muestra
       su URL bar según el gesto. */
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    display: flex;
    flex-direction: column;
    /* --app-height lo actualiza el JS con window.visualViewport.height cada vez
       que cambia (teclado que abre/cierra, rotación, barra de URL que se
       muestra/oculta). Sin esto, en móvil 100dvh mide el layout viewport (no
       encoge con el teclado), el body queda más alto que lo visible y el
       navegador scrollea para exponer el textarea focado — llevándose la
       topbar fuera de pantalla. Fallback a 100dvh para navegadores sin
       visualViewport. */
    height: var(--app-height, 100dvh);
    /* Fija el body al viewport visible: aunque overflow:hidden clipea el
       contenido, iOS aún scrollea la ventana en respuesta a focus() de un
       input. Con position:fixed la ventana no tiene qué scrollear. */
    position: fixed;
    inset: 0;
    width: 100%;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px max(16px, calc((100% - var(--app-max-width)) / 2));
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex: 0 0 auto;
}

.brand {
    font-weight: 600;
    letter-spacing: 0.3px;
}

button {
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

button.ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 8px;
    transition: color 0.15s, border-color 0.15s;
}

button.ghost:hover {
    color: var(--text);
    border-color: var(--accent);
}

.chat {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    width: 100%;
    max-width: var(--app-max-width);
    align-self: center;
}

.msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.msg.user, .msg.assistant {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.msg-text {
    flex: 1 1 auto;
    min-width: 0;
}

/* Botoncito de reproducción por mensaje. Hereda el color de texto de la
   burbuja: en la del usuario queda blanco sobre teal, en la del asistente
   queda oscuro sobre blanco. Al reproducirse (o al hover) sube su opacidad
   y toma un fondo translúcido acorde al color de la burbuja. */
.msg-speak {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: opacity 0.15s, background 0.15s;
}
.msg-speak i { font-size: 10px; line-height: 1; }
.msg-speak:hover { opacity: 1; }
.msg.assistant .msg-speak:hover,
.msg.assistant .msg-speak.is-playing { background: rgba(46, 93, 91, 0.12); opacity: 1; }
.msg.user .msg-speak:hover,
.msg.user .msg-speak.is-playing { background: rgba(255, 255, 255, 0.22); opacity: 1; }

.msg.user {
    align-self: flex-end;
    background: var(--user-bubble);
    border-bottom-right-radius: 4px;
}

.msg.assistant {
    align-self: flex-start;
    background: var(--assistant-bubble);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.msg.error {
    align-self: flex-start;
    background: transparent;
    border: 1px dashed var(--error);
    color: var(--error);
}

.msg.typing {
    align-self: flex-start;
    background: var(--assistant-bubble);
    border: 1px solid var(--border);
    color: var(--text-dim);
    display: inline-flex;
    gap: 4px;
    padding: 12px 16px;
}

.msg.typing span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-dim);
    animation: pulse 1.2s infinite ease-in-out;
}
.msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.9); }
    40%           { opacity: 1;   transform: scale(1.1); }
}

.composer {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding: 12px max(16px, calc((100% - var(--app-max-width)) / 2)) calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--panel);
}

.composer textarea {
    flex: 1 1 auto;
    resize: none;
    max-height: 160px;
    padding: 10px 12px;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.15s;
}

.composer textarea:focus {
    border-color: var(--accent);
}

.composer button {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: none;
    background: var(--accent-strong);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, opacity 0.15s;
}

.composer button:hover  { background: var(--accent); }
.composer button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.empty {
    color: var(--text-dim);
    text-align: center;
    margin: auto;
    padding: 40px 20px;
    font-size: 14px;
}

/* ============================================================
   Topbar: cluster derecho (nombre paciente + acciones)
   ============================================================ */

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.paciente-nombre {
    color: var(--text-dim);
    font-size: 13px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Botón TTS: sin fondo, hereda el color blanco del topbar. Cuando está
   activo lo marcamos con un fondo suave para diferenciarlo del estado off. */
.btn-tts {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}
.btn-tts:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffffff;
}
.btn-tts.is-on {
    background: rgba(255, 255, 255, 0.22);
    border-color: #ffffff;
}
.btn-tts i { font-size: 14px; line-height: 1; }

/* Wrapper del contenido gateado por login. Ocupa toda la altura de
   body para conservar el layout de columna del chat existente. */
#app-screen {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* ============================================================
   Pantalla de login
   ============================================================ */

.login-screen {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    /* safe center evita que el card quede "cortado por arriba" cuando es
       más alto que el viewport (típico en móviles con teclado abierto):
       cae a flex-start y así el scroll interno lo alcanza. */
    align-items: safe center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.login-title {
    margin: 0;
    font-size: 22px;
    text-align: center;
    letter-spacing: 0.4px;
}

.login-subtitle {
    margin: 0 0 6px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.5;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

.login-field input {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.login-field input:focus {
    border-color: var(--accent);
}

.login-error {
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: var(--error);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.4;
}

#login-submit {
    background: var(--accent-strong);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 15px;
    font-weight: 500;
    margin-top: 4px;
    transition: background 0.15s, opacity 0.15s;
}

#login-submit:hover:not(:disabled) { background: var(--accent); }
#login-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#registro-submit,
#otp-solicitar-submit,
#otp-verificar-submit {
    background: var(--accent-strong);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 15px;
    font-weight: 500;
    margin-top: 4px;
    transition: background 0.15s, opacity 0.15s;
    width: 100%;
}
#registro-submit:hover:not(:disabled),
#otp-solicitar-submit:hover:not(:disabled),
#otp-verificar-submit:hover:not(:disabled) { background: var(--accent); }
#registro-submit:disabled,
#otp-solicitar-submit:disabled,
#otp-verificar-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Input del codigo OTP: mono, centrado y con spacing grande para que se
   lean bien los 6 digitos, incluso en teclado numerico movil. */
#otp-codigo {
    font-family: "Menlo", "Consolas", "Courier New", monospace;
    font-size: 22px;
    letter-spacing: 0.4em;
    text-align: center;
    padding-left: 12px;   /* compensa el letter-spacing del ultimo char */
}

/* Sub-steps del OTP form: heredan el gap de flex-column del .login-card
   pero al vivir dentro de un <div> lo pierden. Los volvemos a poner. */
#otp-step-email,
#otp-step-codigo {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-switch {
    margin: 6px 0 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-dim);
}
.login-switch a {
    color: var(--accent-strong);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}
.login-switch a:hover {
    text-decoration: underline;
}

/* ============================================================
   Dashboard: listado de conversaciones del paciente
   ============================================================ */

#dashboard-screen {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 8px;
    flex: 0 0 auto;
}

.dashboard-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

button.primary {
    background: var(--accent-strong);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}
button.primary:hover { background: var(--accent); }

.dashboard-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.dashboard-loading,
.dashboard-error,
.dashboard-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 32px 16px;
    font-size: 14px;
    line-height: 1.5;
}
.dashboard-error {
    color: var(--error);
}
.dashboard-empty p {
    margin: 0 0 14px;
}

.conv-item {
    text-align: left;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}

.conv-item:hover {
    border-color: var(--accent);
    background: var(--panel-2);
}

.conv-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--primary-lighter);
    margin-bottom: 4px;
}

.conv-item-titulo {
    font-weight: 600;
    font-size: 14.5px;
    word-break: break-word;
    line-height: 1.35;
}

.conv-item-fecha {
    font-size: 12px;
    color: var(--text-dim);
    flex: 0 0 auto;
    white-space: nowrap;
}

.conv-item-preview {
    font-size: 13px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    white-space: normal;
    line-height: 1.4;
}

.conv-item-rol {
    color: var(--accent);
    margin-right: 4px;
}

.conv-item-doctor {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 1 auto;
    min-width: 0;
    font-size: 12px;
    color: var(--accent-strong);
    background: var(--primary-lightest);
    border: 1px solid var(--primary-lighter);
    padding: 2px 8px;
    border-radius: 999px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conv-item-doctor > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conv-item-doctor i {
    font-size: 11px;
    line-height: 1;
}

/* ============================================================
   Chat: topbar con volver + titulo
   ============================================================ */

.btn-back {
    padding: 6px 10px;
    font-size: 13px;
}

.chat-titulo {
    flex: 1 1 auto;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
    min-width: 0;
}

/* ============================================================
   Overrides de marca: el color primario impregna la interfaz
   ============================================================ */

/* Login: la pantalla entera se pinta con el color primario. */
.login-screen {
    background: var(--primary);
}

/* La topbar es una franja branded en teal fuerte con texto blanco. */
.topbar {
    background: var(--primary);
    color: #ffffff;
    border-bottom-color: var(--primary-darker);
}
.topbar .brand,
.topbar .chat-titulo {
    color: #ffffff;
}
.topbar .paciente-nombre {
    color: rgba(255, 255, 255, 0.85);
}
.topbar button.ghost {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.55);
}
.topbar button.ghost:hover {
    color: #ffffff;
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

/* Burbuja del usuario: texto blanco sobre teal. */
.msg.user {
    color: #ffffff;
}

/* ============================================================
   Modal: seleccion de doctor para una nueva conversacion
   ============================================================ */

.doctor-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.doctor-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 49, 47, 0.55);
    backdrop-filter: blur(2px);
}

.doctor-modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    max-height: calc(100dvh - 40px);
}

.doctor-modal-title {
    margin: 0;
    font-size: 17px;
    line-height: 1.35;
    color: var(--text);
    text-align: center;
}

.doctor-modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 55vh;
    padding-right: 2px;
}

.doctor-modal-loading,
.doctor-modal-empty,
.doctor-modal-error {
    text-align: center;
    color: var(--text-dim);
    padding: 20px 8px;
    font-size: 14px;
    line-height: 1.5;
}
.doctor-modal-error { color: var(--error); }

.doctor-item {
    text-align: left;
    background: var(--accent-strong);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    font-size: 14.5px;
}

.doctor-item:hover {
    background: var(--accent);
}

.doctor-item-nombre {
    font-weight: 600;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doctor-item-badge {
    flex: 0 0 auto;
    color: #FFD54A;
    font-size: 15px;
    line-height: 1;
}

.doctor-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}

/* ============================================================
   Tabs (Inicio / Conversaciones / Perfil) + bottom nav
   ============================================================ */

.tab-panes {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    max-width: var(--app-max-width);
    align-self: center;
}

.tab-pane {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* En tab "conversaciones", el hijo #dashboard-list scrollea. */
#tab-conversaciones { overflow: hidden; }

/* Inicio y perfil scrollean por si el contenido crece. */
#tab-inicio,
#tab-perfil {
    overflow-y: auto;
    padding: 16px;
    gap: 16px;
}

/* ---- Inicio ---------------------------------------------------------- */

.inicio-header {
    text-align: center;
    padding: 4px 4px 0;
}
.inicio-saludo {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}
.inicio-sub {
    margin: 0;
    color: var(--text-dim);
    font-size: 13px;
}

.inicio-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.inicio-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}
.inicio-card-wide { grid-column: 1 / -1; }

.inicio-card-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-strong);
    line-height: 1;
}
.inicio-card-lbl {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
}

.inicio-cta {
    display: flex;
    justify-content: center;
    padding: 4px 0 8px;
}

/* ---- Perfil ---------------------------------------------------------- */

.perfil-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.perfil-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
}

.perfil-nombre {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}
.perfil-email {
    font-size: 13px;
    color: var(--text-dim);
    text-align: center;
    word-break: break-all;
}

.perfil-actions {
    display: flex;
    justify-content: center;
}

.perfil-logout {
    background: var(--accent-strong);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}
.perfil-logout:hover {
    background: var(--accent);
}

/* ---- Bottom nav ------------------------------------------------------ */

.bottom-nav {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding: 6px max(4px, calc((100% - var(--app-max-width)) / 2)) calc(6px + env(safe-area-inset-bottom));
}

.bottom-nav-btn {
    background: transparent;
    border: none;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
    border-radius: 10px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.bottom-nav-btn:hover { color: var(--text); }

.bottom-nav-btn.is-active {
    color: var(--accent-strong);
    background: var(--primary-lightest);
}

.bottom-nav-icon {
    font-size: 20px;
    line-height: 1;
}
.bottom-nav-lbl {
    line-height: 1;
}

/* ============================================================
   Modal: instalar como PWA
   ============================================================ */

.install-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.install-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 49, 47, 0.55);
    backdrop-filter: blur(2px);
}

.install-modal-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px 22px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.install-modal-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
    margin-bottom: 4px;
}

.install-modal-title {
    margin: 0;
    font-size: 20px;
    color: var(--text);
    letter-spacing: 0.3px;
}

.install-modal-body {
    margin: 0;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.5;
}

.install-modal-ios {
    background: var(--primary-lightest);
    border: 1px solid var(--primary-lighter);
    color: var(--accent-strong);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    width: 100%;
}
.install-modal-ios p { margin: 0; }
.install-modal-ios i {
    margin: 0 3px;
    font-size: 12px;
}

.install-modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    width: 100%;
}
.install-modal-actions button {
    flex: 1 1 0;
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 10px;
}

/* ============================================================
   Modal "hay una nueva version" — bloqueante.
   z-index mayor que install-modal (60) para tapar cualquier UI
   abierta. Sin cursor:pointer en el backdrop porque no cierra.
   ============================================================ */
.update-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.update-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 49, 47, 0.72);
    backdrop-filter: blur(3px);
}

.update-modal-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px 22px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.update-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-lightest);
    color: var(--primary-dark);
    font-size: 26px;
    margin-bottom: 4px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.update-modal-title {
    margin: 0;
    font-size: 20px;
    color: var(--text);
    letter-spacing: 0.3px;
}

.update-modal-body {
    margin: 0;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.5;
}

.update-modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    width: 100%;
}
.update-modal-actions button {
    flex: 1 1 0;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
}
